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

    Résolu Créer un bateau

    1.8.x
    1.8
    7
    59
    10014
    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.
    • Eryah
      Eryah dernière édition par

      Bonjour, je me présente, Eryah. Je risque de me manger quelques points de réputation en moins avec se topic. 
      Bien, dans mon mod, j’aimerai inculure quelques bateaux.

      • Bateau motorisé
      • Bateau en fer
      • Bateau en fer motorisé
      • Bateau thermorésistant
      • bateau thermorésistant motorisé

      Donc, j’aimerai avoir plusieurs renseignement ( J’ai bien fait des recherche !! Mais j’ai rien trouvé en 1.8, même 1.7, et ce n’était pas très clair pour moi)

      • Comment augmenter/réduire la vitesse du bateau
      • Comment empécher le bateau de casser en rencontrant un bord
      • Comment rendre un bateau résistant à la lave
      • COMMENT REGISTER UN MOB ( Avec et sans œuf, j’ai le même problème avec ma poule au œuf d’or, je n’arrive pas à la register

      Classe du bateau normal

      package net.minecraft.entity.item;
      
      import java.util.List;
      import net.minecraft.block.Block;
      import net.minecraft.block.material.Material;
      import net.minecraft.entity.Entity;
      import net.minecraft.entity.EntityLivingBase;
      import net.minecraft.entity.player.EntityPlayer;
      import net.minecraft.init.Blocks;
      import net.minecraft.init.Items;
      import net.minecraft.item.Item;
      import net.minecraft.nbt.NBTTagCompound;
      import net.minecraft.util.AxisAlignedBB;
      import net.minecraft.util.BlockPos;
      import net.minecraft.util.DamageSource;
      import net.minecraft.util.EntityDamageSourceIndirect;
      import net.minecraft.util.EnumParticleTypes;
      import net.minecraft.util.MathHelper;
      import net.minecraft.world.World;
      import net.minecraftforge.fml.relauncher.Side;
      import net.minecraftforge.fml.relauncher.SideOnly;
      
      public class EntityBoat extends Entity
      {
         /** true if no player in boat */
         private boolean isBoatEmpty;
         private double speedMultiplier;
         private int boatPosRotationIncrements;
         private double boatX;
         private double boatY;
         private double boatZ;
         private double boatYaw;
         private double boatPitch;
         @SideOnly(Side.CLIENT)
         private double velocityX;
         @SideOnly(Side.CLIENT)
         private double velocityY;
         @SideOnly(Side.CLIENT)
         private double velocityZ;
         private static final String __OBFID = "CL_00001667";
      
         public EntityBoat(World worldIn)
         {
             super(worldIn);
             this.isBoatEmpty = true;
             this.speedMultiplier = 0.07D;
             this.preventEntitySpawning = true;
             this.setSize(1.5F, 0.6F);
         }
      
         /**
          * returns if this entity triggers Block.onEntityWalking on the blocks they walk on. used for spiders and wolves to
          * prevent them from trampling crops
          */
         protected boolean canTriggerWalking()
         {
             return false;
         }
      
         protected void entityInit()
         {
             this.dataWatcher.addObject(17, new Integer(0));
             this.dataWatcher.addObject(18, new Integer(1));
             this.dataWatcher.addObject(19, new Float(0.0F));
         }
      
         /**
          * Returns a boundingBox used to collide the entity with other entities and blocks. This enables the entity to be
          * pushable on contact, like boats or minecarts.
          */
         public AxisAlignedBB getCollisionBox(Entity entityIn)
         {
             return entityIn.getEntityBoundingBox();
         }
      
         /**
          * returns the bounding box for this entity
          */
         public AxisAlignedBB getBoundingBox()
         {
             return this.getEntityBoundingBox();
         }
      
         /**
          * Returns true if this entity should push and be pushed by other entities when colliding.
          */
         public boolean canBePushed()
         {
             return true;
         }
      
         public EntityBoat(World worldIn, double p_i1705_2_, double p_i1705_4_, double p_i1705_6_)
         {
             this(worldIn);
             this.setPosition(p_i1705_2_, p_i1705_4_, p_i1705_6_);
             this.motionX = 0.0D;
             this.motionY = 0.0D;
             this.motionZ = 0.0D;
             this.prevPosX = p_i1705_2_;
             this.prevPosY = p_i1705_4_;
             this.prevPosZ = p_i1705_6_;
         }
      
         /**
          * Returns the Y offset from the entity's position for any entity riding this one.
          */
         public double getMountedYOffset()
         {
             return (double)this.height * 0.0D - 0.30000001192092896D;
         }
      
         /**
          * Called when the entity is attacked.
          */
         public boolean attackEntityFrom(DamageSource source, float amount)
         {
             if (this.isEntityInvulnerable(source))
             {
                 return false;
             }
             else if (!this.worldObj.isRemote && !this.isDead)
             {
                 if (this.riddenByEntity != null && this.riddenByEntity == source.getEntity() && source instanceof EntityDamageSourceIndirect)
                 {
                     return false;
                 }
                 else
                 {
                     this.setForwardDirection(-this.getForwardDirection());
                     this.setTimeSinceHit(10);
                     this.setDamageTaken(this.getDamageTaken() + amount * 10.0F);
                     this.setBeenAttacked();
                     boolean flag = source.getEntity() instanceof EntityPlayer && ((EntityPlayer)source.getEntity()).capabilities.isCreativeMode;
      
                     if (flag || this.getDamageTaken() > 40.0F)
                     {
                         if (this.riddenByEntity != null)
                         {
                             this.riddenByEntity.mountEntity(this);
                         }
      
                         if (!flag)
                         {
                             this.dropItemWithOffset(Items.boat, 1, 0.0F);
                         }
      
                         this.setDead();
                     }
      
                     return true;
                 }
             }
             else
             {
                 return true;
             }
         }
      
         /**
          * Setups the entity to do the hurt animation. Only used by packets in multiplayer.
          */
         @SideOnly(Side.CLIENT)
         public void performHurtAnimation()
         {
             this.setForwardDirection(-this.getForwardDirection());
             this.setTimeSinceHit(10);
             this.setDamageTaken(this.getDamageTaken() * 11.0F);
         }
      
         /**
          * Returns true if other Entities should be prevented from moving through this Entity.
          */
         public boolean canBeCollidedWith()
         {
             return !this.isDead;
         }
      
         @SideOnly(Side.CLIENT)
         public void func_180426_a(double p_180426_1_, double p_180426_3_, double p_180426_5_, float p_180426_7_, float p_180426_8_, int p_180426_9_, boolean p_180426_10_)
         {
             if (p_180426_10_ && this.riddenByEntity != null)
             {
                 this.prevPosX = this.posX = p_180426_1_;
                 this.prevPosY = this.posY = p_180426_3_;
                 this.prevPosZ = this.posZ = p_180426_5_;
                 this.rotationYaw = p_180426_7_;
                 this.rotationPitch = p_180426_8_;
                 this.boatPosRotationIncrements = 0;
                 this.setPosition(p_180426_1_, p_180426_3_, p_180426_5_);
                 this.motionX = this.velocityX = 0.0D;
                 this.motionY = this.velocityY = 0.0D;
                 this.motionZ = this.velocityZ = 0.0D;
             }
             else
             {
                 if (this.isBoatEmpty)
                 {
                     this.boatPosRotationIncrements = p_180426_9_ + 5;
                 }
                 else
                 {
                     double d3 = p_180426_1_ - this.posX;
                     double d4 = p_180426_3_ - this.posY;
                     double d5 = p_180426_5_ - this.posZ;
                     double d6 = d3 * d3 + d4 * d4 + d5 * d5;
      
                     if (d6 <= 1.0D)
                     {
                         return;
                     }
      
                     this.boatPosRotationIncrements = 3;
                 }
      
                 this.boatX = p_180426_1_;
                 this.boatY = p_180426_3_;
                 this.boatZ = p_180426_5_;
                 this.boatYaw = (double)p_180426_7_;
                 this.boatPitch = (double)p_180426_8_;
                 this.motionX = this.velocityX;
                 this.motionY = this.velocityY;
                 this.motionZ = this.velocityZ;
             }
         }
      
         /**
          * Sets the velocity to the args. Args: x, y, z
          */
         @SideOnly(Side.CLIENT)
         public void setVelocity(double x, double y, double z)
         {
             this.velocityX = this.motionX = x;
             this.velocityY = this.motionY = y;
             this.velocityZ = this.motionZ = z;
         }
      
         /**
          * Called to update the entity's position/logic.
          */
         public void onUpdate()
         {
             super.onUpdate();
      
             if (this.getTimeSinceHit() > 0)
             {
                 this.setTimeSinceHit(this.getTimeSinceHit() - 1);
             }
      
             if (this.getDamageTaken() > 0.0F)
             {
                 this.setDamageTaken(this.getDamageTaken() - 1.0F);
             }
      
             this.prevPosX = this.posX;
             this.prevPosY = this.posY;
             this.prevPosZ = this.posZ;
             byte b0 = 5;
             double d0 = 0.0D;
      
             for (int i = 0; i < b0; ++i)
             {
                 double d1 = this.getEntityBoundingBox().minY + (this.getEntityBoundingBox().maxY - this.getEntityBoundingBox().minY) * (double)(i + 0) / (double)b0 - 0.125D;
                 double d3 = this.getEntityBoundingBox().minY + (this.getEntityBoundingBox().maxY - this.getEntityBoundingBox().minY) * (double)(i + 1) / (double)b0 - 0.125D;
                 AxisAlignedBB axisalignedbb = new AxisAlignedBB(this.getEntityBoundingBox().minX, d1, this.getEntityBoundingBox().minZ, this.getEntityBoundingBox().maxX, d3, this.getEntityBoundingBox().maxZ);
      
                 if (this.worldObj.isAABBInMaterial(axisalignedbb, Material.water))
                 {
                     d0 += 1.0D / (double)b0;
                 }
             }
      
             double d9 = Math.sqrt(this.motionX * this.motionX + this.motionZ * this.motionZ);
             double d2;
             double d4;
             int j;
      
             if (d9 > 0.2975D)
             {
                 d2 = Math.cos((double)this.rotationYaw * Math.PI / 180.0D);
                 d4 = Math.sin((double)this.rotationYaw * Math.PI / 180.0D);
      
                 for (j = 0; (double)j < 1.0D + d9 * 60.0D; ++j)
                 {
                     double d5 = (double)(this.rand.nextFloat() * 2.0F - 1.0F);
                     double d6 = (double)(this.rand.nextInt(2) * 2 - 1) * 0.7D;
                     double d7;
                     double d8;
      
                     if (this.rand.nextBoolean())
                     {
                         d7 = this.posX - d2 * d5 * 0.8D + d4 * d6;
                         d8 = this.posZ - d4 * d5 * 0.8D - d2 * d6;
                         this.worldObj.spawnParticle(EnumParticleTypes.WATER_SPLASH, d7, this.posY - 0.125D, d8, this.motionX, this.motionY, this.motionZ, new int[0]);
                     }
                     else
                     {
                         d7 = this.posX + d2 + d4 * d5 * 0.7D;
                         d8 = this.posZ + d4 - d2 * d5 * 0.7D;
                         this.worldObj.spawnParticle(EnumParticleTypes.WATER_SPLASH, d7, this.posY - 0.125D, d8, this.motionX, this.motionY, this.motionZ, new int[0]);
                     }
                 }
             }
      
             double d10;
             double d11;
      
             if (this.worldObj.isRemote && this.isBoatEmpty)
             {
                 if (this.boatPosRotationIncrements > 0)
                 {
                     d2 = this.posX + (this.boatX - this.posX) / (double)this.boatPosRotationIncrements;
                     d4 = this.posY + (this.boatY - this.posY) / (double)this.boatPosRotationIncrements;
                     d10 = this.posZ + (this.boatZ - this.posZ) / (double)this.boatPosRotationIncrements;
                     d11 = MathHelper.wrapAngleTo180_double(this.boatYaw - (double)this.rotationYaw);
                     this.rotationYaw = (float)((double)this.rotationYaw + d11 / (double)this.boatPosRotationIncrements);
                     this.rotationPitch = (float)((double)this.rotationPitch + (this.boatPitch - (double)this.rotationPitch) / (double)this.boatPosRotationIncrements);
                     –this.boatPosRotationIncrements;
                     this.setPosition(d2, d4, d10);
                     this.setRotation(this.rotationYaw, this.rotationPitch);
                 }
                 else
                 {
                     d2 = this.posX + this.motionX;
                     d4 = this.posY + this.motionY;
                     d10 = this.posZ + this.motionZ;
                     this.setPosition(d2, d4, d10);
      
                     if (this.onGround)
                     {
                         this.motionX *= 0.5D;
                         this.motionY *= 0.5D;
                         this.motionZ *= 0.5D;
                     }
      
                     this.motionX *= 0.9900000095367432D;
                     this.motionY *= 0.949999988079071D;
                     this.motionZ *= 0.9900000095367432D;
                 }
             }
             else
             {
                 if (d0 < 1.0D)
                 {
                     d2 = d0 * 2.0D - 1.0D;
                     this.motionY += 0.03999999910593033D * d2;
                 }
                 else
                 {
                     if (this.motionY < 0.0D)
                     {
                         this.motionY /= 2.0D;
                     }
      
                     this.motionY += 0.007000000216066837D;
                 }
      
                 if (this.riddenByEntity instanceof EntityLivingBase)
                 {
                     EntityLivingBase entitylivingbase = (EntityLivingBase)this.riddenByEntity;
                     float f = this.riddenByEntity.rotationYaw + -entitylivingbase.moveStrafing * 90.0F;
                     this.motionX += -Math.sin((double)(f * (float)Math.PI / 180.0F)) * this.speedMultiplier * (double)entitylivingbase.moveForward * 0.05000000074505806D;
                     this.motionZ += Math.cos((double)(f * (float)Math.PI / 180.0F)) * this.speedMultiplier * (double)entitylivingbase.moveForward * 0.05000000074505806D;
                 }
      
                 d2 = Math.sqrt(this.motionX * this.motionX + this.motionZ * this.motionZ);
      
                 if (d2 > 0.35D)
                 {
                     d4 = 0.35D / d2;
                     this.motionX *= d4;
                     this.motionZ *= d4;
                     d2 = 0.35D;
                 }
      
                 if (d2 > d9 && this.speedMultiplier < 0.35D)
                 {
                     this.speedMultiplier += (0.35D - this.speedMultiplier) / 35.0D;
      
                     if (this.speedMultiplier > 0.35D)
                     {
                         this.speedMultiplier = 0.35D;
                     }
                 }
                 else
                 {
                     this.speedMultiplier -= (this.speedMultiplier - 0.07D) / 35.0D;
      
                     if (this.speedMultiplier < 0.07D)
                     {
                         this.speedMultiplier = 0.07D;
                     }
                 }
      
                 int l;
      
                 for (l = 0; l < 4; ++l)
                 {
                     int i1 = MathHelper.floor_double(this.posX + ((double)(l % 2) - 0.5D) * 0.8D);
                     j = MathHelper.floor_double(this.posZ + ((double)(l / 2) - 0.5D) * 0.8D);
      
                     for (int j1 = 0; j1 < 2; ++j1)
                     {
                         int k = MathHelper.floor_double(this.posY) + j1;
                         BlockPos blockpos = new BlockPos(i1, k, j);
                         Block block = this.worldObj.getBlockState(blockpos).getBlock();
      
                         if (block == Blocks.snow_layer)
                         {
                             this.worldObj.setBlockToAir(blockpos);
                             this.isCollidedHorizontally = false;
                         }
                         else if (block == Blocks.waterlily)
                         {
                             this.worldObj.destroyBlock(blockpos, true);
                             this.isCollidedHorizontally = false;
                         }
                     }
                 }
      
                 if (this.onGround)
                 {
                     this.motionX *= 0.5D;
                     this.motionY *= 0.5D;
                     this.motionZ *= 0.5D;
                 }
      
                 this.moveEntity(this.motionX, this.motionY, this.motionZ);
      
                 if (this.isCollidedHorizontally && d9 > 0.2D)
                 {
                     if (!this.worldObj.isRemote && !this.isDead)
                     {
                         this.setDead();
      
                         for (l = 0; l < 3; ++l)
                         {
                             this.dropItemWithOffset(Item.getItemFromBlock(Blocks.planks), 1, 0.0F);
                         }
      
                         for (l = 0; l < 2; ++l)
                         {
                             this.dropItemWithOffset(Items.stick, 1, 0.0F);
                         }
                     }
                 }
                 else
                 {
                     this.motionX *= 0.9900000095367432D;
                     this.motionY *= 0.949999988079071D;
                     this.motionZ *= 0.9900000095367432D;
                 }
      
                 this.rotationPitch = 0.0F;
                 d4 = (double)this.rotationYaw;
                 d10 = this.prevPosX - this.posX;
                 d11 = this.prevPosZ - this.posZ;
      
                 if (d10 * d10 + d11 * d11 > 0.001D)
                 {
                     d4 = (double)((float)(Math.atan2(d11, d10) * 180.0D / Math.PI));
                 }
      
                 double d12 = MathHelper.wrapAngleTo180_double(d4 - (double)this.rotationYaw);
      
                 if (d12 > 20.0D)
                 {
                     d12 = 20.0D;
                 }
      
                 if (d12 < -20.0D)
                 {
                     d12 = -20.0D;
                 }
      
                 this.rotationYaw = (float)((double)this.rotationYaw + d12);
                 this.setRotation(this.rotationYaw, this.rotationPitch);
      
                 if (!this.worldObj.isRemote)
                 {
                     List list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.getEntityBoundingBox().expand(0.20000000298023224D, 0.0D, 0.20000000298023224D));
      
                     if (list != null && !list.isEmpty())
                     {
                         for (int k1 = 0; k1 < list.size(); ++k1)
                         {
                             Entity entity = (Entity)list.get(k1);
      
                             if (entity != this.riddenByEntity && entity.canBePushed() && entity instanceof EntityBoat)
                             {
                                 entity.applyEntityCollision(this);
                             }
                         }
                     }
      
                     if (this.riddenByEntity != null && this.riddenByEntity.isDead)
                     {
                         this.riddenByEntity = null;
                     }
                 }
             }
         }
      
         public void updateRiderPosition()
         {
             if (this.riddenByEntity != null)
             {
                 double d0 = Math.cos((double)this.rotationYaw * Math.PI / 180.0D) * 0.4D;
                 double d1 = Math.sin((double)this.rotationYaw * Math.PI / 180.0D) * 0.4D;
                 this.riddenByEntity.setPosition(this.posX + d0, this.posY + this.getMountedYOffset() + this.riddenByEntity.getYOffset(), this.posZ + d1);
             }
         }
      
         /**
          * (abstract) Protected helper method to write subclass entity data to NBT.
          */
         protected void writeEntityToNBT(NBTTagCompound tagCompound) {}
      
         /**
          * (abstract) Protected helper method to read subclass entity data from NBT.
          */
         protected void readEntityFromNBT(NBTTagCompound tagCompund) {}
      
         /**
          * First layer of player interaction
          */
         public boolean interactFirst(EntityPlayer playerIn)
         {
             if (this.riddenByEntity != null && this.riddenByEntity instanceof EntityPlayer && this.riddenByEntity != playerIn)
             {
                 return true;
             }
             else
             {
                 if (!this.worldObj.isRemote)
                 {
                     playerIn.mountEntity(this);
                 }
      
                 return true;
             }
         }
      
         protected void func_180433_a(double p_180433_1_, boolean p_180433_3_, Block p_180433_4_, BlockPos p_180433_5_)
         {
             if (p_180433_3_)
             {
                 if (this.fallDistance > 3.0F)
                 {
                     this.fall(this.fallDistance, 1.0F);
      
                     if (!this.worldObj.isRemote && !this.isDead)
                     {
                         this.setDead();
                         int i;
      
                         for (i = 0; i < 3; ++i)
                         {
                             this.dropItemWithOffset(Item.getItemFromBlock(Blocks.planks), 1, 0.0F);
                         }
      
                         for (i = 0; i < 2; ++i)
                         {
                             this.dropItemWithOffset(Items.stick, 1, 0.0F);
                         }
                     }
      
                     this.fallDistance = 0.0F;
                 }
             }
             else if (this.worldObj.getBlockState((new BlockPos(this)).down()).getBlock().getMaterial() != Material.water && p_180433_1_ < 0.0D)
             {
                 this.fallDistance = (float)((double)this.fallDistance - p_180433_1_);
             }
         }
      
         /**
          * Sets the damage taken from the last hit.
          */
         public void setDamageTaken(float p_70266_1_)
         {
             this.dataWatcher.updateObject(19, Float.valueOf(p_70266_1_));
         }
      
         /**
          * Gets the damage taken from the last hit.
          */
         public float getDamageTaken()
         {
             return this.dataWatcher.getWatchableObjectFloat(19);
         }
      
         /**
          * Sets the time to count down from since the last time entity was hit.
          */
         public void setTimeSinceHit(int p_70265_1_)
         {
             this.dataWatcher.updateObject(17, Integer.valueOf(p_70265_1_));
         }
      
         /**
          * Gets the time since the last hit.
          */
         public int getTimeSinceHit()
         {
             return this.dataWatcher.getWatchableObjectInt(17);
         }
      
         /**
          * Sets the forward direction of the entity.
          */
         public void setForwardDirection(int p_70269_1_)
         {
             this.dataWatcher.updateObject(18, Integer.valueOf(p_70269_1_));
         }
      
         /**
          * Gets the forward direction of the entity.
          */
         public int getForwardDirection()
         {
             return this.dataWatcher.getWatchableObjectInt(18);
         }
      
         /**
          * true if no player in boat
          */
         @SideOnly(Side.CLIENT)
         public void setIsBoatEmpty(boolean p_70270_1_)
         {
             this.isBoatEmpty = p_70270_1_;
         }
      }
      

      Je vois bien que la vitesse se régle ici

         this.motionX = this.velocityX = 0.0D;
                 this.motionY = this.velocityY = 0.0D;
                 this.motionZ = this.velocityZ = 0.0D;
             }
      

      Mais j’ai peur de faire du caca, donc comment bien régler la vitesse ( Je veut pas un jetski ! )

      Membre fantôme
      Je développe maintenant un jeu sur UnrealEngine4


      Contact :…

      1 réponse Dernière réponse Répondre Citer 0
      • L
        Laserflip33 dernière édition par

        Salut,
        Déjà es-tu arrivé à faire un bateau custom simple?

        1 réponse Dernière réponse Répondre Citer 0
        • Eryah
          Eryah dernière édition par

          Non, vu que je ne sais pas comment register les entités, j’ai essayer plusieurs tutos, rien ne fonctionne

          Membre fantôme
          Je développe maintenant un jeu sur UnrealEngine4


          Contact :…

          1 réponse Dernière réponse Répondre Citer 0
          • Diangle
            Diangle dernière édition par

            Tu as des tuto pour créer des entitées. Ensuite, pour se qui est des bateaux, créer un item avec des metadata et en fonctions du craft tu fait spawn le bateau avec les propriétés que tu veux.

            1 réponse Dernière réponse Répondre Citer 0
            • Eryah
              Eryah dernière édition par

              J’ai essayer le tuto sur les entités de MFF en premier biensur, mais il ne fonctionne pas.
              J’ai peut-etre fait un erreur sur les classe
              Laisse moi allez chercher un truc a boire, je refait la ligne , et je te la passe

              Membre fantôme
              Je développe maintenant un jeu sur UnrealEngine4


              Contact :…

              1 réponse Dernière réponse Répondre Citer 0
              • SCAREX
                SCAREX dernière édition par

                Voilà qui devrait t’aider :

                package fr.scarex.st18;
                
                import java.io.File;
                
                import net.minecraft.entity.Entity;
                import net.minecraftforge.fml.common.Mod;
                import net.minecraftforge.fml.common.Mod.EventHandler;
                import net.minecraftforge.fml.common.SidedProxy;
                import net.minecraftforge.fml.common.event.FMLInitializationEvent;
                import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
                import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
                import net.minecraftforge.fml.common.event.FMLServerStartingEvent;
                import net.minecraftforge.fml.common.registry.EntityRegistry;
                
                import org.apache.logging.log4j.LogManager;
                import org.apache.logging.log4j.Logger;
                
                import fr.scarex.st18.ST18Blocks.ST18Blocks;
                import fr.scarex.st18.ST18Entity.EntitySit;
                import fr.scarex.st18.ST18Events.ST18EventHandler;
                import fr.scarex.st18.ST18Items.ST18Items;
                import fr.scarex.st18.commands.ST18GenerateCommand;
                import fr.scarex.st18.commands.ST18SpawnFireballCommand;
                import fr.scarex.st18.commands.ST18SpiraleCommand;
                import fr.scarex.st18.gen.ST18Generation;
                import fr.scarex.st18.proxy.ST18CommonProxy;
                
                @Mod(modid = ST18.MODID, version = ST18.VERSION)
                public class ST18
                {
                public static final String MODID = "ST18";
                public static final String VERSION = "1.0.0";
                public static final Logger log = LogManager.getLogger("ST18");
                public static File conf;
                
                @SidedProxy(clientSide = "fr.scarex.st18.proxy.ST18ClientProxy", serverSide = "fr.scarex.st18.proxy.ST18CommonProxy")
                public static ST18CommonProxy proxy;
                
                @EventHandler
                public void preInit(FMLPreInitializationEvent event) {
                ST18Items.preInit();
                ST18Blocks.preInit();
                ST18EventHandler.registerEvents();
                conf = new File(event.getModConfigurationDirectory(), "chrono.txt");
                log.info("preInit");
                }
                
                @EventHandler
                public void init(FMLInitializationEvent event) {
                addEntity(EntitySit.class, "EntitySit", 300);
                ST18Generation.registerStructures();
                proxy.registerRender();
                log.info("Init");
                }
                
                @EventHandler
                public void postInit(FMLPostInitializationEvent event) {
                log.info("postInit");
                }
                
                @EventHandler
                public void onServerStartingEvent(FMLServerStartingEvent event) {
                event.registerServerCommand(new ST18SpawnFireballCommand());
                event.registerServerCommand(new ST18SpiraleCommand());
                event.registerServerCommand(new ST18GenerateCommand());
                }
                
                public void addEntity(Class entityClass, String name, int id) {
                EntityRegistry.registerGlobalEntityID(entityClass, name, EntityRegistry.findGlobalUniqueEntityId());
                EntityRegistry.registerModEntity(entityClass, name, id, this, 40, 1, true);
                }
                }
                

                PS : c’est un mod de test, c’est très bordélique.

                Site web contenant mes scripts : http://SCAREXgaming.github.io

                Pas de demandes de support par MP ni par skype SVP.
                Je n'accepte sur skype que l…

                1 réponse Dernière réponse Répondre Citer 0
                • Eryah
                  Eryah dernière édition par

                  Alors , mettez moi un petit -1 plz, si mon register de mon chikheineuh ne fonctionnait pas, c’est simplement que la classe Render n’existait pas
                  Enfaite si, elle existait, mais mettez moi alors un -2


                  Donc vila, j’ai refait les codes du register
                  Dans la classe du client proxy j’ai une erreur

                  RenderingRegistry.registerEntityRenderingHandler(GoldenEggChicken.class, new RenderGoldenEggChicken(new ModelChicken(), 0.5F));
                  

                  RenderGoldenEggChicken(new ModelChicken(), 0.5F))
                  The constructor RenderGoldenEggChicken(ModelChicken, float) is undefined
                  Pourtant j’ai le constructeur
                  Je vais tenter quelques trucs


                  Donc, je sais d’ou vient l’erreur ( Les params du constructeurs )
                  Classe du render

                  ​package eryah.usefulthings.client;
                  
                  import net.minecraft.client.model.ModelBase;
                  import net.minecraft.client.renderer.entity.RenderChicken;
                  import net.minecraft.client.renderer.entity.RenderManager;
                  import net.minecraft.entity.EntityLiving;
                  import net.minecraft.util.ResourceLocation;
                  import eryah.usefulthings.Reference;
                  import eryah.usefulthings.entity.passive.GoldenEggChicken;
                  
                  public class RenderGoldenEggChicken extends RenderChicken {
                  
                  public final ResourceLocation texture = new ResourceLocation(Reference.MOD_ID, "textures/entity/gechicken.png");
                  
                  public RenderGoldenEggChicken(RenderManager p_i46188_1_,
                  ModelBase p_i46188_2_, float p_i46188_3_) {
                  super(p_i46188_1_, p_i46188_2_, p_i46188_3_);
                  // TODO Auto-generated constructor stub
                  }
                  
                  protected ResourceLocation getEntityTexture(EntityLiving living)
                  {
                  return this.getMobTexture((GoldenEggChicken)living);
                  }
                  
                  private ResourceLocation getMobTexture(GoldenEggChicken mobTutoriel)
                  {
                  return texture;
                  }
                  
                  }
                  

                  Membre fantôme
                  Je développe maintenant un jeu sur UnrealEngine4


                  Contact :…

                  1 réponse Dernière réponse Répondre Citer 0
                  • Eryah
                    Eryah dernière édition par

                    Donc vila, j’ai refait les codes du register
                    Dans la classe du client proxy j’ai une erreur

                    RenderingRegistry.registerEntityRenderingHandler(GoldenEggChicken.class, new RenderGoldenEggChicken(new ModelChicken(), 0.5F));
                    

                    RenderGoldenEggChicken(new ModelChicken(), 0.5F))
                    The constructor RenderGoldenEggChicken(ModelChicken, float) is undefined
                    Pourtant j’ai le constructeur
                    Je vais tenter quelques trucs


                    Donc, je sais d’ou vient l’erreur ( Les params du constructeurs )
                    Classe du render

                    package eryah.usefulthings.client;
                    
                    import net.minecraft.client.model.ModelBase;
                    import net.minecraft.client.renderer.entity.RenderChicken;
                    import net.minecraft.client.renderer.entity.RenderManager;
                    import net.minecraft.entity.EntityLiving;
                    import net.minecraft.util.ResourceLocation;
                    import eryah.usefulthings.Reference;
                    import eryah.usefulthings.entity.passive.GoldenEggChicken;
                    
                    public class RenderGoldenEggChicken extends RenderChicken {
                    
                    public final ResourceLocation texture = new ResourceLocation(Reference.MOD_ID, "textures/entity/gechicken.png");
                    
                    public RenderGoldenEggChicken(RenderManager p_i46188_1_,
                    ModelBase p_i46188_2_, float p_i46188_3_) {
                    super(p_i46188_1_, p_i46188_2_, p_i46188_3_);
                    // TODO Auto-generated constructor stub
                    }
                    
                    protected ResourceLocation getEntityTexture(EntityLiving living)
                    {
                    return this.getMobTexture((GoldenEggChicken)living);
                    }
                    
                    private ResourceLocation getMobTexture(GoldenEggChicken mobTutoriel)
                    {
                    return texture;
                    }
                    
                    }
                    
                    

                    Membre fantôme
                    Je développe maintenant un jeu sur UnrealEngine4


                    Contact :…

                    1 réponse Dernière réponse Répondre Citer 0
                    • SCAREX
                      SCAREX dernière édition par

                      Problème résolu ?

                      Site web contenant mes scripts : http://SCAREXgaming.github.io

                      Pas de demandes de support par MP ni par skype SVP.
                      Je n'accepte sur skype que l…

                      1 réponse Dernière réponse Répondre Citer 0
                      • Eryah
                        Eryah dernière édition par

                        Le sujet du topic parle des bateaux que je voudrais créer, et non pas du register de mon poulet 🙂
                        Mais sinon, toujours pas 😞

                        Membre fantôme
                        Je développe maintenant un jeu sur UnrealEngine4


                        Contact :…

                        1 réponse Dernière réponse Répondre Citer 0
                        • SCAREX
                          SCAREX dernière édition par

                          Où est le problème actuellement ? Tu n’arrives pas à l’enregistrer ? Ton model ne s’affiche pas ? Tu as un crash report ?

                          Site web contenant mes scripts : http://SCAREXgaming.github.io

                          Pas de demandes de support par MP ni par skype SVP.
                          Je n'accepte sur skype que l…

                          1 réponse Dernière réponse Répondre Citer 0
                          • Eryah
                            Eryah dernière édition par

                            Actuellement, j’essaie de regler le problème de register de mon chicken.
                            Sur son constructeur

                            ​public RenderGoldenEggChicken(ModelChicken model, float shadow)
                            {
                            super(renderManager, model, shadow);
                            }
                            

                            Je n’arrive pas a vouloir faire afficher sans problème le code que je veut, qui est le même code que dans le tuto

                            ​
                            
                            1. public RenderMobTutoriel(ModelBiped model, float shadow)
                            2. {
                            3. super(model, shadow);
                            4. }

                            Mais je ne comprend pas, Eclipse veut toujours rajouter renderManager…


                            EDIT


                            Je viens de bidouiller plein de null, et il  n’y a plus d’erreur, j’espère que cela va fonctionner…

                            Membre fantôme
                            Je développe maintenant un jeu sur UnrealEngine4


                            Contact :…

                            1 réponse Dernière réponse Répondre Citer 0
                            • SCAREX
                              SCAREX dernière édition par

                              la classe c’est RenderManager, regarde que tu n’ai pas enregistré une classe du même nom dans tes imports : supprimer la ligne temporairement et fait Ctrl + shift + O puis remets ta ligne et refait Ctrl + shift + O.

                              Site web contenant mes scripts : http://SCAREXgaming.github.io

                              Pas de demandes de support par MP ni par skype SVP.
                              Je n'accepte sur skype que l…

                              1 réponse Dernière réponse Répondre Citer 0
                              • Eryah
                                Eryah dernière édition par

                                Tout fonctionne 🙂 ( Pour le poulet ) l’oeuf est la et…
                                OOOH quelle surprise !
                                Un crash !

                                ​---- Minecraft Crash Report ----
                                // Sorry :(
                                
                                Time: 18/06/15 17:38
                                Description: Rendering entity in world
                                
                                java.lang.NullPointerException: Rendering entity in world
                                at net.minecraft.client.renderer.entity.RendererLivingEntity.doRender(RendererLivingEntity.java:103)
                                at net.minecraft.client.renderer.entity.RenderLiving.doRender(RenderLiving.java:59)
                                at net.minecraft.client.renderer.entity.RenderLiving.doRender(RenderLiving.java:199)
                                at net.minecraft.client.renderer.entity.RenderManager.doRenderEntity(RenderManager.java:377)
                                at net.minecraft.client.renderer.entity.RenderManager.renderEntityStatic(RenderManager.java:334)
                                at net.minecraft.client.renderer.entity.RenderManager.renderEntitySimple(RenderManager.java:301)
                                at net.minecraft.client.renderer.RenderGlobal.renderEntities(RenderGlobal.java:657)
                                at net.minecraft.client.renderer.EntityRenderer.renderWorldPass(EntityRenderer.java:1350)
                                at net.minecraft.client.renderer.EntityRenderer.renderWorld(EntityRenderer.java:1263)
                                at net.minecraft.client.renderer.EntityRenderer.updateCameraAndRender(EntityRenderer.java:1088)
                                at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1114)
                                at net.minecraft.client.Minecraft.run(Minecraft.java:376)
                                at net.minecraft.client.main.Main.main(Main.java:117)
                                at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                                at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
                                at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
                                at java.lang.reflect.Method.invoke(Unknown Source)
                                at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)
                                at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
                                at net.minecraftforge.gradle.GradleStartCommon.launch(Unknown Source)
                                at GradleStart.main(Unknown Source)
                                
                                A detailed walkthrough of the error, its code path and all known details is as follows:
                                ---------------------------------------------------------------------------------------
                                
                                -- Head --
                                Stacktrace:
                                at net.minecraft.client.renderer.entity.RendererLivingEntity.doRender(RendererLivingEntity.java:103)
                                at net.minecraft.client.renderer.entity.RenderLiving.doRender(RenderLiving.java:59)
                                at net.minecraft.client.renderer.entity.RenderLiving.doRender(RenderLiving.java:199)
                                
                                -- Entity being rendered --
                                Details:
                                Entity Type: goldenEggChicken (eryah.usefulthings.entity.passive.GoldenEggChicken)
                                Entity ID: 100
                                Entity Name: entity.goldenEggChicken.name
                                Entity's Exact location: 179,50, 64,00, 321,50
                                Entity's Block location: 179,00,64,00,321,00 - World: (179,64,321), Chunk: (at 3,4,1 in 11,20; contains blocks 176,0,320 to 191,255,335), Region: (0,0; contains chunks 0,0 to 31,31, blocks 0,0,0 to 511,255,511)
                                Entity's Momentum: 0,00, -0,02, 0,00
                                Entity's Rider: ~~ERROR~~ NullPointerException: null
                                Entity's Vehicle: ~~ERROR~~ NullPointerException: null
                                
                                -- Renderer details --
                                Details:
                                Assigned renderer: eryah.usefulthings.client.RenderGoldenEggChicken@a8eb0bf
                                Location: -0,02,0,00,2,15 - World: (-1,0,2), Chunk: (at 15,0,2 in -1,0; contains blocks -16,0,0 to -1,255,15), Region: (-1,0; contains chunks -32,0 to -1,31, blocks -512,0,0 to -1,255,511)
                                Rotation: 42.1875
                                Delta: 0.28713226
                                Stacktrace:
                                at net.minecraft.client.renderer.entity.RenderManager.doRenderEntity(RenderManager.java:377)
                                at net.minecraft.client.renderer.entity.RenderManager.renderEntityStatic(RenderManager.java:334)
                                at net.minecraft.client.renderer.entity.RenderManager.renderEntitySimple(RenderManager.java:301)
                                at net.minecraft.client.renderer.RenderGlobal.renderEntities(RenderGlobal.java:657)
                                at net.minecraft.client.renderer.EntityRenderer.renderWorldPass(EntityRenderer.java:1350)
                                at net.minecraft.client.renderer.EntityRenderer.renderWorld(EntityRenderer.java:1263)
                                
                                -- Affected level --
                                Details:
                                Level name: MpServer
                                All players: 1 total; [EntityPlayerSP['Eryah'/72, l='MpServer', x=179,52, y=64,00, z=319,35]]
                                Chunk stats: MultiplayerChunkCache: 25, 25
                                Level seed: 0
                                Level generator: ID 01 - flat, ver 0\. Features enabled: false
                                Level generator options: 
                                Level spawn location: 182,00,4,00,237,00 - World: (182,4,237), Chunk: (at 6,0,13 in 11,14; contains blocks 176,0,224 to 191,255,239), Region: (0,0; contains chunks 0,0 to 31,31, blocks 0,0,0 to 511,255,511)
                                Level time: 762689 game time, 6000 day time
                                Level dimension: 0
                                Level storage version: 0x00000 - Unknown?
                                Level weather: Rain time: 0 (now: true), thunder time: 0 (now: false)
                                Level game mode: Game mode: creative (ID 1). Hardcore: false. Cheats: false
                                Forced entities: 28 total; [EntityPlayerSP['Eryah'/72, l='MpServer', x=179,52, y=64,00, z=319,35], EntityRabbit['Lapin'/9, l='MpServer', x=144,84, y=64,00, z=344,03], EntityItemFrame['entity.ItemFrame.name'/31, l='MpServer', x=182,97, y=65,50, z=285,50], EntityItemFrame['entity.ItemFrame.name'/32, l='MpServer', x=182,97, y=65,50, z=287,50], EntityItemFrame['entity.ItemFrame.name'/33, l='MpServer', x=182,97, y=65,50, z=275,50], EntityItemFrame['entity.ItemFrame.name'/34, l='MpServer', x=182,97, y=65,50, z=283,50], EntityItemFrame['entity.ItemFrame.name'/35, l='MpServer', x=182,97, y=65,50, z=273,50], EntityItemFrame['entity.ItemFrame.name'/36, l='MpServer', x=182,97, y=65,50, z=279,50], GoldenEggChicken['entity.goldenEggChicken.name'/100, l='MpServer', x=179,50, y=64,00, z=321,50], EntityItemFrame['entity.ItemFrame.name'/37, l='MpServer', x=182,97, y=65,50, z=277,50], EntityItemFrame['entity.ItemFrame.name'/38, l='MpServer', x=182,97, y=65,50, z=281,50], EntityItemFrame['entity.ItemFrame.name'/39, l='MpServer', x=182,97, y=65,50, z=299,50], EntityItemFrame['entity.ItemFrame.name'/40, l='MpServer', x=182,97, y=65,50, z=301,50], EntityItemFrame['entity.ItemFrame.name'/41, l='MpServer', x=182,97, y=65,50, z=289,50], EntityItemFrame['entity.ItemFrame.name'/42, l='MpServer', x=182,97, y=65,50, z=293,50], EntityItemFrame['entity.ItemFrame.name'/43, l='MpServer', x=182,97, y=65,50, z=297,50], EntityItemFrame['entity.ItemFrame.name'/44, l='MpServer', x=182,97, y=65,50, z=295,50], EntityItemFrame['entity.ItemFrame.name'/45, l='MpServer', x=182,97, y=65,50, z=303,50], EntityItemFrame['entity.ItemFrame.name'/46, l='MpServer', x=182,97, y=65,50, z=291,50], EntityItemFrame['entity.ItemFrame.name'/47, l='MpServer', x=182,97, y=65,50, z=317,50], EntityItemFrame['entity.ItemFrame.name'/48, l='MpServer', x=182,97, y=65,50, z=311,50], EntityItemFrame['entity.ItemFrame.name'/49, l='MpServer', x=182,97, y=65,50, z=307,50], EntityItemFrame['entity.ItemFrame.name'/50, l='MpServer', x=182,97, y=65,50, z=315,50], EntityItemFrame['entity.ItemFrame.name'/51, l='MpServer', x=182,97, y=65,50, z=309,50], EntityItemFrame['entity.ItemFrame.name'/52, l='MpServer', x=182,97, y=65,50, z=305,50], EntityItemFrame['entity.ItemFrame.name'/53, l='MpServer', x=182,97, y=65,50, z=313,50], EntityCow['Vache'/61, l='MpServer', x=214,09, y=64,00, z=285,91], EntityRabbit['Lapin'/63, l='MpServer', x=218,38, y=64,00, z=325,78]]
                                Retry entities: 0 total; []
                                Server brand: fml,forge
                                Server type: Integrated singleplayer server
                                Stacktrace:
                                at net.minecraft.client.multiplayer.WorldClient.addWorldInfoToCrashReport(WorldClient.java:392)
                                at net.minecraft.client.Minecraft.addGraphicsAndWorldToCrashReport(Minecraft.java:2613)
                                at net.minecraft.client.Minecraft.run(Minecraft.java:398)
                                at net.minecraft.client.main.Main.main(Main.java:117)
                                at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                                at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
                                at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
                                at java.lang.reflect.Method.invoke(Unknown Source)
                                at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)
                                at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
                                at net.minecraftforge.gradle.GradleStartCommon.launch(Unknown Source)
                                at GradleStart.main(Unknown Source)
                                
                                – System Details --
                                Details:
                                Minecraft Version: 1.8
                                Operating System: Windows 8.1 (amd64) version 6.3
                                Java Version: 1.8.0_45, Oracle Corporation
                                Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
                                Memory: 870697328 bytes (830 MB) / 1056309248 bytes (1007 MB) up to 1056309248 bytes (1007 MB)
                                JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M
                                IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0
                                FML: MCP v9.10 FML v8.99.8.1412 Minecraft Forge 11.14.1.1412 4 mods loaded, 4 mods active
                                mcp{9.05} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
                                FML{8.99.8.1412} [Forge Mod Loader] (forgeSrc-1.8-11.14.1.1412.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
                                Forge{11.14.1.1412} [Minecraft Forge] (forgeSrc-1.8-11.14.1.1412.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
                                ut{Beta 1.0} [Useful Things] (bin) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
                                Loaded coremods (and transformers): 
                                GL info: ' Vendor: 'ATI Technologies Inc.' Version: '4.2.12420 Compatibility Profile Context 13.151.0.0' Renderer: 'AMD Radeon HD 8240'
                                Launched Version: 1.8
                                LWJGL: 2.9.1
                                OpenGL: AMD Radeon HD 8240 GL version 4.2.12420 Compatibility Profile Context 13.151.0.0, ATI Technologies Inc.
                                GL Caps: Using GL 1.3 multitexturing.
                                Using GL 1.3 texture combiners.
                                Using framebuffer objects because OpenGL 3.0 is supported and separate blending is supported.
                                Shaders are available because OpenGL 2.1 is supported.
                                VBOs are available because OpenGL 1.5 is supported.
                                
                                Using VBOs: No
                                Is Modded: Definitely; Client brand changed to 'fml,forge'
                                Type: Client (map_client.txt)
                                Resource Packs: []
                                Current Language: Français (France)
                                Profiler Position: N/A (disabled)
                                

                                La classe de mon KFC

                                ​package eryah.usefulthings.entity.passive;
                                
                                import net.minecraft.block.Block;
                                import net.minecraft.client.model.ModelChicken;
                                import net.minecraft.entity.EntityAgeable;
                                import net.minecraft.entity.EntityLiving;
                                import net.minecraft.entity.EntityLivingBase;
                                import net.minecraft.entity.SharedMonsterAttributes;
                                import net.minecraft.entity.ai.EntityAIFollowParent;
                                import net.minecraft.entity.ai.EntityAILookIdle;
                                import net.minecraft.entity.ai.EntityAIMate;
                                import net.minecraft.entity.ai.EntityAIPanic;
                                import net.minecraft.entity.ai.EntityAISwimming;
                                import net.minecraft.entity.ai.EntityAITempt;
                                import net.minecraft.entity.ai.EntityAIWander;
                                import net.minecraft.entity.ai.EntityAIWatchClosest;
                                import net.minecraft.entity.monster.EntityMob;
                                import net.minecraft.entity.passive.EntityAnimal;
                                import net.minecraft.entity.player.EntityPlayer;
                                import net.minecraft.init.Items;
                                import net.minecraft.item.Item;
                                import net.minecraft.item.ItemStack;
                                import net.minecraft.nbt.NBTTagCompound;
                                import net.minecraft.util.BlockPos;
                                import net.minecraft.util.MathHelper;
                                import net.minecraft.util.ResourceLocation;
                                import net.minecraft.world.World;
                                import eryah.usefulthings.Reference;
                                import eryah.usefulthings.init.GoldenEgg;
                                
                                public class GoldenEggChicken extends EntityAnimal {
                                
                                public float field_70886_e;
                                   public float destPos;
                                   public float field_70884_g;
                                   public float field_70888_h;
                                   public float field_70889_i = 1.0F;
                                   /** The time until the next egg is spawned. */
                                   public int timeUntilNextEgg;
                                   public boolean chickenJockey;
                                   private static final String __OBFID = "CL_00001639";
                                   public final ResourceLocation texture = new ResourceLocation(Reference.MOD_ID, "textures/entity/gechiken.png");
                                
                                   public GoldenEggChicken(World worldIn)
                                   {
                                       super(worldIn);
                                       this.setSize(0.4F, 0.7F);
                                       this.timeUntilNextEgg = this.rand.nextInt(6000) + 6000;
                                       this.tasks.addTask(0, new EntityAISwimming(this));
                                       this.tasks.addTask(1, new EntityAIPanic(this, 1.4D));
                                       this.tasks.addTask(2, new EntityAIMate(this, 1.0D));
                                       this.tasks.addTask(3, new EntityAITempt(this, 1.0D, Items.wheat_seeds, false));
                                       this.tasks.addTask(4, new EntityAIFollowParent(this, 1.1D));
                                       this.tasks.addTask(5, new EntityAIWander(this, 1.0D));
                                       this.tasks.addTask(6, new EntityAIWatchClosest(this, EntityPlayer.class, 6.0F));
                                       this.tasks.addTask(7, new EntityAILookIdle(this));
                                   }
                                
                                public float getEyeHeight()
                                   {
                                       return this.height;
                                   }
                                
                                   protected void applyEntityAttributes()
                                   {
                                       super.applyEntityAttributes();
                                       this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(4.0D);
                                       this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.25D);
                                   }
                                
                                   /**
                                    * Called frequently so the entity can update its state every tick as required. For example, zombies and skeletons
                                    * use this to react to sunlight and start to burn.
                                    */
                                   public void onLivingUpdate()
                                   {
                                       super.onLivingUpdate();
                                       this.field_70888_h = this.field_70886_e;
                                       this.field_70884_g = this.destPos;
                                       this.destPos = (float)((double)this.destPos + (double)(this.onGround ? -1 : 4) * 0.3D);
                                       this.destPos = MathHelper.clamp_float(this.destPos, 0.0F, 1.0F);
                                
                                       if (!this.onGround && this.field_70889_i < 1.0F)
                                       {
                                           this.field_70889_i = 1.0F;
                                       }
                                
                                       this.field_70889_i = (float)((double)this.field_70889_i * 0.9D);
                                
                                       if (!this.onGround && this.motionY < 0.0D)
                                       {
                                           this.motionY *= 0.6D;
                                       }
                                
                                       this.field_70886_e += this.field_70889_i * 2.0F;
                                
                                       if (!this.worldObj.isRemote && !this.isChild() && !this.isChickenJockey() && –this.timeUntilNextEgg <= 0)
                                       {
                                           this.playSound("mob.chicken.plop", 1.0F, (this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F + 1.0F);
                                           this.dropItem(GoldenEgg.golden_egg, 1);
                                           this.timeUntilNextEgg = this.rand.nextInt(6000) + 6000;
                                       }
                                   }
                                
                                   public void fall(float distance, float damageMultiplier) {}
                                
                                   /**
                                    * Returns the sound this mob makes while it's alive.
                                    */
                                   protected String getLivingSound()
                                   {
                                       return "mob.chicken.say";
                                   }
                                
                                   /**
                                    * Returns the sound this mob makes when it is hurt.
                                    */
                                   protected String getHurtSound()
                                   {
                                       return "mob.chicken.hurt";
                                   }
                                
                                   /**
                                    * Returns the sound this mob makes on death.
                                    */
                                   protected String getDeathSound()
                                   {
                                       return "mob.chicken.hurt";
                                   }
                                
                                   protected void playStepSound(BlockPos p_180429_1_, Block p_180429_2_)
                                   {
                                       this.playSound("mob.chicken.step", 0.15F, 1.0F);
                                   }
                                
                                   protected Item getDropItem()
                                   {
                                       return Items.feather;
                                   }
                                
                                   /**
                                    * Drop 0-2 items of this living's type
                                    */
                                   protected void dropFewItems(boolean p_70628_1_, int p_70628_2_)
                                   {
                                       int j = this.rand.nextInt(3) + this.rand.nextInt(1 + p_70628_2_);
                                
                                       for (int k = 0; k < j; ++k)
                                       {
                                           this.dropItem(Items.feather, 1);
                                       }
                                
                                       if (this.isBurning())
                                       {
                                           this.dropItem(Items.cooked_chicken, 1);
                                       }
                                       else
                                       {
                                           this.dropItem(Items.chicken, 1);
                                           this.dropItem(GoldenEgg.golden_egg, 2);
                                       }
                                   }
                                
                                   public GoldenEggChicken createChild(EntityAgeable ageable)
                                   {
                                       return new GoldenEggChicken(this.worldObj);
                                   }
                                
                                   /**
                                    * Checks if the parameter is an item which this animal can be fed to breed it (wheat, carrots or seeds depending on
                                    * the animal type)
                                    */
                                   public boolean isBreedingItem(ItemStack stack)
                                   {
                                       return stack != null && stack.getItem() == Items.wheat_seeds;
                                   }
                                
                                   /**
                                    * (abstract) Protected helper method to read subclass entity data from NBT.
                                    */
                                   public void readEntityFromNBT(NBTTagCompound tagCompund)
                                   {
                                       super.readEntityFromNBT(tagCompund);
                                       this.chickenJockey = tagCompund.getBoolean("IsChickenJockey");
                                
                                       if (tagCompund.hasKey("EggLayTime"))
                                       {
                                           this.timeUntilNextEgg = tagCompund.getInteger("EggLayTime");
                                       }
                                   }
                                
                                   /**
                                    * Get the experience points the entity currently has.
                                    */
                                   protected int getExperiencePoints(EntityPlayer player)
                                   {
                                       return this.isChickenJockey() ? 10 : super.getExperiencePoints(player);
                                   }
                                
                                   /**
                                    * (abstract) Protected helper method to write subclass entity data to NBT.
                                    */
                                   public void writeEntityToNBT(NBTTagCompound tagCompound)
                                   {
                                       super.writeEntityToNBT(tagCompound);
                                       tagCompound.setBoolean("IsChickenJockey", this.chickenJockey);
                                       tagCompound.setInteger("EggLayTime", this.timeUntilNextEgg);
                                   }
                                
                                   /**
                                    * Determines if an entity can be despawned, used on idle far away entities
                                    */
                                   protected boolean canDespawn()
                                   {
                                       return this.isChickenJockey() && this.riddenByEntity == null;
                                   }
                                
                                   public void updateRiderPosition()
                                   {
                                       super.updateRiderPosition();
                                       float f = MathHelper.sin(this.renderYawOffset * (float)Math.PI / 180.0F);
                                       float f1 = MathHelper.cos(this.renderYawOffset * (float)Math.PI / 180.0F);
                                       float f2 = 0.1F;
                                       float f3 = 0.0F;
                                       this.riddenByEntity.setPosition(this.posX + (double)(f2 * f), this.posY + (double)(this.height * 0.5F) + this.riddenByEntity.getYOffset() + (double)f3, this.posZ - (double)(f2 * f1));
                                
                                       if (this.riddenByEntity instanceof EntityLivingBase)
                                       {
                                           ((EntityLivingBase)this.riddenByEntity).renderYawOffset = this.renderYawOffset;
                                       }
                                   }
                                
                                   /**
                                    * Determines if this chicken is a jokey with a zombie riding it.
                                    */
                                   public boolean isChickenJockey()
                                   {
                                       return this.chickenJockey;
                                   }
                                
                                   /**
                                    * Sets whether this chicken is a jockey or not.
                                    *  
                                    * @param jockey Whether this chicken is a jockey or not
                                    */
                                   public void setChickenJockey(boolean jockey)
                                   {
                                       this.chickenJockey = jockey;
                                   }
                                
                                }
                                

                                La classe du render

                                ​package eryah.usefulthings.client;
                                
                                import net.minecraft.client.model.ModelBase;
                                import net.minecraft.client.renderer.entity.RenderChicken;
                                import net.minecraft.client.renderer.entity.RenderManager;
                                import net.minecraft.entity.EntityLiving;
                                import net.minecraft.util.ResourceLocation;
                                import eryah.usefulthings.Reference;
                                import eryah.usefulthings.entity.passive.GoldenEggChicken;
                                
                                public class RenderGoldenEggChicken extends RenderChicken {
                                
                                public RenderGoldenEggChicken(RenderManager p_i46188_1_,
                                ModelBase p_i46188_2_, float p_i46188_3_) {
                                super(p_i46188_1_, p_i46188_2_, p_i46188_3_);
                                // TODO Auto-generated constructor stub
                                }
                                
                                public final ResourceLocation texture = new ResourceLocation(Reference.MOD_ID, "textures/entity/gechicken.png"); 
                                
                                protected ResourceLocation getEntityTexture(EntityLiving living)
                                {
                                return this.getMobTexture((GoldenEggChicken)living);
                                }
                                
                                private ResourceLocation getMobTexture(GoldenEggChicken mobTutoriel)
                                {
                                return texture;
                                }
                                
                                }
                                

                                Membre fantôme
                                Je développe maintenant un jeu sur UnrealEngine4


                                Contact :…

                                1 réponse Dernière réponse Répondre Citer 0
                                • SCAREX
                                  SCAREX dernière édition par

                                  Comment est enregistré ton entité ?

                                  Site web contenant mes scripts : http://SCAREXgaming.github.io

                                  Pas de demandes de support par MP ni par skype SVP.
                                  Je n'accepte sur skype que l…

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

                                    Pour l’enregistrement des entités, il parait que seul registerModEntity est nécessaire.
                                    registerGlobalEntityID ne devrait pas être utilisé car il pose des problèmes de limitation (256 entité au total, y comprit ceux de Minecraft).
                                    Alors que registerModEntity est limité à la taille l’int, et est interne à chaque mod.

                                    J’ai vu Lex dire ça, après je n’ai jamais tester.

                                    Pour tout ce qui concerne les bateaux, étudie le code du bateau de Minecraft, il y a de forte chance que tu y trouve ta réponse.
                                    (juste pour information, la façon dont Minecraft gère les collisions va faire que le joueur va prendre feu lorsqu’il sera dans ton bateau qui résiste à la lave, donc il faudra lui ajouter l’effet de résistance au feu).

                                    1 réponse Dernière réponse Répondre Citer 0
                                    • Eryah
                                      Eryah dernière édition par

                                      J’ai bien retirer donc la fonction registerGlobalEntityID, mais…

                                      • L’œuf disparait ( Wow… quelle surprise… )
                                      • Le nom de mes entités ne sont plus ‘goldenEggChicken’ et ‘motorizedBoat’, mais ‘ut.goldenEggChicken’
                                      • Je crash toujours

                                      C’est le m^me crash report, inutile de vous le redonner


                                      Register des mes entity

                                      Main Class

                                      EntityRegistry.registerModEntity(GoldenEggChicken.class, "goldenEggChicken", 420, this.instance, 40, 1, true);
                                      
                                      EntityRegistry.registerModEntity(MotorizedBoat.class, "motorizedBoat", 420, this.instance, 40, 1, true);​
                                      

                                      ClientProxy

                                      ​RenderingRegistry.registerEntityRenderingHandler(GoldenEggChicken.class, new RenderGoldenEggChicken(null, null, 0));
                                      
                                      RenderingRegistry.registerEntityRenderingHandler(MotorizedBoat.class, new RenderBoat(null));
                                      

                                      L’erreur vient de la, je m’en suis rendu compte en copier collant le code…
                                      Mais que faut-il mettre dans ‘null’

                                      Membre fantôme
                                      Je développe maintenant un jeu sur UnrealEngine4


                                      Contact :…

                                      1 réponse Dernière réponse Répondre Citer 0
                                      • SCAREX
                                        SCAREX dernière édition par

                                        çà dépend de tes classes.

                                        Site web contenant mes scripts : http://SCAREXgaming.github.io

                                        Pas de demandes de support par MP ni par skype SVP.
                                        Je n'accepte sur skype que l…

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

                                          u_U
                                          Si tu enregistre des rendus avec un modèle null, faut pas s’étonner d’avoir des NPE …

                                          Il n’est pas possible de coder correctement sans apprendre le Java.
                                          http://fr.java.wikia.com/wiki/Java.lang.NullPointerException
                                          http://blog.octo.com/comment-ne-plus-avoir-de-nullpointerexception-en-java/
                                          http://stackoverflow.com/questions/218384/what-is-a-null-pointer-exception-and-how-do-i-fix-it

                                          1 réponse Dernière réponse Répondre Citer 0
                                          • Eryah
                                            Eryah dernière édition par

                                            Déso de l’absence… Quelques problèmes… Enfin voila

                                            Pendent ce temps, j’ai codé mon bateau

                                            Classe du bateau (La MÊME que vanilla, légèrement modifié)

                                            ​package eryah.usefulthings.entity.item;
                                            
                                            import java.util.List;
                                            import net.minecraft.block.Block;
                                            import net.minecraft.block.material.Material;
                                            import net.minecraft.entity.Entity;
                                            import net.minecraft.entity.EntityLivingBase;
                                            import net.minecraft.entity.player.EntityPlayer;
                                            import net.minecraft.init.Blocks;
                                            import net.minecraft.init.Items;
                                            import net.minecraft.item.Item;
                                            import net.minecraft.nbt.NBTTagCompound;
                                            import net.minecraft.util.AxisAlignedBB;
                                            import net.minecraft.util.BlockPos;
                                            import net.minecraft.util.DamageSource;
                                            import net.minecraft.util.EntityDamageSourceIndirect;
                                            import net.minecraft.util.EnumParticleTypes;
                                            import net.minecraft.util.MathHelper;
                                            import net.minecraft.world.World;
                                            import net.minecraftforge.fml.relauncher.Side;
                                            import net.minecraftforge.fml.relauncher.SideOnly;
                                            
                                            public class MotorizedBoat extends Entity
                                            {
                                                /** true if no player in boat */
                                                private boolean isBoatEmpty;
                                                private double speedMultiplier;
                                                private int boatPosRotationIncrements;
                                                private double boatX;
                                                private double boatY;
                                                private double boatZ;
                                                private double boatYaw;
                                                private double boatPitch;
                                                @SideOnly(Side.CLIENT)
                                                private double velocityX;
                                                @SideOnly(Side.CLIENT)
                                                private double velocityY;
                                                @SideOnly(Side.CLIENT)
                                                private double velocityZ;
                                                private static final String __OBFID = "CL_00001667";
                                            
                                                public MotorizedBoat(World worldIn)
                                                {
                                                    super(worldIn);
                                                    this.isBoatEmpty = true;
                                                    this.speedMultiplier = 0.07D;
                                                    this.preventEntitySpawning = true;
                                                    this.setSize(1.5F, 0.6F);
                                                }
                                            
                                                /**
                                                 * returns if this entity triggers Block.onEntityWalking on the blocks they walk on. used for spiders and wolves to
                                                 * prevent them from trampling crops
                                                 */
                                                protected boolean canTriggerWalking()
                                                {
                                                    return false;
                                                }
                                            
                                                protected void entityInit()
                                                {
                                                    this.dataWatcher.addObject(17, new Integer(0));
                                                    this.dataWatcher.addObject(18, new Integer(1));
                                                    this.dataWatcher.addObject(19, new Float(0.0F));
                                                }
                                            
                                                /**
                                                 * Returns a boundingBox used to collide the entity with other entities and blocks. This enables the entity to be
                                                 * pushable on contact, like boats or minecarts.
                                                 */
                                                public AxisAlignedBB getCollisionBox(Entity entityIn)
                                                {
                                                    return entityIn.getEntityBoundingBox();
                                                }
                                            
                                                /**
                                                 * returns the bounding box for this entity
                                                 */
                                                public AxisAlignedBB getBoundingBox()
                                                {
                                                    return this.getEntityBoundingBox();
                                                }
                                            
                                                /**
                                                 * Returns true if this entity should push and be pushed by other entities when colliding.
                                                 */
                                                public boolean canBePushed()
                                                {
                                                    return true;
                                                }
                                            
                                                public MotorizedBoat(World worldIn, double p_i1705_2_, double p_i1705_4_, double p_i1705_6_)
                                                {
                                                    this(worldIn);
                                                    this.setPosition(p_i1705_2_, p_i1705_4_, p_i1705_6_);
                                                    this.motionX = 0.0D;
                                                    this.motionY = 0.0D;
                                                    this.motionZ = 0.0D;
                                                    this.prevPosX = p_i1705_2_;
                                                    this.prevPosY = p_i1705_4_;
                                                    this.prevPosZ = p_i1705_6_;
                                                }
                                            
                                                /**
                                                 * Returns the Y offset from the entity's position for any entity riding this one.
                                                 */
                                                public double getMountedYOffset()
                                                {
                                                    return (double)this.height * 0.0D - 0.30000001192092896D;
                                                }
                                            
                                                /**
                                                 * Called when the entity is attacked.
                                                 */
                                                public boolean attackEntityFrom(DamageSource source, float amount)
                                                {
                                                    if (this.isEntityInvulnerable(source))
                                                    {
                                                        return false;
                                                    }
                                                    else if (!this.worldObj.isRemote && !this.isDead)
                                                    {
                                                        if (this.riddenByEntity != null && this.riddenByEntity == source.getEntity() && source instanceof EntityDamageSourceIndirect)
                                                        {
                                                            return false;
                                                        }
                                                        else
                                                        {
                                                            this.setForwardDirection(-this.getForwardDirection());
                                                            this.setTimeSinceHit(10);
                                                            this.setDamageTaken(this.getDamageTaken() + amount * 10.0F);
                                                            this.setBeenAttacked();
                                                            boolean flag = source.getEntity() instanceof EntityPlayer && ((EntityPlayer)source.getEntity()).capabilities.isCreativeMode;
                                            
                                                            if (flag || this.getDamageTaken() > 40.0F)
                                                            {
                                                                if (this.riddenByEntity != null)
                                                                {
                                                                    this.riddenByEntity.mountEntity(this);
                                                                }
                                            
                                                                if (!flag)
                                                                {
                                                                    this.dropItemWithOffset(Items.boat, 1, 0.0F);
                                                                }
                                            
                                                                this.setDead();
                                                            }
                                            
                                                            return true;
                                                        }
                                                    }
                                                    else
                                                    {
                                                        return true;
                                                    }
                                                }
                                            
                                                /**
                                                 * Setups the entity to do the hurt animation. Only used by packets in multiplayer.
                                                 */
                                                @SideOnly(Side.CLIENT)
                                                public void performHurtAnimation()
                                                {
                                                    this.setForwardDirection(-this.getForwardDirection());
                                                    this.setTimeSinceHit(10);
                                                    this.setDamageTaken(this.getDamageTaken() * 11.0F);
                                                }
                                            
                                                /**
                                                 * Returns true if other Entities should be prevented from moving through this Entity.
                                                 */
                                                public boolean canBeCollidedWith()
                                                {
                                                    return !this.isDead;
                                                }
                                            
                                                @SideOnly(Side.CLIENT)
                                                public void func_180426_a(double p_180426_1_, double p_180426_3_, double p_180426_5_, float p_180426_7_, float p_180426_8_, int p_180426_9_, boolean p_180426_10_)
                                                {
                                                    if (p_180426_10_ && this.riddenByEntity != null)
                                                    {
                                                        this.prevPosX = this.posX = p_180426_1_;
                                                        this.prevPosY = this.posY = p_180426_3_;
                                                        this.prevPosZ = this.posZ = p_180426_5_;
                                                        this.rotationYaw = p_180426_7_;
                                                        this.rotationPitch = p_180426_8_;
                                                        this.boatPosRotationIncrements = 0;
                                                        this.setPosition(p_180426_1_, p_180426_3_, p_180426_5_);
                                                        this.motionX = this.velocityX = 0.1D;
                                                        this.motionY = this.velocityY = 0.0D;
                                                        this.motionZ = this.velocityZ = 0.1D;
                                                    }
                                                    else
                                                    {
                                                        if (this.isBoatEmpty)
                                                        {
                                                            this.boatPosRotationIncrements = p_180426_9_ + 5;
                                                        }
                                                        else
                                                        {
                                                            double d3 = p_180426_1_ - this.posX;
                                                            double d4 = p_180426_3_ - this.posY;
                                                            double d5 = p_180426_5_ - this.posZ;
                                                            double d6 = d3 * d3 + d4 * d4 + d5 * d5;
                                            
                                                            if (d6 <= 1.0D)
                                                            {
                                                                return;
                                                            }
                                            
                                                            this.boatPosRotationIncrements = 3;
                                                        }
                                            
                                                        this.boatX = p_180426_1_;
                                                        this.boatY = p_180426_3_;
                                                        this.boatZ = p_180426_5_;
                                                        this.boatYaw = (double)p_180426_7_;
                                                        this.boatPitch = (double)p_180426_8_;
                                                        this.motionX = this.velocityX;
                                                        this.motionY = this.velocityY;
                                                        this.motionZ = this.velocityZ;
                                                    }
                                                }
                                            
                                                /**
                                                 * Sets the velocity to the args. Args: x, y, z
                                                 */
                                                @SideOnly(Side.CLIENT)
                                                public void setVelocity(double x, double y, double z)
                                                {
                                                    this.velocityX = this.motionX = x;
                                                    this.velocityY = this.motionY = y;
                                                    this.velocityZ = this.motionZ = z;
                                                }
                                            
                                                /**
                                                 * Called to update the entity's position/logic.
                                                 */
                                                public void onUpdate()
                                                {
                                                    super.onUpdate();
                                            
                                                    if (this.getTimeSinceHit() > 0)
                                                    {
                                                        this.setTimeSinceHit(this.getTimeSinceHit() - 1);
                                                    }
                                            
                                                    if (this.getDamageTaken() > 0.0F)
                                                    {
                                                        this.setDamageTaken(this.getDamageTaken() - 1.0F);
                                                    }
                                            
                                                    this.prevPosX = this.posX;
                                                    this.prevPosY = this.posY;
                                                    this.prevPosZ = this.posZ;
                                                    byte b0 = 5;
                                                    double d0 = 0.0D;
                                            
                                                    for (int i = 0; i < b0; ++i)
                                                    {
                                                        double d1 = this.getEntityBoundingBox().minY + (this.getEntityBoundingBox().maxY - this.getEntityBoundingBox().minY) * (double)(i + 0) / (double)b0 - 0.125D;
                                                        double d3 = this.getEntityBoundingBox().minY + (this.getEntityBoundingBox().maxY - this.getEntityBoundingBox().minY) * (double)(i + 1) / (double)b0 - 0.125D;
                                                        AxisAlignedBB axisalignedbb = new AxisAlignedBB(this.getEntityBoundingBox().minX, d1, this.getEntityBoundingBox().minZ, this.getEntityBoundingBox().maxX, d3, this.getEntityBoundingBox().maxZ);
                                            
                                                        if (this.worldObj.isAABBInMaterial(axisalignedbb, Material.water))
                                                        {
                                                            d0 += 1.0D / (double)b0;
                                                        }
                                                    }
                                            
                                                    double d9 = Math.sqrt(this.motionX * this.motionX + this.motionZ * this.motionZ);
                                                    double d2;
                                                    double d4;
                                                    int j;
                                            
                                                    if (d9 > 0.2975D)
                                                    {
                                                        d2 = Math.cos((double)this.rotationYaw * Math.PI / 180.0D);
                                                        d4 = Math.sin((double)this.rotationYaw * Math.PI / 180.0D);
                                            
                                                        for (j = 0; (double)j < 1.0D + d9 * 60.0D; ++j)
                                                        {
                                                            double d5 = (double)(this.rand.nextFloat() * 2.0F - 1.0F);
                                                            double d6 = (double)(this.rand.nextInt(2) * 2 - 1) * 0.7D;
                                                            double d7;
                                                            double d8;
                                            
                                                            if (this.rand.nextBoolean())
                                                            {
                                                                d7 = this.posX - d2 * d5 * 0.8D + d4 * d6;
                                                                d8 = this.posZ - d4 * d5 * 0.8D - d2 * d6;
                                                                this.worldObj.spawnParticle(EnumParticleTypes.WATER_SPLASH, d7, this.posY - 0.125D, d8, this.motionX, this.motionY, this.motionZ, new int[0]);
                                                            }
                                                            else
                                                            {
                                                                d7 = this.posX + d2 + d4 * d5 * 0.7D;
                                                                d8 = this.posZ + d4 - d2 * d5 * 0.7D;
                                                                this.worldObj.spawnParticle(EnumParticleTypes.WATER_SPLASH, d7, this.posY - 0.125D, d8, this.motionX, this.motionY, this.motionZ, new int[0]);
                                                            }
                                                        }
                                                    }
                                            
                                                    double d10;
                                                    double d11;
                                            
                                                    if (this.worldObj.isRemote && this.isBoatEmpty)
                                                    {
                                                        if (this.boatPosRotationIncrements > 0)
                                                        {
                                                            d2 = this.posX + (this.boatX - this.posX) / (double)this.boatPosRotationIncrements;
                                                            d4 = this.posY + (this.boatY - this.posY) / (double)this.boatPosRotationIncrements;
                                                            d10 = this.posZ + (this.boatZ - this.posZ) / (double)this.boatPosRotationIncrements;
                                                            d11 = MathHelper.wrapAngleTo180_double(this.boatYaw - (double)this.rotationYaw);
                                                            this.rotationYaw = (float)((double)this.rotationYaw + d11 / (double)this.boatPosRotationIncrements);
                                                            this.rotationPitch = (float)((double)this.rotationPitch + (this.boatPitch - (double)this.rotationPitch) / (double)this.boatPosRotationIncrements);
                                                            –this.boatPosRotationIncrements;
                                                            this.setPosition(d2, d4, d10);
                                                            this.setRotation(this.rotationYaw, this.rotationPitch);
                                                        }
                                                        else
                                                        {
                                                            d2 = this.posX + this.motionX;
                                                            d4 = this.posY + this.motionY;
                                                            d10 = this.posZ + this.motionZ;
                                                            this.setPosition(d2, d4, d10);
                                            
                                                            if (this.onGround)
                                                            {
                                                                this.motionX *= 0.5D;
                                                                this.motionY *= 0.5D;
                                                                this.motionZ *= 0.5D;
                                                            }
                                            
                                                            this.motionX *= 0.9900000095367432D;
                                                            this.motionY *= 0.949999988079071D;
                                                            this.motionZ *= 0.9900000095367432D;
                                                        }
                                                    }
                                                    else
                                                    {
                                                        if (d0 < 1.0D)
                                                        {
                                                            d2 = d0 * 2.0D - 1.0D;
                                                            this.motionY += 0.03999999910593033D * d2;
                                                        }
                                                        else
                                                        {
                                                            if (this.motionY < 0.0D)
                                                            {
                                                                this.motionY /= 2.0D;
                                                            }
                                            
                                                            this.motionY += 0.007000000216066837D;
                                                        }
                                            
                                                        if (this.riddenByEntity instanceof EntityLivingBase)
                                                        {
                                                            EntityLivingBase entitylivingbase = (EntityLivingBase)this.riddenByEntity;
                                                            float f = this.riddenByEntity.rotationYaw + -entitylivingbase.moveStrafing * 90.0F;
                                                            this.motionX += -Math.sin((double)(f * (float)Math.PI / 180.0F)) * this.speedMultiplier * (double)entitylivingbase.moveForward * 0.05000000074505806D;
                                                            this.motionZ += Math.cos((double)(f * (float)Math.PI / 180.0F)) * this.speedMultiplier * (double)entitylivingbase.moveForward * 0.05000000074505806D;
                                                        }
                                            
                                                        d2 = Math.sqrt(this.motionX * this.motionX + this.motionZ * this.motionZ);
                                            
                                                        if (d2 > 0.35D)
                                                        {
                                                            d4 = 0.35D / d2;
                                                            this.motionX *= d4;
                                                            this.motionZ *= d4;
                                                            d2 = 0.35D;
                                                        }
                                            
                                                        if (d2 > d9 && this.speedMultiplier < 0.35D)
                                                        {
                                                            this.speedMultiplier += (0.35D - this.speedMultiplier) / 35.0D;
                                            
                                                            if (this.speedMultiplier > 0.35D)
                                                            {
                                                                this.speedMultiplier = 0.35D;
                                                            }
                                                        }
                                                        else
                                                        {
                                                            this.speedMultiplier -= (this.speedMultiplier - 0.07D) / 35.0D;
                                            
                                                            if (this.speedMultiplier < 0.07D)
                                                            {
                                                                this.speedMultiplier = 0.07D;
                                                            }
                                                        }
                                            
                                                        int l;
                                            
                                                        for (l = 0; l < 4; ++l)
                                                        {
                                                            int i1 = MathHelper.floor_double(this.posX + ((double)(l % 2) - 0.5D) * 0.8D);
                                                            j = MathHelper.floor_double(this.posZ + ((double)(l / 2) - 0.5D) * 0.8D);
                                            
                                                            for (int j1 = 0; j1 < 2; ++j1)
                                                            {
                                                                int k = MathHelper.floor_double(this.posY) + j1;
                                                                BlockPos blockpos = new BlockPos(i1, k, j);
                                                                Block block = this.worldObj.getBlockState(blockpos).getBlock();
                                            
                                                                if (block == Blocks.snow_layer)
                                                                {
                                                                    this.worldObj.setBlockToAir(blockpos);
                                                                    this.isCollidedHorizontally = false;
                                                                }
                                                                else if (block == Blocks.waterlily)
                                                                {
                                                                    this.worldObj.destroyBlock(blockpos, true);
                                                                    this.isCollidedHorizontally = false;
                                                                }
                                                            }
                                                        }
                                            
                                                        if (this.onGround)
                                                        {
                                                            this.motionX *= 0.6D;
                                                            this.motionY *= 0.5D;
                                                            this.motionZ *= 0.6D;
                                                        }
                                            
                                                        this.moveEntity(this.motionX, this.motionY, this.motionZ);
                                            
                                                        if (this.isCollidedHorizontally && d9 > 0.2D)
                                                        {
                                                            if (!this.worldObj.isRemote && !this.isDead)
                                                            {
                                                                this.setDead();
                                            
                                                                for (l = 0; l < 3; ++l)
                                                                {
                                                                    this.dropItemWithOffset(Item.getItemFromBlock(Blocks.planks), 1, 0.0F);
                                                                }
                                            
                                                                for (l = 0; l < 2; ++l)
                                                                {
                                                                    this.dropItemWithOffset(Items.stick, 1, 0.0F);
                                                                }
                                                            }
                                                        }
                                                        else
                                                        {
                                                            this.motionX *= 0.9900000095367432D;
                                                            this.motionY *= 0.949999988079071D;
                                                            this.motionZ *= 0.9900000095367432D;
                                                        }
                                            
                                                        this.rotationPitch = 0.0F;
                                                        d4 = (double)this.rotationYaw;
                                                        d10 = this.prevPosX - this.posX;
                                                        d11 = this.prevPosZ - this.posZ;
                                            
                                                        if (d10 * d10 + d11 * d11 > 0.001D)
                                                        {
                                                            d4 = (double)((float)(Math.atan2(d11, d10) * 180.0D / Math.PI));
                                                        }
                                            
                                                        double d12 = MathHelper.wrapAngleTo180_double(d4 - (double)this.rotationYaw);
                                            
                                                        if (d12 > 20.0D)
                                                        {
                                                            d12 = 20.0D;
                                                        }
                                            
                                                        if (d12 < -20.0D)
                                                        {
                                                            d12 = -20.0D;
                                                        }
                                            
                                                        this.rotationYaw = (float)((double)this.rotationYaw + d12);
                                                        this.setRotation(this.rotationYaw, this.rotationPitch);
                                            
                                                        if (!this.worldObj.isRemote)
                                                        {
                                                            List list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.getEntityBoundingBox().expand(0.20000000298023224D, 0.0D, 0.20000000298023224D));
                                            
                                                            if (list != null && !list.isEmpty())
                                                            {
                                                                for (int k1 = 0; k1 < list.size(); ++k1)
                                                                {
                                                                    Entity entity = (Entity)list.get(k1);
                                            
                                                                    if (entity != this.riddenByEntity && entity.canBePushed() && entity instanceof MotorizedBoat)
                                                                    {
                                                                        entity.applyEntityCollision(this);
                                                                    }
                                                                }
                                                            }
                                            
                                                            if (this.riddenByEntity != null && this.riddenByEntity.isDead)
                                                            {
                                                                this.riddenByEntity = null;
                                                            }
                                                        }
                                                    }
                                                }
                                            
                                                public void updateRiderPosition()
                                                {
                                                    if (this.riddenByEntity != null)
                                                    {
                                                        double d0 = Math.cos((double)this.rotationYaw * Math.PI / 180.0D) * 0.4D;
                                                        double d1 = Math.sin((double)this.rotationYaw * Math.PI / 180.0D) * 0.4D;
                                                        this.riddenByEntity.setPosition(this.posX + d0, this.posY + this.getMountedYOffset() + this.riddenByEntity.getYOffset(), this.posZ + d1);
                                                    }
                                                }
                                            
                                                /**
                                                 * (abstract) Protected helper method to write subclass entity data to NBT.
                                                 */
                                                protected void writeEntityToNBT(NBTTagCompound tagCompound) {}
                                            
                                                /**
                                                 * (abstract) Protected helper method to read subclass entity data from NBT.
                                                 */
                                                protected void readEntityFromNBT(NBTTagCompound tagCompund) {}
                                            
                                                /**
                                                 * First layer of player interaction
                                                 */
                                                public boolean interactFirst(EntityPlayer playerIn)
                                                {
                                                    if (this.riddenByEntity != null && this.riddenByEntity instanceof EntityPlayer && this.riddenByEntity != playerIn)
                                                    {
                                                        return true;
                                                    }
                                                    else
                                                    {
                                                        if (!this.worldObj.isRemote)
                                                        {
                                                            playerIn.mountEntity(this);
                                                        }
                                            
                                                        return true;
                                                    }
                                                }
                                            
                                                protected void func_180433_a(double p_180433_1_, boolean p_180433_3_, Block p_180433_4_, BlockPos p_180433_5_)
                                                {
                                                    if (p_180433_3_)
                                                    {
                                                        if (this.fallDistance > 3.0F)
                                                        {
                                                            this.fall(this.fallDistance, 1.0F);
                                            
                                                            if (!this.worldObj.isRemote && !this.isDead)
                                                            {
                                                                this.setDead();
                                                                int i;
                                            
                                                                for (i = 0; i < 3; ++i)
                                                                {
                                                                    this.dropItemWithOffset(Item.getItemFromBlock(Blocks.planks), 1, 0.0F);
                                                                }
                                            
                                                                for (i = 0; i < 2; ++i)
                                                                {
                                                                    this.dropItemWithOffset(Items.stick, 1, 0.0F);
                                                                }
                                                            }
                                            
                                                            this.fallDistance = 0.0F;
                                                        }
                                                    }
                                                    else if (this.worldObj.getBlockState((new BlockPos(this)).down()).getBlock().getMaterial() != Material.water && p_180433_1_ < 0.0D)
                                                    {
                                                        this.fallDistance = (float)((double)this.fallDistance - p_180433_1_);
                                                    }
                                                }
                                            
                                                /**
                                                 * Sets the damage taken from the last hit.
                                                 */
                                                public void setDamageTaken(float p_70266_1_)
                                                {
                                                    this.dataWatcher.updateObject(19, Float.valueOf(p_70266_1_));
                                                }
                                            
                                                /**
                                                 * Gets the damage taken from the last hit.
                                                 */
                                                public float getDamageTaken()
                                                {
                                                    return this.dataWatcher.getWatchableObjectFloat(19);
                                                }
                                            
                                                /**
                                                 * Sets the time to count down from since the last time entity was hit.
                                                 */
                                                public void setTimeSinceHit(int p_70265_1_)
                                                {
                                                    this.dataWatcher.updateObject(17, Integer.valueOf(p_70265_1_));
                                                }
                                            
                                                /**
                                                 * Gets the time since the last hit.
                                                 */
                                                public int getTimeSinceHit()
                                                {
                                                    return this.dataWatcher.getWatchableObjectInt(17);
                                                }
                                            
                                                /**
                                                 * Sets the forward direction of the entity.
                                                 */
                                                public void setForwardDirection(int p_70269_1_)
                                                {
                                                    this.dataWatcher.updateObject(18, Integer.valueOf(p_70269_1_));
                                                }
                                            
                                                /**
                                                 * Gets the forward direction of the entity.
                                                 */
                                                public int getForwardDirection()
                                                {
                                                    return this.dataWatcher.getWatchableObjectInt(18);
                                                }
                                            
                                                /**
                                                 * true if no player in boat
                                                 */
                                                @SideOnly(Side.CLIENT)
                                                public void setIsBoatEmpty(boolean p_70270_1_)
                                                {
                                                    this.isBoatEmpty = p_70270_1_;
                                                }
                                            }
                                            

                                            Classe du render

                                            ​package eryah.usefulthings.client.render;
                                            
                                            import net.minecraft.client.model.ModelBase;
                                            import net.minecraft.client.renderer.entity.RenderBoat;
                                            import net.minecraft.client.renderer.entity.RenderManager;
                                            import net.minecraft.entity.EntityLiving;
                                            import net.minecraft.util.ResourceLocation;
                                            import eryah.usefulthings.Reference;
                                            import eryah.usefulthings.entity.passive.GoldenEggChicken;
                                            
                                            public class RenderMotoBoat extends RenderBoat {
                                            
                                            public RenderMotoBoat(RenderManager p_i46188_1_,
                                            ModelBase p_i46188_2_, float p_i46188_3_) {
                                            super(p_i46188_1_);
                                            // TODO Auto-generated constructor stub
                                            }
                                            
                                            public final ResourceLocation texture = new ResourceLocation(Reference.MOD_ID, "textures/entity/motorized_boat.png"); 
                                            
                                            protected ResourceLocation getEntityTexture(EntityLiving living)
                                            {
                                            return this.getMobTexture((GoldenEggChicken)living);
                                            }
                                            
                                            private ResourceLocation getMobTexture(GoldenEggChicken mobTutoriel)
                                            {
                                            return texture;
                                            }
                                            
                                            }
                                            

                                            Classe du Chikhein (La même que vanilla, légèrement modifié)

                                            ​package eryah.usefulthings.entity.passive;
                                            
                                            import net.minecraft.block.Block;
                                            import net.minecraft.client.model.ModelChicken;
                                            import net.minecraft.entity.EntityAgeable;
                                            import net.minecraft.entity.EntityLiving;
                                            import net.minecraft.entity.EntityLivingBase;
                                            import net.minecraft.entity.SharedMonsterAttributes;
                                            import net.minecraft.entity.ai.EntityAIFollowParent;
                                            import net.minecraft.entity.ai.EntityAILookIdle;
                                            import net.minecraft.entity.ai.EntityAIMate;
                                            import net.minecraft.entity.ai.EntityAIPanic;
                                            import net.minecraft.entity.ai.EntityAISwimming;
                                            import net.minecraft.entity.ai.EntityAITempt;
                                            import net.minecraft.entity.ai.EntityAIWander;
                                            import net.minecraft.entity.ai.EntityAIWatchClosest;
                                            import net.minecraft.entity.monster.EntityMob;
                                            import net.minecraft.entity.passive.EntityAnimal;
                                            import net.minecraft.entity.player.EntityPlayer;
                                            import net.minecraft.init.Items;
                                            import net.minecraft.item.Item;
                                            import net.minecraft.item.ItemStack;
                                            import net.minecraft.nbt.NBTTagCompound;
                                            import net.minecraft.util.BlockPos;
                                            import net.minecraft.util.MathHelper;
                                            import net.minecraft.util.ResourceLocation;
                                            import net.minecraft.world.World;
                                            import eryah.usefulthings.Reference;
                                            import eryah.usefulthings.init.GoldenEgg;
                                            
                                            public class GoldenEggChicken extends EntityAnimal {
                                            
                                            public float field_70886_e;
                                               public float destPos;
                                               public float field_70884_g;
                                               public float field_70888_h;
                                               public float field_70889_i = 1.0F;
                                               /** The time until the next egg is spawned. */
                                               public int timeUntilNextEgg;
                                               public boolean chickenJockey;
                                               private static final String __OBFID = "CL_00001639";
                                               public final ResourceLocation texture = new ResourceLocation(Reference.MOD_ID, "textures/entity/gechiken.png");
                                            
                                               public GoldenEggChicken(World worldIn)
                                               {
                                                   super(worldIn);
                                                   this.setSize(0.4F, 0.7F);
                                                   this.timeUntilNextEgg = this.rand.nextInt(6000) + 6000;
                                                   this.tasks.addTask(0, new EntityAISwimming(this));
                                                   this.tasks.addTask(1, new EntityAIPanic(this, 1.4D));
                                                   this.tasks.addTask(2, new EntityAIMate(this, 1.0D));
                                                   this.tasks.addTask(3, new EntityAITempt(this, 1.0D, Items.wheat_seeds, false));
                                                   this.tasks.addTask(4, new EntityAIFollowParent(this, 1.1D));
                                                   this.tasks.addTask(5, new EntityAIWander(this, 1.0D));
                                                   this.tasks.addTask(6, new EntityAIWatchClosest(this, EntityPlayer.class, 6.0F));
                                                   this.tasks.addTask(7, new EntityAILookIdle(this));
                                               }
                                            
                                            public float getEyeHeight()
                                               {
                                                   return this.height;
                                               }
                                            
                                               protected void applyEntityAttributes()
                                               {
                                                   super.applyEntityAttributes();
                                                   this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(4.0D);
                                                   this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.25D);
                                               }
                                            
                                               /**
                                                * Called frequently so the entity can update its state every tick as required. For example, zombies and skeletons
                                                * use this to react to sunlight and start to burn.
                                                */
                                               public void onLivingUpdate()
                                               {
                                                   super.onLivingUpdate();
                                                   this.field_70888_h = this.field_70886_e;
                                                   this.field_70884_g = this.destPos;
                                                   this.destPos = (float)((double)this.destPos + (double)(this.onGround ? -1 : 4) * 0.3D);
                                                   this.destPos = MathHelper.clamp_float(this.destPos, 0.0F, 1.0F);
                                            
                                                   if (!this.onGround && this.field_70889_i < 1.0F)
                                                   {
                                                       this.field_70889_i = 1.0F;
                                                   }
                                            
                                                   this.field_70889_i = (float)((double)this.field_70889_i * 0.9D);
                                            
                                                   if (!this.onGround && this.motionY < 0.0D)
                                                   {
                                                       this.motionY *= 0.6D;
                                                   }
                                            
                                                   this.field_70886_e += this.field_70889_i * 2.0F;
                                            
                                                   if (!this.worldObj.isRemote && !this.isChild() && --this.timeUntilNextEgg <= 0)
                                                   {
                                                       this.playSound("mob.chicken.plop", 1.0F, (this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F + 1.0F);
                                                       this.dropItem(GoldenEgg.golden_egg, 1);
                                                       this.timeUntilNextEgg = this.rand.nextInt(6000) + 6000;
                                                   }
                                               }
                                            
                                               public void fall(float distance, float damageMultiplier) {}
                                            
                                               /**
                                                * Returns the sound this mob makes while it's alive.
                                                */
                                               protected String getLivingSound()
                                               {
                                                   return "mob.chicken.say";
                                               }
                                            
                                               /**
                                                * Returns the sound this mob makes when it is hurt.
                                                */
                                               protected String getHurtSound()
                                               {
                                                   return "mob.chicken.hurt";
                                               }
                                            
                                               /**
                                                * Returns the sound this mob makes on death.
                                                */
                                               protected String getDeathSound()
                                               {
                                                   return "mob.chicken.hurt";
                                               }
                                            
                                               protected void playStepSound(BlockPos p_180429_1_, Block p_180429_2_)
                                               {
                                                   this.playSound("mob.chicken.step", 0.15F, 1.0F);
                                               }
                                            
                                               protected Item getDropItem()
                                               {
                                                   return Items.feather;
                                               }
                                            
                                               /**
                                                * Drop 0-2 items of this living's type
                                                */
                                               protected void dropFewItems(boolean p_70628_1_, int p_70628_2_)
                                               {
                                                   int j = this.rand.nextInt(3) + this.rand.nextInt(1 + p_70628_2_);
                                            
                                                   for (int k = 0; k < j; ++k)
                                                   {
                                                       this.dropItem(Items.feather, 1);
                                                   }
                                            
                                                   if (this.isBurning())
                                                   {
                                                       this.dropItem(Items.cooked_chicken, 1);
                                                   }
                                                   else
                                                   {
                                                       this.dropItem(Items.chicken, 1);
                                                       this.dropItem(GoldenEgg.golden_egg, 2);
                                                   }
                                               }
                                            
                                               public GoldenEggChicken createChild(EntityAgeable ageable)
                                               {
                                                   return new GoldenEggChicken(this.worldObj);
                                               }
                                            
                                               /**
                                                * Checks if the parameter is an item which this animal can be fed to breed it (wheat, carrots or seeds depending on
                                                * the animal type)
                                                */
                                               public boolean isBreedingItem(ItemStack stack)
                                               {
                                                   return stack != null && stack.getItem() == Items.wheat_seeds;
                                               }
                                            
                                               /**
                                                * (abstract) Protected helper method to read subclass entity data from NBT.
                                                */
                                               public void readEntityFromNBT(NBTTagCompound tagCompund)
                                               {
                                                   super.readEntityFromNBT(tagCompund);
                                                   this.chickenJockey = tagCompund.getBoolean("IsChickenJockey");
                                            
                                                   if (tagCompund.hasKey("EggLayTime"))
                                                   {
                                                       this.timeUntilNextEgg = tagCompund.getInteger("EggLayTime");
                                                   }
                                               }
                                            
                                               /**
                                                * Get the experience points the entity currently has.
                                                */
                                            
                                               /**
                                                * (abstract) Protected helper method to write subclass entity data to NBT.
                                                */
                                               public void writeEntityToNBT(NBTTagCompound tagCompound)
                                               {
                                                   super.writeEntityToNBT(tagCompound);
                                                   tagCompound.setBoolean("IsChickenJockey", this.chickenJockey);
                                                   tagCompound.setInteger("EggLayTime", this.timeUntilNextEgg);
                                               }
                                            
                                               /**
                                                * Determines if an entity can be despawned, used on idle far away entities
                                                */    
                                            
                                               /**
                                                * Determines if this chicken is a jokey with a zombie riding it.
                                                */
                                            
                                               /**
                                                * Sets whether this chicken is a jockey or not.
                                                *  
                                                * @param jockey Whether this chicken is a jockey or not
                                                */
                                            
                                            }
                                            

                                            Classe du render poulet

                                            ​package eryah.usefulthings.client.render;
                                            
                                            import net.minecraft.client.model.ModelBase;
                                            import net.minecraft.client.renderer.entity.RenderChicken;
                                            import net.minecraft.client.renderer.entity.RenderManager;
                                            import net.minecraft.entity.EntityLiving;
                                            import net.minecraft.util.ResourceLocation;
                                            import eryah.usefulthings.Reference;
                                            import eryah.usefulthings.entity.passive.GoldenEggChicken;
                                            
                                            public class RenderGoldenEggChicken extends RenderChicken {
                                            
                                            public RenderGoldenEggChicken(RenderManager p_i46188_1_,
                                            ModelBase p_i46188_2_, float p_i46188_3_) {
                                            super(p_i46188_1_, p_i46188_2_, p_i46188_3_);
                                            // TODO Auto-generated constructor stub
                                            }
                                            
                                            public final ResourceLocation texture = new ResourceLocation(Reference.MOD_ID, "textures/entity/gechicken.png"); 
                                            
                                            protected ResourceLocation getEntityTexture(EntityLiving living)
                                            {
                                            return this.getMobTexture((GoldenEggChicken)living);
                                            }
                                            
                                            private ResourceLocation getMobTexture(GoldenEggChicken mobTutoriel)
                                            {
                                            return texture;
                                            }
                                            
                                            }
                                            

                                            Le but est donc de savoir il faut mettre quoi à la place des ‘null’ ici

                                            ​RenderingRegistry.registerEntityRenderingHandler(GoldenEggChicken.class, new RenderGoldenEggChicken(null, null, 0));
                                            
                                            RenderingRegistry.registerEntityRenderingHandler(MotorizedBoat.class, new RenderMotoBoat(null, null, 0));
                                            

                                            Membre fantôme
                                            Je développe maintenant un jeu sur UnrealEngine4


                                            Contact :…

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

                                            MINECRAFT FORGE FRANCE © 2018

                                            Powered by NodeBB