Any Block Removed Counter

Started by adamdived on

Topic category: Help with Minecraft modding (Java Edition)

Active 2 years ago
Joined May 2023
Points:
232

User statistics:

  • Modifications: 0
  • Forum topics: 1
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 1
Any Block Removed Counter

Hello everyone. I mainly code in C# and Java but i'm new in MCreator. So i hope i can get help. For a personal project i'm making with an external AI controlling the main player, i need to show in the game screen a counter that count each single block destroyed by the player. What would the best way to do it? I just need a simple counter that add 1 integer every time a block is destroyed. I created the UI with all the labels. Should i create a "custom element" and code the functions directly in there? Is there any specific API reference should i import in the script for this? Thanks in advance for any help i can receive.

Active 12 hours ago
Joined Aug 2016
Points:
3304

User statistics:

  • Modifications: 9
  • Forum topics: 63
  • Wiki pages: 20
  • MCreator plugins: 11
  • Comments: 2927
Global variable (with a…
Tue, 05/09/2023 - 22:18

Global variable (with a player scope), then add a peocddire with a global trigger "on block destroyed", check if it's broken by a player and if so, increment by one your global variable. Then, return your global variable on your overlay or GUI (using a label)

Active 2 years ago
Joined May 2023
Points:
232

User statistics:

  • Modifications: 0
  • Forum topics: 1
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 1
Thank you for the response…
Wed, 05/10/2023 - 11:36

Thank you for the response. I did what you said and it works perfectly.