8

I created a big adventure map and I was able to do lots of amazing things I never thought possible with redstone, but I came across a problem I was baffled by.

I have a house in minecraft that is movable. I want to know of a way I can teleport directly to my house using a command block. The catch is that my house is never in the same spot so the x,y,z coordinates are constantly changing.

One way I thought of that might possibly work would maybe have a clock set up to record my radius around my house using /setspawn so I'll constantly have my spawn position recorded; however, this isn't very good for teleporting as I would have to kill myself. There's a possible way of keeping your inventory after you die, but you would still lose exp. I don't really like the idea of dying to re-spawn as a "tele". It seems as though I'm trying to fit a square peg into a round hole.

Anyone have any ideas of a way to actually teleport using a command block to some how record your current x,y,z position in a certain radius? I am also open to plugin suggestions;however, I don't like releasing a map that requires a bunch of plugins.

Oh btw I'm on a 1.7.10 build. I know the 1.8.0 added a lot of new commands.

  • Does the structure never move more than 1 block per 1 tick? – QbsidianH20 Feb 12 '15 at 11:42
6

To teleport a player to a movable location, you'll need to use an entity. Summon a custom named entity, such as a WitherSkull, like this:

/summon WitherSkull ~ ~ ~ {CustomName:"HomeMarker",direction:[0.0,0.0,0.0]}

You haven't detailed how your house moves, but when it does, move this WitherSkull too.

Then, whenever you need to teleport back home, run something like this:

/tp @p @e[name=HomeMarker,type=WitherSkull]

Keep in mind that you cannot teleport to an unloaded entity, although if this house is "constantly" moving then you must already have it loaded.

  • This is 1.7, the @e selector is added in 1.8 – ModDL Feb 13 '15 at 0:39
  • 1
    @ModDL You're right, although the "Oh btw I'm on a 1.7.10 build" wasn't in the original question. – SirBenet Feb 13 '15 at 18:03
2

I thought of a different solution, this one should work in 1.7.

One way I thought of that might possibly work would maybe have a clock set up to record my radius around my house using /setspawn so I'll constantly have my spawn position recorded; however, this isn't very good for teleporting as I would have to kill myself. There's a possible way of keeping your inventory after you die, but you would still lose exp. I don't really like the idea of dying to re-spawn as a "tele".

Rather than killing yourself to return to spawn, you could teleport yourself to the end's overworld portal, which returns you to your spawnpoint.

You'll need to have an end portal block somewhere in the overworld to get players to the end. Teleport players to that first, then from the end teleport them to the overworld portal. This should return them home, although it will cause two loading screens.

  • Creative. Nice answer altogether, I'd have never thought of this. – Carcass May 7 '16 at 15:57
1

Get singleplayer commands. (or another thing that does similar stuff.) have a clock repeating /setspawn to teleport there via command block simply use /home command added by singleplayer commands.

0

Same concept as the last answer, though using the /spreadplayers command. Note this will teleport the player to the highest Y coordinate possible, so then you need another command block to teleport the players down.

Setup:

/scoreboard objectives add teleport dummy

Command ran in house:

/spreadplayers ~ ~ 0 1 false @a[score_teleport_min=1]

/scoreboard players set @a[<Area in which the player is teleported>] teleport 0

Teleport Command Block:

/scoreboard players set @p teleport 1
-1

Use relative coordinates of a command block to teleport all marked players to the desired area

SetUp:

/scoreboard objectives add teleport dummy

Command ran in house:

/tp @a[score_teleport_min = 1] ~ ~ ~
/scoreboard players set @a[<Area in which the player is teleported>] 0

Teleport Command Block:

/scoreboard players set @p 1
  • 1
    Tested in 1.7.10, sadly this doesn't work. It's relative to the selected player not the command block that is running teleport command. – QbsidianH20 Feb 12 '15 at 10:04
  • Unfortunately they made /tp kind of a special case. Unlike other commands such as /playsound where the coordinates are relative to the executer, tp coordinates are relative to the target. – SirBenet Feb 12 '15 at 19:46

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.