mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-15 14:13:56 +01:00
Fix issue with entity activation range check - #1199
This commit is contained in:
parent
695beffc27
commit
fe9d5b5570
10 changed files with 31 additions and 17 deletions
|
@ -37,7 +37,7 @@ index ec9a87239..b08274d93 100644
|
|||
|
||||
if (scoreboard.addPlayerToTeam(s2, s)) {
|
||||
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
|
||||
index 158ee9e37..0e761997c 100644
|
||||
index 804104818..f547dbfd0 100644
|
||||
--- a/src/main/java/net/minecraft/server/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/server/Entity.java
|
||||
@@ -0,0 +0,0 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
|
||||
|
|
|
@ -5,7 +5,7 @@ Subject: [PATCH] Don't allow entities to ride themselves - #572
|
|||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
|
||||
index e4b45f2c7..8fbef57cc 100644
|
||||
index b6711dcfa..e7f63c927 100644
|
||||
--- a/src/main/java/net/minecraft/server/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/server/Entity.java
|
||||
@@ -0,0 +0,0 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
|
||||
|
|
|
@ -7,7 +7,7 @@ Had some issue with this in past, and this is the vanilla logic.
|
|||
Potentially an old CB change that's no longer needed.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
|
||||
index b3eea4337..13035574e 100644
|
||||
index eb07d4233..e2202ed0c 100644
|
||||
--- a/src/main/java/net/minecraft/server/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/server/Entity.java
|
||||
@@ -0,0 +0,0 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
|
||||
|
|
|
@ -24,7 +24,7 @@ index 0094d1a87..4da846719 100644
|
|||
+ }
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
|
||||
index 05aad7dd0..bee8e632a 100644
|
||||
index 4540bf9f9..d358ab26a 100644
|
||||
--- a/src/main/java/net/minecraft/server/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/server/Entity.java
|
||||
@@ -0,0 +0,0 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
|
||||
|
|
|
@ -5,7 +5,7 @@ Subject: [PATCH] Entity Origin API
|
|||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
|
||||
index bee8e632a..7f66f7579 100644
|
||||
index d358ab26a..011cf59c0 100644
|
||||
--- a/src/main/java/net/minecraft/server/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/server/Entity.java
|
||||
@@ -0,0 +0,0 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
|
||||
|
|
|
@ -19,7 +19,7 @@ index abc1aabdd..6ea608ba9 100644
|
|||
+ }
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
|
||||
index 13035574e..8f47ffd47 100644
|
||||
index e2202ed0c..88faa4601 100644
|
||||
--- a/src/main/java/net/minecraft/server/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/server/Entity.java
|
||||
@@ -0,0 +0,0 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
|
||||
|
@ -31,7 +31,7 @@ index 13035574e..8f47ffd47 100644
|
|||
public ScoreboardTeamBase aY() {
|
||||
if (!this.world.paperConfig.nonPlayerEntitiesOnScoreboards && !(this instanceof EntityHuman)) { return null; } // Paper
|
||||
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
|
||||
index 7c708a0de..9eb7b012f 100644
|
||||
index ba1cc267e..2b8162917 100644
|
||||
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
|
||||
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
|
||||
@@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
|
||||
|
|
|
@ -32,7 +32,7 @@ index 067cb233e..06acdaaf0 100644
|
|||
+ }
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
|
||||
index b6b4b581b..e77a3b2ab 100644
|
||||
index c105dd9b0..334441ed7 100644
|
||||
--- a/src/main/java/net/minecraft/server/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/server/Entity.java
|
||||
@@ -0,0 +0,0 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
|
||||
|
|
|
@ -22,7 +22,7 @@ requirement, but plugins (such as my own) use this method to
|
|||
trigger a "reload" of the entity on the client.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
|
||||
index b61927c99..eff84f812 100644
|
||||
index 7b17c32bb..d03e7c24f 100644
|
||||
--- a/src/main/java/net/minecraft/server/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/server/Entity.java
|
||||
@@ -0,0 +0,0 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
|
||||
|
|
|
@ -81,7 +81,7 @@ index 4bbebb25a..68008fe6a 100644
|
|||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
|
||||
index 3a8902bf1..f140d5e28 100644
|
||||
index 3a8902bf1..4af566b36 100644
|
||||
--- a/src/main/java/net/minecraft/server/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/server/Entity.java
|
||||
@@ -0,0 +0,0 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
|
||||
|
@ -89,20 +89,34 @@ index 3a8902bf1..f140d5e28 100644
|
|||
|
||||
// Paper start
|
||||
+ private java.lang.ref.WeakReference<Chunk> currentChunk = null;
|
||||
+
|
||||
+ public void setCurrentChunk(Chunk chunk) {
|
||||
+ this.currentChunk = chunk != null ? new java.lang.ref.WeakReference<>(chunk) : null;
|
||||
+ }
|
||||
+ /**
|
||||
+ * Returns the entities current registered chunk. If the entity is not added to a chunk yet, it will return null
|
||||
+ */
|
||||
+ public Chunk getCurrentChunk() {
|
||||
+ final Chunk chunk = currentChunk != null ? currentChunk.get() : null;
|
||||
+ return chunk != null && chunk.isLoaded() ? chunk : null;
|
||||
+ }
|
||||
+ public void setCurrentChunk(Chunk chunk) {
|
||||
+ this.currentChunk = chunk != null ? new java.lang.ref.WeakReference<>(chunk) : null;
|
||||
+ }
|
||||
+ /**
|
||||
+ * Returns the chunk at the location, using the entities local cache if avail
|
||||
+ * Will only return null if the location specified is not loaded
|
||||
+ */
|
||||
+ public Chunk getCurrentChunkAt(int x, int z) {
|
||||
+ if (getChunkX() == x && getChunkZ() == z) {
|
||||
+ return getCurrentChunk();
|
||||
+ } else {
|
||||
+ return world.getChunkIfLoaded(x, z);
|
||||
+ Chunk chunk = getCurrentChunk();
|
||||
+ if (chunk != null) {
|
||||
+ return chunk;
|
||||
+ }
|
||||
+ }
|
||||
+ return world.getChunkIfLoaded(x, z);
|
||||
+ }
|
||||
+ /**
|
||||
+ * Returns the chunk at the entities current location, using the entities local cache if avail
|
||||
+ * Will only return null if the location specified is not loaded
|
||||
+ */
|
||||
+ public Chunk getChunkAtLocation() {
|
||||
+ return getCurrentChunkAt((int)Math.floor(locX) >> 4, (int)Math.floor(locZ) >> 4);
|
||||
+ }
|
||||
|
|
|
@ -5,7 +5,7 @@ Subject: [PATCH] Vehicle Event Cancellation Changes
|
|||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
|
||||
index 8f47ffd47..41fca4118 100644
|
||||
index 88faa4601..aece54d26 100644
|
||||
--- a/src/main/java/net/minecraft/server/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/server/Entity.java
|
||||
@@ -0,0 +0,0 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
|
||||
|
|
Loading…
Reference in a new issue