Jump to content

FireDragon033632

Members
  • Posts

    8
  • Joined

  • Last visited

Everything posted by FireDragon033632

  1. I made it give me an item when it breaks through TutEventHandler with this code: public class TutEventHandler { @SubscribeEvent public void onEvent(PlayerDestroyItemEvent event) { event.entityPlayer.inventory.addItemStackToInventory(new ItemStack(SwordsMod.BrokenHilt, 1)); } } I still need an 'if' statement to determine what item broke, any ideas for what 'if' statement I should use. Thanks for the help up until now
  2. I know the event's called PlayerDestroyItemEvent, the code I actually tried was(as stated in jabelars tutorial): public void onEvent(PlayerDestroyItemEvent event){ event.entityPlayer.inventory.addItemStackToInventory(new ItemStack(SwordsMod.BrokenHilt, 1)); } I typed WHATEVER_EVENT(EntityPlayer player) so nobody would get confused as to why it said player instead of EntityPlayer. The only reason it's there is to show how to add an item to inventory to make it easier to show me an example.
  3. Could you give me an example of a way to give item on break? Here's the code for giving the item: public void WHATEVER_EVENT(EntityPlayer player) { player.inventory.addItemStackToInventory(new ItemStack(SwordsMod.BrokenHilt, 1)); } Also I'm completely confused about the Item#setDamage, could you show me an example of that?
  4. If this is for 1.7.2 then put the setHarvestLevel in your constructor like: this.setHarvestLevel("pickaxe", Whatever_level); 0 = Wood and Gold, 1 = Stone, 2 = Iron, 3 = Diamond
  5. Could someone please tell me how to format them properly, that might be the problem. For "setContainerItem()" I tried putting |--- this.setContainerItem(SwordsMod.BrokenHilt); ---| and for "PlayerDestroyItemEvent" I tried |--- public void PlayerDestroyItemEvent(ItemStack itemstack, World world, EntityPlayer player) { player.inventory.addItemStackToInventory(new ItemStack(SwordsMod.BrokenHilt, 1)); } ---|
  6. PlayerDestroyItemEvent doesn't work for me and this.setContainerItem(Whatever) doesn't work when the item breaks, any other idea's?
  7. Hi, I've been searching all over the internet looking for how to do something when the item breaks but I can't find anything. I'm trying to make it so when my item breaks it gives me another item (by the way I'm modding on 1.7.2). Can anyone help? Thanks In Advance
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.