Problem with item as a portal

Started by Landein207 on

Topic category: Help with modding (Java Edition)

Last seen on 10:25, 10. Jun 2020
Joined Dec 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Problem with item as a portal

 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

Last seen on 20:35, 13. Jun 2023
Joined Feb 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I managed to get this to…
Mon, 02/17/2020 - 18:15

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.

Last seen on 10:25, 10. Jun 2020
Joined Dec 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Thank you very much :)
Tue, 02/18/2020 - 19:47

Thank you very much :)

Last seen on 20:35, 13. Jun 2023
Joined Feb 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
You're welcome! :D
Tue, 02/18/2020 - 20:31

You're welcome! :D