-1

So I was following this tutorial (the answer from randomuser922) How can I block people getting onto the roof of the Nether in Minecraft?

which creates a dummy and stores the y value of all players to a scoreboard then using another command block it will teleport them if they go above a certain height.

This does work BUT it also happens in the overworld and I can't seem to figure out how to make it happen only for the nether?

I would assume I would also need to get the dimension from the nbt tag, so ypos = 128 and dimension = nether but I'm not 100% sure on the syntax as all the examples seem to be for older versions that 1.16.5

Can anyone help me out please?

3
  • 2
    Possible duplicate of How to make a teleport command that does not work in the Nether?
    – pppery
    Apr 3, 2021 at 14:02
  • 3
    I don't agree with that duplicate because it asks for a not. There is likely a better way and even if there's not it's not the same question.
    – Penguin
    Apr 4, 2021 at 3:03
  • 3
    Yeah the suggested duplicate doesn't answer anything, the similar question I actually linked too funnily enough is closer minus a few needed details. I have since figured out the syntax on my own and will likely post later for people who actually want to keep people from glitching onto the nether roof. This is because the nether roof is the original height of 128 vs the new height of 256 in the overworld.
    – John B
    Apr 4, 2021 at 10:25

1 Answer 1

-1

I was able to fix you problem by also testing if the player was in the nether.

The first command puts the Y position in a score by grabbing the second value from the players Pos nbt:

/execute as @a store result score @s YPos run data get entity @s Pos.[1]

The second command teleports any player with YPos score of 128 or higher, and an nbt of Dimension:"minecraft:the_nether" down one block:

execute as @a[scores={YPos=128..},nbt={Dimension:"minecraft:the_nether"}] at @s run tp ~ ~-1 ~

Pretty simple setup with just 2 commands: Command chain

1
  • 1
    instead of checking NBT you can use execute in minecraft:the_nether as @a[distance=0..] to execute only at players who are in the nether.
    – Plagiatus
    Apr 11 at 5:46

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .