Help with coding

Started by Patsore on

Topic category: User side tutorials

Last seen on 09:16, 30. Jul 2020
Joined Jul 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Help with coding

Ok, so. I'm trying to make a mod with tools that can be upgraded when a certain amount of actions with them is met. E.g. After breaking 100 blocks with a pickaxe you will be able to unlock some upgrade to it. The thing I'm struggling with is a counter for how many blocks you've mined with that pick.

Last seen on 21:12, 25. Jul 2022
Joined Jul 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
For a custom tool you can…
Tue, 07/28/2020 - 08:48

For a custom tool you can make a procedure that sets an item NBT number tag (set it equal to 0) to the item. Call this procedure in the "when item crafted/smelted" trigger.

Then, make another procedure that says:

IF item NBT tag > 100 (meaning you broke more than 100 blocks),

DO set item in main hand = (upgraded version of item),

ELSE set item NBT tag = (get) item NBT tag + 1

Call this second procedure in the "When block destroyed with tool" trigger.