Getting player entity from username string

Started by NayNayF11 on

Topic category: Help with Minecraft modding (Java Edition)

Joined Jan 2026
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Getting player entity from username string
Wed, 02/25/2026 - 01:22 (edited)

I'm making a custom Lifesteal mod and in it I'm adding a special block to revive players who have run out of hearts. The way you select a player is by entering their username, inserting a certain item, and pressing a confirm button which is linked to a procedure. I need some way to check if the username entered is the username of a person in the server or not, and get the player from it so it can revive them. Is there any way to do this using just procedure code or do I need to include a custom JSON file?

EDIT: I figured it out from another post on the forum here

 

Edited by NayNayF11 on Wed, 02/25/2026 - 01:22