9
0
mirror of https://github.com/BX-Team/DivineMC.git synced 2026-01-03 22:16:22 +00:00
Files
DivineMC/divinemc-server/minecraft-patches/features/0074-Pufferfish-Cache-climbing-check-for-activation.patch
NONPLAYT d9c4e8a199 Updated Upstream (Purpur)
Upstream has released updates that appear to apply and compile correctly

Purpur Changes:
PurpurMC/Purpur@efc76215 Add missing copper blocks to waxables and weatherables options (#1712)
PurpurMC/Purpur@3ca0d663 Updated Upstream (Paper)
PurpurMC/Purpur@917675d0 Updated Upstream (Paper)
PurpurMC/Purpur@ffe2f809 Add option to disable Warden Sonic Boom (#1713)
2025-10-28 03:51:29 +03:00

50 lines
2.5 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com>
Date: Tue, 14 Oct 2025 01:35:26 +0300
Subject: [PATCH] Pufferfish: Cache climbing check for activation
This patch is based on the following patch:
"Cache climbing check for activation"
By: Paul Sauve <paul@technove.co>
As part of: Pufferfish (https://github.com/pufferfish-gg/Pufferfish)
Licensed under: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html)
diff --git a/io/papermc/paper/entity/activation/ActivationRange.java b/io/papermc/paper/entity/activation/ActivationRange.java
index 226088405c019922085285ba5d04d7c131470c69..61bf86a1380060ff118c31b5070b28705a897529 100644
--- a/io/papermc/paper/entity/activation/ActivationRange.java
+++ b/io/papermc/paper/entity/activation/ActivationRange.java
@@ -238,7 +238,7 @@ public final class ActivationRange {
}
// special cases.
if (entity instanceof final LivingEntity living) {
- if (living.onClimbable() || living.jumping || living.hurtTime > 0 || !living.activeEffects.isEmpty() || living.isFreezing()) {
+ if (living.onClimbableCached() || living.jumping || living.hurtTime > 0 || !living.activeEffects.isEmpty() || living.isFreezing()) { // DivineMC - Pufferfish: Cache climbing check for activation
return 1;
}
if (entity instanceof final Mob mob && mob.getTarget() != null) {
diff --git a/net/minecraft/world/entity/LivingEntity.java b/net/minecraft/world/entity/LivingEntity.java
index c08fb102fb9d325cf7c41e32b32833e70474fecb..3533a8fe46f255025db70242b214fcd51916a6d0 100644
--- a/net/minecraft/world/entity/LivingEntity.java
+++ b/net/minecraft/world/entity/LivingEntity.java
@@ -2243,6 +2243,20 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin
return this.lastClimbablePos;
}
+ // DivineMC start - Pufferfish: Cache climbing check for activation
+ private boolean cachedOnClimbable = false;
+ private BlockPos lastClimbingPosition = null;
+
+ public boolean onClimbableCached() {
+ if (!this.blockPosition().equals(this.lastClimbingPosition)) {
+ this.cachedOnClimbable = this.onClimbable();
+ this.lastClimbingPosition = this.blockPosition();
+ }
+
+ return this.cachedOnClimbable;
+ }
+ // DivineMC end - Pufferfish: Cache climbing check for activation
+
public boolean onClimbable() {
if (this.isSpectator()) {
return false;