Do statement local variable restriction workaround [SOLVED]

Started by SamIsCool213 on

Topic category: Help with Minecraft modding (Java Edition)

Joined Jun 2025
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Do statement local variable restriction workaround [SOLVED]
Thu, 06/26/2025 - 00:36 (edited)

I'm making a "Gate" block where custom illagers deal damage to it to try to break through. "Damage" is stored in a local variable inside an on block tick update where the block checks for illagers around it then it SHOULD damage itself accordingly. Since there will be multiple gate blocks, I can't just switch it to a global.  I LITTERALLY JUST NEED IT TO RETAIN THAT NUMBER INSIDE THE BLOCK FOR 15 TICKS IS THERE A WAY TO STORE A NUMBER ON A BLOCK!?

Edited by SamIsCool213 on Thu, 06/26/2025 - 00:36
Joined Apr 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
use an integer custom…
Tue, 06/24/2025 - 01:32

use an integer custom property in the "block states" tab of the block

Joined Jun 2025
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I forgot to mark this as…
Tue, 06/24/2025 - 21:28

I forgot to mark this as solved but thanks the way i did it is i made it into a block entity then a used an nbt tag

:)