Soucis de texture sur dynamite



  • Bonjour alors voilà j'ai un soucis ma dynamite fonctionne niquel juste quand je la lance j'ai un soucis de texture, on dirai que je lance une flèche.

    Mon code:

    package com.degraduck.atlantidecraft.items;
    
    import com.degraduck.atlantidecraft.core.AtlantideCraft;
    import com.degraduck.atlantidecraft.core.Constants;
    import com.degraduck.atlantidecraft.entity.EntityDynamite;
    
    import cpw.mods.fml.common.registry.GameRegistry;
    import cpw.mods.fml.relauncher.Side;
    import cpw.mods.fml.relauncher.SideOnly;
    import net.minecraft.entity.player.EntityPlayer;
    import net.minecraft.item.Item;
    import net.minecraft.item.ItemStack;
    import net.minecraft.util.MathHelper;
    import net.minecraft.world.World;
    
    public class ItemDynamite extends Item {
    
    public ItemDynamite(String unlocalizedName, String texture)
    {
       setUnlocalizedName(unlocalizedName);
       setTextureName(Constants.MODID + ":" + texture);
       setCreativeTab(AtlantideCraft.AtlantideCraftCreativeTabs);
       setMaxStackSize(64);  
       GameRegistry.registerItem(this, unlocalizedName);
    
    }
    
     public int getItemEnchantability()
     {
       return 0;
     }
    
     public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer entityplayer)
     {
       if (entityplayer.inventory.consumeInventoryItem(this))
       {
         world.playSoundAtEntity(entityplayer, "game.tnt.primed", 1.0F, 1.0F / (itemRand.nextFloat() * 0.4F + 0.8F));
         if (!world.isRemote) {
           world.spawnEntityInWorld(new EntityDynamite(world, entityplayer, 40 + itemRand.nextInt(10)));
         }
       }
       return itemstack;
     }
    
     private void spawnSmoke(EntityPlayer entityplayer)
     {
       float particleX = -MathHelper.sin((entityplayer.rotationYaw + 23.0F) / 180.0F * 3.141593F) * MathHelper.cos(entityplayer.rotationPitch / 180.0F * 3.141593F);
       float particleY = -MathHelper.sin(entityplayer.rotationPitch / 180.0F * 3.141593F);
       float particleZ = MathHelper.cos((entityplayer.rotationYaw + 23.0F) / 180.0F * 3.141593F) * MathHelper.cos(entityplayer.rotationPitch / 180.0F * 3.141593F);
    
       entityplayer.worldObj.spawnParticle("smoke", entityplayer.posX + particleX, entityplayer.posY + particleY, entityplayer.posZ + particleZ, 0.0D, 0.0D, 0.0D);
     }
    
     @SideOnly(Side.CLIENT)
     public boolean shouldRotateAroundWhenRendering()
     {
       return true;
     }
    
     @SideOnly(Side.CLIENT)
     public boolean isFull3D()
     {
       return true;
     }
    
    }
    
    
    package com.degraduck.atlantidecraft.proxy;
    
    import org.lwjgl.opengl.GL11;
    
    import com.degraduck.atlantidecraft.entity.EntityDynamite;
    
    import net.minecraft.client.renderer.Tessellator;
    import net.minecraft.client.renderer.entity.Render;
    import net.minecraft.entity.Entity;
    import net.minecraft.util.MathHelper;
    import net.minecraft.util.ResourceLocation;
    
    public class RenderDynamite extends Render {
    
    ResourceLocation textureDynamite = new ResourceLocation("atlantidecraft:textures/entity/dynamite.png");
    
    public void renderDynamite(EntityDynamite entityarrow, double d, double d1, double d2, float f, float f1)
     {
       bindEntityTexture(entityarrow);
       GL11.glPushMatrix();
       GL11.glTranslatef((float)d, (float)d1, (float)d2);
       GL11.glRotatef(entityarrow.rotationYaw + 90.0F, 0.0F, 1.0F, 0.0F);
       GL11.glRotatef(entityarrow.prevRotationPitch + (entityarrow.rotationPitch - entityarrow.prevRotationPitch) * f1, 0.0F, 0.0F, 1.0F);
       Tessellator tessellator = Tessellator.instance;
       int i = 0;
       float f2 = 0.0F;
       float f3 = 0.5F;
       float f4 = (0 + i * 10) / 32.0F;
       float f5 = (5 + i * 10) / 32.0F;
       float f6 = 0.0F;
       float f7 = 0.15625F;
       float f8 = (5 + i * 10) / 32.0F;
       float f9 = (10 + i * 10) / 32.0F;
       float f10 = 0.05625F;
       GL11.glEnable(32826);
       float f11 = -f1;
       if (f11 > 0.0F)
       {
         float f12 = -MathHelper.sin(f11 * 3.0F) * f11;
         GL11.glRotatef(f12, 0.0F, 0.0F, 1.0F);
       }
       GL11.glRotatef(45.0F, 1.0F, 0.0F, 0.0F);
       GL11.glScalef(f10, f10, f10);
       GL11.glTranslatef(-4.0F, 0.0F, 0.0F);
       GL11.glNormal3f(f10, 0.0F, 0.0F);
       tessellator.startDrawingQuads();
       tessellator.addVertexWithUV(-7.0D, -2.0D, -2.0D, f6, f8);
       tessellator.addVertexWithUV(-7.0D, -2.0D, 2.0D, f7, f8);
       tessellator.addVertexWithUV(-7.0D, 2.0D, 2.0D, f7, f9);
       tessellator.addVertexWithUV(-7.0D, 2.0D, -2.0D, f6, f9);
       tessellator.draw();
       GL11.glNormal3f(-f10, 0.0F, 0.0F);
       tessellator.startDrawingQuads();
       tessellator.addVertexWithUV(-7.0D, 2.0D, -2.0D, f6, f8);
       tessellator.addVertexWithUV(-7.0D, 2.0D, 2.0D, f7, f8);
       tessellator.addVertexWithUV(-7.0D, -2.0D, 2.0D, f7, f9);
       tessellator.addVertexWithUV(-7.0D, -2.0D, -2.0D, f6, f9);
       tessellator.draw();
       for (int j = 0; j < 4; j++)
       {
         GL11.glRotatef(90.0F, 1.0F, 0.0F, 0.0F);
         GL11.glNormal3f(0.0F, 0.0F, f10);
         tessellator.startDrawingQuads();
         tessellator.addVertexWithUV(-8.0D, -2.0D, 0.0D, f2, f4);
         tessellator.addVertexWithUV(8.0D, -2.0D, 0.0D, f3, f4);
         tessellator.addVertexWithUV(8.0D, 2.0D, 0.0D, f3, f5);
         tessellator.addVertexWithUV(-8.0D, 2.0D, 0.0D, f2, f5);
         tessellator.draw();
       }
       GL11.glDisable(32826);
       GL11.glPopMatrix();
     }
    
     public float pitch = 40.0F;
    
     public void doRender(Entity entity, double d, double d1, double d2, float f, float f1)
     {
       renderDynamite((EntityDynamite)entity, d, d1, d2, f, f1);
     }
    
     protected ResourceLocation getEntityTexture(Entity entity)
     {
       return this.textureDynamite;
     }
    }
    
    package com.degraduck.atlantidecraft.entity;
    
    import com.degraduck.atlantidecraft.items.ItemRegister;
    
    import net.minecraft.entity.Entity;
    import net.minecraft.entity.EntityLivingBase;
    import net.minecraft.item.ItemStack;
    import net.minecraft.nbt.NBTTagCompound;
    import net.minecraft.util.MathHelper;
    import net.minecraft.util.MovingObjectPosition;
    import net.minecraft.world.World;
    
    public class EntityDynamite extends EntityProjectile {
    
    private int explodefuse;
     private boolean extinguished;
    
     public EntityDynamite(World world)
     {
       super(world);
       setPickupMode(0);
       this.extinguished = false;
       this.explodefuse = (this.rand.nextInt(30) + 20);
     }
    
     public EntityDynamite(World world, double d, double d1, double d2)
     {
       this(world);
       setPosition(d, d1, d2);
     }
    
     public EntityDynamite(World world, EntityLivingBase entityliving, int i)
     {
       this(world);
       this.shootingEntity = entityliving;
       setLocationAndAngles(entityliving.posX, entityliving.posY + entityliving.getEyeHeight(), entityliving.posZ, entityliving.rotationYaw, entityliving.rotationPitch);
       this.posX -= MathHelper.cos(this.rotationYaw / 180.0F * 3.141593F) * 0.16F;
       this.posY -= 0.1D;
       this.posZ -= MathHelper.sin(this.rotationYaw / 180.0F * 3.141593F) * 0.16F;
       setPosition(this.posX, this.posY, this.posZ);
       this.motionX = (-MathHelper.sin(this.rotationYaw / 180.0F * 3.141593F) * MathHelper.cos(this.rotationPitch / 180.0F * 3.141593F));
       this.motionZ = (MathHelper.cos(this.rotationYaw / 180.0F * 3.141593F) * MathHelper.cos(this.rotationPitch / 180.0F * 3.141593F));
       this.motionY = (-MathHelper.sin(this.rotationPitch / 180.0F * 3.141593F));
       setThrowableHeading(this.motionX, this.motionY, this.motionZ, 0.7F, 4.0F);
       this.explodefuse = i;
     }
    
     protected void entityInit() {}
    
     public void onUpdate()
     {
       super.onUpdate();
       if ((!this.inGround) && (!this.beenInGround)) {
         this.rotationPitch -= 50.0F;
       } else {
         this.rotationPitch = 180.0F;
       }
       if ((isInWater()) && (!this.extinguished))
       {
         this.extinguished = true;
         this.worldObj.playSoundAtEntity(this, "random.fizz", 1.0F, 1.2F / (this.rand.nextFloat() * 0.2F + 0.9F));
         for (int k = 0; k < 8; k++)
         {
           float f6 = 0.25F;
           this.worldObj.spawnParticle("explode", this.posX - this.motionX * f6, this.posY - this.motionY * f6, this.posZ - this.motionZ * f6, this.motionX, this.motionY, this.motionZ);
         }
       }
       this.explodefuse -= 1;
       if (!this.extinguished) {
         if (this.explodefuse <= 0)
         {
           detonate();
           setDead();
         }
         else if (this.explodefuse > 0)
         {
           this.worldObj.spawnParticle("smoke", this.posX, this.posY, this.posZ, 0.0D, 0.0D, 0.0D);
         }
       }
     }
    
     public void onEntityHit(Entity entity)
     {
     bounceBack();
     applyEntityHitEffects(entity);
     }
    
     public void onGroundHit(MovingObjectPosition mop)
     {
       this.xTile = mop.blockX;
       this.yTile = mop.blockY;
       this.zTile = mop.blockZ;
       this.inTile = this.worldObj.getBlock(this.xTile, this.yTile, this.zTile);
       this.motionX = ((float)(mop.hitVec.xCoord - this.posX));
       this.motionY = ((float)(mop.hitVec.yCoord - this.posY));
       this.motionZ = ((float)(mop.hitVec.zCoord - this.posZ));
       float f1 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionY * this.motionY + this.motionZ * this.motionZ);
       this.posX -= this.motionX / f1 * 0.05D;
       this.posY -= this.motionY / f1 * 0.05D;
       this.posZ -= this.motionZ / f1 * 0.05D;
    
       this.motionX *= -0.2D;
       this.motionZ *= -0.2D;
       if (mop.sideHit == 1)
       {
         this.inGround = true;
         this.beenInGround = true;
       }
       else
       {
         this.inGround = false;
         this.worldObj.playSoundAtEntity(this, "random.fizz", 1.0F, 1.2F / (this.rand.nextFloat() * 0.2F + 0.9F));
       }
       if (this.inTile != null) {
         this.inTile.onEntityCollidedWithBlock(this.worldObj, this.xTile, this.yTile, this.zTile, this);
       }
     }
    
     private void detonate()
     {
       if (this.worldObj.isRemote) {
         return;
       }
       if ((this.extinguished) && ((this.ticksInGround >= 200) || (this.ticksInAir >= 200))) {
         setDead();
       }
       float f = 2.0F;
       SilentExplosion.newExplosion(this, this.posX, this.posY, this.posZ, f, false, false, this.worldObj);
     }
    
     public boolean aimRotation()
     {
       return false;
     }
    
     public int getMaxArrowShake()
     {
       return 0;
     }
    
     public ItemStack getPickupItem()
     {
       return new ItemStack(ItemRegister.dynamite, 1);
     }
    
     public float getShadowSize()
     {
       return 0.2F;
     }
    
     public void playHitSound()
     {
       this.worldObj.playSoundAtEntity(this, "random.fizz", 1.0F, 1.2F / (this.rand.nextFloat() * 0.2F + 0.9F));
     }
    
     public void writeEntityToNBT(NBTTagCompound nbttagcompound)
     {
       super.writeEntityToNBT(nbttagcompound);
       nbttagcompound.setByte("fuse", (byte)this.explodefuse);
       nbttagcompound.setBoolean("off", this.extinguished);
     }
    
     public void readEntityFromNBT(NBTTagCompound nbttagcompound)
     {
       super.readEntityFromNBT(nbttagcompound);
       this.explodefuse = nbttagcompound.getByte("fuse");
       this.extinguished = nbttagcompound.getBoolean("off");
     }
    }
    
    
    package com.degraduck.atlantidecraft.entity;
    
    import java.util.List;
    
    import cpw.mods.fml.common.registry.IThrowableEntity;
    import cpw.mods.fml.relauncher.Side;
    import cpw.mods.fml.relauncher.SideOnly;
    import net.minecraft.block.Block;
    import net.minecraft.enchantment.EnchantmentHelper;
    import net.minecraft.entity.Entity;
    import net.minecraft.entity.EntityLivingBase;
    import net.minecraft.entity.monster.EntityEnderman;
    import net.minecraft.entity.player.EntityPlayer;
    import net.minecraft.entity.player.EntityPlayerMP;
    import net.minecraft.entity.projectile.EntityArrow;
    import net.minecraft.item.ItemStack;
    import net.minecraft.nbt.NBTTagCompound;
    import net.minecraft.network.play.server.S2BPacketChangeGameState;
    import net.minecraft.util.AxisAlignedBB;
    import net.minecraft.util.MathHelper;
    import net.minecraft.util.MovingObjectPosition;
    import net.minecraft.util.Vec3;
    import net.minecraft.world.World;
    
    public class EntityProjectile extends EntityArrow implements IThrowableEntity
    {
     public static final int NO_PICKUP = 0;
     public static final int PICKUP_ALL = 1;
     public static final int PICKUP_CREATIVE = 2;
     public static final int PICKUP_OWNER = 3;
     protected int xTile;
     protected int yTile;
     protected int zTile;
     protected Block inTile;
     protected int inData;
     protected boolean inGround;
     public int pickupMode;
     protected int ticksInGround;
     protected int ticksInAir;
     public boolean beenInGround;
     public float extraDamage;
     public int knockBack;
    
     public EntityProjectile(World world)
     {
       super(world);
       this.xTile = -1;
       this.yTile = -1;
       this.zTile = -1;
       this.inTile = null;
       this.inData = 0;
       this.inGround = false;
       this.arrowShake = 0;
       this.ticksInAir = 0;
       this.yOffset = 0.0F;
       this.pickupMode = 0;
    
       this.extraDamage = 0.0F;
       this.knockBack = 0;
    
       setSize(0.5F, 0.5F);
     }
    
     protected void entityInit()
     {
       super.entityInit();
     }
    
     public Entity getThrower()
     {
       return this.shootingEntity;
     }
    
     public void setThrower(Entity entity)
     {
       this.shootingEntity = entity;
     }
    
     protected void setPickupModeFromEntity(EntityLivingBase entityliving)
     {
       if ((entityliving instanceof EntityPlayer))
       {
         if (((EntityPlayer)entityliving).capabilities.isCreativeMode) {
           setPickupMode(2);
         } else {
             setPickupMode(0);
         }
       }
       else {
         setPickupMode(0);
       }
     }
    
     public void setThrowableHeading(double x, double y, double z, float speed, float deviation)
     {
       float f2 = MathHelper.sqrt_double(x * x + y * y + z * z);
       x /= f2;
       y /= f2;
       z /= f2;
       x += this.rand.nextGaussian() * 0.007499999832361937D * deviation;
       y += this.rand.nextGaussian() * 0.007499999832361937D * deviation;
       z += this.rand.nextGaussian() * 0.007499999832361937D * deviation;
       x *= speed;
       y *= speed;
       z *= speed;
       this.motionX = x;
       this.motionY = y;
       this.motionZ = z;
       float f3 = MathHelper.sqrt_double(x * x + z * z);
       this.prevRotationYaw = (this.rotationYaw = (float)(Math.atan2(x, z) * 180.0D / 3.141592653589793D));
       this.prevRotationPitch = (this.rotationPitch = (float)(Math.atan2(y, f3) * 180.0D / 3.141592653589793D));
       this.ticksInGround = 0;
     }
    
     public void setVelocity(double d, double d1, double d2)
     {
       this.motionX = d;
       this.motionY = d1;
       this.motionZ = d2;
       if ((aimRotation()) && (this.prevRotationPitch == 0.0F) && (this.prevRotationYaw == 0.0F))
       {
         float f = MathHelper.sqrt_double(d * d + d2 * d2);
         this.prevRotationYaw = (this.rotationYaw = (float)(Math.atan2(d, d2) * 180.0D / 3.141592653589793D));
         this.prevRotationPitch = (this.rotationPitch = (float)(Math.atan2(d1, f) * 180.0D / 3.141592653589793D));
         setLocationAndAngles(this.posX, this.posY, this.posZ, this.rotationYaw, this.rotationPitch);
         this.ticksInGround = 0;
       }
     }
    
     public void onUpdate()
     {
       onEntityUpdate();
     }
    
     public void onEntityUpdate()
     {
       super.onEntityUpdate();
       if (aimRotation())
       {
         float f = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ);
         this.prevRotationYaw = (this.rotationYaw = (float)(Math.atan2(this.motionX, this.motionZ) * 180.0D / 3.141592653589793D));
         this.prevRotationPitch = (this.rotationPitch = (float)(Math.atan2(this.motionY, f) * 180.0D / 3.141592653589793D));
       }
       Block i = this.worldObj.getBlock(this.xTile, this.yTile, this.zTile);
       if (i != null)
       {
         i.setBlockBoundsBasedOnState(this.worldObj, this.xTile, this.yTile, this.zTile);
         AxisAlignedBB axisalignedbb = i.getCollisionBoundingBoxFromPool(this.worldObj, this.xTile, this.yTile, this.zTile);
         if ((axisalignedbb != null) && (axisalignedbb.isVecInside(Vec3.createVectorHelper(this.posX, this.posY, this.posZ)))) {
           this.inGround = true;
         }
       }
       if (this.arrowShake > 0) {
         this.arrowShake -= 1;
       }
       if (this.inGround)
       {
         Block j = this.worldObj.getBlock(this.xTile, this.yTile, this.zTile);
         int k = this.worldObj.getBlockMetadata(this.xTile, this.yTile, this.zTile);
         if ((j == this.inTile) && (k == this.inData))
         {
           this.ticksInGround += 1;
           int t = getMaxLifetime();
           if ((t != 0) && (this.ticksInGround >= t)) {
             setDead();
           }
         }
         else
         {
           this.inGround = false;
           this.motionX *= this.rand.nextFloat() * 0.2F;
           this.motionY *= this.rand.nextFloat() * 0.2F;
           this.motionZ *= this.rand.nextFloat() * 0.2F;
           this.ticksInGround = 0;
           this.ticksInAir = 0;
         }
         return;
       }
       this.ticksInAir += 1;
    
       Vec3 vec3d = Vec3.createVectorHelper(this.posX, this.posY, this.posZ);
       Vec3 vec3d1 = Vec3.createVectorHelper(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ);
       MovingObjectPosition movingobjectposition = this.worldObj.func_147447_a(vec3d, vec3d1, false, true, false);
       vec3d = Vec3.createVectorHelper(this.posX, this.posY, this.posZ);
       vec3d1 = Vec3.createVectorHelper(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ);
       if (movingobjectposition != null) {
         vec3d1 = Vec3.createVectorHelper(movingobjectposition.hitVec.xCoord, movingobjectposition.hitVec.yCoord, movingobjectposition.hitVec.zCoord);
       }
       Entity entity = null;
    
       List <entity>list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.boundingBox.addCoord(this.motionX, this.motionY, this.motionZ).expand(1.0D, 1.0D, 1.0D));
       double d = 0.0D;
       for (int l = 0; l < list.size(); l++)
       {
         Entity entity1 = (Entity)list.get(l);
         if ((entity1.canBeCollidedWith()) && ((entity1 != this.shootingEntity) || (this.ticksInAir >= 5)))
         {
           float f4 = 0.3F;
           AxisAlignedBB axisalignedbb1 = entity1.boundingBox.expand(f4, f4, f4);
           MovingObjectPosition movingobjectposition1 = axisalignedbb1.calculateIntercept(vec3d, vec3d1);
           if (movingobjectposition1 != null)
           {
             double d1 = vec3d.distanceTo(movingobjectposition1.hitVec);
             if ((d1 < d) || (d == 0.0D))
             {
               entity = entity1;
               d = d1;
             }
           }
         }
       }
       if (entity != null) {
         movingobjectposition = new MovingObjectPosition(entity);
       }
       if (movingobjectposition != null) {
         if (movingobjectposition.entityHit != null) {
           onEntityHit(movingobjectposition.entityHit);
         } else {
           onGroundHit(movingobjectposition);
         }
       }
       if (getIsCritical()) {
         for (int i1 = 0; i1 < 2; i1++) {
           this.worldObj.spawnParticle("crit", this.posX + this.motionX * i1 / 4.0D, this.posY + this.motionY * i1 / 4.0D, this.posZ + this.motionZ * i1 / 4.0D, -this.motionX, -this.motionY + 0.2D, -this.motionZ);
         }
       }
       this.posX += this.motionX;
       this.posY += this.motionY;
       this.posZ += this.motionZ;
       if (aimRotation())
       {
         float f2 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ);
         this.rotationYaw = ((float)(Math.atan2(this.motionX, this.motionZ) * 180.0D / 3.141592653589793D));
         for (this.rotationPitch = ((float)(Math.atan2(this.motionY, f2) * 180.0D / 3.141592653589793D)); this.rotationPitch - this.prevRotationPitch < -180.0F; this.prevRotationPitch -= 360.0F) {}
         while (this.rotationPitch - this.prevRotationPitch >= 180.0F) {
           this.prevRotationPitch += 360.0F;
         }
         while (this.rotationYaw - this.prevRotationYaw < -180.0F) {
           this.prevRotationYaw -= 360.0F;
         }
         while (this.rotationYaw - this.prevRotationYaw >= 180.0F) {
           this.prevRotationYaw += 360.0F;
         }
         this.rotationPitch = (this.prevRotationPitch + (this.rotationPitch - this.prevRotationPitch) * 0.2F);
         this.rotationYaw = (this.prevRotationYaw + (this.rotationYaw - this.prevRotationYaw) * 0.2F);
       }
       float res = getAirResistance();
       float grav = getGravity();
       if (isInWater())
       {
         this.beenInGround = true;
         for (int i1 = 0; i1 < 4; i1++)
         {
           float f6 = 0.25F;
           this.worldObj.spawnParticle("bubble", this.posX - this.motionX * f6, this.posY - this.motionY * f6, this.posZ - this.motionZ * f6, this.motionX, this.motionY, this.motionZ);
         }
         res *= 0.8080808F;
       }
       this.motionX *= res;
       this.motionY *= res;
       this.motionZ *= res;
       this.motionY -= grav;
       setPosition(this.posX, this.posY, this.posZ);
       func_145775_I();
     }
    
     public void onEntityHit(Entity entity)
     {
       bounceBack();
       applyEntityHitEffects(entity);
     }
    
     public void applyEntityHitEffects(Entity entity)
     {
       if ((isBurning()) && (!(entity instanceof EntityEnderman))) {
         entity.setFire(5);
       }
       if ((entity instanceof EntityLivingBase))
       {
         EntityLivingBase entityliving = (EntityLivingBase)entity;
         if (this.knockBack > 0)
         {
           float f = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ);
           if (f > 0.0F) {
             entity.addVelocity(this.motionX * this.knockBack * 0.6D / f, 0.1D, this.motionZ * this.knockBack * 0.6D / f);
           }
         }
         if ((this.shootingEntity instanceof EntityLivingBase))
         {
           EnchantmentHelper.func_151384_a(entityliving, this.shootingEntity);
           EnchantmentHelper.func_151385_b((EntityLivingBase)this.shootingEntity, entityliving);
         }
         if (((this.shootingEntity instanceof EntityPlayerMP)) && (this.shootingEntity != entity) && ((entity instanceof EntityPlayer))) {
           ((EntityPlayerMP)this.shootingEntity).playerNetServerHandler.sendPacket(new S2BPacketChangeGameState(6, 0.0F));
         }
       }
     }
    
     public void onGroundHit(MovingObjectPosition mop)
     {
       this.xTile = mop.blockX;
       this.yTile = mop.blockY;
       this.zTile = mop.blockZ;
       this.inTile = this.worldObj.getBlock(this.xTile, this.yTile, this.zTile);
       this.inData = this.worldObj.getBlockMetadata(this.xTile, this.yTile, this.zTile);
       this.motionX = (mop.hitVec.xCoord - this.posX);
       this.motionY = (mop.hitVec.yCoord - this.posY);
       this.motionZ = (mop.hitVec.zCoord - this.posZ);
       float f1 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionY * this.motionY + this.motionZ * this.motionZ);
       this.posX -= this.motionX / f1 * 0.05D;
       this.posY -= this.motionY / f1 * 0.05D;
       this.posZ -= this.motionZ / f1 * 0.05D;
       this.inGround = true;
       this.beenInGround = true;
       setIsCritical(false);
       this.arrowShake = getMaxArrowShake();
       playHitSound();
       if (this.inTile != null) {
         this.inTile.onEntityCollidedWithBlock(this.worldObj, this.xTile, this.yTile, this.zTile, this);
       }
     }
    
     protected void bounceBack()
     {
       this.motionX *= -0.1D;
       this.motionY *= -0.1D;
       this.motionZ *= -0.1D;
       this.rotationYaw += 180.0F;
       this.prevRotationYaw += 180.0F;
       this.ticksInAir = 0;
     }
    
     public final double getTotalVelocity()
     {
       return Math.sqrt(this.motionX * this.motionX + this.motionY * this.motionY + this.motionZ * this.motionZ);
     }
    
     public boolean aimRotation()
     {
       return true;
     }
    
     public int getMaxLifetime()
     {
       return 1200;
     }
    
     public ItemStack getPickupItem()
     {
       return null;
     }
    
     public float getAirResistance()
     {
       return 0.99F;
     }
    
     public float getGravity()
     {
       return 0.05F;
     }
    
     public int getMaxArrowShake()
     {
       return 7;
     }
    
     public void playHitSound() {}
    
     public boolean canBeCritical()
     {
       return false;
     }
    
     public void setIsCritical(boolean flag)
     {
       if (canBeCritical()) {
         this.dataWatcher.updateObject(16, Byte.valueOf((byte)(flag ? 1 : 0)));
       }
     }
    
     public boolean getIsCritical()
     {
       return (canBeCritical()) && (this.dataWatcher.getWatchableObjectByte(16) != 0);
     }
    
     public void setExtraDamage(float f)
     {
       this.extraDamage = f;
     }
    
     public void setKnockbackStrength(int i)
     {
       this.knockBack = i;
     }
    
     public void setPickupMode(int i)
     {
       this.pickupMode = i;
     }
    
     public int getPickupMode()
     {
       return this.pickupMode;
     }
    
     public boolean canPickup(EntityPlayer entityplayer)
     {
       if (this.pickupMode == 1) {
         return true;
       }
       if (this.pickupMode == 2) {
         return entityplayer.capabilities.isCreativeMode;
       }
       if (this.pickupMode == 3) {
         return entityplayer == this.shootingEntity;
       }
       return false;
     }
    
     public void onCollideWithPlayer(EntityPlayer entityplayer)
     {
       if ((this.inGround) && (this.arrowShake <= 0)) {
         if (canPickup(entityplayer)) {
           if (!this.worldObj.isRemote)
           {
             ItemStack item = getPickupItem();
             if (item == null) {
               return;
             }
             if (((this.pickupMode == 2) && (entityplayer.capabilities.isCreativeMode)) || (entityplayer.inventory.addItemStackToInventory(item)))
             {
               this.worldObj.playSoundAtEntity(this, "random.pop", 0.2F, ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.7F + 1.0F) * 2.0F);
               onItemPickup(entityplayer);
               setDead();
             }
           }
         }
       }
     }
    
     protected void onItemPickup(EntityPlayer entityplayer)
     {
       entityplayer.onItemPickup(this, 1);
     }
    
     @SideOnly(Side.CLIENT)
     public float getShadowSize()
     {
       return 0.0F;
     }
    
     protected boolean canTriggerWalking()
     {
       return false;
     }
    
     public void writeEntityToNBT(NBTTagCompound nbttagcompound)
     {
       nbttagcompound.setShort("xTile", (short)this.xTile);
       nbttagcompound.setShort("yTile", (short)this.yTile);
       nbttagcompound.setShort("zTile", (short)this.zTile);
       nbttagcompound.setByte("inTile", (byte)Block.getIdFromBlock(this.inTile));
       nbttagcompound.setByte("inData", (byte)this.inData);
       nbttagcompound.setByte("shake", (byte)this.arrowShake);
       nbttagcompound.setBoolean("inGround", this.inGround);
       nbttagcompound.setBoolean("beenInGround", this.beenInGround);
       nbttagcompound.setByte("pickup", (byte)this.pickupMode);
     }
    
     public void readEntityFromNBT(NBTTagCompound nbttagcompound)
     {
       this.xTile = nbttagcompound.getShort("xTile");
       this.yTile = nbttagcompound.getShort("yTile");
       this.zTile = nbttagcompound.getShort("zTile");
       this.inTile = Block.getBlockById(nbttagcompound.getByte("inTile") & 0xFF);
       this.inData = (nbttagcompound.getByte("inData") & 0xFF);
       this.arrowShake = (nbttagcompound.getByte("shake") & 0xFF);
       this.inGround = nbttagcompound.getBoolean("inGround");
       this.beenInGround = nbttagcompound.getBoolean("beenInGrond");
       this.pickupMode = nbttagcompound.getByte("pickup");
     }
    }
    
    
    package com.degraduck.atlantidecraft.entity;
    
    import java.util.ArrayList;
    import java.util.HashMap;
    import java.util.HashSet;
    import java.util.Iterator;
    import java.util.List;
    import java.util.Map;
    import java.util.Random;
    
    import net.minecraft.block.Block;
    import net.minecraft.block.material.Material;
    import net.minecraft.enchantment.EnchantmentProtection;
    import net.minecraft.entity.Entity;
    import net.minecraft.entity.EntityLivingBase;
    import net.minecraft.entity.item.EntityTNTPrimed;
    import net.minecraft.entity.player.EntityPlayer;
    import net.minecraft.init.Blocks;
    import net.minecraft.util.AxisAlignedBB;
    import net.minecraft.util.DamageSource;
    import net.minecraft.util.MathHelper;
    import net.minecraft.util.Vec3;
    import net.minecraft.world.ChunkPosition;
    import net.minecraft.world.Explosion;
    import net.minecraft.world.World;
    import net.minecraftforge.event.ForgeEventFactory;
    
    public class SilentExplosion extends Explosion {
    
    World worldObj;
     Random explosionRNG = new Random();
     private int field_77289_h = 16;
     public boolean isFlaming;
     public boolean isSmoking = true;
     public double explosionX;
     public double explosionY;
     public double explosionZ;
     public Entity exploder;
     public float explosionSize;
     public List affectedBlockPositions = new ArrayList();
     private Map field_77288_k = new HashMap();
     private static final String __OBFID = "CL_00000134";
    
     public void doExplosionA()
     {
       float f = this.explosionSize;
       HashSet hashset = new HashSet();
       for (int i = 0; i < this.field_77289_h; i++) {
         for (int j = 0; j < this.field_77289_h; j++) {
           for (int k = 0; k < this.field_77289_h; k++) {
             if ((i == 0) || (i == this.field_77289_h - 1) || (j == 0) || (j == this.field_77289_h - 1) || (k == 0) || (k == this.field_77289_h - 1))
             {
               double d0 = i / (this.field_77289_h - 1.0F) * 2.0F - 1.0F;
               double d1 = j / (this.field_77289_h - 1.0F) * 2.0F - 1.0F;
               double d2 = k / (this.field_77289_h - 1.0F) * 2.0F - 1.0F;
               double d3 = Math.sqrt(d0 * d0 + d1 * d1 + d2 * d2);
               d0 /= d3;
               d1 /= d3;
               d2 /= d3;
               float f1 = this.explosionSize * (0.7F + this.worldObj.rand.nextFloat() * 0.6F);
               double d5 = this.explosionX;
               double d6 = this.explosionY;
               double d7 = this.explosionZ;
               for (float f2 = 0.3F; f1 > 0.0F; f1 -= f2 * 0.75F)
               {
                 int j1 = MathHelper.floor_double(d5);
                 int k1 = MathHelper.floor_double(d6);
                 int l1 = MathHelper.floor_double(d7);
                 Block block = this.worldObj.getBlock(j1, k1, l1);
                 if (block.getMaterial() != Material.air)
                 {
                   float f3 = this.exploder != null ? this.exploder.func_145772_a(this, this.worldObj, j1, k1, l1, block) : block.getExplosionResistance(this.exploder, this.worldObj, j1, k1, l1, this.explosionX, this.explosionY, this.explosionZ);
                   f1 -= (f3 + 0.3F) * f2;
                 }
                 if ((f1 > 0.0F) && ((this.exploder == null) || (this.exploder.func_145774_a(this, this.worldObj, j1, k1, l1, block, f1)))) {
                   hashset.add(new ChunkPosition(j1, k1, l1));
                 }
                 d5 += d0 * f2;
                 d6 += d1 * f2;
                 d7 += d2 * f2;
               }
             }
           }
         }
       }
       this.affectedBlockPositions.addAll(hashset);
       this.explosionSize *= 2.0F;
       int i = MathHelper.floor_double(this.explosionX - this.explosionSize - 1.0D);
       int j = MathHelper.floor_double(this.explosionX + this.explosionSize + 1.0D);
       int k = MathHelper.floor_double(this.explosionY - this.explosionSize - 1.0D);
       int i2 = MathHelper.floor_double(this.explosionY + this.explosionSize + 1.0D);
       int l = MathHelper.floor_double(this.explosionZ - this.explosionSize - 1.0D);
       int j2 = MathHelper.floor_double(this.explosionZ + this.explosionSize + 1.0D);
       List list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this.exploder, AxisAlignedBB.getBoundingBox(i, k, l, j, i2, j2));
       ForgeEventFactory.onExplosionDetonate(this.worldObj, this, list, this.explosionSize);
       Vec3 vec3 = Vec3.createVectorHelper(this.explosionX, this.explosionY, this.explosionZ);
       for (int i1 = 0; i1 < list.size(); i1++)
       {
         Entity entity = (Entity)list.get(i1);
         double d4 = entity.getDistance(this.explosionX, this.explosionY, this.explosionZ) / this.explosionSize;
         if (d4 <= 1.0D)
         {
           double d5 = entity.posX - this.explosionX;
           double d6 = entity.posY + entity.getEyeHeight() - this.explosionY;
           double d7 = entity.posZ - this.explosionZ;
           double d9 = MathHelper.sqrt_double(d5 * d5 + d6 * d6 + d7 * d7);
           if (d9 != 0.0D)
           {
             d5 /= d9;
             d6 /= d9;
             d7 /= d9;
             double d10 = this.worldObj.getBlockDensity(vec3, entity.boundingBox);
             double d11 = (1.0D - d4) * d10;
             entity.attackEntityFrom(DamageSource.setExplosionSource(this), (int)((d11 * d11 + d11) / 2.0D * 8.0D * this.explosionSize + 1.0D));
             double d8 = EnchantmentProtection.func_92092_a(entity, d11);
             entity.motionX += d5 * d8;
             entity.motionY += d6 * d8;
             entity.motionZ += d7 * d8;
             if ((entity instanceof EntityPlayer)) {
               this.field_77288_k.put((EntityPlayer)entity, Vec3.createVectorHelper(d5 * d11, d6 * d11, d7 * d11));
             }
           }
         }
       }
       this.explosionSize = f;
     }
    
     public void doExplosionB(boolean p_77279_1_)
     {
       if ((this.explosionSize >= 2.0F) && (this.isSmoking)) {
         this.worldObj.spawnParticle("hugeexplosion", this.explosionX, this.explosionY, this.explosionZ, 1.0D, 0.0D, 0.0D);
       } else {
         this.worldObj.spawnParticle("largeexplode", this.explosionX, this.explosionY, this.explosionZ, 1.0D, 0.0D, 0.0D);
       }
       if (this.isSmoking)
       {
         Iterator iterator = this.affectedBlockPositions.iterator();
         while (iterator.hasNext())
         {
           ChunkPosition chunkposition = (ChunkPosition)iterator.next();
           int i = chunkposition.chunkPosX;
           int j = chunkposition.chunkPosY;
           int k = chunkposition.chunkPosZ;
           Block block = this.worldObj.getBlock(i, j, k);
           if (p_77279_1_)
           {
             double d0 = i + this.worldObj.rand.nextFloat();
             double d1 = j + this.worldObj.rand.nextFloat();
             double d2 = k + this.worldObj.rand.nextFloat();
             double d3 = d0 - this.explosionX;
             double d4 = d1 - this.explosionY;
             double d5 = d2 - this.explosionZ;
             double d6 = MathHelper.sqrt_double(d3 * d3 + d4 * d4 + d5 * d5);
             d3 /= d6;
             d4 /= d6;
             d5 /= d6;
             double d7 = 0.5D / (d6 / this.explosionSize + 0.1D);
             d7 *= (this.worldObj.rand.nextFloat() * this.worldObj.rand.nextFloat() + 0.3F);
             d3 *= d7;
             d4 *= d7;
             d5 *= d7;
             this.worldObj.spawnParticle("explode", (d0 + this.explosionX * 1.0D) / 2.0D, (d1 + this.explosionY * 1.0D) / 2.0D, (d2 + this.explosionZ * 1.0D) / 2.0D, d3, d4, d5);
             this.worldObj.spawnParticle("smoke", d0, d1, d2, d3, d4, d5);
           }
           if (block.getMaterial() != Material.air)
           {
             if (block.canDropFromExplosion(this)) {
               block.dropBlockAsItemWithChance(this.worldObj, i, j, k, this.worldObj.getBlockMetadata(i, j, k), 1.0F / this.explosionSize, 0);
             }
             block.onBlockExploded(this.worldObj, i, j, k, this);
           }
         }
       }
       if (this.isFlaming)
       {
         Iterator iterator = this.affectedBlockPositions.iterator();
         while (iterator.hasNext())
         {
           ChunkPosition chunkposition = (ChunkPosition)iterator.next();
           int i = chunkposition.chunkPosX;
           int j = chunkposition.chunkPosY;
           int k = chunkposition.chunkPosZ;
           Block block = this.worldObj.getBlock(i, j, k);
           Block block1 = this.worldObj.getBlock(i, j - 1, k);
           if ((block.getMaterial() == Material.air) && (block1.func_149730_j()) && (this.explosionRNG.nextInt(3) == 0)) {
             this.worldObj.setBlock(i, j, k, Blocks.fire);
           }
         }
       }
     }
    
     public Map func_77277_b()
     {
       return this.field_77288_k;
     }
    
     public EntityLivingBase getExplosivePlacedBy()
     {
       return (this.exploder instanceof EntityLivingBase) ? (EntityLivingBase)this.exploder : (this.exploder instanceof EntityTNTPrimed) ? ((EntityTNTPrimed)this.exploder).getTntPlacedBy() : this.exploder == null ? null : null;
     }
    
     public SilentExplosion(World world, Entity e, double x, double y, double z, float f)
     {
       super(world, e, x, y, z, f);
       this.worldObj = world;
       this.exploder = e;
       this.explosionSize = f;
       this.explosionX = x;
       this.explosionY = y;
       this.explosionZ = z;
     }
    
     public static Explosion newExplosion(Entity e, double x, double y, double z, float f, boolean smoking, boolean flaming, World world)
     {
       SilentExplosion explosion = new SilentExplosion(world, e, x, y, z, f);
       if (ForgeEventFactory.onExplosionStart(world, explosion)) {
         return explosion;
       }
       explosion.doExplosionA();
       explosion.doExplosionB(true);
       return explosion;
     }
    }
    
    

    https://youtu.be/b51c8bVXNEo</entity>



  • Regarde dans ta classe common et client proxy j'avais le même probléme mais jsp c'étais quoi



  • Je pense ```java
    public class EntityProjectile extends EntityArrow


  • Modérateurs

    Je pense aussi que tu as pas enregistré ta classe 'RenderDynamite' au bon endroit.



  • Pour la classe du render c'est corriger elle est à sa place. Pour l'extends EntityArrow le soucis ne vient pas de là je penses car par exemple le mod blakon weapon utilise le même extends et n'as pas le soucis de texture.

    package com.degraduck.atlantidecraft.proxy;
    
    import com.degraduck.atlantidecraft.entity.EntityDynamite;
    import com.degraduck.atlantidecraft.entity.RenderDynamite;
    
    import cpw.mods.fml.client.registry.RenderingRegistry;
    
    public class ClientProxy extends CommonProxy {
    
    public void registerRender() {
    
    RenderingRegistry.registerEntityRenderingHandler(EntityDynamite.class, new RenderDynamite());
    
    }
    
    }
    
    package com.degraduck.atlantidecraft.proxy;
    
    import com.degraduck.atlantidecraft.core.AtlantideCraft;
    
    import cpw.mods.fml.common.event.FMLInitializationEvent;
    
    public class CommonProxy {
    
    public void registerRender() {
    }
    
    }
    
    

  • Administrateurs

    La fonction registerRender est-elle appelé dans la classe principale ?
    Ton entité est-elle enregistrée ?



  • Oui.

    @EventHandler
    public void preInit(FMLPreInitializationEvent event) {
    
    proxy.registerRender();
    
    }
    
    @EventHandler
    public void init(FMLInitializationEvent event) {
    
    EntityRegistry.registerGlobalEntityID(EntityDynamite.class, "dynamite", EntityRegistry.findGlobalUniqueEntityId(), new Color(0, 255, 0).getRGB(), new Color(255, 0, 0).getRGB());
    EntityRegistry.registerModEntity(EntityDynamite.class, "dynamite", 420, AtlantideCraft.instance, 40, 1, true);
    
    }
    

    EDIT: Après désinstallation et réinstallation d'eclipse soucis corrigé, entre ça et les textures qui s'affoche que si je relance eclipse ça fait beaucoup ^^je vais aller sous IntelliJ . Merci a tous d'avoir essayé de chercher.


  • Administrateurs

    Juste une remarque, tu n'as pas besoin de EntityRegistry.registerGlobalEntityID.
    RegisterModEntity suffit comme tu n'as pas besoin d’œuf.