2021-03-15 23:00:00 +01:00
|
|
|
--- a/net/minecraft/world/entity/animal/EntityDolphin.java
|
|
|
|
+++ b/net/minecraft/world/entity/animal/EntityDolphin.java
|
2021-11-21 23:00:00 +01:00
|
|
|
@@ -233,6 +233,12 @@
|
|
|
|
ItemStack itemstack = entityitem.getItem();
|
2019-04-23 04:00:00 +02:00
|
|
|
|
2021-11-21 23:00:00 +01:00
|
|
|
if (this.canHoldItem(itemstack)) {
|
2019-05-17 23:19:52 +02:00
|
|
|
+ // CraftBukkit start - call EntityPickupItemEvent
|
|
|
|
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityPickupItemEvent(this, entityitem, 0, false).isCancelled()) {
|
|
|
|
+ return;
|
|
|
|
+ }
|
2021-11-21 23:00:00 +01:00
|
|
|
+ itemstack = entityitem.getItem(); // update ItemStack from event
|
2019-05-17 23:19:52 +02:00
|
|
|
+ // CraftBukkit end
|
2021-11-21 23:00:00 +01:00
|
|
|
this.onItemPickup(entityitem);
|
|
|
|
this.setItemSlot(EnumItemSlot.MAINHAND, itemstack);
|
|
|
|
this.handDropChances[EnumItemSlot.MAINHAND.getIndex()] = 2.0F;
|
|
|
|
@@ -391,7 +397,7 @@
|
2020-01-03 06:56:58 +01:00
|
|
|
|
|
|
|
@Override
|
2021-11-21 23:00:00 +01:00
|
|
|
public boolean canUse() {
|
|
|
|
- return this.dolphin.gotFish() && this.dolphin.getAirSupply() >= 100;
|
|
|
|
+ return this.dolphin.gotFish() && this.dolphin.getAirSupply() >= 100 && this.dolphin.level.getWorld().canGenerateStructures(); // MC-151364, SPIGOT-5494: hangs if generate-structures=false
|
2020-01-03 06:56:58 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2021-11-21 23:00:00 +01:00
|
|
|
@@ -501,7 +507,7 @@
|
2018-07-20 08:04:37 +02:00
|
|
|
|
2019-04-23 04:00:00 +02:00
|
|
|
@Override
|
2021-11-21 23:00:00 +01:00
|
|
|
public void start() {
|
2021-06-11 07:00:00 +02:00
|
|
|
- this.player.addEffect(new MobEffect(MobEffects.DOLPHINS_GRACE, 100), this.dolphin);
|
|
|
|
+ this.player.addEffect(new MobEffect(MobEffects.DOLPHINS_GRACE, 100), this.dolphin, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.DOLPHIN); // CraftBukkit
|
2018-07-20 08:04:37 +02:00
|
|
|
}
|
|
|
|
|
2019-04-23 04:00:00 +02:00
|
|
|
@Override
|
2021-11-21 23:00:00 +01:00
|
|
|
@@ -520,7 +526,7 @@
|
2018-07-20 08:04:37 +02:00
|
|
|
}
|
|
|
|
|
2021-06-11 07:00:00 +02:00
|
|
|
if (this.player.isSwimming() && this.player.level.random.nextInt(6) == 0) {
|
|
|
|
- this.player.addEffect(new MobEffect(MobEffects.DOLPHINS_GRACE, 100), this.dolphin);
|
|
|
|
+ this.player.addEffect(new MobEffect(MobEffects.DOLPHINS_GRACE, 100), this.dolphin, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.DOLPHIN); // CraftBukkit
|
2018-07-20 08:04:37 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|