aboutsummaryrefslogtreecommitdiffhomepage
path: root/patch-remap/mache-spigotflower-stripped/net/minecraft/world/entity/animal/Dolphin.java.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patch-remap/mache-spigotflower-stripped/net/minecraft/world/entity/animal/Dolphin.java.patch')
-rw-r--r--patch-remap/mache-spigotflower-stripped/net/minecraft/world/entity/animal/Dolphin.java.patch64
1 files changed, 64 insertions, 0 deletions
diff --git a/patch-remap/mache-spigotflower-stripped/net/minecraft/world/entity/animal/Dolphin.java.patch b/patch-remap/mache-spigotflower-stripped/net/minecraft/world/entity/animal/Dolphin.java.patch
new file mode 100644
index 0000000000..c2a7096092
--- /dev/null
+++ b/patch-remap/mache-spigotflower-stripped/net/minecraft/world/entity/animal/Dolphin.java.patch
@@ -0,0 +1,64 @@
+--- a/net/minecraft/world/entity/animal/Dolphin.java
++++ b/net/minecraft/world/entity/animal/Dolphin.java
+@@ -60,9 +60,19 @@
+ import net.minecraft.world.level.ServerLevelAccessor;
+ import net.minecraft.world.level.pathfinder.PathComputationType;
+ import net.minecraft.world.phys.Vec3;
++// CraftBukkit start
++import org.bukkit.craftbukkit.event.CraftEventFactory;
++import org.bukkit.event.entity.EntityPotionEffectEvent;
++// CraftBukkit end
+
+ public class Dolphin extends WaterAnimal {
+
++ // CraftBukkit start - SPIGOT-6907: re-implement LivingEntity#setMaximumAir()
++ @Override
++ public int getDefaultMaxAirSupply() {
++ return TOTAL_AIR_SUPPLY;
++ }
++ // CraftBukkit end
+ private static final EntityDataAccessor<BlockPos> TREASURE_POS = SynchedEntityData.defineId(Dolphin.class, EntityDataSerializers.BLOCK_POS);
+ private static final EntityDataAccessor<Boolean> GOT_FISH = SynchedEntityData.defineId(Dolphin.class, EntityDataSerializers.BOOLEAN);
+ private static final EntityDataAccessor<Integer> MOISTNESS_LEVEL = SynchedEntityData.defineId(Dolphin.class, EntityDataSerializers.INT);
+@@ -194,7 +195,7 @@
+ @Override
+ @Override
+ public int getMaxAirSupply() {
+- return 4800;
++ return maxAirTicks; // CraftBukkit - SPIGOT-6907: re-implement LivingEntity#setMaximumAir()
+ }
+
+ @Override
+@@ -242,7 +236,13 @@
+ ItemStack itemstack = itementity.getItem();
+
+ if (this.canHoldItem(itemstack)) {
+- this.onItemPickup(itementity);
++ // CraftBukkit start - call EntityPickupItemEvent
++ if (CraftEventFactory.callEntityPickupItemEvent(this, itemEntity, 0, false).isCancelled()) {
++ return;
++ }
++ itemstack = itemEntity.getItem(); // CraftBukkit- update ItemStack from event
++ // CraftBukkit start
++ this.onItemPickup(itemEntity);
+ this.setItemSlot(EquipmentSlot.MAINHAND, itemstack);
+ this.setGuaranteedDrop(EquipmentSlot.MAINHAND);
+ this.take(itementity, itemstack.getCount());
+@@ -519,7 +500,7 @@
+ @Override
+ @Override
+ public void start() {
+- this.player.addEffect(new MobEffectInstance(MobEffects.DOLPHINS_GRACE, 100), this.dolphin);
++ this.player.addEffect(new MobEffectInstance(MobEffects.DOLPHINS_GRACE, 100), this.dolphin, EntityPotionEffectEvent.Cause.DOLPHIN); // CraftBukkit
+ }
+
+ @Override
+@@ -540,7 +519,7 @@
+ }
+
+ if (this.player.isSwimming() && this.player.level().random.nextInt(6) == 0) {
+- this.player.addEffect(new MobEffectInstance(MobEffects.DOLPHINS_GRACE, 100), this.dolphin);
++ this.player.addEffect(new MobEffectInstance(MobEffects.DOLPHINS_GRACE, 100), this.dolphin, EntityPotionEffectEvent.Cause.DOLPHIN); // CraftBukkit
+ }
+
+ }