Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-12-19 13:00:06 +01:00
SPIGOT-5257: Call EntityBreedEvent for foxes and set the child's spawn reason to BREEDING
Dieser Commit ist enthalten in:
Ursprung
1ec1b05e2a
Commit
54f4e7f958
@ -68,3 +68,35 @@
|
|||||||
this.c = this.j;
|
this.c = this.j;
|
||||||
if (this.k != null) {
|
if (this.k != null) {
|
||||||
this.l = this.k.ct();
|
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
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren