Started by
chaoticDreemur
on
Topic category: Help with Minecraft modding (Java Edition)
Hi!
I'm trying to add a back command to my mod (basically like those plugins for servers) that teleports you to your last death location. I was obviously able to set up the command, but I'm trying to also have a procedure that activates when you die and stores your death coordinates for the sake of the command. Problem is, I have no idea how to do that. Is there a way for that to be possible with MCreator?
You basically create three custom global variable, it must be "PLAYER_PERSISTENT" of type "number". Those are the player coordinates.
Then create a procedure, make sure the global trigger is set to "Entity dies". Add an if statement that checks if the entity that died is the player. inside the if statement, set the global variables to the player coordinates.
Finally, create a procedure from your command element "When command executed" trigger. In the procedure, drag out "Set Location of Entity to:" then replace the x, y, and z with the 3 global variables.
I haven't tested if it works or not, so you better try it out.