How do I get the entity position after a dimension change?

Started by DerexXD on

Topic category: Help with Minecraft modding (Java Edition)

Joined Jan 2016
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
How do I get the entity position after a dimension change?

I have a block that takes you to another dimension when right clicked

However, I want to make sure they do not suffocate so I made two add block at the entity position, they both add air

But this is only adding the blocks it to the overworld coordinates, not the new ones in the other dimension. Any help? 

Joined May 2017
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
the x y and z values in the…
Mon, 09/23/2019 - 13:25

the x y and z values in the new dimension should be the same, just make sure the actual procedure is being called in the new dimension and not the overworld

Joined Jan 2017
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
As seph said, you have the…
Mon, 09/23/2019 - 13:43

As seph said, you have the call the dimension first, then set it to air.

Joined Jan 2016
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
yes, I'm calling the…
Mon, 09/23/2019 - 23:49

yes, I'm calling the coordinates after they move dimensions though 

Joined Aug 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Hey Derex. You can do this…
Tue, 09/24/2019 - 20:30

Hey Derex. You can do this through:

OnBlockRightClicked:

Switch dimension for provided (entity)player to [ID]

Set entity data logic NBT tag to "JustTeleportedToID"
OnPlayerUpdateTick:

If Get entity data logic NBT tag "JustTeleportedToID" = true AND Get dimension id of provided world [ID]

do Place air at x y z

do Place air at x y+1 z

do Set entity data logic NBT tag "JustTeleportedToID" to false.

You wont be teleported to the same coordinates however, but you can if you simply store the player coordinates in NBT tags and teleport the player there, then playing the second procedure.

Joined Aug 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
OnBlockRightClicked: Switch…
Tue, 09/24/2019 - 20:32
OnBlockRightClicked:

Switch dimension for provided (entity)player to [ID]

Set entity data logic NBT tag "JustTeleportedToID" to true

correction*

Joined Aug 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Additionally, you might want…
Tue, 09/24/2019 - 20:39

Additionally, you might want to delete 4 blocks of air as you are spawned at the vertices of a block and not in the middle. Hope that helps.

Joined Jan 2016
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
ok i'll try that 
Tue, 09/24/2019 - 22:36

ok i'll try that 

Joined Jan 2016
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
thanks guys! It worked!
Tue, 03/03/2020 - 02:36

thanks guys! It worked!