Jump to content

Recommended Posts

Posted

I have a custom item which i want to apply damage to when i click a custom block. The whole point to it is that after clicking a block, it takes one more damage until its damage is at 0 and must click another block for it to "refill" the damage before being used again. In the items constructor i set the max damage to 16. In the items use method, after all other logic is done, i call the items set damage method and set it as 1 lower than what it currently is. Also when i click on another certain block im calling the set damage method to the items max damage, as in the item gets fully repaired (without using anvils). In game this doesnt work, and no damage bar is shown on the item. I cannot post my code as im not home on my computer. So basically the question is how do i allow an item to lower its damage when clicked on a certain block, and how can the items damage "refill" after clicking another block. Or in better terms, how does minecraft handle item damage to items that are not considered tools?

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

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