Damage / Destroy Tools Based on Damage Procedure Blocks

Started by xDovah on Tue, 01/29/2019 - 01:43

Topic category: User side tutorials

Last seen on 03:36, 31. Oct 2020
Joined Sep 2018
User points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
Damage / Destroy Tools Based on Damage Procedure Blocks
Thu, 01/31/2019 - 03:00 (edited)

MCreator 1.8.2 just recently released and already I am taking advantage of being able to use one of the program's newest features -- The item damage blocks.

Item Damage Blocks

"Get max possible damage of the provided item" and "Get damage of the provided item" are pretty self-explanatory. "Get max possible damage of the provided item" states if an item's damage has reached or surpassed the coded durability limit. "Get damage of the provided item" looks for the current damage on an item.

Now, during normal gameplay, these aren't needed, as the game automatically knows, given the coded limit, when to have an item break, like how Gold tools break in 32 uses, and Diamond, at 1,562.

However, what happens when you have an effect with a tool and, when activated, uses durability? That's where these come into play, as custom effects do not apply to the coded durability limit, allowing tools to go way into the negatives. Those of you who are familiar with my mod, DovahCraft, you may have seen something like this being done on most of my Pickaxes. Thanks to these two blocks, those errors can now be corrected. Here's an example, and a run-down on what's going on, and how it works:


Obsidian Pickaxe


The above picture is of my Obsidium Pickaxe's procedure. This can be used as a reference if need to.

Now, what's going on here?
When Right-Clicked in the air, the game looks for an Obsidium Pickaxe in the main hand. If true, then it applies a Resistance potion effect for 300 ticks, or 15 seconds, with level 2 (Resistance 3, as level 0 registers as 1, level 1 is 2, etc.). It will also deal damage of 100 durability, play a sound effect, and print a message. Now, given MCreator 1.8.2's newest update, the item will now break if the effect is used too much, i.e. using up all durability points. 

 

This post is mostly for reference to those who haven't yet used the new procedure blocks or haven't updated to 1.8.2 yet. If this helped at all, then awesome!

Edited by xDovah on Thu, 01/31/2019 - 03:00
Last seen on 03:36, 31. Oct 2020
Joined Sep 2018
User points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
Thanks! This is one of the…
Thu, 01/31/2019 - 02:55

Thanks! This is one of the biggest changes I was looking forward to for 1.8.2, among some others.