FireDragon033632
Members-
Posts
8 -
Joined
-
Last visited
Converted
-
Gender
Undisclosed
-
Personal Text
I am new!
FireDragon033632's Achievements
Tree Puncher (2/8)
1
Reputation
-
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
-
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.
-
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?
-
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
-
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)); } ---|