2015-05-25 12:37:24 +02:00
|
|
|
--- a/net/minecraft/server/PathfinderGoalBreed.java
|
|
|
|
+++ b/net/minecraft/server/PathfinderGoalBreed.java
|
2019-04-23 04:00:00 +02:00
|
|
|
@@ -82,11 +82,24 @@
|
2016-02-29 22:32:46 +01:00
|
|
|
EntityAgeable entityageable = this.animal.createChild(this.partner);
|
2014-11-25 22:32:16 +01:00
|
|
|
|
|
|
|
if (entityageable != null) {
|
|
|
|
+ // CraftBukkit start - set persistence for tame animals
|
|
|
|
+ if (entityageable instanceof EntityTameableAnimal && ((EntityTameableAnimal) entityageable).isTamed()) {
|
|
|
|
+ entityageable.persistent = true;
|
|
|
|
+ }
|
|
|
|
+ // CraftBukkit end
|
2017-05-14 04:00:00 +02:00
|
|
|
EntityPlayer entityplayer = this.animal.getBreedCause();
|
2014-11-25 22:32:16 +01:00
|
|
|
|
2017-05-14 04:00:00 +02:00
|
|
|
if (entityplayer == null && this.partner.getBreedCause() != null) {
|
|
|
|
entityplayer = this.partner.getBreedCause();
|
2016-06-19 07:00:39 +02:00
|
|
|
}
|
|
|
|
+ // CraftBukkit start - call EntityBreedEvent
|
|
|
|
+ int experience = this.animal.getRandom().nextInt(7) + 1;
|
2017-05-14 04:00:00 +02:00
|
|
|
+ org.bukkit.event.entity.EntityBreedEvent entityBreedEvent = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityBreedEvent(entityageable, animal, partner, entityplayer, this.animal.breedItem, experience);
|
2016-06-19 07:00:39 +02:00
|
|
|
+ if (entityBreedEvent.isCancelled()) {
|
|
|
|
+ return;
|
|
|
|
+ }
|
2016-11-29 05:42:46 +01:00
|
|
|
+ experience = entityBreedEvent.getExperience();
|
2016-06-19 07:00:39 +02:00
|
|
|
+ // CraftBukkit end
|
|
|
|
|
2017-05-14 04:00:00 +02:00
|
|
|
if (entityplayer != null) {
|
2018-07-15 02:00:00 +02:00
|
|
|
entityplayer.a(StatisticList.ANIMALS_BRED);
|
2019-04-23 04:00:00 +02:00
|
|
|
@@ -99,10 +112,14 @@
|
2016-02-29 22:32:46 +01:00
|
|
|
this.partner.resetLove();
|
2014-11-25 22:32:16 +01:00
|
|
|
entityageable.setAgeRaw(-24000);
|
2016-02-29 22:32:46 +01:00
|
|
|
entityageable.setPositionRotation(this.animal.locX, this.animal.locY, this.animal.locZ, 0.0F, 0.0F);
|
2018-07-15 02:00:00 +02:00
|
|
|
- this.b.addEntity(entityageable);
|
|
|
|
+ this.b.addEntity(entityageable, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.BREEDING); // CraftBukkit - added SpawnReason
|
2019-04-23 04:00:00 +02:00
|
|
|
this.b.broadcastEntityEffect(this.animal, (byte) 18);
|
2019-06-21 12:00:00 +02:00
|
|
|
if (this.b.getGameRules().getBoolean(GameRules.DO_MOB_LOOT)) {
|
2019-04-23 04:00:00 +02:00
|
|
|
- this.b.addEntity(new EntityExperienceOrb(this.b, this.animal.locX, this.animal.locY, this.animal.locZ, this.animal.getRandom().nextInt(7) + 1));
|
2016-11-29 05:42:46 +01:00
|
|
|
+ // CraftBukkit start - use event experience
|
|
|
|
+ if (experience > 0) {
|
2018-07-15 02:00:00 +02:00
|
|
|
+ this.b.addEntity(new EntityExperienceOrb(this.b, this.animal.locX, this.animal.locY, this.animal.locZ, experience));
|
2016-11-29 05:42:46 +01:00
|
|
|
+ }
|
|
|
|
+ // CraftBukkit end
|
2016-06-19 07:00:39 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|