mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-17 16:37:43 +01:00
82 lines
4.0 KiB
Diff
82 lines
4.0 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 28a763cb92cd5c63e5f9083e451802d5b1516eb1..a4c5bf20c69432a35ce04846e49c347364ecfaff 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
|
@@ -3832,11 +3832,17 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
|
|
this.yRotO = this.getYRot();
|
|
}
|
|
|
|
+ // Purpur start
|
|
+ public AABB getAxisForFluidCheck() {
|
|
+ return this.getBoundingBox().deflate(0.001D);
|
|
+ }
|
|
+ // Purpur end
|
|
+
|
|
public boolean updateFluidHeightAndDoFluidPushing(Tag<Fluid> tag, double d0) {
|
|
if (this.touchingUnloadedChunk()) {
|
|
return false;
|
|
} else {
|
|
- AABB axisalignedbb = this.getBoundingBox().deflate(0.001D);
|
|
+ AABB axisalignedbb = getAxisForFluidCheck(); // Purpur
|
|
int i = Mth.floor(axisalignedbb.minX);
|
|
int j = Mth.ceil(axisalignedbb.maxX);
|
|
int k = Mth.floor(axisalignedbb.minY);
|
|
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 f96def2ebdf114823c322c2d4318d039e20eab97..2affff346a7fe81480e86cb61996039df0569853 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/animal/Squid.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/animal/Squid.java
|
|
@@ -79,6 +79,12 @@ public class Squid extends WaterAnimal {
|
|
public void initAttributes() {
|
|
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 this.getBoundingBox().deflate(0.001D).offsetY(level.purpurConfig.squidOffsetWaterCheck);
|
|
+ }
|
|
// Purpur end
|
|
|
|
@Override
|
|
diff --git a/src/main/java/net/minecraft/world/phys/AABB.java b/src/main/java/net/minecraft/world/phys/AABB.java
|
|
index 6f7e6429c35eea346517cbf08cf223fc6d838a8c..6a77112180556675af38cb1b3ce0b38a42ce9525 100644
|
|
--- a/src/main/java/net/minecraft/world/phys/AABB.java
|
|
+++ b/src/main/java/net/minecraft/world/phys/AABB.java
|
|
@@ -367,4 +367,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/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
|
index 91697c96d7133f1815fd6d89b4fc55c24609b2aa..1d804ff002c3736b3c6199130a4c1c27fd048dd3 100644
|
|
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
|
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
|
@@ -1300,6 +1300,7 @@ public class PurpurWorldConfig {
|
|
public boolean squidRidable = false;
|
|
public double squidMaxHealth = 10.0D;
|
|
public boolean squidImmuneToEAR = true;
|
|
+ public double squidOffsetWaterCheck = 0.0D;
|
|
private void squidSettings() {
|
|
squidRidable = getBoolean("mobs.squid.ridable", squidRidable);
|
|
if (PurpurConfig.version < 10) {
|
|
@@ -1309,6 +1310,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;
|