SPIGOT-2860: Don't create 0 exp orbs when breeding

This commit is contained in:
md_5 2016-11-29 15:42:46 +11:00
parent 1c07d5c78f
commit 41ade2f291

View File

@ -1,6 +1,6 @@
--- a/net/minecraft/server/PathfinderGoalBreed.java
+++ b/net/minecraft/server/PathfinderGoalBreed.java
@@ -75,11 +75,23 @@
@@ -75,11 +75,24 @@
EntityAgeable entityageable = this.animal.createChild(this.partner);
if (entityageable != null) {
@ -20,11 +20,12 @@
+ if (entityBreedEvent.isCancelled()) {
+ return;
+ }
+ experience = entityBreedEvent.getExperience();
+ // CraftBukkit end
if (entityhuman != null) {
entityhuman.b(StatisticList.C);
@@ -94,7 +106,7 @@
@@ -94,7 +107,7 @@
this.partner.resetLove();
entityageable.setAgeRaw(-24000);
entityageable.setPositionRotation(this.animal.locX, this.animal.locY, this.animal.locZ, 0.0F, 0.0F);
@ -33,12 +34,16 @@
Random random = this.animal.getRandom();
for (int i = 0; i < 7; ++i) {
@@ -109,7 +121,7 @@
@@ -109,7 +122,11 @@
}
if (this.a.getGameRules().getBoolean("doMobLoot")) {
- this.a.addEntity(new EntityExperienceOrb(this.a, this.animal.locX, this.animal.locY, this.animal.locZ, random.nextInt(7) + 1));
+ this.a.addEntity(new EntityExperienceOrb(this.a, this.animal.locX, this.animal.locY, this.animal.locZ, entityBreedEvent.getExperience())); // CraftBukkit - use event experience
+ // CraftBukkit start - use event experience
+ if (experience > 0) {
+ this.a.addEntity(new EntityExperienceOrb(this.a, this.animal.locX, this.animal.locY, this.animal.locZ, experience));
+ }
+ // CraftBukkit end
}
}