The final bit that you need is to just teleport the non-mod player, like so: tp @p ~ ~ ~
(of course, you're probably going to execute
that command at the horse). This works because the teleport moves the target, and everything that is riding it, but not the things that the target is riding.
But that's just the bit you were missing, my full solution is below.
First things first, you're going to have to give your mod horses custom names. They can be unique, but it makes it easier if they're all the same. For my example, I'll just use "Mod Horse".
Next, you'll need two scoreboard objectives, isRiding
and isMod
. I have to admit that I don't really like having to use the isMod
objective, but for my solution to work, it's unavoidable.
The final step is to have 4 command blocks triggered by a 20Hz fill clock. In order, those commands are:
scoreboard players add @a isMod 0
scoreboard players set @a isRiding 0
scoreboard players set @a isRiding 1 {Riding:{CustomName:"Mod Horse"}}
tp @a[score_isRiding_min=1,score_isMod=0] ~ ~ ~
The first command ensures that everyone always has a score in the isMod
objective, the second and third commands reset the isRiding
score, then set the score for anyone riding an entity named "Mod Horse" (this can be abused, by the way), and the fourth command teleports anyone riding a mod horse who isn't a mod to the same spot they were in, effectively knocking them off the horse.
Of course, you're also going to have to set the isMod
score for all your mods, but that's easy with /scoreboard players set <mod name> isMod 1
.
At the beginning, in order:
/scoreboard objectives add id dummy
/scoreboard players set @r[score_id=0] id 1
/scoreboard players set @r[score_id=0] id 2
/scoreboard players set @r[score_id=0] id 3
...
On checkpoint reached:
/execute @p[score_id=1,score_id_min=1] ~ ~ ~ detect ~ ~-1 ~ minecraft:diamond_ore 0 summon ArmorStand ~ ~ ~ {customName:'1'}
/kill @e[type=ArmorStand,name:'1',rm=3]
(repeat for all players, replacing all the 1's except the middle '~-1' with the player's id)
On fail:
/execute @p[score_id=1,score_id_min=1] ~ ~ ~ detect ~ ~-1 ~ minecraft:lit_redstone_ore 0 tp @p @e[type=ArmorStand,name='1'
(repeat for all players, replacing all the 1's except the right middle '~-1' with the player's id)
Best Answer
I removed the tag from the first command as it is not formatted correctly and is not needed. Here is the command I used:
Your command to teleport uses the tag target selector argument(
tag=test
), which is used with scoreboard tags. It is easier to use the name argument(name=test
).This would give you:
/tp @e[name=test,c=1] @p
I ran this command and it does run properly. If you wanted to be more specific in selecting you could add
type=wolf
to the target selector.This would give you:
/tp @e[name=test,c=1,type=wolf] @p
This teleports them to the nearest player(
@p
). You can then be more specific with the target selector for the player to teleport them to.Also, to note, if you were to name the passenger and teleport the passenger, it would split them up and only teleport the passenger.