From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
Date: Thu, 13 Aug 2020 04:00:26 -0500
Subject: [PATCH] Stop squids floating on top of water


diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index 4b9e44aad705247c075e435ebc6eb9b1393f7b17..30408e9e8b4acec56a95852558ead6a581b8565c 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -3461,8 +3461,13 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
         this.lastYaw = this.yaw;
     }
 
+    // Purpur start
+    public AxisAlignedBB getAxisForFluidCheck() {
+        return this.getBoundingBox().shrink(0.001D);
+    }
     public boolean a(Tag<FluidType> tag, double d0) {
-        AxisAlignedBB axisalignedbb = this.getBoundingBox().shrink(0.001D);
+        AxisAlignedBB axisalignedbb = getAxisForFluidCheck();
+        // Purpur end
         int i = MathHelper.floor(axisalignedbb.minX);
         int j = MathHelper.f(axisalignedbb.maxX);
         int k = MathHelper.floor(axisalignedbb.minY);
diff --git a/src/main/java/net/minecraft/server/EntitySquid.java b/src/main/java/net/minecraft/server/EntitySquid.java
index b21605a62365fe24f315f35bd840b4740fc80f0e..148e4b158734f136832e5c17bdc69634c0f294aa 100644
--- a/src/main/java/net/minecraft/server/EntitySquid.java
+++ b/src/main/java/net/minecraft/server/EntitySquid.java
@@ -25,6 +25,14 @@ public class EntitySquid extends EntityWaterAnimal {
         this.bu = 1.0F / (this.random.nextFloat() + 1.0F) * 0.2F;
     }
 
+    // Purpur start
+    @Override
+    public AxisAlignedBB getAxisForFluidCheck() {
+        // Stops squids from floating just over the water
+        return this.getBoundingBox().shrink(0.001D).offsetY(world.purpurConfig.squidOffsetWaterCheck);
+    }
+    // Purpur end
+
     @Override
     protected void initPathfinder() {
         this.goalSelector.a(0, new EntitySquid.PathfinderGoalSquid(this));
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
index 07cc9766d420d5584c53692e37abaca5b5ac95f5..637cac2758a44e72794953b9fbca2accb7d86b6a 100644
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
@@ -499,8 +499,10 @@ public class PurpurWorldConfig {
     }
 
     public boolean squidImmuneToEAR = true;
+    public double squidOffsetWaterCheck = 0.0D;
     private void squidSettings() {
         squidImmuneToEAR = getBoolean("mobs.squid.immune-to-EAR", squidImmuneToEAR);
+        squidOffsetWaterCheck = getDouble("mobs.squid.water-offset-check", squidOffsetWaterCheck);
     }
 
     public int villagerBrainTicks = 1;
