Paper/nms-patches/EntityOcelot.patch

41 lines
1.6 KiB
Diff

--- a/net/minecraft/server/EntityOcelot.java
+++ b/net/minecraft/server/EntityOcelot.java
@@ -57,7 +57,7 @@
}
protected boolean isTypeNotPersistent() {
- return !this.isTamed() && this.ticksLived > 2400;
+ return !this.isTamed() /*&& this.ticksLived > 2400*/; // CraftBukkit
}
protected void initAttributes() {
@@ -108,7 +108,8 @@
return false;
} else {
if (this.goalSit != null) {
- this.goalSit.setSitting(false);
+ // CraftBukkit - moved into EntityLiving.d(DamageSource, float)
+ // this.goalSit.setSitting(false);
}
return super.damageEntity(damagesource, f);
@@ -133,7 +134,8 @@
}
if (!this.world.isClientSide) {
- if (this.random.nextInt(3) == 0) {
+ // CraftBukkit - added event call and isCancelled check
+ if (this.random.nextInt(3) == 0 && !org.bukkit.craftbukkit.event.CraftEventFactory.callEntityTameEvent(this, entityhuman).isCancelled()) {
this.c(entityhuman);
this.setCatType(1 + this.world.random.nextInt(3));
this.p(true);
@@ -237,7 +239,7 @@
entityocelot.setPositionRotation(this.locX, this.locY, this.locZ, this.yaw, 0.0F);
entityocelot.setAgeRaw(-24000);
- this.world.addEntity(entityocelot);
+ this.world.addEntity(entityocelot, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.OCELOT_BABY); // CraftBukkit - add SpawnReason
}
}