• Register
    • Login
    • Search
    • Recent
    • Tags
    • Popular
    • Users
    • Groups

    Problème de lancement de ma dynamite

    Discussion générale
    1
    1
    64
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • S
      Skyrim last edited by

      Re : Problème avec ma Dynamite [1.7.10]

      Bonjour / Bonsoir,
      j’ai un problème avec ma dynamite quand je la lance elle ne va pas a l’endroit ou j’ai visé elle explose je vous donne mon code pour que vous puisait m’aider Cordialement Skyrim

      ItemDynamite :

      package com.mod.azuriom.Dynamite;
      
      import net.minecraft.creativetab.CreativeTabs;
      import net.minecraft.entity.player.EntityPlayer;
      import net.minecraft.entity.projectile.EntitySnowball;
      import net.minecraft.item.Item;
      import net.minecraft.item.ItemStack;
      import net.minecraft.world.World;
       
      public class ItemDynamite extends Item
      {
          public ItemDynamite()
          {
              this.setCreativeTab(CreativeTabs.tabMisc);
          }
          public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player)
          {
          	if (player.capabilities.isCreativeMode) 
          	{
          		setMaxStackSize(16);
          	}
          	
          	world.playSoundAtEntity(player, "random.bow", 0.5F, 0.8F / (itemRand.nextFloat() * 0.4F + 0.8F));
          	
          	if(!world.isRemote) 
          	{
          		world.spawnEntityInWorld(new EntityDynamite(world, player));
          		stack.stackSize--;
          	}
          	
          	return stack;
          }
      
      }
      
      

      EntityDynamite :

      package com.mod.azuriom.Dynamite;
      
      import cpw.mods.fml.common.registry.IEntityAdditionalSpawnData;
      import io.netty.buffer.ByteBuf;
      import net.minecraft.entity.EntityLivingBase;
      import net.minecraft.entity.monster.EntityBlaze;
      import net.minecraft.entity.projectile.EntityThrowable;
      import net.minecraft.util.DamageSource;
      import net.minecraft.util.MovingObjectPosition;
      import net.minecraft.world.World;
       
      public class EntityDynamite extends EntityThrowable implements IEntityAdditionalSpawnData
      {
         private int fuseTime = 50;
       
         public EntityDynamite(World world)
         {
             super(world);
         }
       
         public EntityDynamite(World world, EntityLivingBase thrower)
         {
             super(world, thrower);
         }
       
         public EntityDynamite(World world, double x, double y, double z)
         {
             super(world, x, y, z);
         }
       
         protected void onImpact(MovingObjectPosition mop)
         {
             this.motionX = 0;
             this.motionY = 0;
             this.motionZ = 0;
             if (!this.worldObj.isRemote)
             {
       
             }
         }       
         @Override
         public void onUpdate()
         {
             super.onUpdate();
             if(this.fuseTime > 0)
             {
                 this.fuseTime --;
             }
       
             else if(!this.worldObj.isRemote)
             {
                 this.worldObj.newExplosion(this, this.posX, this.posY, this.posZ, 3.0F, false, true);
                 this.setDead();
             }
       
         }
       
         @Override
         public void writeSpawnData(ByteBuf buffer)
         {
             buffer.writeDouble(this.motionX);
         }
       
         @Override
         public void readSpawnData(ByteBuf additionalData)
         {
             this.motionX = additionalData.readDouble();
         }
      }
      

      RenderDynamite :

      package com.mod.azuriom.Dynamite;
      
      import net.minecraft.client.renderer.entity.Render;
      import net.minecraft.entity.Entity;
      import net.minecraft.item.Item;
      import net.minecraft.util.IIcon;
      import net.minecraft.util.ResourceLocation;
       
      public class RenderDynamite extends Render
      {
          private Item dynamite;
          private int RenderDynamite;
          private static final String __OBFID = "CL_00001008";
          public static final int DEFAULT = 0;
       
          public RenderDynamite(Item dynamite, int RenderDynamite)
          {
              this.dynamite = dynamite;
              this.RenderDynamite = RenderDynamite;
          }
       
          public RenderDynamite(Item dynamite)
          {
              this(dynamite, 0);
          }
       
          @Override
          public void doRender(Entity dynamite, double x, double y, double z, float dynamite1, float RenderDynamite)
          {
              IIcon icon = this.dynamite.getIconFromDamage(this.RenderDynamite);
       
          }
       
          @Override
          protected ResourceLocation getEntityTexture(Entity dynamite)
          {
              // TODO Auto-generated method stub
              return null;
          }
      }
      
      
      1 Reply Last reply Reply Quote 0
      • 1 / 1
      • First post
        Last post
      Design by Woryk
      Contact / Mentions Légales

      MINECRAFT FORGE FRANCE © 2018

      Powered by NodeBB