MFF

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

    Plusieurs texture pour UNE entité.

    Planifier Épinglé Verrouillé Déplacé Résolu 1.9.x et 1.10.x
    1.10.x
    37 Messages 4 Publieurs 4.7k Vues 1 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.
    • DeletedD Hors-ligne
      Deleted
      dernière édition par

      Salut, c’est encore moi,
      si tu souhaites une texture random sur ton entité, même principe que pour les différents ItemStack tenus: un tableau et un index random.
      Ici dans le cas présent, un tableau de ResourceLocation en final dans ta classe, et puis le getEntityTexture pointant sur un index précis de ton tableau, via un int généré aléatoirement.
      En revanche, je vois un erreur dans ton code: la méthode getAssassinTexture n’existe pas, donc mc ne pourra jamais bind la texture de ton entité. Tu dois juste faire hériter la méthode getEntityTexture, et mettre ta classe d’entité en paramètre (comme tu l’as fait ici). Un conseil pour être sûr que tu surcharges les bonnes méthodes avec les bons paramètres à chaque fois: écrire l’annotation @Override au-dessus, ainsi si tu t’es trompé, eclipse te l’indiquera !

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

        Merci pour ta réponse Plaigon.

        Je me suis inspiré de ce que j’ai fait pour les Items

        package fr.hard.mod.Render;
        
        import net.minecraft.client.model.ModelBase;
        import net.minecraft.client.model.ModelBiped;
        import net.minecraft.client.model.ModelZombie;
        import net.minecraft.client.renderer.OpenGlHelper;
        import net.minecraft.client.renderer.entity.RenderBiped;
        import net.minecraft.client.renderer.entity.RenderLiving;
        import net.minecraft.client.renderer.entity.RenderManager;
        import net.minecraft.entity.Entity;
        import net.minecraft.entity.monster.EntityEnderman;
        import net.minecraft.init.Items;
        import net.minecraft.item.ItemStack;
        import net.minecraft.util.ResourceLocation;
        import net.minecraftforge.fml.relauncher.SideOnly;
        import net.minecraftforge.fml.relauncher.Side;
        
        import org.lwjgl.opengl.GL11;
        
        import fr.hard.mod.Entity.EntityAssassin;
        import fr.hard.mod.Models.ModelAssassin;
        import fr.hard.mod.Models.ModelHerobrine;
        
        @SideOnly(Side.CLIENT)
        public class RenderAssassin extends RenderBiped
        {
        
        public static ResourceLocation[] skins;
           public int currentSkin; {
        
            currentSkin = rand.nextInt(skins.length);}
        
               private static final ResourceLocation ASSASSIN1_TEXTURE = new ResourceLocation("hard", "textures/humans/assassin1.png");
        
               public RenderAssassin(RenderManager renderManagerIn, ModelAssassin modelAssassin, float f)
               {
                   super(renderManagerIn, new ModelBiped(), 0.5F, 1.0F);
               }
        
               static
               {
                   skins = (new ResourceLocation[]
                           {
                            new ResourceLocation("hard", "textures/humans/assassin1.png"), new ResourceLocation("hard", "textures/humans/assassin2.png"), new ResourceLocation("hard", "textures/humans/assassin2.png"), new ResourceLocation("hard", "textures/humans/assassin3.png"), new ResourceLocation("hard", "textures/humans/assassin4.png"), new ResourceLocation("hard", "textures/humans/assassin5.png")
                           });
                }
        
               protected ResourceLocation getAssassinTexture(EntityAssassin assassin)
               {
                       return skins[currentSkin];
               }
        
               protected ResourceLocation getEntityTexture(Entity entity)
               {
                       return this.getAssassinTexture((EntityAssassin)entity);
               }
        
        }
        

        J’ai une erreur sur la ligne : currentSkin = rand.nextInt(skins.length);}
        Sur le mot rand. Erreur: rand cannot be resolved.

        Bizarre ça ne ma pas fait l’erreur pour les items 😕

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

          Tu n’as déclaré aucune variable rand, normal que ton ide ne la trouve pas. Essaie donc de la créer.

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

            C’est bizarre je n’ai pas creer de variable rand pour mes Items.

            package fr.hard.mod.Entity;
            
            import fr.hard.mod.HSoundEvents;
            import net.minecraft.block.material.Material;
            import net.minecraft.enchantment.EnchantmentHelper;
            import net.minecraft.entity.Entity;
            import net.minecraft.entity.EntityLiving;
            import net.minecraft.entity.IEntityLivingData;
            import net.minecraft.entity.SharedMonsterAttributes;
            import net.minecraft.entity.ai.EntityAIAttackMelee;
            import net.minecraft.entity.ai.EntityAIFollowParent;
            import net.minecraft.entity.ai.EntityAIHurtByTarget;
            import net.minecraft.entity.ai.EntityAILookIdle;
            import net.minecraft.entity.ai.EntityAIMoveThroughVillage;
            import net.minecraft.entity.ai.EntityAIMoveTowardsRestriction;
            import net.minecraft.entity.ai.EntityAINearestAttackableTarget;
            import net.minecraft.entity.ai.EntityAISwimming;
            import net.minecraft.entity.ai.EntityAIWander;
            import net.minecraft.entity.ai.EntityAIWatchClosest;
            import net.minecraft.entity.monster.EntityCreeper;
            import net.minecraft.entity.monster.EntityIronGolem;
            import net.minecraft.entity.monster.EntityMob;
            import net.minecraft.entity.monster.EntityPigZombie;
            import net.minecraft.entity.monster.EntityPolarBear;
            import net.minecraft.entity.monster.EntitySkeleton;
            import net.minecraft.entity.monster.EntityZombie;
            import net.minecraft.entity.passive.EntityPig;
            import net.minecraft.entity.passive.EntityRabbit;
            import net.minecraft.entity.passive.EntitySheep;
            import net.minecraft.entity.passive.EntityVillager;
            import net.minecraft.entity.player.EntityPlayer;
            import net.minecraft.init.Items;
            import net.minecraft.init.SoundEvents;
            import net.minecraft.inventory.EntityEquipmentSlot;
            import net.minecraft.item.Item;
            import net.minecraft.item.ItemStack;
            import net.minecraft.nbt.NBTTagCompound;
            import net.minecraft.network.datasync.DataParameter;
            import net.minecraft.network.datasync.DataSerializers;
            import net.minecraft.network.datasync.EntityDataManager;
            import net.minecraft.util.DamageSource;
            import net.minecraft.util.EnumHand;
            import net.minecraft.util.SoundEvent;
            import net.minecraft.util.math.MathHelper;
            import net.minecraft.util.text.ITextComponent;
            import net.minecraft.util.text.TextFormatting;
            import net.minecraft.world.DifficultyInstance;
            import net.minecraft.world.EnumDifficulty;
            import net.minecraft.world.World;
            import net.minecraftforge.event.entity.living.LivingDeathEvent;
            import net.minecraftforge.event.entity.player.AttackEntityEvent;
            
            public class EntityAssassin extends EntityMob
            {
            
            public static ItemStack equippedItems[];
               public int currentItem; {
            
               currentItem = rand.nextInt(equippedItems.length);}
            
            public EntityAssassin(World worldIn)
               {
                   super(worldIn);
                   this.tasks.addTask(0, new EntityAISwimming(this));
                   this.tasks.addTask(2, new EntityAIAttackMelee(this, 1.0D, false));
                   this.tasks.addTask(5, new EntityAIMoveTowardsRestriction(this, 1.0D));
                   this.tasks.addTask(7, new EntityAIWander(this, 1.0D));
                   this.tasks.addTask(8, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F));
                   this.tasks.addTask(8, new EntityAILookIdle(this));
                   this.applyEntityAI();
               }
            
            protected void applyEntityAttributes()
               {
                   super.applyEntityAttributes();
                   this.getEntityAttribute(SharedMonsterAttributes.FOLLOW_RANGE).setBaseValue(12.0D);
                   this.getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED).setBaseValue(0.39000000417232513D);
                   this.getEntityAttribute(SharedMonsterAttributes.ATTACK_DAMAGE).setBaseValue(6.0D);
                   this.getEntityAttribute(SharedMonsterAttributes.MAX_HEALTH).setBaseValue(20.0D);
               }
            
               protected void applyEntityAI()
               {
                   this.targetTasks.addTask(1, new EntityAIHurtByTarget(this, true, new Class[] {EntityPlayer.class}));
                   this.targetTasks.addTask(3, new EntityAINearestAttackableTarget(this, EntityBandit.class, false));
                   this.targetTasks.addTask(3, new EntityAINearestAttackableTarget(this, EntityCreeper.class, true));
                   this.targetTasks.addTask(3, new EntityAINearestAttackableTarget(this, EntityPirate.class, true));
                   this.targetTasks.addTask(3, new EntityAINearestAttackableTarget(this, EntityRogue.class, true));
                   this.targetTasks.addTask(3, new EntityAINearestAttackableTarget(this, EntityRogueArcher.class, true));
                   this.targetTasks.addTask(3, new EntityAINearestAttackableTarget(this, EntityShadow.class, true));
                   this.targetTasks.addTask(3, new EntityAINearestAttackableTarget(this, EntityZombie.class, true));
                   this.targetTasks.addTask(3, new EntityAINearestAttackableTarget(this, EntitySkeleton.class, true));
                   this.targetTasks.addTask(3, new EntityAINearestAttackableTarget(this, EntityCreeper.class, true));
               }
            
                protected SoundEvent getHurtSound()
                {
                    return HSoundEvents.ENTITY_HURT;
                }
            
                protected SoundEvent getDeathSound()
                {
                    return HSoundEvents.ENTITY_NEUTRAL_DEATH;
                }
            
                public void dropFewItems(boolean b, int looting)
                {
                    this.dropItem(Items.GOLD_INGOT, 2);
                    this.dropItem(Items.REDSTONE, 1);
                }
            
                static
                {
                    equippedItems = (new ItemStack[]
                            {
                                new ItemStack(Items.WOODEN_PICKAXE, 1), new ItemStack(Items.WOODEN_SWORD, 1), new ItemStack(Items.BRICK, 1), new ItemStack(Items.IRON_AXE, 1), new ItemStack(Items.GOLDEN_AXE, 1), new ItemStack(Items.IRON_HOE, 1), new ItemStack(Items.DIAMOND_SWORD, 1), new ItemStack(Items.IRON_SWORD, 1), new ItemStack(Items.GOLDEN_SWORD, 1), new ItemStack(Items.IRON_PICKAXE, 1)
                            });
                 }
            
                public ItemStack getHeldItem()
                {
                    return equippedItems[currentItem];
                }
            
                public void writeEntityToNBT(NBTTagCompound nbttagcompound)
                {
                    nbttagcompound.setInteger("equippedItem", currentItem);
                    super.writeEntityToNBT(nbttagcompound);;
                }
            
                public void readEntityFromNBT(NBTTagCompound nbttagcompound)
                {
                    currentItem = nbttagcompound.getInteger("equippedItem");
                    super.readEntityFromNBT(nbttagcompound);
                }
            
                @Override
                public IEntityLivingData onInitialSpawn(DifficultyInstance difficulty, IEntityLivingData livingdata)
                   {
                livingdata = super.onInitialSpawn(difficulty, livingdata);
                this.setEquipmentBasedOnDifficulty(difficulty);
                return livingdata;
                }
            
                   @Override
                   protected void setEquipmentBasedOnDifficulty(DifficultyInstance difficulty)
                   {
                       super.setEquipmentBasedOnDifficulty(difficulty);
                       this.setItemStackToSlot(EntityEquipmentSlot.MAINHAND, equippedItems[currentItem]);
                   }
               }
            
            1 réponse Dernière réponse Répondre Citer 0
            • DeletedD Hors-ligne
              Deleted
              dernière édition par

              La classe Item possède déjà une variable rand en réalité.
              Par ailleurs, les accolades suivant ta variable currentItem, sont inutiles, tu peux les retirer.

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

                Merci pour ta réponse Plaigon.

                En ce qui concerne les accolades, elles me sont utiles car sinon j’ai une erreur sur un “;”, elles ne me fossent pas mon code.
                Ensuite j’ai reussi a faire ma variable rand.

                package fr.hard.mod.Render;
                
                import net.minecraft.client.model.ModelBase;
                import net.minecraft.client.model.ModelBiped;
                import net.minecraft.client.model.ModelZombie;
                import net.minecraft.client.renderer.OpenGlHelper;
                import net.minecraft.client.renderer.entity.RenderBiped;
                import net.minecraft.client.renderer.entity.RenderLiving;
                import net.minecraft.client.renderer.entity.RenderManager;
                import net.minecraft.client.renderer.entity.layers.LayerHeldItem;
                import net.minecraft.entity.Entity;
                import net.minecraft.entity.monster.EntityEnderman;
                import net.minecraft.init.Items;
                import net.minecraft.item.ItemStack;
                import net.minecraft.util.ResourceLocation;
                import net.minecraftforge.fml.relauncher.SideOnly;
                import net.minecraftforge.fml.relauncher.Side;
                
                import java.util.Random;
                
                import org.lwjgl.opengl.GL11;
                
                import fr.hard.mod.Entity.EntityAssassin;
                import fr.hard.mod.Models.ModelAssassin;
                import fr.hard.mod.Models.ModelHerobrine;
                
                @SideOnly(Side.CLIENT)
                public class RenderAssassin extends RenderBiped
                {
                
                public static ResourceLocation[] skins;
                   public int currentSkin; {
                
                    Random rand = new Random();
                
                    currentSkin = rand.nextInt(skins.length);}
                
                       public RenderAssassin(RenderManager renderManagerIn, ModelAssassin modelAssassin, float f)
                       {
                           super(renderManagerIn, new ModelBiped(), 0.5F, 1.0F);
                           this.addLayer(new LayerHeldItem(this));
                       }
                
                       static
                       {
                           skins = (new ResourceLocation[]
                                   {
                                    new ResourceLocation("hard", "textures/humans/assassin1.png"), new ResourceLocation("hard", "textures/humans/assassin2.png"), new ResourceLocation("hard", "textures/humans/assassin2.png"), new ResourceLocation("hard", "textures/humans/assassin3.png"), new ResourceLocation("hard", "textures/humans/assassin4.png"), new ResourceLocation("hard", "textures/humans/assassin5.png")
                                   });
                        }
                
                       protected ResourceLocation getAssassinTexture(EntityAssassin assassin)
                       {
                               return skins[currentSkin];
                       }
                
                       protected ResourceLocation getEntityTexture(Entity entity)
                       {
                               return this.getAssassinTexture((EntityAssassin)entity);
                       }
                
                }
                

                Le problème maintenant c’est que quand je fait apparaitre mon Mob, j’ai uniquement la 4è texture 😕

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

                  Ce qu’il faut que tu fasse, c’est mettre une variable dans la class de ton entité qui est choisie aléatoirement lorsque l’entité spawn, qui est enregistrée dans les nbtTags et dans la fonction
                  getEntityTexture, tu utilise cette variable. (En fait, tu peux juste déplacer la variable currentSkin dans la class de ton entité, et modifier les fonctions pour enregistrer cette variable dans les nbt
                  )

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

                    Merci de ta réponse LeBossMax2

                    Je me suis inspiré de ce que j’ai deja fait a propos des NBT tags.

                    J’ai mit ceci dans ma Classe Render:

                    public void writeEntityToNBT(NBTTagCompound nbttagcompound)
                          {
                              nbttagcompound.setInteger("skins", currentSkin);
                              super.writeEntityToNBT(nbttagcompound);;
                          }
                    
                          public void readEntityFromNBT(NBTTagCompound nbttagcompound)
                          {
                          currentSkin = nbttagcompound.getInteger("skins");
                              super.readEntityFromNBT(nbttagcompound);
                          }
                    

                    Mais j’ai une erreur sur : writeEntityToNBT et readEntityFromNBT
                    La méthode n’est pas définie pour le ModelBiped


                    C’est exactement le meme systeme que mes Items aléatoire.

                    Au lieux que ce soit des ItemsStacks c’est des ResourceLocation.

                    Mais il n’a pas apprécié writeEntityToNBT et readEntityFromNBT 😕

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

                      Enfin NBTTag uniquement s’il souhaite save la texture actuelle.

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

                        Oui 😕 J’ai uniquement la quatrieme possibilité 😕

                        package fr.hard.mod.Render;
                        
                        import net.minecraft.client.model.ModelBase;
                        import net.minecraft.client.model.ModelBiped;
                        import net.minecraft.client.model.ModelZombie;
                        import net.minecraft.client.renderer.OpenGlHelper;
                        import net.minecraft.client.renderer.entity.RenderBiped;
                        import net.minecraft.client.renderer.entity.RenderLiving;
                        import net.minecraft.client.renderer.entity.RenderManager;
                        import net.minecraft.client.renderer.entity.layers.LayerHeldItem;
                        import net.minecraft.entity.Entity;
                        import net.minecraft.entity.monster.EntityEnderman;
                        import net.minecraft.init.Items;
                        import net.minecraft.item.ItemStack;
                        import net.minecraft.nbt.NBTTagCompound;
                        import net.minecraft.util.ResourceLocation;
                        import net.minecraftforge.fml.relauncher.SideOnly;
                        import net.minecraftforge.fml.relauncher.Side;
                        
                        import java.util.Random;
                        
                        import org.lwjgl.opengl.GL11;
                        
                        import fr.hard.mod.Entity.EntityAssassin;
                        import fr.hard.mod.Models.ModelAssassin;
                        import fr.hard.mod.Models.ModelHerobrine;
                        
                        @SideOnly(Side.CLIENT)
                        public class RenderAssassin extends RenderBiped
                        {
                        
                        public static ResourceLocation[] skins;
                           public int currentSkin; {
                        
                            Random rand = new Random();
                        
                            currentSkin = rand.nextInt(skins.length);}
                        
                               public RenderAssassin(RenderManager renderManagerIn, ModelAssassin modelAssassin, float f)
                               {
                                   super(renderManagerIn, new ModelBiped(), 0.5F, 1.0F);
                                   this.addLayer(new LayerHeldItem(this));
                               }
                        
                               static
                               {
                                   skins = (new ResourceLocation[]
                                           {
                                            new ResourceLocation("hard", "textures/humans/assassin1.png"), new ResourceLocation("hard", "textures/humans/assassin2.png"), new ResourceLocation("hard", "textures/humans/assassin2.png"), new ResourceLocation("hard", "textures/humans/assassin3.png"), new ResourceLocation("hard", "textures/humans/assassin4.png"), new ResourceLocation("hard", "textures/humans/assassin5.png")
                                           });
                                }
                        
                               protected ResourceLocation getAssassinTexture(EntityAssassin assassin)
                               {
                                       return skins[currentSkin];
                               }
                        
                               protected ResourceLocation getEntityTexture(Entity entity)
                               {
                                       return this.getAssassinTexture((EntityAssassin)entity);
                               }
                        
                        }
                        
                        1 réponse Dernière réponse Répondre Citer 0
                        • robin4002R Hors-ligne
                          robin4002 Moddeurs confirmés Rédacteurs Administrateurs
                          dernière édition par

                          Les nbt sont à mettre dans la classe de l’entité et la variable aléatoire est à mettre au même endroit. Tu peux ensuite y accéder depuis ton rendu comme tu as l’entité en argument de la fonction getEntityTexture

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

                            J’ai rajouter ceci dans ma Classe de l’entité, c’est correct ?

                            //Textures
                            
                                   public static ResourceLocation[] skins;
                                   public int currentSkin; {
                            
                                    Random rand = new Random();
                            
                                    currentSkin = rand.nextInt(skins.length);}
                            
                                   public void writeEntityToNBT2(NBTTagCompound nbttagcompound)
                                   {
                                       nbttagcompound.setInteger("skins", currentSkin);
                                       super.writeEntityToNBT(nbttagcompound);;
                                   }
                            
                                   public void readEntityFromNBT2(NBTTagCompound nbttagcompound)
                                   {
                                    currentSkin = nbttagcompound.getInteger("skins");
                                       super.readEntityFromNBT(nbttagcompound);
                                   }
                            
                            1 réponse Dernière réponse Répondre Citer 0
                            • DeletedD Hors-ligne
                              Deleted
                              dernière édition par

                              Utilise les balises java, plutôt que les balises code, ce sera + lisible.
                              Le tableau de ResourceLocation a + à voir avec la classe render que entity. Si tu souhaites avoir de la persistance dans la sélection de la texture pour chaque instance de ton entity, alors oui go NBTTag + DataWatcher pour synchroniser l’indexe 😉

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

                                Bon, je m’avoue un peu dépasser, c’est un peu hors de mes compétences.

                                il n’y a pas plus simple ? Comme le rendu des lapins, et des ocelots ?

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

                                  Non, c’est d’ailleurs ce qu’utilisent les lapins/ocelots apprivoisés

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

                                    Justement , je pourrais peut etre me servir de ça ?

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

                                      Oui, c’est la seule manière simple de synchroniser le serveur (l’index du skin) avec tous les clients connectés (permettant de rendre le bon).
                                      Inspire toi des classes cités au-dessus, et reviens si tu as des questions.

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

                                        Prendre exemple sur le rendu des Ocelots est le plus simple.

                                        Ma seule question est par quoi remplacer: switch (entity.getTameSkin())

                                        package net.minecraft.client.renderer.entity;
                                        
                                        import net.minecraft.client.model.ModelBase;
                                        import net.minecraft.client.renderer.GlStateManager;
                                        import net.minecraft.entity.passive.EntityOcelot;
                                        import net.minecraft.util.ResourceLocation;
                                        import net.minecraftforge.fml.relauncher.Side;
                                        import net.minecraftforge.fml.relauncher.SideOnly;
                                        
                                        @SideOnly(Side.CLIENT)
                                        public class RenderOcelot extends RenderLiving <entityocelot>{
                                           private static final ResourceLocation BLACK_OCELOT_TEXTURES = new ResourceLocation("textures/entity/cat/black.png");
                                           private static final ResourceLocation OCELOT_TEXTURES = new ResourceLocation("textures/entity/cat/ocelot.png");
                                           private static final ResourceLocation RED_OCELOT_TEXTURES = new ResourceLocation("textures/entity/cat/red.png");
                                           private static final ResourceLocation SIAMESE_OCELOT_TEXTURES = new ResourceLocation("textures/entity/cat/siamese.png");
                                        
                                           public RenderOcelot(RenderManager renderManagerIn, ModelBase modelBaseIn, float shadowSizeIn)
                                           {
                                               super(renderManagerIn, modelBaseIn, shadowSizeIn);
                                           }
                                        
                                           /**
                                            * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture.
                                            */
                                           protected ResourceLocation getEntityTexture(EntityOcelot entity)
                                           {
                                               switch (entity.getTameSkin())
                                               {
                                                   case 0:
                                                   default:
                                                       return OCELOT_TEXTURES;
                                                   case 1:
                                                       return BLACK_OCELOT_TEXTURES;
                                                   case 2:
                                                       return RED_OCELOT_TEXTURES;
                                                   case 3:
                                                       return SIAMESE_OCELOT_TEXTURES;
                                               }
                                           }
                                        

                                        J’arrive à tout remplacer ce qui faut mais comme j’ai dit il y a la ligne: switch (entity.getTameSkin())

                                        Je sais pas par quoi le remplacer pour ce ça marche avec mon mob. De type Humain , Biped :/</entityocelot>

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

                                          La méthode getTameSkin renvoie un int représentant l’index de la texture à bind, du coup à toi de faire ta propre méthode.

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

                                            J’ai fait quelques changements dans la Classe de l’entité:

                                            private static final DataParameter <integer>ASSASSIN_VARIANT = EntityDataManager.<integer>createKey(EntityAssassin.class, DataSerializers.VARINT);
                                            
                                            public int getAssassinSkin()
                                                   {
                                                       return ((Integer)this.dataManager.get(ASSASSIN_VARIANT)).intValue();
                                                   }
                                            

                                            Et la classe Render:

                                            package fr.hard.mod.Render;
                                            
                                            import fr.hard.mod.Entity.EntityAssassin;
                                            import fr.hard.mod.Models.ModelAssassin;
                                            import fr.hard.mod.Models.ModelBandit;
                                            import fr.hard.mod.Models.ModelRogue;
                                            import net.minecraft.client.model.ModelBase;
                                            import net.minecraft.client.model.ModelBiped;
                                            import net.minecraft.client.renderer.GlStateManager;
                                            import net.minecraft.client.renderer.entity.RenderBiped;
                                            import net.minecraft.client.renderer.entity.RenderManager;
                                            import net.minecraft.client.renderer.entity.layers.LayerHeldItem;
                                            import net.minecraft.entity.passive.EntityOcelot;
                                            import net.minecraft.util.ResourceLocation;
                                            import net.minecraftforge.fml.relauncher.Side;
                                            import net.minecraftforge.fml.relauncher.SideOnly;
                                            
                                            @SideOnly(Side.CLIENT)
                                            public class RenderAssassin extends RenderBiped
                                            {
                                            private static final ResourceLocation ASSASSIN1_TEXTURE = new ResourceLocation("hard", "textures/humans/assassin1.png");
                                            private static final ResourceLocation ASSASSIN2_TEXTURE = new ResourceLocation("hard", "textures/humans/assassin2.png");
                                            private static final ResourceLocation ASSASSIN3_TEXTURE = new ResourceLocation("hard", "textures/humans/assassin3.png");
                                            private static final ResourceLocation ASSASSIN4_TEXTURE = new ResourceLocation("hard", "textures/humans/assassin4.png");
                                            private static final ResourceLocation ASSASSIN5_TEXTURE = new ResourceLocation("hard", "textures/humans/assassin5.png");
                                            
                                            public RenderAssassin(RenderManager renderManagerIn, ModelAssassin modelAssassin, float f)
                                               {
                                                   super(renderManagerIn, new ModelBiped(), 0.5F, 1.0F);
                                                   this.addLayer(new LayerHeldItem(this));
                                               }
                                            
                                               protected ResourceLocation getEntityTexture(EntityAssassin entity)
                                               {
                                                   switch (entity.getAssassinSkin())
                                                   {
                                                       case 0:
                                                       default:
                                                           return ASSASSIN1_TEXTURE;
                                                       case 1:
                                                           return ASSASSIN2_TEXTURE;
                                                       case 2:
                                                           return ASSASSIN3_TEXTURE;
                                                       case 3:
                                                           return ASSASSIN4_TEXTURE;
                                                       case 4:
                                                           return ASSASSIN5_TEXTURE;
                                                   }
                                               }
                                            }
                                            

                                            Et j’obtiens maintenant ceci: 
                                            </integer></integer>

                                            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