• S'inscrire
    • Se connecter
    • Recherche
    • Récent
    • Mots-clés
    • Populaire
    • Utilisateurs
    • Groupes

    Résolu Textures Randoms Mob 1.7.10

    1.7.x
    1.7.10
    2
    7
    1535
    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.
    • 2
      20cents34 dernière édition par

      Bonjour, je cherche comment mettre une texture random sur un mob perso sans que cela change les textures des mobs que j’ai fais spawner avant. Je m’explique, j’ai suivi le tuto de ZeAmateis pour le faire et je n’obtiens aucune erreur sauf que lorsque je fais spawner un mob avec un oeuf il apparaît avec une texture et lorsque j’en fais spawner d’autre la texture de tous les mobs précédents change.
      Je ne vois vraiment pas quoi faire  😊
      Je modde sur 1.7.10.
      Merci d’avance

      1 réponse Dernière réponse Répondre Citer 0
      • robin4002
        robin4002 Moddeurs confirmés Rédacteurs Administrateurs dernière édition par

        Salut,
        Enregistre la valeur aléatoire dans le mobs, et récupérer la sur le rendu. Normalement ça devrait être bon.

        1 réponse Dernière réponse Répondre Citer 0
        • 2
          20cents34 dernière édition par

          Euh je fais ça comment ? ll faut quelle fonction pour enregistrer la valeur dans le mob et la récuperer ensuite svp?

          1 réponse Dernière réponse Répondre Citer 0
          • robin4002
            robin4002 Moddeurs confirmés Rédacteurs Administrateurs dernière édition par

            Envoie ton code actuelle (ton mob + ton rendu)

            1 réponse Dernière réponse Répondre Citer 0
            • 2
              20cents34 dernière édition par

              Classe du mob

              public class EntityZombie extends EntityMob{
              
              public static int texture;
              
              public EntityZombie(World par1World) {
              
              super(par1World);
              this.tasks.addTask(0, new EntityAISwimming(this));
                     this.tasks.addTask(1, new EntityAIAttackOnCollide(this, EntityPlayer.class, 0.8D, false));
                     this.tasks.addTask(2, new EntityAIWander(this, 1.0D));
                     this.tasks.addTask(3, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F));
                     this.tasks.addTask(4, new EntityAILookIdle(this));
                     this.targetTasks.addTask(5, new EntityAINearestAttackableTarget(this, EntityPlayer.class, 0, true));
              
                     texture = this.worldObj.rand.nextInt(4);
              
                  if (this.worldObj.difficultySetting == EnumDifficulty.HARD){
              
                  this.setCurrentItemOrArmor(0, new ItemStack(Items.diamond_sword));
                  this.setCurrentItemOrArmor(1, new ItemStack(Items.diamond_helmet));
                  this.setCurrentItemOrArmor(2, new ItemStack(Items.diamond_chestplate));
                  this.setCurrentItemOrArmor(3, new ItemStack(Items.diamond_leggings));
                  this.setCurrentItemOrArmor(4, new ItemStack(Items.diamond_boots));
              
                  }
              }
              
              public void onUpdate()
                 {
                     super.onUpdate();
              
                     if (!this.worldObj.isRemote && this.worldObj.difficultySetting == EnumDifficulty.PEACEFUL)
                     {
                         this.setDead();
                     }
                 }
              public void applyEntityAttributes()
              {
              super.applyEntityAttributes();
              this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.3D);
              this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(20D);
              this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(3.0D);
              
              }
              
                 protected boolean isAIEnabled()
                 {
                     return true;
                 }
              
              public boolean attackEntityAsMob(Entity par1Entity)
                 {
                     float f = (float)this.getEntityAttribute(SharedMonsterAttributes.attackDamage).getAttributeValue();
                     int i = 0;
              
                     if (par1Entity instanceof EntityLivingBase)
                     {
                         f += EnchantmentHelper.getEnchantmentModifierLiving(this, (EntityLivingBase)par1Entity);
                         i += EnchantmentHelper.getKnockbackModifier(this, (EntityLivingBase)par1Entity);
                     }
              
                     boolean flag = par1Entity.attackEntityFrom(DamageSource.causeMobDamage(this), f);
              
                     if (flag)
                     {
                         if (i > 0)
                         {
                             par1Entity.addVelocity((double)(-MathHelper.sin(this.rotationYaw * (float)Math.PI / 180.0F) * (float)i * 0.5F), 0.1D, (double)(MathHelper.cos(this.rotationYaw * (float)Math.PI / 180.0F) * (float)i * 0.5F));
                             this.motionX *= 0.6D;
                             this.motionZ *= 0.6D;
                         }
              
                         int j = EnchantmentHelper.getFireAspectModifier(this);
              
                         if (j > 0)
                         {
                             par1Entity.setFire(j * 4);
                         }
              
                         if (par1Entity instanceof EntityLivingBase)
                         {
                             EnchantmentHelper.func_151384_a((EntityLivingBase)par1Entity, this);
                         }
              
                         EnchantmentHelper.func_151385_b(this, par1Entity);
                     }
              
                     return flag;
                 }
              
              public boolean attackEntityFrom(DamageSource par1DamageSource, float par2)
              {
                 if (this.isEntityInvulnerable())
                 {
                     return false;
                 }
                 else
                 {
                     Entity entity = par1DamageSource.getEntity();
              
                     if (entity != null && !(entity instanceof EntityPlayer) && !(entity instanceof EntityArrow))
                     {
                         par2 = (par2 + 1.0F) / 2.0F;
                     }
              
                     return super.attackEntityFrom(par1DamageSource, par2);
                 }
              }
              protected void attackEntity(Entity par1Entity, float par2)
              {
                 if (this.attackTime <= 0 && par2 < 2.0F && par1Entity.boundingBox.maxY > this.boundingBox.minY && par1Entity.boundingBox.minY < this.boundingBox.maxY)
                 {
                     this.attackTime = 20;
                     this.attackEntityAsMob(par1Entity);
                 }
              
              }
              
              public boolean getCanSpawnHere()
              {
                  return worldObj.isDaytime();
              }
              
              protected Entity findPlayerToAttack()
              {
                 float f = this.getBrightness(1.0F);
              
                 if (f < 0.5F)
                 {
                     double d0 = 16.0D;
                     return this.worldObj.getClosestVulnerablePlayerToEntity(this, d0);
                 }
                 else
                 {
                     return null;
                 }
              }
              public Item getDropItem()
              {
              return MoreObject.itemcuivre;
              }
              
              }
              

              render du mob

              public class RenderZombie extends RenderBiped {
              
              public RenderZombie(ModelBiped par1ModelBiped, float par2) {
              super(par1ModelBiped, par2);
              
              }
              
              protected ResourceLocation getEntityTexture(EntityLiving living)
              {
              return this.getZombieTexture((EntityZombie)living);
              }
              
              private ResourceLocation getZombieTexture(EntityZombie zombie)
              {
              return new ResourceLocation("mobject:textures/entity/zombie"  + zombie.texture + ".png");
              }
              protected void renderEquippedItems(EntityLivingBase par1EntityLivingBase, float par2)
                 {
                     this.renderEquippedItems((EntityZombie)par1EntityLivingBase, par2);
                 }
              }
              
              1 réponse Dernière réponse Répondre Citer 0
              • robin4002
                robin4002 Moddeurs confirmés Rédacteurs Administrateurs dernière édition par

                En fait le code est déjà presque tout bon.
                Le problème est juste là :
                public static int texture;
                Enlève le static.

                1 réponse Dernière réponse Répondre Citer 0
                • 2
                  20cents34 dernière édition par

                  Merci ça marche ! j’ai honte d’avoir fais une faute comme ca

                  1 réponse Dernière réponse Répondre Citer 0
                  • 1 / 1
                  • Premier message
                    Dernier message
                  Design by Woryk
                  Contact / Mentions Légales

                  MINECRAFT FORGE FRANCE © 2018

                  Powered by NodeBB