PaperMC/nms-patches/EntityOcelot.patch
2015-03-04 09:48:58 +00:00

48 lines
1.9 KiB
Diff

--- /home/matt/mc-dev-private//net/minecraft/server/EntityOcelot.java 2015-02-26 22:40:22.643608139 +0000
+++ src/main/java/net/minecraft/server/EntityOcelot.java 2015-02-26 22:40:22.643608139 +0000
@@ -51,7 +51,7 @@
}
protected boolean isTypeNotPersistent() {
- return !this.isTamed() && this.ticksLived > 2400;
+ return !this.isTamed() /*&& this.ticksLived > 2400*/; // CraftBukkit
}
protected void initAttributes() {
@@ -96,6 +96,9 @@
return entity.damageEntity(DamageSource.mobAttack(this), 3.0F);
}
+ /* CraftBukkit start
+ // Function disabled as it has no special function anymore after
+ // setSitting is disabled.
public boolean damageEntity(DamageSource damagesource, float f) {
if (this.isInvulnerable(damagesource)) {
return false;
@@ -104,6 +107,7 @@
return super.damageEntity(damagesource, f);
}
}
+ // CraftBukkit end */
protected void dropDeathLoot(boolean flag, int i) {}
@@ -124,7 +128,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.setTamed(true);
this.setCatType(1 + this.world.random.nextInt(3));
this.setOwnerUUID(entityhuman.getUniqueID().toString());
@@ -231,7 +236,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
}
}