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 74f80b6af18c0b91d9613384ca6bafd9c89f23a4..003e1f6dc8efbabcb2e0f7a6b379196f02203903 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 8b36ca5062f8e0e8bd58aa506e91704a747de81b..94910bf0c53c79588c55b89e4a023273d6c859ef 100644
|
|
--- a/src/main/java/org/spigotmc/ActivationRange.java
|
|
+++ b/src/main/java/org/spigotmc/ActivationRange.java
|
|
@@ -309,7 +309,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
|
|
}
|