mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-17 16:37:43 +01:00
Disable pufferfish's suffocation optimization for withers, supersedes #1411
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: wefhy <85190077+wefhy@users.noreply.github.com>
|
||||
Date: Sat, 26 Aug 2023 23:48:05 -0700
|
||||
Subject: [PATCH] Disable pufferfish suffocation optimization for withers
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
index 0b08cf7b26731ffd6f3909342f4e3a92fe0c813e..4cd04661b39a7055f5767a3dff88f9a3e197d810 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -419,7 +419,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
boolean flag = this instanceof net.minecraft.world.entity.player.Player;
|
||||
|
||||
if (!this.level().isClientSide) {
|
||||
- if ((!gg.pufferfish.pufferfish.PufferfishConfig.enableSuffocationOptimization || (tickCount % 10 == 0 && couldPossiblyBeHurt(1.0F))) && this.isInWall()) { // Pufferfish - optimize suffocation
|
||||
+ if (shouldCheckForSuffocation() && this.isInWall()) { // Pufferfish - optimize suffocation // Purpur
|
||||
this.hurt(this.damageSources().inWall(), 1.0F);
|
||||
} else if (flag && !this.level().getWorldBorder().isWithinBounds(this.getBoundingBox())) {
|
||||
double d0 = this.level().getWorldBorder().getDistanceToBorder(this) + this.level().getWorldBorder().getDamageSafeZone();
|
||||
@@ -1412,6 +1412,11 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
return true;
|
||||
}
|
||||
// Pufferfish end
|
||||
+ // Purpur start
|
||||
+ public boolean shouldCheckForSuffocation() {
|
||||
+ return (!gg.pufferfish.pufferfish.PufferfishConfig.enableSuffocationOptimization || (tickCount % 10 == 0 && couldPossiblyBeHurt(1.0F)));
|
||||
+ }
|
||||
+ // Purpur end
|
||||
|
||||
@Override
|
||||
public boolean hurt(DamageSource source, float amount) {
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java b/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java
|
||||
index 71f8cea4a33b30fdafa41714a424b3092a3a7cd0..4952a7daa1aad68e3ba53123093cd879e0d544b5 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java
|
||||
@@ -291,6 +291,13 @@ public class WitherBoss extends Monster implements PowerableMob, RangedAttackMob
|
||||
this.bossEvent.setName(this.getDisplayName());
|
||||
}
|
||||
|
||||
+ // Purpur start - optimize suffocation
|
||||
+ @Override
|
||||
+ public boolean shouldCheckForSuffocation() {
|
||||
+ return true;
|
||||
+ }
|
||||
+ // Purpur end
|
||||
+
|
||||
@Override
|
||||
protected SoundEvent getAmbientSound() {
|
||||
return SoundEvents.WITHER_AMBIENT;
|
||||
Reference in New Issue
Block a user