Commits
Owen1212055 authored and md_5 committed 7cf863de17b
35 35 | if (this.canHoldItem(itemstack)) { |
36 36 | + // CraftBukkit start - call EntityPickupItemEvent |
37 37 | + if (CraftEventFactory.callEntityPickupItemEvent(this, entityitem, 0, false).isCancelled()) { |
38 38 | + return; |
39 39 | + } |
40 40 | + itemstack = entityitem.getItem(); // CraftBukkit- update ItemStack from event |
41 41 | + // CraftBukkit start |
42 42 | this.onItemPickup(entityitem); |
43 43 | this.setItemSlot(EnumItemSlot.MAINHAND, itemstack); |
44 44 | this.setGuaranteedDrop(EnumItemSlot.MAINHAND); |
45 - | |
46 - | |
47 - | @Override |
48 - | public boolean canUse() { |
49 - | - return this.dolphin.gotFish() && this.dolphin.getAirSupply() >= 100; |
50 - | + return this.dolphin.gotFish() && this.dolphin.getAirSupply() >= 100 && this.dolphin.level().getWorld().canGenerateStructures(); // MC-151364, SPIGOT-5494: hangs if generate-structures=false |
51 - | } |
52 - | |
53 - | @Override |
54 45 | |
55 46 | |
56 47 | @Override |
57 48 | public void start() { |
58 49 | - this.player.addEffect(new MobEffect(MobEffects.DOLPHINS_GRACE, 100), this.dolphin); |
59 50 | + this.player.addEffect(new MobEffect(MobEffects.DOLPHINS_GRACE, 100), this.dolphin, EntityPotionEffectEvent.Cause.DOLPHIN); // CraftBukkit |
60 51 | } |
61 52 | |
62 53 | @Override |
63 54 | |