1

I'm building a Minecraft "War" server where there are 2 teams. Each has a 750×750 area of the Nether to gain resources from. However, I don't want them getting onto the Nether roof and then breaking bedrock to gain access into the other team's side. I can use command blocks and commands.

8
  • I don’t exactly know the command for this, but you could just teleport anyone higher than 122 back to Y 122
    – Penguin
    Nov 29 '20 at 5:22
  • Ok, if that's possible, then that would be perfect. I don't know the command, however.
    – kanosereg
    Nov 29 '20 at 5:37
  • Yes I know it is possible through accessing player NBT Position but I am not sure how to do it, I do not doubt that someone will soon see this who does, though. However I might know, is the area you want finite or infinite (limited area or never ending area)?
    – Penguin
    Nov 29 '20 at 5:38
  • @Penguin It's probably finite. Question: "2 teams. Each team has a 750x750 area." Nov 29 '20 at 6:46
  • 2
    If you have access to commands, why not fill the nether ceiling with bedrock or barrier blocks? Then there is no easily accessible nether ceiling.
    – qwr
    Nov 29 '20 at 7:37
3

My method uses scoreboards for detecting position. Since with scoreboards you can execute if a score is in a range.

Note: This will work in a infinite area, and may cause less lag then some other methods

Hovering your mouse over italicized words will give you a short explanation/tooltip

Important: You must be in a Minecraft version of at least 1.13 for this method to work

Preparation

In Minecraft, you need to create a scoreboard objective with a dummy critera. You can do that with the following command.

scoreboard objectives create ypos dummy

After Preparation

Next, you need to have in a Repeating Command Block or a Ticking Function a command that gets the Pos[1] of all players/entities and stores it in our ypos scoreboard. The following command will accomplish that.

execute as @a at @s store result score @s ypos run data get entity @s Pos[1]

If you want it to work for all entities, replace @a with @e. Next, you need a Repeating Command Block or a Ticking Function with a command testing for players that have a ypos score of 122 or more and teleport them to 121 or lower. The following command accomplishes that.

execute as @a[scores={ypos=122..}] at @s run tp ~ 121 ~

Again, if you want this to work with entities, change the @a to @e

Summary

This method stores the ypos of every player/entity in a scoreboard, then checks to see if the ypos value is greater than or equal to 122 and if so, it will teleport them down.

1
  • A user has reported that this may also take effect in other dimensions when they don't want it to. Do you know how to fix it? Apr 3 '21 at 17:07
2

Note: The following method is for a finite area.

1.13+

Command (obviously adjust the coordinates for your needs):

/execute as @a[x=0,y=123,z=0,dx=750,dy=200,dz=750] at @s run tp @s ~ 121 ~
  • x=0..y=..z=... - Corner 1
  • dx=750..dy=..dz=... - Corner 2
  • ~ 121 ~ - Location of player, but at Y 121

1.8 - 1.12

Command (obviously adjust the coordinates for your needs):

/execute @a[x=0,y=123,z=0,dx=750,dy=200,dz=750] tp @s ~ 121 ~
  • x=0..y=..z=... - Corner 1
  • dx=750..dy=..dz=... - Corner 2
  • ~ 121 ~ - Location of player, but at Y 121

1.7-

The selector arguments dx, dy, and dz did not exist pre-1.8.

3
  • There's no point in including answers for really old versions.
    – pppery
    Nov 30 '20 at 3:53
  • @pppery why not? It doesn’t take away from the post does it?
    – Penguin
    Nov 30 '20 at 4:59
  • Suggestion: Combine this answer with an appropriately configured world border so that players cannot escape the finite area where they are intended to be.
    – Kevin
    Dec 2 '20 at 6:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.