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.
This commit is contained in:
@@ -45,7 +45,8 @@ public class PathfinderGoalTame extends PathfinderGoal {
|
||||
int i = this.entity.getTemper();
|
||||
int j = this.entity.cq();
|
||||
|
||||
if (j > 0 && this.entity.aC().nextInt(j) < i) {
|
||||
// CraftBukkit
|
||||
if (j > 0 && this.entity.aC().nextInt(j) < i && !org.bukkit.craftbukkit.event.CraftEventFactory.callEntityTameEvent(this.entity, (EntityHuman) this.entity.passenger).isCancelled() && this.entity.passenger instanceof EntityHuman) {
|
||||
this.entity.g((EntityHuman) this.entity.passenger);
|
||||
this.entity.world.broadcastEntityEffect(this.entity, (byte) 7);
|
||||
return;
|
||||
@@ -54,7 +55,7 @@ public class PathfinderGoalTame extends PathfinderGoal {
|
||||
this.entity.t(5);
|
||||
}
|
||||
|
||||
this.entity.passenger.mount((Entity) null);
|
||||
if (this.entity.passenger != null) this.entity.passenger.mount((Entity) null); // CraftBukkit - Check for null
|
||||
this.entity.passenger = null;
|
||||
this.entity.cD();
|
||||
this.entity.world.broadcastEntityEffect(this.entity, (byte) 6);
|
||||
|
||||
Reference in New Issue
Block a user