TransWikia.com

How do I prevent players from riding a donkey, but still be able to access its inventory?

Arqade Asked by random user 922 on July 23, 2020

I am trying to make a data pack in Minecraft 1.16 where you can equip gear without taking up space in the player’s inventory. I have it set up that when a player holds a specific item, a donkey is teleported in front of them. So then the player can access its inventory, but I don’t want the players riding the donkey. How do I make the donkey unrideable, but players can still access its inventory. I tried putting an armor stand on the donkey that works to prevent me from riding the donkey, but I can’t access the donkey’s inventory. I can’t use a chest in a minecart because I can’t make that invisible without removing the minecart texture (which I don’t want to do). If mules work but donkeys don’t that’s fine.
Any Ideas?

One Answer

While this doesn't directly answer the question, it is possible to use a command block to forcibly dismount the player if they do ride the donkey. This isn't perfect, because it still shows the "Press shift to dismount" screen, but it does prevent the player from riding. To do this, run

/execute as @a[nbt={RootVehicle:{Entity:{id:"minecraft:donkey"}}}] at @s run tp @s ~ ~ ~

in a repeating command block. (A player automatically stops riding when they are teleported)

The above command prevents the player from riding all donkeys. If you want to only effect some donkeys, then best way to do this is using a tag: summon the donkey you want to be unridable with Tags:["dummy"] and change the above command to:

/execute as @a[nbt={RootVehicle:{Entity:{id:"minecraft:donkey",Tags:["dummy"]}}}] at @s run tp @s ~ ~ ~

Answered by pppery on July 23, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP