Procedure to select random player returns null entity for no reason

Started by kempsridley on

Topic category: Help with Minecraft modding (Java Edition)

Joined Apr 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Procedure to select random player returns null entity for no reason

I made a procedure that uses the "for each player in the current world as entity iterator" block to make a procedure that randomly selects one player in the world by assigning a random number to each player and picking the player with the highest number (by progressively comparing them until only the highest number remains). This is the procedure. It worked seemingly fine when I tested it, but for some reason, if you leave the world and rejoin, when you try to use it again, the first time it works fine and then the second time it returns a null entity. I can't figure out why.

 

The procedure as is designed…
Tue, 03/18/2025 - 17:34

The procedure as is designed may not choose any player in some cases if condition never passes so this is normal based on your current setup