9
0
mirror of https://github.com/BX-Team/DivineMC.git synced 2025-12-19 14:59:25 +00:00
Files
DivineMC/divinemc-server/minecraft-patches/features/0073-Pufferfish-Cache-climbing-check-for-activation.patch
wiyba 6e0570e215 Updated Upstream (Purpur)
Upstream has released updates that appear to apply and compile correctly

Purpur Changes:
2025-10-31 15:33:03 +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 5d9089d98ed0daa8ee680123e50c3ce9abd2bca6..04623779031daa2f0d8e9c149f0b40388cb2bd8b 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 e3e64a0bf7b8b9e04114a2b0b363932517deea0f..ad3e68127ba84bdc18f738dbf709099a50aa8216 100644
--- a/net/minecraft/world/entity/LivingEntity.java
+++ b/net/minecraft/world/entity/LivingEntity.java
@@ -2244,6 +2244,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;