Started by
Landein207
on
Topic category: Help with Minecraft modding (Java Edition)
I did a procedure that changes the player's dimention if dimention id isn't 1 send player to dimention 1 else send player to dimention 2 but the player changes its dimention only that it always ends up in the same place in x:1 y:54 z:-32 and no matters where player is beucause he will always stay in the same place. How can I prevent this form happening?
probably sorry my english
I managed to get this to work by setting NBT tags based on the player's coordinates, and then using those tags to move the player back to the same coordinates after changing dimensions.
Like this:
Set entity data number NBT tag ["playerXPosition"] to [Entity x position]
Set entity data number NBT tag ["playerYPosition"] to [Entity y position]
Set entity data number NBT tag ["playerZPosition"] to [Entity z position]
if [ID of dimension the provided entity is in] = [4]
do Switch dimension for provided player to Surface
Move provided entity to x: [Get entity data number NBT tag ["playerXPosition"]
Move provided entity to y: [Get entity data number NBT tag ["playerYPosition"]
Move provided entity to z: [Get entity data number NBT tag ["playerZPosition"]
else
Switch dimension for provided player to Moonscape
Move provided entity to x: [Get entity data number NBT tag ["playerXPosition"]
Move provided entity to y: [Get entity data number NBT tag ["playerYPosition"]
Move provided entity to z: [Get entity data number NBT tag ["playerZPosition"]
That's on the "right click in air" procedure for my item, by the way. It seems to work pretty well.
Thank you very much :)
You're welcome! :D