Minecraft – ny way to make horses unable to jump

minecraft-commandsminecraft-java-edition

I made a horse track in Minecraft, but I don't want people to be able to jump over the starting gate at the beginning. I tried using /effect @e 8 1000000 150, which made me unable to jump but made the horses jump really high. How can I make it so that they can't jump either?

Best Answer

You can use a negative value of jump boost effect to achieve a corrupted jump boost (which, in effect, makes an entity unable to jump). You can't use the /effect command to do this, though, you have to edit the entity data manually. Which can be done like so:

/entitydata @e[type=EntityHorse] {ActiveEffects:[{Id:8,Amplifier:-128,Duration:600,Ambient:0}]}

Where Duration is measured in ticks. So 600 ticks will give you around 30 seconds of no jumping. Adjust this value depending on what you want. This is the best solution if you want just a temporary "no jump" effect.

If you want this to be permanent, that can be done too. Horses also have a horse.jumpStrength attribute in their NBT data. If you want to make all horses unable to jump, you can change that value to '0' with the following command:

/entitydata @e[type=EntityHorse] {Attributes:[{Name:"horse.jumpStrength",Base:0}]}

This will make all horses completely unable to jump. You can reset this by setting the value to some other value, however, that will set the overall jump strength for all horses to be the same, which may or may not be what you want.