2021-03-15 23:00:00 +01:00
|
|
|
--- a/net/minecraft/world/entity/animal/EntityFox.java
|
|
|
|
+++ b/net/minecraft/world/entity/animal/EntityFox.java
|
2023-03-14 17:30:00 +01:00
|
|
|
@@ -517,7 +517,8 @@
|
2021-11-21 23:00:00 +01:00
|
|
|
protected void pickUpItem(EntityItem entityitem) {
|
|
|
|
ItemStack itemstack = entityitem.getItem();
|
2019-05-20 03:27:00 +02:00
|
|
|
|
2021-11-21 23:00:00 +01:00
|
|
|
- if (this.canHoldItem(itemstack)) {
|
|
|
|
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityPickupItemEvent(this, entityitem, itemstack.getCount() - 1, !this.canHoldItem(itemstack)).isCancelled()) { // CraftBukkit - call EntityPickupItemEvent
|
|
|
|
+ itemstack = entityitem.getItem(); // CraftBukkit - update ItemStack from event
|
2019-05-20 03:27:00 +02:00
|
|
|
int i = itemstack.getCount();
|
|
|
|
|
|
|
|
if (i > 1) {
|
2023-03-14 17:30:00 +01:00
|
|
|
@@ -872,6 +873,16 @@
|
2019-08-09 04:34:33 +02:00
|
|
|
if (entityplayer1 != null && entityplayer != entityplayer1) {
|
2021-11-21 23:00:00 +01:00
|
|
|
entityfox.addTrustedUUID(entityplayer1.getUUID());
|
2019-08-09 04:34:33 +02:00
|
|
|
}
|
|
|
|
+ // CraftBukkit start - call EntityBreedEvent
|
2021-11-21 23:00:00 +01:00
|
|
|
+ entityfox.setAge(-24000);
|
|
|
|
+ entityfox.moveTo(this.animal.getX(), this.animal.getY(), this.animal.getZ(), 0.0F, 0.0F);
|
2019-08-09 04:34:33 +02:00
|
|
|
+ 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) {
|
2021-11-21 23:00:00 +01:00
|
|
|
entityplayer2.awardStat(StatisticList.ANIMALS_BRED);
|
2023-03-14 17:30:00 +01:00
|
|
|
@@ -882,12 +893,14 @@
|
2021-11-21 23:00:00 +01:00
|
|
|
this.partner.setAge(6000);
|
2021-05-11 10:33:28 +02:00
|
|
|
this.animal.resetLove();
|
2019-08-09 04:34:33 +02:00
|
|
|
this.partner.resetLove();
|
2021-11-21 23:00:00 +01:00
|
|
|
- entityfox.setAge(-24000);
|
|
|
|
- entityfox.moveTo(this.animal.getX(), this.animal.getY(), this.animal.getZ(), 0.0F, 0.0F);
|
|
|
|
- worldserver.addFreshEntityWithPassengers(entityfox);
|
|
|
|
+ worldserver.addFreshEntityWithPassengers(entityfox, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.BREEDING); // CraftBukkit - added SpawnReason
|
|
|
|
this.level.broadcastEntityEvent(this.animal, (byte) 18);
|
2021-06-11 07:00:00 +02:00
|
|
|
if (this.level.getGameRules().getBoolean(GameRules.RULE_DOMOBLOOT)) {
|
2021-11-21 23:00:00 +01:00
|
|
|
- this.level.addFreshEntity(new EntityExperienceOrb(this.level, this.animal.getX(), this.animal.getY(), this.animal.getZ(), this.animal.getRandom().nextInt(7) + 1));
|
2019-08-09 04:34:33 +02:00
|
|
|
+ // CraftBukkit start - use event experience
|
|
|
|
+ if (experience > 0) {
|
2021-11-21 23:00:00 +01:00
|
|
|
+ this.level.addFreshEntity(new EntityExperienceOrb(this.level, this.animal.getX(), this.animal.getY(), this.animal.getZ(), experience));
|
2019-08-09 04:34:33 +02:00
|
|
|
+ }
|
|
|
|
+ // CraftBukkit end
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
2023-03-14 17:30:00 +01:00
|
|
|
@@ -1285,6 +1298,11 @@
|
2021-11-21 23:00:00 +01:00
|
|
|
int i = (Integer) iblockdata.getValue(BlockSweetBerryBush.AGE);
|
2021-06-11 07:00:00 +02:00
|
|
|
|
2021-11-21 23:00:00 +01:00
|
|
|
iblockdata.setValue(BlockSweetBerryBush.AGE, 1);
|
2021-06-11 07:00:00 +02:00
|
|
|
+ // CraftBukkit start - call EntityChangeBlockEvent
|
2021-11-21 23:00:00 +01:00
|
|
|
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(EntityFox.this, this.blockPos, iblockdata.setValue(BlockSweetBerryBush.AGE, 1)).isCancelled()) {
|
2021-06-11 07:00:00 +02:00
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ // CraftBukkit end
|
2023-06-07 17:30:00 +02:00
|
|
|
int j = 1 + EntityFox.this.level().random.nextInt(2) + (i == 3 ? 1 : 0);
|
2021-11-21 23:00:00 +01:00
|
|
|
ItemStack itemstack = EntityFox.this.getItemBySlot(EnumItemSlot.MAINHAND);
|
2021-06-11 07:00:00 +02:00
|
|
|
|
2023-03-14 17:30:00 +01:00
|
|
|
@@ -1441,7 +1459,7 @@
|
2021-06-11 07:00:00 +02:00
|
|
|
private EntityLiving trustedLastHurt;
|
|
|
|
private int timestamp;
|
|
|
|
|
|
|
|
- public a(Class oclass, boolean flag, boolean flag1, @Nullable Predicate predicate) {
|
|
|
|
+ public a(Class oclass, boolean flag, boolean flag1, @Nullable Predicate<EntityLiving> predicate) { // CraftBukkit - decompile error
|
|
|
|
super(EntityFox.this, oclass, 10, flag, flag1, predicate);
|
|
|
|
}
|
|
|
|
|