Skip to content

Commit d549dda

Browse files
committed
Improve vanilla parity of suffocation patch
1 parent b6b58c4 commit d549dda

7 files changed

+33
-15
lines changed

patches/server/0007-Optimize-suffocation.patch

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,26 @@ damage in the first place. This check doesn't improve performance much
1616
but is so much cheaper than the suffocation check that it's worth
1717
keeping it.
1818

19+
diff --git a/src/main/java/gg/pufferfish/pufferfish/PufferfishConfig.java b/src/main/java/gg/pufferfish/pufferfish/PufferfishConfig.java
20+
index cca95d190a979f49762a24729ce399cffbb4d0b0..38545e484d7008fe7549d473720527d5e508b67a 100644
21+
--- a/src/main/java/gg/pufferfish/pufferfish/PufferfishConfig.java
22+
+++ b/src/main/java/gg/pufferfish/pufferfish/PufferfishConfig.java
23+
@@ -152,4 +152,13 @@ public class PufferfishConfig {
24+
"This can be overridden per-player with the permission pufferfish.usebooks");
25+
}
26+
27+
+ public static boolean enableSuffocationOptimization;
28+
+ private static void suffocationOptimization() {
29+
+ enableSuffocationOptimization = getBoolean("enable-suffocation-optimization", true,
30+
+ "Optimizes the suffocation check by selectively skipping",
31+
+ "the check in a way that still appears vanilla. This should",
32+
+ "be left enabled on most servers, but is provided as a",
33+
+ "configuration option if the vanilla deviation is undesirable.");
34+
+ }
35+
+
36+
}
1937
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
20-
index 25338fe4cfdc683ca4c01487e166a1649c6f640b..710f0435647d1887155ceebd8cea9894f0dd9bc0 100644
38+
index 25338fe4cfdc683ca4c01487e166a1649c6f640b..e62856dd80fce42a89256ff2dc7ee1f7f77dca10 100644
2139
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
2240
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
2341
@@ -393,8 +393,7 @@ public abstract class LivingEntity extends Entity {
@@ -26,7 +44,7 @@ index 25338fe4cfdc683ca4c01487e166a1649c6f640b..710f0435647d1887155ceebd8cea9894
2644
boolean flag = this instanceof net.minecraft.world.entity.player.Player;
2745
-
2846
- if (this.isInWall()) {
29-
+ if (tickCount % 20 == 0 && couldPossiblyBeHurt(1.0F) && this.isInWall()) { // Pufferfish - optimize suffocation
47+
+ if ((!gg.pufferfish.pufferfish.PufferfishConfig.enableSuffocationOptimization || (tickCount % hurtDuration == 0 && couldPossiblyBeHurt(1.0F))) && this.isInWall()) { // Pufferfish - optimize suffocation
3048
this.hurt(DamageSource.IN_WALL, 1.0F);
3149
} else if (flag && !this.level.getWorldBorder().isWithinBounds(this.getBoundingBox())) {
3250
double d0 = this.level.getWorldBorder().getDistanceToBorder(this) + this.level.getWorldBorder().getDamageSafeZone();

patches/server/0008-Optimize-mob-spawning.patch

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@ and, in my opinion, worth the low risk of minor mob-spawning-related
1717
inconsistencies.
1818

1919
diff --git a/src/main/java/gg/pufferfish/pufferfish/PufferfishConfig.java b/src/main/java/gg/pufferfish/pufferfish/PufferfishConfig.java
20-
index cca95d190a979f49762a24729ce399cffbb4d0b0..fabd8ff79a0f49413ed43b37621402e3c4fd355d 100644
20+
index 38545e484d7008fe7549d473720527d5e508b67a..951367456b7caf49b047b273302e4c4f5f924a09 100644
2121
--- a/src/main/java/gg/pufferfish/pufferfish/PufferfishConfig.java
2222
+++ b/src/main/java/gg/pufferfish/pufferfish/PufferfishConfig.java
23-
@@ -152,4 +152,21 @@ public class PufferfishConfig {
24-
"This can be overridden per-player with the permission pufferfish.usebooks");
23+
@@ -161,4 +161,21 @@ public class PufferfishConfig {
24+
"configuration option if the vanilla deviation is undesirable.");
2525
}
2626

2727
+ public static boolean enableAsyncMobSpawning;

patches/server/0012-Reduce-projectile-chunk-loading.patch

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ You should have received a copy of the GNU General Public License
2020
along with this program. If not, see <http://www.gnu.org/licenses/>.
2121

2222
diff --git a/src/main/java/gg/pufferfish/pufferfish/PufferfishConfig.java b/src/main/java/gg/pufferfish/pufferfish/PufferfishConfig.java
23-
index fabd8ff79a0f49413ed43b37621402e3c4fd355d..8a854f830fbec0c674d4266552602cee3e07af9b 100644
23+
index 951367456b7caf49b047b273302e4c4f5f924a09..c4cfe0ed4134c2582a1726695fe81cbdd6c6c025 100644
2424
--- a/src/main/java/gg/pufferfish/pufferfish/PufferfishConfig.java
2525
+++ b/src/main/java/gg/pufferfish/pufferfish/PufferfishConfig.java
26-
@@ -169,4 +169,15 @@ public class PufferfishConfig {
26+
@@ -178,4 +178,15 @@ public class PufferfishConfig {
2727
}
2828
}
2929

patches/server/0015-Dynamic-Activation-of-Brain.patch

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ You should have received a copy of the GNU General Public License
2727
along with this program. If not, see <http://www.gnu.org/licenses/>.
2828

2929
diff --git a/src/main/java/gg/pufferfish/pufferfish/PufferfishConfig.java b/src/main/java/gg/pufferfish/pufferfish/PufferfishConfig.java
30-
index 8a854f830fbec0c674d4266552602cee3e07af9b..a2d35abb0cf6054323896c2dff52b95e64050e71 100644
30+
index c4cfe0ed4134c2582a1726695fe81cbdd6c6c025..6b51b23569fbed87c02fbce50c2a9e10758e31e3 100644
3131
--- a/src/main/java/gg/pufferfish/pufferfish/PufferfishConfig.java
3232
+++ b/src/main/java/gg/pufferfish/pufferfish/PufferfishConfig.java
3333
@@ -2,6 +2,12 @@ package gg.pufferfish.pufferfish;
@@ -43,7 +43,7 @@ index 8a854f830fbec0c674d4266552602cee3e07af9b..a2d35abb0cf6054323896c2dff52b95e
4343
import java.lang.reflect.Method;
4444
import java.lang.reflect.Modifier;
4545
import java.util.List;
46-
@@ -179,5 +185,37 @@ public class PufferfishConfig {
46+
@@ -188,5 +194,37 @@ public class PufferfishConfig {
4747
}
4848

4949

patches/server/0018-Flare-Profiler.patch

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ index 5e494f3ca75958efb0aa53ec556e2ad4b03001bd..0f194168f5fca8eb768bca3ce953f280
3232
testImplementation("io.github.classgraph:classgraph:4.8.47") // Paper - mob goal test
3333
testImplementation("junit:junit:4.13.2")
3434
diff --git a/src/main/java/gg/pufferfish/pufferfish/PufferfishConfig.java b/src/main/java/gg/pufferfish/pufferfish/PufferfishConfig.java
35-
index a2d35abb0cf6054323896c2dff52b95e64050e71..30f491b8f70d402223c0f0bf1a73a7a19a7e5eaa 100644
35+
index 6b51b23569fbed87c02fbce50c2a9e10758e31e3..636eb6c5cec1e29481b1de9ad7f5c6047a229b4e 100644
3636
--- a/src/main/java/gg/pufferfish/pufferfish/PufferfishConfig.java
3737
+++ b/src/main/java/gg/pufferfish/pufferfish/PufferfishConfig.java
3838
@@ -11,6 +11,7 @@ import net.minecraft.world.entity.EntityType;
@@ -57,7 +57,7 @@ index a2d35abb0cf6054323896c2dff52b95e64050e71..30f491b8f70d402223c0f0bf1a73a7a1
5757

5858
public class PufferfishConfig {
5959

60-
@@ -217,5 +225,29 @@ public class PufferfishConfig {
60+
@@ -226,5 +234,29 @@ public class PufferfishConfig {
6161
setComment("dab", "Optimizes entity brains when", "they're far away from the player");
6262
}
6363

patches/server/0024-Config-to-disable-method-profiler.patch

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ Subject: [PATCH] Config to disable method profiler
55

66

77
diff --git a/src/main/java/gg/pufferfish/pufferfish/PufferfishConfig.java b/src/main/java/gg/pufferfish/pufferfish/PufferfishConfig.java
8-
index 30f491b8f70d402223c0f0bf1a73a7a19a7e5eaa..f5b7c4e2c96171cc3a4eb9daf4e01daeaee3075c 100644
8+
index 636eb6c5cec1e29481b1de9ad7f5c6047a229b4e..fcc7344042e41838440ee624f4ea3c6f19292f6d 100644
99
--- a/src/main/java/gg/pufferfish/pufferfish/PufferfishConfig.java
1010
+++ b/src/main/java/gg/pufferfish/pufferfish/PufferfishConfig.java
11-
@@ -250,4 +250,10 @@ public class PufferfishConfig {
11+
@@ -259,4 +259,10 @@ public class PufferfishConfig {
1212
}
1313

1414

patches/server/0041-Throttle-goal-selector-during-inactive-ticking.patch

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ Subject: [PATCH] Throttle goal selector during inactive ticking
55

66

77
diff --git a/src/main/java/gg/pufferfish/pufferfish/PufferfishConfig.java b/src/main/java/gg/pufferfish/pufferfish/PufferfishConfig.java
8-
index f5b7c4e2c96171cc3a4eb9daf4e01daeaee3075c..284f9eb542b686833ec54d4de6493d7dac5aa6b8 100644
8+
index fcc7344042e41838440ee624f4ea3c6f19292f6d..889561a6b0cb46405398d94fa071d33d3f02c3df 100644
99
--- a/src/main/java/gg/pufferfish/pufferfish/PufferfishConfig.java
1010
+++ b/src/main/java/gg/pufferfish/pufferfish/PufferfishConfig.java
11-
@@ -224,6 +224,13 @@ public class PufferfishConfig {
11+
@@ -233,6 +233,13 @@ public class PufferfishConfig {
1212

1313
setComment("dab", "Optimizes entity brains when", "they're far away from the player");
1414
}

0 commit comments

Comments
 (0)