2021-03-15 23:00:00 +01:00
|
|
|
--- a/net/minecraft/world/entity/animal/EntityDolphin.java
|
|
|
|
+++ b/net/minecraft/world/entity/animal/EntityDolphin.java
|
2024-04-23 17:15:00 +02:00
|
|
|
@@ -59,8 +59,20 @@
|
2023-06-24 09:15:05 +02:00
|
|
|
import net.minecraft.world.level.pathfinder.PathMode;
|
|
|
|
import net.minecraft.world.phys.Vec3D;
|
2022-01-22 23:06:19 +01:00
|
|
|
|
2023-06-24 09:15:05 +02:00
|
|
|
+// CraftBukkit start
|
|
|
|
+import org.bukkit.craftbukkit.event.CraftEventFactory;
|
|
|
|
+import org.bukkit.event.entity.EntityPotionEffectEvent;
|
2024-02-21 10:55:34 +01:00
|
|
|
+import org.bukkit.event.entity.EntityRemoveEvent;
|
2023-06-24 09:15:05 +02:00
|
|
|
+// CraftBukkit end
|
|
|
|
+
|
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);
|
2024-04-23 17:15:00 +02:00
|
|
|
@@ -183,7 +195,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
|
2024-04-23 17:15:00 +02:00
|
|
|
@@ -219,11 +231,17 @@
|
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
|
2023-06-24 09:15:05 +02:00
|
|
|
+ if (CraftEventFactory.callEntityPickupItemEvent(this, entityitem, 0, false).isCancelled()) {
|
2019-05-17 23:19:52 +02:00
|
|
|
+ return;
|
|
|
|
+ }
|
2023-06-24 09:15:05 +02:00
|
|
|
+ itemstack = entityitem.getItem(); // CraftBukkit- update ItemStack from event
|
|
|
|
+ // CraftBukkit start
|
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);
|
2024-02-21 10:55:34 +01:00
|
|
|
this.take(entityitem, itemstack.getCount());
|
|
|
|
- entityitem.discard();
|
|
|
|
+ entityitem.discard(EntityRemoveEvent.Cause.PICKUP); // CraftBukkit - add Bukkit remove cause
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-04-23 17:15:00 +02:00
|
|
|
@@ -474,7 +492,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);
|
2023-06-24 09:15:05 +02:00
|
|
|
+ this.player.addEffect(new MobEffect(MobEffects.DOLPHINS_GRACE, 100), this.dolphin, EntityPotionEffectEvent.Cause.DOLPHIN); // CraftBukkit
|
2018-07-20 08:04:37 +02:00
|
|
|
}
|
|
|
|
|
2019-04-23 04:00:00 +02:00
|
|
|
@Override
|
2024-04-23 17:15:00 +02:00
|
|
|
@@ -493,7 +511,7 @@
|
2018-07-20 08:04:37 +02:00
|
|
|
}
|
|
|
|
|
2023-06-07 17:30:00 +02:00
|
|
|
if (this.player.isSwimming() && this.player.level().random.nextInt(6) == 0) {
|
2021-06-11 07:00:00 +02:00
|
|
|
- this.player.addEffect(new MobEffect(MobEffects.DOLPHINS_GRACE, 100), this.dolphin);
|
2023-06-24 09:15:05 +02:00
|
|
|
+ this.player.addEffect(new MobEffect(MobEffects.DOLPHINS_GRACE, 100), this.dolphin, EntityPotionEffectEvent.Cause.DOLPHIN); // CraftBukkit
|
2018-07-20 08:04:37 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|