mirror of https://github.com/YatopiaMC/Yatopia.git
44 lines
2.0 KiB
Diff
44 lines
2.0 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Paul Sauve <paul@technove.co>
|
|
Date: Mon, 26 Apr 2021 10:52:56 -0500
|
|
Subject: [PATCH] Cache climbing check for activation
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/entity/EntityLiving.java b/src/main/java/net/minecraft/world/entity/EntityLiving.java
|
|
index 6b82dffa3d0938a94114ead277b42c71ea3bb52b..88fc16e49076cf5589e27660a388909291447fac 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/EntityLiving.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/EntityLiving.java
|
|
@@ -1745,6 +1745,19 @@ public abstract class EntityLiving extends Entity {
|
|
}
|
|
}
|
|
|
|
+ // Airplane start
|
|
+ private boolean cachedIsClimbing = false;
|
|
+ private BlockPosition lastClimbingPosition = null;
|
|
+
|
|
+ public boolean isClimbingCached() {
|
|
+ if (!this.getChunkCoordinates().equals(this.lastClimbingPosition)) {
|
|
+ this.cachedIsClimbing = this.isClimbing();
|
|
+ this.lastClimbingPosition = this.getChunkCoordinates();
|
|
+ }
|
|
+ return this.cachedIsClimbing;
|
|
+ }
|
|
+ // Airplane end
|
|
+
|
|
public IBlockData ds() {
|
|
return this.world.getType(this.getChunkCoordinates());
|
|
}
|
|
diff --git a/src/main/java/org/spigotmc/ActivationRange.java b/src/main/java/org/spigotmc/ActivationRange.java
|
|
index 0c86a93a34fdbb65365e81915ac9f54df4dde88b..b9c675ecae8fd87cca3c7475f4901c9d5529ac6b 100644
|
|
--- a/src/main/java/org/spigotmc/ActivationRange.java
|
|
+++ b/src/main/java/org/spigotmc/ActivationRange.java
|
|
@@ -313,7 +313,7 @@ public class ActivationRange
|
|
if ( entity instanceof EntityLiving )
|
|
{
|
|
EntityLiving living = (EntityLiving) entity;
|
|
- if ( living.isClimbing() || living.jumping || living.hurtTicks > 0 || living.effects.size() > 0 ) // Paper
|
|
+ if ( living.isClimbingCached() || living.jumping || living.hurtTicks > 0 || living.effects.size() > 0 ) // Paper // Airplane - use cached climbing
|
|
{
|
|
return 1; // Paper
|
|
}
|