2

So I'm trying to build a custom map, and I don't want people to be entering nether if someone would build a portal.

With only command blocks or just commands, is it be possible for the nether portal not teleport you anywhere, teleport you a few blocks away from it, or just teleport you back into the map's center? (In singleplayer)

  • I assume survival, and 1.8, right? – Ghalid Feb 27 '16 at 17:53
  • Well, the player who is playing the map, is going to be in survival, yes. And the map is going to be in 1.9, but I assume 1.8 solutions might also work – MrWhiteee Feb 27 '16 at 17:55
2

First, have a repeating command block set to Always Active testing for a minecraft:portal block(the purple part of the nether portal):

/execute @p ~ ~ ~ testforblock ~ ~ ~ minecraft:portal

It will point into another repeating command block, also Always Active, and it will also be set to Conditional, using /spreadplayers to teleport them 2-4 blocks out of the portal.

/execute @p ~ ~ ~ spreadplayers ~ ~ 2 4 true @p

The reason /execute is used is to teleport them within a 2-4 block range of where they are currently.

  • Whoops, I typed /execute @p ~ ~ ~ spreadplayers ~ ~ 2 4 true wrong. Fixed. – Ghalid Feb 27 '16 at 18:12
  • Thanks, I kind of changed the second command into teleporting a player into map's center, because for some reason the spreadplayers command didn't work. – MrWhiteee Feb 27 '16 at 18:12
  • Yea, I changed it wrong again, lol. The correct command is /execute @p ~ ~ ~ spreadplayers ~ ~ 2 4 true @p. But your way works too! – Ghalid Feb 27 '16 at 18:13
  • 2
    @p will not work for multiplayer, since it only targets the player closest to the command block. Use @a and @a[c=1] in the execute and subsequent commands, respectively, instead. – MrLemon Feb 27 '16 at 20:31
  • 2
    Also, you can condense this to a single command by using execute's detect scheme instead of testforblock: /execute @a ~ ~ ~ detect ~ ~ ~ minecrat:portal -1 spreadplayers ~ ~ 2 4 true @a[c=1]. – MrLemon Feb 27 '16 at 20:33

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.