Help with coding

Started by Patsore on

Topic category: User side tutorials

Active 4 years ago
Joined Jul 2020
Points:
601

User statistics:

  • Modifications: 0
  • Forum topics: 1
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 0
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.

Active 2 years ago
Joined Jul 2020
Points:
649

User statistics:

  • Modifications: 0
  • Forum topics: 2
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 84
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.