Implement Horse API. Adds BUKKIT-4424

API has been added to interface with Horses and to modify their inventories. Horse entities will now be recognized with the type EntityType.HORSE, and will no longer be UNKNOWN.

HorseJumpEvent, EntityDamageEvent, and EntityTameEvent are all correctly fired for horses.

This commit fixes BUKKIT-4393.

By: h31ix <zero_gravity@outlook.com>
This commit is contained in:
CraftBukkit/Spigot
2013-07-10 11:58:18 -04:00
parent 69a37fc533
commit 8524394d06
5 changed files with 159 additions and 33 deletions

View File

@@ -48,6 +48,7 @@ import org.bukkit.entity.AnimalTamer;
import org.bukkit.entity.Arrow;
import org.bukkit.entity.Creeper;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Horse;
import org.bukkit.entity.LightningStrike;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Pig;
@@ -492,6 +493,12 @@ public class CraftEventFactory {
return event;
}
public static HorseJumpEvent callHorseJumpEvent(Entity horse, float power) {
HorseJumpEvent event = new HorseJumpEvent((Horse) horse.getBukkitEntity(), power);
horse.getBukkitEntity().getServer().getPluginManager().callEvent(event);
return event;
}
public static EntityChangeBlockEvent callEntityChangeBlockEvent(org.bukkit.entity.Entity entity, Block block, Material material) {
return callEntityChangeBlockEvent(entity, block, material, 0);
}