@@ -16,8 +16,26 @@ damage in the first place. This check doesn't improve performance much
1616but is so much cheaper than the suffocation check that it's worth
1717keeping 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+ }
1937diff --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();
0 commit comments