Posted August 5, 201411 yr So basically im trying to have it when certain items are right clicked on my block the item in hand is taken is replaced with a new one. I was also thinking i could do the same type of thing where if the player throws the item on my block they get a new item and the thrown on is destroyed, i figured i could do that with a item event handler, something like the Twilight Forest mod does to create the portal. but i have not been successful ether way. i've also tried PlayerInteractionEvent Any help is great, thanks currently what im trying public boolean onItemRightClick(ItemStack stack, World world, EntityPlayer player, PlayerInteractEvent event) { ItemStack beef = new ItemStack(Items.beef); ItemStack cookedBeef = new ItemStack(Items.cooked_beef); if(player.getCurrentEquippedItem() != null && player.getCurrentEquippedItem() == beef) { player.inventory.addItemStackToInventory(cookedBeef); --player.getCurrentEquippedItem().stackSize; } return true; }
August 5, 201411 yr Copied from the Block class: public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitx, float hity, float hitz) {} or: /** * Called whenever an entity is walking on top of this block. Args: world, x, y, z, entity //check if the entity is your item? */ public void onEntityWalking(World p_149724_1_, int p_149724_2_, int p_149724_3_, int p_149724_4_, Entity p_149724_5_) {} Here could be your advertisement!
August 5, 201411 yr ...or public boolean onItemUse(ItemStack is, EntityPlayer pl, World world, int x, int y, int z, int side, float sx, float sy, float sz)
August 5, 201411 yr Was my first thought too, but it will be a little bit difficult to get this working with a vanilla item. Here could be your advertisement!
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.