mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-16 06:30:46 +01:00
Only use stored chunk ref if it matches current chunk registration
Closes #1197 While this really undoes a lot of the desired performance gains avoiding chunk lookups, we sadly have to accept this because we are seeing lots of bugs with entities.
This commit is contained in:
parent
20aba250df
commit
1ba951ee5d
10 changed files with 17 additions and 12 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 21118c031..921b442cd 100644
|
||||
index a4c5b780c..c620667e0 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 0ed9a8413..646a2d673 100644
|
||||
index 64e566d3a..f75d57c30 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 e8775e66c..7e992aeaa 100644
|
||||
index 843cb3a61..89ea217b9 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 137da4255..655340c0b 100644
|
||||
index 9d7fe97ce..c7513622e 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 655340c0b..a96513e27 100644
|
||||
index c7513622e..72efe282b 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 7e992aeaa..08d872318 100644
|
||||
index 89ea217b9..437ae2fa3 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
|
||||
|
|
|
@ -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 0412e183a..9ce691061 100644
|
||||
index e860e9c6a..a52cd0728 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 fccaebfbd..5d1ea0d55 100644
|
||||
index 9f2db9025..a96cdcbc6 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..ed090cc50 100644
|
||||
index 3a8902bf1..f7750a05c 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
|
||||
|
@ -90,8 +90,13 @@ index 3a8902bf1..ed090cc50 100644
|
|||
// Paper start
|
||||
+ private java.lang.ref.WeakReference<Chunk> currentChunk = null;
|
||||
+ public Chunk getCurrentChunk() {
|
||||
+ final Chunk chunk = currentChunk != null ? currentChunk.get() : world.getChunkIfLoaded(getChunkX(), getChunkZ());
|
||||
+ return chunk != null && chunk.isLoaded() ? chunk : null;
|
||||
+ final Chunk chunk = currentChunk != null ? currentChunk.get() : null;
|
||||
+ final int cx = getChunkX();
|
||||
+ final int cz = getChunkZ();
|
||||
+ if (chunk != null && chunk.isLoaded() && chunk.locX == cx && chunk.locZ == cz) {
|
||||
+ return chunk;
|
||||
+ }
|
||||
+ return world.getChunkIfLoaded(cx, cz);
|
||||
+ }
|
||||
+ public void setCurrentChunk(Chunk chunk) {
|
||||
+ this.currentChunk = chunk != null ? new java.lang.ref.WeakReference<>(chunk) : null;
|
||||
|
|
|
@ -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 08d872318..e6a5bc53c 100644
|
||||
index 437ae2fa3..17ec10c26 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