Files
2019-02-24 22:29:41 +08:00

53 lines
2.2 KiB
Diff

--- ../src-base/minecraft/net/minecraft/entity/passive/EntityOcelot.java
+++ ../src-work/minecraft/net/minecraft/entity/passive/EntityOcelot.java
@@ -106,9 +106,9 @@
}
}
- protected boolean canDespawn()
+ public boolean canDespawn()
{
- return !this.isTamed() && this.ticksExisted > 2400;
+ return !this.isTamed() /*&& this.ticksExisted > 2400*/; // CraftBukkit
}
protected void applyEntityAttributes()
@@ -189,7 +189,8 @@
{
if (this.aiSit != null)
{
- this.aiSit.setSitting(false);
+ // CraftBukkit - moved into EntityLiving.damageEntity(DamageSource, float)
+ // this.aiSit.setSitting(false);
}
return super.attackEntityFrom(source, amount);
@@ -222,7 +223,8 @@
if (!this.world.isRemote)
{
- if (this.rand.nextInt(3) == 0)
+ // CraftBukkit - added event call and isCancelled check
+ if (this.rand.nextInt(3) == 0 && !net.minecraftforge.event.ForgeEventFactory.onAnimalTame(this, player) && !org.bukkit.craftbukkit.event.CraftEventFactory.callEntityTameEvent(this, player).isCancelled())
{
this.setTamedBy(player);
this.setTameSkin(1 + this.world.rand.nextInt(3));
@@ -320,7 +322,7 @@
IBlockState iblockstate = this.world.getBlockState(blockpos.down());
Block block = iblockstate.getBlock();
- if (block == Blocks.GRASS || iblockstate.getMaterial() == Material.LEAVES)
+ if (block == Blocks.GRASS || block.isLeaves(iblockstate, this.world, blockpos.down()))
{
return true;
}
@@ -368,7 +370,7 @@
EntityOcelot entityocelot = new EntityOcelot(this.world);
entityocelot.setLocationAndAngles(this.posX, this.posY, this.posZ, this.rotationYaw, 0.0F);
entityocelot.setGrowingAge(-24000);
- this.world.spawnEntity(entityocelot);
+ this.world.addEntity(entityocelot, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.OCELOT_BABY);
}
}