Files
CatServer/patches/net/minecraft/entity/ai/EntityAIMate.java.patch

36 lines
1.8 KiB
Diff

--- ../src-base/minecraft/net/minecraft/entity/ai/EntityAIMate.java
+++ ../src-work/minecraft/net/minecraft/entity/ai/EntityAIMate.java
@@ -107,6 +107,13 @@
entityplayer = this.targetMate.getPlayerInLove();
}
+ int experience = this.theAnimal.getRNG().nextInt(7) + 1;
+ org.bukkit.event.entity.EntityBreedEvent entityBreedEvent = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityBreedEvent(entityageable, this.theAnimal, targetMate, entityplayer, this.theAnimal.breedItem, experience);
+ if (entityBreedEvent.isCancelled()) {
+ return;
+ }
+ experience = entityBreedEvent.getExperience();
+
if (entityplayer != null)
{
entityplayer.addStat(StatList.ANIMALS_BRED);
@@ -123,7 +130,7 @@
this.targetMate.resetInLove();
entityageable.setGrowingAge(-24000);
entityageable.setLocationAndAngles(this.theAnimal.posX, this.theAnimal.posY, this.theAnimal.posZ, 0.0F, 0.0F);
- this.theWorld.spawnEntityInWorld(entityageable);
+ this.theWorld.addEntity(entityageable, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.BREEDING);
Random random = this.theAnimal.getRNG();
for (int i = 0; i < 7; ++i)
@@ -139,7 +146,8 @@
if (this.theWorld.getGameRules().getBoolean("doMobLoot"))
{
- this.theWorld.spawnEntityInWorld(new EntityXPOrb(this.theWorld, this.theAnimal.posX, this.theAnimal.posY, this.theAnimal.posZ, random.nextInt(7) + 1));
+ if (experience > 0)
+ this.theWorld.spawnEntityInWorld(new EntityXPOrb(this.theWorld, this.theAnimal.posX, this.theAnimal.posY, this.theAnimal.posZ, experience));
}
}
}