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/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 5ac6b7759cf43dbbad1bcf74d5d86efd69883cf5..240f30f6ca6007ba8e7de1c3e033b2a8493838e7 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -3556,8 +3556,13 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne
         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/world/entity/animal/EntitySquid.java b/src/main/java/net/minecraft/world/entity/animal/EntitySquid.java
index 1f5f3e0d209426b97e32b82dd15176b800f85816..e6757b22497c6e274c3999d58671653e931ebe2b 100644
--- a/src/main/java/net/minecraft/world/entity/animal/EntitySquid.java
+++ b/src/main/java/net/minecraft/world/entity/animal/EntitySquid.java
@@ -27,6 +27,7 @@ import net.minecraft.world.level.GeneratorAccess;
 import net.minecraft.world.level.World;
 import net.minecraft.world.level.block.state.IBlockData;
 import net.minecraft.world.level.material.Fluid;
+import net.minecraft.world.phys.AxisAlignedBB;
 import net.minecraft.world.phys.Vec3D;
 
 public class EntitySquid extends EntityWaterAnimal {
@@ -52,6 +53,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 18289cb1453fa00ed00f6a9ae7636eec472b47c1..a13f5e2f242f5ff7bfe7fbd56439a1c1b8b7df2c 100644
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
@@ -511,8 +511,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;
