2021-03-15 23:00:00 +01:00
|
|
|
--- a/net/minecraft/world/entity/animal/EntityDolphin.java
|
|
|
|
+++ b/net/minecraft/world/entity/animal/EntityDolphin.java
|
2022-02-28 16:00:00 +01:00
|
|
|
@@ -63,6 +63,12 @@
|
2022-01-22 23:06:19 +01:00
|
|
|
|
|
|
|
public class EntityDolphin extends EntityWaterAnimal {
|
|
|
|
|
|
|
|
+ // CraftBukkit start - SPIGOT-6907: re-implement LivingEntity#setMaximumAir()
|
|
|
|
+ @Override
|
|
|
|
+ public int getDefaultMaxAirSupply() {
|
|
|
|
+ return TOTAL_AIR_SUPPLY;
|
|
|
|
+ }
|
|
|
|
+ // CraftBukkit end
|
|
|
|
private static final DataWatcherObject<BlockPosition> TREASURE_POS = DataWatcher.defineId(EntityDolphin.class, DataWatcherRegistry.BLOCK_POS);
|
|
|
|
private static final DataWatcherObject<Boolean> GOT_FISH = DataWatcher.defineId(EntityDolphin.class, DataWatcherRegistry.BOOLEAN);
|
|
|
|
private static final DataWatcherObject<Integer> MOISTNESS_LEVEL = DataWatcher.defineId(EntityDolphin.class, DataWatcherRegistry.INT);
|
2022-02-28 16:00:00 +01:00
|
|
|
@@ -190,7 +196,7 @@
|
2022-01-22 23:06:19 +01:00
|
|
|
|
|
|
|
@Override
|
|
|
|
public int getMaxAirSupply() {
|
|
|
|
- return 4800;
|
|
|
|
+ return maxAirTicks; // CraftBukkit - SPIGOT-6907: re-implement LivingEntity#setMaximumAir()
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2022-02-28 16:00:00 +01:00
|
|
|
@@ -231,6 +237,12 @@
|
2021-11-21 23:00:00 +01:00
|
|
|
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);
|
2022-06-07 18:00:00 +02:00
|
|
|
this.setGuaranteedDrop(EnumItemSlot.MAINHAND);
|
2022-02-28 16:00:00 +01:00
|
|
|
@@ -389,7 +401,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
|
2022-02-28 16:00:00 +01:00
|
|
|
@@ -489,7 +501,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
|
2022-02-28 16:00:00 +01:00
|
|
|
@@ -508,7 +520,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
|
|
|
}
|
|
|
|
|
|
|
|
}
|