Posted July 4, 201411 yr i have an item that is supposed to turn itself into another item after x ticks. i know how to do this in onRightClick() and onEaten() etc. by returning another itemstack, but how do i do this in a void? http://www.planetminecraft.com/member/sigurd4 I'm making the bioshock mod!
July 4, 201411 yr Author "in a void" - No comment on that. For this to work you need a tick counter in the ItemStack. You can use the NBT or the damage value for this. To do this use the onUpdate method, it is called as long as the Item is in your inventory. i am using the onUpdate method, but it doesnt return anything (thats what i ment with void) so i dont know how i can do this there since its different from in methods like onEaten and onRightClick which returns the itemstack. http://www.planetminecraft.com/member/sigurd4 I'm making the bioshock mod!
July 4, 201411 yr The return type of onUpdate has nothing to do with replacing the ItemStack . As diesieben07 said, you need a tick counter in the ItemStack through either NBT or damage value. It should be a matter of simply creating a new ItemStack and replacing the player's current item with this new stack after x ticks, as indicated by the NBT/damage value.
July 4, 201411 yr Author The return type of onUpdate has nothing to do with replacing the ItemStack . As diesieben07 said, you need a tick counter in the ItemStack through either NBT or damage value. It should be a matter of simply creating a new ItemStack and replacing the player's current item with this new stack after x ticks, as indicated by the NBT/damage value. thats excactly what i want to do, but i dont know how. http://www.planetminecraft.com/member/sigurd4 I'm making the bioshock mod!
July 4, 201411 yr Hint: The quote functionality is mostly useful for quoting posts earlier than the most recent post, as well as quoting specific parts of posts Anyway, pseudocode: onUpdate() { if (ticks++ >= 100) { // Remove player's current ItemStack // Give player new ItemStack in that slot } }
July 4, 201411 yr Author ok, thank you i will remember that. how do i replace and remove the item? http://www.planetminecraft.com/member/sigurd4 I'm making the bioshock mod!
July 4, 201411 yr player.inventory.setInventorySlotContents(player.inventory.currentItem, itemStack);
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.