Teleport player to the Nether safely

Started by jmods on

Topic category: Help with Minecraft modding (Java Edition)

Joined Jun 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Teleport player to the Nether safely

Are there any tutorials on safe teleporting?

I've basically made my own version of a netherportal that when a player collides with it they teleport to the nether, however this teleports them under the world and instantly kills them. How can I make it so when they're teleported they're in a safe spot (i.e. not in lava, below/above bedrock and not in the air)?

I can't seem to find any tutorials. I'm a complete noob at this, this is my first mod with McCreator so I apologise if I ask simply questions

Joined Jun 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I am also new here. I will…
Tue, 06/06/2023 - 11:34

I am also new here. I will try and create something similar and get back to you.

Joined Jun 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Thank you. I can’t for the…
Tue, 06/06/2023 - 16:13

Thank you. I can’t for the life of me work it out

Joined Jun 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Hello. I have an idea. What…
Tue, 06/06/2023 - 17:45

Hello. I have an idea. What if, you found the coordinates of a structure or feature like a fortress, and teleport to that. I haven't tried it yet though.

Joined Oct 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Hi, I have an idea for you…
Wed, 06/07/2023 - 15:56

Hi, I have an idea for you. Maybe first turn the blocks in a 5x5x5 cube around you into air, then into a hollow glass cage. When you teleport, immediately set the y coordinate of the player to something higher than the sea level for lava in the nether so you dont have to worry about that.

Joined Jun 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
What if they have silk touch…
Thu, 06/08/2023 - 13:41

What if they have silk touch and use it for farming glass? I would say make a new block that cannot be obtained, but can be broken.

Joined Nov 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
The chorus fruit…
Tue, 06/27/2023 - 23:37

The chorus fruit teleportation never teleports you inside a block.

Building off its algorithm, I'd suggest something like:

  1. Check random points in an increasingly large cube around where your target location is.
  2. For each one, make sure the block and the block above it both have air.

For the first one, I would probably do something like this:

float size = 1;
int x = 0;
int y = 0;
int z = 0;
while (true) {
    x = Math.floor(Math.random() * size * 2) - size;
    y = Math.floor(Math.random() * size * 2) - size;
    z = Math.floor(Math.random() * size * 2) - size;
    if (validPositionBySomeMeasure(x, y, z)) {
        break;
    }
    size += 0.4;
}

I would also recommend putting some sort of limit on the while loop.