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

Started by DerexXD on

Topic category: Help with Minecraft modding (Java Edition)

Active 1 month ago
Joined Jan 2016
Points:
956

User statistics:

  • Modifications: 0
  • Forum topics: 32
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 177
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? 

Active 5 years ago
Joined May 2017
Points:
743

User statistics:

  • Modifications: 0
  • Forum topics: 6
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 39
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

Active 8 months ago
Joined Jan 2017
Points:
950

User statistics:

  • Modifications: 0
  • Forum topics: 23
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 274
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.

Active 1 month ago
Joined Jan 2016
Points:
956

User statistics:

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

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

Active 5 years ago
Joined Aug 2019
Points:
1024

User statistics:

  • Modifications: 0
  • Forum topics: 31
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 450
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.

Active 5 years ago
Joined Aug 2019
Points:
1024

User statistics:

  • Modifications: 0
  • Forum topics: 31
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 450
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*

Active 5 years ago
Joined Aug 2019
Points:
1024

User statistics:

  • Modifications: 0
  • Forum topics: 31
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 450
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.

Active 1 month ago
Joined Jan 2016
Points:
956

User statistics:

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

ok i'll try that 

Active 1 month ago
Joined Jan 2016
Points:
956

User statistics:

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

thanks guys! It worked!