Unable to create a loop that damages the player

Started by Star60 on

Topic category: Help with modding (Java Edition)

Last seen on 08:40, 11. May 2024
Joined Dec 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Unable to create a loop that damages the player

I haven't used Mcreator a lot and don't have an extensive programming history so I apologize if what I'm asking sounds like common sense to know.

I'm trying to create a simple mod, the goal I'm trying to achieve is to make the air in the overworld toxic to players so they're forced to stay in the nether unless they create a special potion to negate the negative effects.

Everything works except for the part where the code is meant to damage the player, it just doesn't run for some reason and I don't know why. I've used print blocks to follow each step the procedure is taking but have been unable to get the Minecraft to actually run the part of the procedure that damages the player.

This is the procedure, I assume it's really inefficient but again I'm not too well versed in this sort of thing. I hope to be one day though


The console doesn't print "Player is in the Overworld" or anything after that so I assume something is going wrong at the "While" block or I've misused it. I originally tried using a "Repeat" block but that just made the procedure run the code X amount of times on the same tick which instantly killed the player and isn't what I want.

If anyone's able to lend a hand on this I'd be very appreciative.