Posted September 11, 201411 yr Like you could (hopefully) read in the Topic, I have an usable Item that does stuff by using the onItemRightClick Method. Everything is nice and dandy, just the blocking animation I applied to it doesnt exactly do what I want. I suppose the setDamage() Method (see in Code) I'm using is interrupting it. It would be awesome if someone of you guys could tell me how to damage my Item without interrupting the animation (it would be even better if the Item wouldnt stop blocking as long as I hold right-clock and it still does its stuff every, say 1 Second <- confusing text?) public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer player){ if (player.capabilities.isCreativeMode || itemStack.getItemDamage() < this.getMaxDamage()) { player.setItemInUse(itemStack, this.getMaxItemUseDuration(itemStack)); if(!player.capabilities.isCreativeMode)setDamage(itemStack, itemStack.getItemDamage()+1); if (itemStack.getItemDamage() == itemStack.getMaxDamage() && player.inventory.hasItem(Items.stick)){ setDamage(itemStack, 0); } } return itemStack; }
September 11, 201411 yr Hi Setting setDamage to 0 might cause your item to be destroyed, is that what you want? If you change your item to a blocking type like the sword eg public EnumAction getItemUseAction(ItemStack p_77661_1_) { return EnumAction.block; } /** * How long it takes to use or consume an item */ public int getMaxItemUseDuration(ItemStack p_77626_1_) { return 72000; } you can use the server tick event to apply your item's effect (whatever it is) once per second, instead of using onItemRightClick -TGG
September 11, 201411 yr Author Well setDamage() and itemStack.damageItem() both interrupt my Animation (to make things more clear, its a complete block Animation, but when I hold right click, other than when using a sword, its repeatedly played). The only advantage setDamage() holds is, that it doesnt destroy the Item. So my main problem is not the action my Item performs, but rather damaging it while it is playing the block animation. Maybe its just impossible, because acctually I allways return a different and edited Item, so I suppose the Animation is played per Item.
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.