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

Paper Changes:
PaperMC/Paper@862299b "Downgrade" Vineflower to 1.10.1 release (#10423)
PaperMC/Paper@9e886c4 Remove dead code (LegacyResult) (#10411)
PaperMC/Paper@3b078f8 Add API for ticking fluids (#10435)
PaperMC/Paper@908b814 Fix inventory desync with PlayerLeashEntityEvent (#10436)
PaperMC/Paper@3af1346 Allow setting player list name early
PaperMC/Paper@a033033 Added chunk view API (#10398)
PaperMC/Paper@c5f68ff Add CartographyItemEvent and get/setResult for CartographyInventory (#10396)
PaperMC/Paper@fc53ff5 Add Configuration for finding Structures outside World Border (#10437)
PaperMC/Paper@a6b6ecd More Raid API (#7537)
2024-04-21 14:39:56 -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 10a0f2b4968600f088677103b0bfbe5f69aa4428..c02c75620e256e4c129a7966a73f2d5a383fb9e2 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -4462,6 +4462,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
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 9f598ff84b836d10e215c7e8fe79735f7f41e32b..bed42fe33d3788151188075f8969442555263492 100644
--- a/src/main/java/net/minecraft/world/entity/animal/Squid.java
+++ b/src/main/java/net/minecraft/world/entity/animal/Squid.java
@@ -75,6 +75,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 92394960fc76886f393cba02ac33c57739a4b383..494808b7bc2fb296b78e229ce138a937b7ac2c59 100644
--- a/src/main/java/net/minecraft/world/phys/AABB.java
+++ b/src/main/java/net/minecraft/world/phys/AABB.java
@@ -502,4 +502,10 @@ public class AABB {
public static AABB ofSize(Vec3 center, double dx, double dy, double dz) {
return new AABB(center.x - dx / 2.0, center.y - dy / 2.0, center.z - dz / 2.0, center.x + dx / 2.0, center.y + dy / 2.0, center.z + dz / 2.0);
}
+
+ // 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 b9faaf71e0cd5918b072d068bbc2096aa2805616..56f34c0a0f7bc94a90bb1db32f8e30a590a3b38c 100644
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
@@ -1478,6 +1478,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);
@@ -1488,6 +1489,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;