2

I run a 100% Vanilla Minecraft server, and would like to have Undead Horses that only Moderators are able to use, but I'm not sure about how to do this. I've tried to use CustomName data tags when summoning the horse and then testing for players near the horse, but do not know how to kick the player off the horse if they do not match the correct UUID.

  • This is an interesting problem. I hope there's a solution to it. – MBraedley Jun 27 '15 at 15:39
  • Fun discovery: Untamed horses with a saddle are fully rideable, but you can't access their inventory. – MrLemon Jun 27 '15 at 18:56
4

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.

  • That is way easier than my idea of untaming them, setting temper to 0 and taking off the saddle... – MrLemon Jun 27 '15 at 19:27
  • Afaik, spaces in the name break DataTags, so you might want to change the name to "ModHorse". – MrLemon Jun 27 '15 at 19:29
  • Not if they're in quotes. It works for me. – MBraedley Jun 27 '15 at 19:30
  • I already had the Mod objective on my server so as to display a list of moderators. So that's no issue! I'm testing the solution now. – Carcass Jun 27 '15 at 20:10
  • This seems to not work, but I'm not exactly sure if it is simply an issue with my setup. What exactly do you mean by "in order"? – Carcass Jun 27 '15 at 20:29

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.