mirror of
https://github.com/Dreeam-qwq/Gale.git
synced 2025-12-26 18:19:11 +00:00
Faster floating-point positive modulo
This commit is contained in:
78
patches/server/0033-Cache-on-climbable-check.patch
Normal file
78
patches/server/0033-Cache-on-climbable-check.patch
Normal file
@@ -0,0 +1,78 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Martijn Muijsers <martijnmuijsers@live.nl>
|
||||
Date: Wed, 23 Nov 2022 20:40:40 +0100
|
||||
Subject: [PATCH] Cache on climbable check
|
||||
|
||||
License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html)
|
||||
Gale - https://galemc.org
|
||||
|
||||
This patch is based on the following patch:
|
||||
"Cache climbing check for activation"
|
||||
By: Paul Sauve <paul@technove.co>
|
||||
As part of: Airplane (https://github.com/TECHNOVE/Airplane)
|
||||
Licensed under: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html)
|
||||
|
||||
* Airplane copyright *
|
||||
|
||||
Airplane
|
||||
Copyright (C) 2020 Technove LLC
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
index e1f8f3480bfda2bc3c042d0b57cbb051ad3d95bc..6ad84442f7722f709c7430a1b22a59957852c28b 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -142,7 +142,6 @@ import org.bukkit.event.entity.EntityTeleportEvent;
|
||||
import org.bukkit.event.player.PlayerItemConsumeEvent;
|
||||
// CraftBukkit end
|
||||
|
||||
-import co.aikar.timings.MinecraftTimings; // Paper
|
||||
|
||||
public abstract class LivingEntity extends Entity implements Attackable {
|
||||
|
||||
@@ -1963,6 +1962,20 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
return this.lastClimbablePos;
|
||||
}
|
||||
|
||||
+
|
||||
+ // Gale start - Airplane - cache on climbable check
|
||||
+ 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;
|
||||
+ }
|
||||
+ // Gale end - Airplane - cache on climbable check
|
||||
+
|
||||
public boolean onClimbable() {
|
||||
if (this.isSpectator()) {
|
||||
return false;
|
||||
diff --git a/src/main/java/org/spigotmc/ActivationRange.java b/src/main/java/org/spigotmc/ActivationRange.java
|
||||
index eda7f0bb42f7269676d5d2193e1155912ede9920..0d04d7f9a9df7140cc35534a3f301f2815faed51 100644
|
||||
--- a/src/main/java/org/spigotmc/ActivationRange.java
|
||||
+++ b/src/main/java/org/spigotmc/ActivationRange.java
|
||||
@@ -292,7 +292,7 @@ public class ActivationRange
|
||||
if ( entity instanceof LivingEntity )
|
||||
{
|
||||
LivingEntity living = (LivingEntity) entity;
|
||||
- if ( living.onClimbable() || living.jumping || living.hurtTime > 0 || living.activeEffects.size() > 0 ) // Paper
|
||||
+ if ( living.onClimbableCached() || living.jumping || living.hurtTime > 0 || living.activeEffects.size() > 0 ) // Paper // Gale - Airplane - cache on climbable check - use cached
|
||||
{
|
||||
return 1; // Paper
|
||||
}
|
||||
Reference in New Issue
Block a user