I am trying to testfor a donkey in Minecraft, but if I do \

/testfor @e[type=EntityHorse] {Type:2}

then it won't work. The only way I can think of doing it is testing if the donkey has anything in its chest inventory, but I don't want the player to be able to assess the chest on the donkey, so would there be any way to maybe have a locked chest on a donkey? Also, how would I testfor if the donkey was being ridden by a player?


To "lock" the inventory, you could summon a mule with a saddle: /summon EntityHorse ~ ~ ~ {Type:2,Tame:0,SaddleItem:{id:329},ChestedHorse:1}. Summoning a horse that is not tame and giving it a saddle will make it rideable, with an inaccessable inventory. Also, testing for a mule will work using the /testfor @e[type=EntityHorse] {Type:2} syntax, so you may simply have an issue with your setup. I hope this helps!

  • Hey, sorry it took me forever to get back to you on this. My setup must have been wrong, as now it works perfectly.... Unfortunately, I forgot what I was going to use it for :/ I'll find a use for it though. Also, would you perhaps know anyway to test for a player riding on a horse/donkey? Testing for mobs with the Riding tag doesn't seem to work, so I doubt there would be a way to testfor a player with the Riding tag (Do players even get "Riding" tags?). – thezi3 Jan 22 '16 at 14:33
  • @thezi3 I'm not 100% sure, but I think /execute @a ~ ~ ~ testfor @p {Riding:{id:EntityHorse}} should work for the nearest player in 1.8+. I haven't been able to test this yet. If not, a slightly less reliable method could be used, testing for the player's height instead: /execute @a ~ ~ ~ execute @p[y=(the ground level of your world + about 2),dx=0,dy=0,dz=0] ~ ~ ~ testfor @p. For example, I could use /execute @a ~ ~ ~ execute @p[y=64,dx=0,dy=0,dz=0] ~ ~ ~ testfor @p if the ground level was 62. – Carcass Jan 28 '16 at 23:09

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.