--- a/net/minecraft/world/entity/animal/EntityDolphin.java +++ b/net/minecraft/world/entity/animal/EntityDolphin.java @@ -233,6 +233,12 @@ ItemStack itemstack = entityitem.getItem(); if (this.canHoldItem(itemstack)) { + // CraftBukkit start - call EntityPickupItemEvent + if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityPickupItemEvent(this, entityitem, 0, false).isCancelled()) { + return; + } + itemstack = entityitem.getItem(); // update ItemStack from event + // CraftBukkit end this.onItemPickup(entityitem); this.setItemSlot(EnumItemSlot.MAINHAND, itemstack); this.handDropChances[EnumItemSlot.MAINHAND.getIndex()] = 2.0F; @@ -391,7 +397,7 @@ @Override 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 } @Override @@ -501,7 +507,7 @@ @Override public void start() { - 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 } @Override @@ -520,7 +526,7 @@ } 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 } }