MFF

    Minecraft Forge France
    • Récent
    • Mots-clés
    • Populaire
    • Utilisateurs
    • Groupes
    • Forge Events
      • Automatique
      • Foncé
      • Clair
    • S'inscrire
    • Se connecter

    RenderItem

    Planifier Épinglé Verrouillé Déplacé Non résolu Sans suite
    1.12.2
    24 Messages 2 Publieurs 1.5k Vues 2 Watching
    Charger plus de messages
    • Du plus ancien au plus récent
    • Du plus récent au plus ancien
    • Les plus votés
    Répondre
    • Répondre à l'aide d'un nouveau sujet
    Se connecter pour répondre
    Ce sujet a été supprimé. Seuls les utilisateurs avec les droits d'administration peuvent le voir.
    • D Hors-ligne
      Drastic @Asonyx
      dernière édition par

      @Asonyx Ah rip

      package com.avonia.mod.util.handlers;
      
      import com.avonia.mod.Main;
      import com.avonia.mod.init.BlockInit;
      import com.avonia.mod.init.EntityInit;
      import com.avonia.mod.init.ItemInit;
      import com.avonia.mod.util.IHasModel;
      import com.avonia.mod.util.Reference;
      
      import net.minecraft.block.Block;
      import net.minecraft.item.Item;
      import net.minecraft.util.ResourceLocation;
      import net.minecraftforge.client.event.ModelRegistryEvent;
      import net.minecraftforge.common.MinecraftForge;
      import net.minecraftforge.event.RegistryEvent;
      import net.minecraftforge.fml.client.registry.ClientRegistry;
      import net.minecraftforge.fml.common.Mod.EventBusSubscriber;
      import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
      import net.minecraftforge.fml.common.network.NetworkRegistry;
      import net.minecraftforge.fml.relauncher.Side;
      import net.minecraftforge.fml.relauncher.SideOnly;
      
      @EventBusSubscriber
      public class RegistryHandler
      {
          @SubscribeEvent
          public static void onItemRegister(RegistryEvent.Register<Item> event)
          {
              event.getRegistry().registerAll(ItemInit.ITEMS.toArray(new Item[0]));
          }
          
          @SubscribeEvent
          public static void onBlockRegister(RegistryEvent.Register<Block> event)
          {
              event.getRegistry().registerAll(BlockInit.BLOCKS.toArray(new Block[0]));
              TileEntityHandler.registerTileEntities();
          }
          
          @SubscribeEvent
          public static void onModelRegister(ModelRegistryEvent event)
          {
              
              for(Item item : ItemInit.ITEMS)
              {
                  if(item instanceof IHasModel)
                  {
                      ((IHasModel)item).registerModels();
                  }
              }
              
              for(Block block : BlockInit.BLOCKS)
              {
                  if(block instanceof IHasModel)
                  {
                      ((IHasModel)block).registerModels();
                  }
              }
          }
          
          public static void preInitRegistries()
          {
              EntityInit.registerEntities();
              RenderHandler.registerEntityRenders();
          }
         
          public static void initRegistries()
          {
      
          }
      }
      
      1 réponse Dernière réponse Répondre Citer 0
      • AsonyxA Hors-ligne
        Asonyx
        dernière édition par

        Les entitées doivent être dans la méthode init, alors que tu l’as mis dans preInit

        D 1 réponse Dernière réponse Répondre Citer 1
        • D Hors-ligne
          Drastic @Asonyx
          dernière édition par

          @Asonyx ah ok

          1 réponse Dernière réponse Répondre Citer 0
          • D Hors-ligne
            Drastic
            dernière édition par

            @Asonyx re, désolé de te redéranger ,mais, je voudrais que l’entité n’explose que si elle atterrit sur un bloc. Comment faire ?
            Merci

            public EntityDyna(World worldIn)
                {
                    super(worldIn);
                }
            
                public EntityDyna(World worldIn, EntityLivingBase throwerIn)
                {
                    super(worldIn, throwerIn);
                }
            
                public EntityDyna(World worldIn, double x, double y, double z)
                {
                    super(worldIn, x, y, z);
                }
            
                public static void registerFixesSnowball(DataFixer fixer)
                {
                    EntityThrowable.registerFixesThrowable(fixer, "Snowball");
                }
            
                /**
                 * Handler for {@link World#setEntityState}
                 */
                @SideOnly(Side.CLIENT)
                public void handleStatusUpdate(byte id)
                {
                    if (id == 3)
                    {
                        for (int i = 0; i < 8; ++i)
                        {
                            this.world.spawnParticle(EnumParticleTypes.SNOWBALL, this.posX, this.posY, this.posZ, 0.0D, 0.0D, 0.0D);
                        }
                    }
                }
            
                /**
                 * Called when this EntityThrowable hits a block or entity.
                 */
                protected void onImpact(RayTraceResult result)
                {
                    if (result.entityHit != null)
                    {
                        int i = 0;
            
                        if (result.entityHit instanceof EntityBlaze)
                        {
                            i = 3;
                        }
                        
                        result.entityHit.attackEntityFrom(DamageSource.causeThrownDamage(this, this.getThrower()), (float)i);
                        world.createExplosion(this, this.posX, this.posY, this.posZ, 4.0F, true);
                        this.setDead();
                    }
            
                    if (!this.world.isRemote)
                    {
                        this.world.setEntityState(this, (byte)3);
                        this.setDead();
                    }
                }
            
            1 réponse Dernière réponse Répondre Citer 0
            • AsonyxA Hors-ligne
              Asonyx
              dernière édition par Asonyx

              Normalement, dans onImpact, tu peut utiliser une fonction qui s’appelle je crois isOnGround() qui retourne un boolean (je ne suis pas sûr)
              Ou une fontion de result

              D 1 réponse Dernière réponse Répondre Citer 0
              • D Hors-ligne
                Drastic @Asonyx
                dernière édition par

                @Asonyx yas inGround et onGround mais aucun ne va.

                1 réponse Dernière réponse Répondre Citer -1
                • AsonyxA Hors-ligne
                  Asonyx
                  dernière édition par

                  Sinon tu vérifie si l’entité touchée est null

                  D 1 réponse Dernière réponse Répondre Citer 0
                  • D Hors-ligne
                    Drastic @Asonyx
                    dernière édition par

                    @Asonyx Comment ca ?

                    1 réponse Dernière réponse Répondre Citer -1
                    • AsonyxA Hors-ligne
                      Asonyx
                      dernière édition par

                      Tu fais :

                      if (result.entityHit == null) {
                              //Le code quand la dynamite touche le sol
                      }
                      
                      1 réponse Dernière réponse Répondre Citer 0
                      • D Hors-ligne
                        Drastic
                        dernière édition par

                        @Asonyx a dit dans RenderItem :

                        if (result.entityHit == null) { //Le code quand la dynamite touche le sol }

                        toujours pas…

                        if (result.entityHit.equals(null)) 
                                    {
                                            world.createExplosion(this, this.posX, this.posY, this.posZ, 1.5F, true);
                                            this.setDead();                    
                                    }
                        
                        1 réponse Dernière réponse Répondre Citer 0
                        • AsonyxA Hors-ligne
                          Asonyx
                          dernière édition par

                          Et ça :

                          if (result.entityHit != null) {
                          }
                          else {
                              //Le code
                          }
                          1 réponse Dernière réponse Répondre Citer 0
                          • 1
                          • 2
                          • 2 / 2
                          • Premier message
                            Dernier message
                          Design by Woryk
                          ContactMentions Légales

                          MINECRAFT FORGE FRANCE © 2024

                          Powered by NodeBB