Files
Purpur/patches/server/0086-Stop-squids-floating-on-top-of-water.patch
granny 991719aa9e Updated Upstream (Paper)
Upstream has released updates that appear to apply and compile correctly

Paper Changes:
PaperMC/Paper@c1ea550 Remove more outdated config settings (#9358)
PaperMC/Paper@3a03739 Add method to get ungenerated chunk from long key (#9254)
PaperMC/Paper@072b78a Add trail ruins structure set seed in spigot config (#9327)
PaperMC/Paper@faf9a65 Disable BukkitMirrorTest
PaperMC/Paper@873533b Add method to remove all active potion effects (#9361)
PaperMC/Paper@275173e Updated Upstream (Bukkit/CraftBukkit)
PaperMC/Paper@976b95c Temp: Pre-init PlayerChunkLoaderData in order to prepopulate the BFS lookup cache because potatos (Closes #9338)
PaperMC/Paper@d6d4c78 Move some Folia API to Paper for easy compat (#9360)
PaperMC/Paper@b1fe756 Revert "Move some Folia API to Paper for easy compat (#9360)"
PaperMC/Paper@1f5bec7 Pull Folia API take two
PaperMC/Paper@3756f5b Properly Cancel Usable Items (#9225)
2023-06-20 15:54:20 -07:00

76 lines
3.9 KiB
Diff

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 03811b4dca610cf0fa3dc6ca0cc7f47d6f8b77ee..59f0880a4ccdea2f0c95e0411bf149d76e866678 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -4372,6 +4372,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
this.yRotO = this.getYRot();
}
+ // Purpur start
+ public AABB getAxisForFluidCheck() {
+ return this.getBoundingBox().deflate(0.001D);
+ }
+ // Purpur end
+
public boolean updateFluidHeightAndDoFluidPushing(TagKey<Fluid> tag, double speed) {
if (false && this.touchingUnloadedChunk()) { // Pufferfish - cost of a lookup here is the same cost as below, so skip
return false;
diff --git a/src/main/java/net/minecraft/world/entity/animal/Squid.java b/src/main/java/net/minecraft/world/entity/animal/Squid.java
index 42ca9df0735b4f928fbbf1e695d1756f77be52fc..de0a015cc944c36358fc34a3142ecbf9d2a332b5 100644
--- a/src/main/java/net/minecraft/world/entity/animal/Squid.java
+++ b/src/main/java/net/minecraft/world/entity/animal/Squid.java
@@ -77,6 +77,12 @@ public class Squid extends WaterAnimal {
this.getAttribute(Attributes.MAX_HEALTH).setBaseValue(this.level().purpurConfig.squidMaxHealth);
}
+ @Override
+ public net.minecraft.world.phys.AABB getAxisForFluidCheck() {
+ // Stops squids from floating just over the water
+ return super.getAxisForFluidCheck().offsetY(level().purpurConfig.squidOffsetWaterCheck);
+ }
+
@Override
protected void registerGoals() {
this.goalSelector.addGoal(0, new Squid.SquidRandomMovementGoal(this));
diff --git a/src/main/java/net/minecraft/world/phys/AABB.java b/src/main/java/net/minecraft/world/phys/AABB.java
index ffc76354ead6937daf366c3d87bcb51d3e4c47f5..5b98d42b5d6bc07265fbb017e51a6281c148436a 100644
--- a/src/main/java/net/minecraft/world/phys/AABB.java
+++ b/src/main/java/net/minecraft/world/phys/AABB.java
@@ -374,4 +374,10 @@ public class AABB {
public static AABB ofSize(Vec3 center, double dx, double dy, double dz) {
return new AABB(center.x - dx / 2.0D, center.y - dy / 2.0D, center.z - dz / 2.0D, center.x + dx / 2.0D, center.y + dy / 2.0D, center.z + dz / 2.0D);
}
+
+ // Purpur - tuinity added method
+ public final AABB offsetY(double dy) {
+ return new AABB(this.minX, this.minY + dy, this.minZ, this.maxX, this.maxY + dy, this.maxZ);
+ }
+ // Purpur
}
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
index f1ab0af8f00a931aedec7647223903a14432f84e..1797098e86a4c0abf1431e1d266be6a977c64b95 100644
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
@@ -1484,6 +1484,7 @@ public class PurpurWorldConfig {
public boolean squidControllable = true;
public double squidMaxHealth = 10.0D;
public boolean squidImmuneToEAR = true;
+ public double squidOffsetWaterCheck = 0.0D;
private void squidSettings() {
squidRidable = getBoolean("mobs.squid.ridable", squidRidable);
squidControllable = getBoolean("mobs.squid.controllable", squidControllable);
@@ -1494,6 +1495,7 @@ public class PurpurWorldConfig {
}
squidMaxHealth = getDouble("mobs.squid.attributes.max_health", squidMaxHealth);
squidImmuneToEAR = getBoolean("mobs.squid.immune-to-EAR", squidImmuneToEAR);
+ squidOffsetWaterCheck = getDouble("mobs.squid.water-offset-check", squidOffsetWaterCheck);
}
public boolean spiderRidable = false;