diff options
Diffstat (limited to 'patch-remap/mache-spigotflower-stripped/net/minecraft/world/entity/animal/Fox.java.patch')
-rw-r--r-- | patch-remap/mache-spigotflower-stripped/net/minecraft/world/entity/animal/Fox.java.patch | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/patch-remap/mache-spigotflower-stripped/net/minecraft/world/entity/animal/Fox.java.patch b/patch-remap/mache-spigotflower-stripped/net/minecraft/world/entity/animal/Fox.java.patch new file mode 100644 index 0000000000..5d38bfb8b9 --- /dev/null +++ b/patch-remap/mache-spigotflower-stripped/net/minecraft/world/entity/animal/Fox.java.patch @@ -0,0 +1,62 @@ +--- a/net/minecraft/world/entity/animal/Fox.java ++++ b/net/minecraft/world/entity/animal/Fox.java +@@ -542,7 +523,8 @@ + protected void pickUpItem(ItemEntity itementity) { + ItemStack itemstack = itementity.getItem(); + +- if (this.canHoldItem(itemstack)) { ++ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityPickupItemEvent(this, itemEntity, itemstack.getCount() - 1, !this.canHoldItem(itemstack)).isCancelled()) { // CraftBukkit - call EntityPickupItemEvent ++ itemstack = itemEntity.getItem(); // CraftBukkit - update ItemStack from event + int i = itemstack.getCount(); + + if (i > 1) { +@@ -928,6 +884,16 @@ + if (serverplayer1 != null && serverplayer != serverplayer1) { + fox.addTrustedUUID(serverplayer1.getUUID()); + } ++ // CraftBukkit start - call EntityBreedEvent ++ entityfox.setAge(-24000); ++ entityfox.moveTo(this.animal.getX(), this.animal.getY(), this.animal.getZ(), 0.0F, 0.0F); ++ 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 (serverplayer2 != null) { + serverplayer2.awardStat(Stats.ANIMALS_BRED); +@@ -938,12 +904,14 @@ + this.partner.setAge(6000); + this.animal.resetLove(); + this.partner.resetLove(); +- fox.setAge(-24000); +- fox.moveTo(this.animal.getX(), this.animal.getY(), this.animal.getZ(), 0.0F, 0.0F); +- serverlevel.addFreshEntityWithPassengers(fox); ++ worldserver.addFreshEntityWithPassengers(entityfox, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.BREEDING); // CraftBukkit - added SpawnReason + this.level.broadcastEntityEvent(this.animal, (byte) 18); + if (this.level.getGameRules().getBoolean(GameRules.RULE_DOMOBLOOT)) { +- this.level.addFreshEntity(new ExperienceOrb(this.level, this.animal.getX(), this.animal.getY(), this.animal.getZ(), this.animal.getRandom().nextInt(7) + 1)); ++ // CraftBukkit start - use event experience ++ if (experience > 0) { ++ this.level.addFreshEntity(new ExperienceOrb(this.level, this.animal.getX(), this.animal.getY(), this.animal.getZ(), experience)); ++ } ++ // CraftBukkit end + } + + } +@@ -1367,7 +1306,12 @@ + private void pickSweetBerries(BlockState blockstate) { + int i = (Integer) blockstate.getValue(SweetBerryBushBlock.AGE); + +- blockstate.setValue(SweetBerryBushBlock.AGE, 1); ++ state.setValue(SweetBerryBushBlock.AGE, 1); ++ // CraftBukkit start - call EntityChangeBlockEvent ++ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(Fox.this, this.blockPos, state.setValue(SweetBerryBushBlock.AGE, 1))) { ++ return; ++ } ++ // CraftBukkit end + int j = 1 + Fox.this.level().random.nextInt(2) + (i == 3 ? 1 : 0); + ItemStack itemstack = Fox.this.getItemBySlot(EquipmentSlot.MAINHAND); + |