Files
CatServer/patches/net/minecraft/entity/passive/EntityOcelot.java.patch
2018-09-08 17:51:33 +08:00

49 lines
1.8 KiB
Diff

--- ../src-base/minecraft/net/minecraft/entity/passive/EntityOcelot.java
+++ ../src-work/minecraft/net/minecraft/entity/passive/EntityOcelot.java
@@ -106,7 +106,7 @@
}
}
- protected boolean canDespawn()
+ public boolean canDespawn()
{
return !this.isTamed() && this.ticksExisted > 2400;
}
@@ -165,6 +165,9 @@
return entityIn.attackEntityFrom(DamageSource.causeMobDamage(this), 3.0F);
}
+ /* CraftBukkit start
+ // Function disabled as it has no special function anymore after
+ // setSitting is disabled.
public boolean attackEntityFrom(DamageSource source, float amount)
{
if (this.isEntityInvulnerable(source))
@@ -181,6 +184,7 @@
return super.attackEntityFrom(source, amount);
}
}
+ // CraftBukkit end */
@Nullable
protected ResourceLocation getLootTable()
@@ -206,7 +210,8 @@
if (!this.worldObj.isRemote)
{
- if (this.rand.nextInt(3) == 0)
+ // CraftBukkit - added event call and isCancelled check
+ if (this.rand.nextInt(3) == 0 && !org.bukkit.craftbukkit.event.CraftEventFactory.callEntityTameEvent(this, player).isCancelled())
{
this.setTamed(true);
this.setTameSkin(1 + this.worldObj.rand.nextInt(3));
@@ -343,7 +348,7 @@
EntityOcelot entityocelot = new EntityOcelot(this.worldObj);
entityocelot.setLocationAndAngles(this.posX, this.posY, this.posZ, this.rotationYaw, 0.0F);
entityocelot.setGrowingAge(-24000);
- this.worldObj.spawnEntityInWorld(entityocelot);
+ this.worldObj.addEntity(entityocelot, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.OCELOT_BABY); // CraftBukkit - add SpawnReason
}
}