diff --git a/nms-patches/EntityFox.patch b/nms-patches/EntityFox.patch index 34ed37a107..d96d9e3156 100644 --- a/nms-patches/EntityFox.patch +++ b/nms-patches/EntityFox.patch @@ -68,3 +68,35 @@ this.c = this.j; if (this.k != null) { this.l = this.k.ct(); +@@ -1225,6 +1230,14 @@ + if (entityplayer1 != null && entityplayer != entityplayer1) { + entityfox.b(entityplayer1.getUniqueID()); + } ++ // CraftBukkit start - call EntityBreedEvent ++ int experience = this.animal.getRandom().nextInt(7) + 1; ++ org.bukkit.event.entity.EntityBreedEvent entityBreedEvent = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityBreedEvent(entityfox, animal, partner, entityplayer, this.animal.breedItem, experience); ++ if (entityBreedEvent.isCancelled()) { ++ return; ++ } ++ experience = entityBreedEvent.getExperience(); ++ // CraftBukkit end + + if (entityplayer2 != null) { + entityplayer2.a(StatisticList.ANIMALS_BRED); +@@ -1239,10 +1252,14 @@ + this.partner.resetLove(); + entityfox.setAgeRaw(-24000); + entityfox.setPositionRotation(this.animal.locX, this.animal.locY, this.animal.locZ, 0.0F, 0.0F); +- this.b.addEntity(entityfox); ++ this.b.addEntity(entityfox, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.BREEDING); // CraftBukkit - added SpawnReason + this.b.broadcastEntityEffect(this.animal, (byte) 18); + if (this.b.getGameRules().getBoolean(GameRules.DO_MOB_LOOT)) { +- this.b.addEntity(new EntityExperienceOrb(this.b, this.animal.locX, this.animal.locY, this.animal.locZ, this.animal.getRandom().nextInt(7) + 1)); ++ // CraftBukkit start - use event experience ++ if (experience > 0) { ++ this.b.addEntity(new EntityExperienceOrb(this.b, this.animal.locX, this.animal.locY, this.animal.locZ, experience)); ++ } ++ // CraftBukkit end + } + + }