Help with dimensional teleportation and coordinates

Started by Onyx12133 on

Topic category: Help with modding (Java Edition)

Last seen on 00:48, 15. Nov 2021
Joined Oct 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Help with dimensional teleportation and coordinates

I'm trying to make an item that teleports you between a custom dimension and the overworld while keeping them at the same X Y Z coordinates. The code is working, but I'm wondering how you could make the Y value increase by 1 If the target block is occupied (to prevent suffocation when teleporting) until the target block is no longer occupied. my code so far is: 

note: to distinguish between coordinates and variable I will put brackets around variables Example: [X]

Set Local [X] to: X position of entity

Set Local [Z] to: Z position of entity

Set Local [Y[ to: Y position of Entity

If: ID of dimension entity is in = surface

Do: Switch dimension of entity to (custom dimension)

Set location of entity to x: [X] y: [Y] z: [Z]

 

Else if: ID of dimension entity is in = (custom dimension)

Do: Switch dimension of entity to surface

Set location of entity to x: [X] y: [Y] z: [Z]