Merge branch 'master' into pre/1.13

* master:
  clear current chunk and entity slice on chunk unload
This commit is contained in:
Aikar 2018-07-30 01:06:39 -04:00
commit 75d71a2f14
No known key found for this signature in database
GPG Key ID: 401ADFC9891FAAFE
6 changed files with 38 additions and 22 deletions

View File

@ -1,4 +1,4 @@
From 9f7252ab03448103fe971b3e9b409fc016c23ff2 Mon Sep 17 00:00:00 2001
From b4426208394038596094e3d30684b8f22aa25a92 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Wed, 4 Jul 2018 02:10:36 -0400
Subject: [PATCH] Store reference to current Chunk for Entity and Block
@ -8,7 +8,7 @@ This enables us a fast reference to the entities current chunk instead
of having to look it up by hashmap lookups.
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
index cd4fbee0ca..7837f1024c 100644
index cd4fbee0ca..5aedd386fe 100644
--- a/src/main/java/net/minecraft/server/Chunk.java
+++ b/src/main/java/net/minecraft/server/Chunk.java
@@ -33,7 +33,7 @@ public class Chunk implements IChunkAccess {
@ -85,6 +85,14 @@ index cd4fbee0ca..7837f1024c 100644
}
public boolean c(BlockPosition blockposition) {
@@ -818,6 +848,7 @@ public class Chunk implements IChunkAccess {
}
}
// Spigot End
+ entity.setCurrentChunk(null); // Paper
// Do not pass along players, as doing so can get them stuck outside of time.
// (which for example disables inventory icon updates and prevents block breaking)
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index 38e606c131..5451ab07f5 100644
--- a/src/main/java/net/minecraft/server/Entity.java

View File

@ -1,4 +1,4 @@
From 86c2617665e69182c21d9c57a6827cec49848fa8 Mon Sep 17 00:00:00 2001
From 683354cb417c352fb5f5507f7c56192b970f65e2 Mon Sep 17 00:00:00 2001
From: Byteflux <byte@byteflux.net>
Date: Wed, 2 Mar 2016 00:52:31 -0600
Subject: [PATCH] Lighting Queue
@ -43,7 +43,7 @@ index 68898d624f..4b36a0f053 100644
+ }
}
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
index adf3dee2ef..eb7a41977f 100644
index 7e5fa65ad7..476f5b4062 100644
--- a/src/main/java/net/minecraft/server/Chunk.java
+++ b/src/main/java/net/minecraft/server/Chunk.java
@@ -91,6 +91,7 @@ public class Chunk implements IChunkAccess {
@ -84,7 +84,7 @@ index adf3dee2ef..eb7a41977f 100644
}
TileEntity tileentity;
@@ -1287,6 +1297,16 @@ public class Chunk implements IChunkAccess {
@@ -1288,6 +1298,16 @@ public class Chunk implements IChunkAccess {
return this.E == 8;
}
@ -114,7 +114,7 @@ index aabdc9e2f0..d025d949e3 100644
// Update neighbor counts
for (int x = -2; x < 3; x++) {
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index ae17796ce2..1ac8d61cd9 100644
index 6fbf841f06..9dc9668c45 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -864,7 +864,7 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati
@ -233,7 +233,7 @@ index 0000000000..345cd58240
+ }
+}
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index bfe09a2055..c40ecbc0c3 100644
index ada8376e8c..776882ba4f 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -325,7 +325,7 @@ public abstract class World implements GeneratorAccess, IIBlockAccess, AutoClose

View File

@ -1,4 +1,4 @@
From 65217eb509331593bef12e5c2a710df06d993889 Mon Sep 17 00:00:00 2001
From 74c31e8ae4ee9d9949abf0b1d68bb464c13b7da9 Mon Sep 17 00:00:00 2001
From: CullanP <cullanpage@gmail.com>
Date: Thu, 3 Mar 2016 02:13:38 -0600
Subject: [PATCH] Avoid hopper searches if there are no items
@ -14,7 +14,7 @@ And since minecart hoppers are used _very_ rarely near we can avoid alot of sear
Combined, this adds up a lot.
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
index 39aeabff74..ea7d82f099 100644
index 476f5b4062..dc9664732b 100644
--- a/src/main/java/net/minecraft/server/Chunk.java
+++ b/src/main/java/net/minecraft/server/Chunk.java
@@ -92,6 +92,10 @@ public class Chunk implements IChunkAccess {
@ -52,7 +52,7 @@ index 39aeabff74..ea7d82f099 100644
entity.setCurrentChunk(null);
entityCounts.decrement(entity.getMinecraftKeyString());
// Paper end
@@ -898,6 +912,15 @@ public class Chunk implements IChunkAccess {
@@ -899,6 +913,15 @@ public class Chunk implements IChunkAccess {
if (!this.entitySlices[k].isEmpty()) {
Iterator iterator = this.entitySlices[k].iterator();
@ -68,7 +68,7 @@ index 39aeabff74..ea7d82f099 100644
while (iterator.hasNext()) {
Entity entity1 = (Entity) iterator.next();
@@ -934,7 +957,18 @@ public class Chunk implements IChunkAccess {
@@ -935,7 +958,18 @@ public class Chunk implements IChunkAccess {
i = MathHelper.clamp(i, 0, this.entitySlices.length - 1);
j = MathHelper.clamp(j, 0, this.entitySlices.length - 1);

View File

@ -1,4 +1,4 @@
From 3886acfd07271f1c99ec15a9751112ea7444500c Mon Sep 17 00:00:00 2001
From ec58c14b8584b009bb326b0164d746a7e4daed47 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Mon, 28 Mar 2016 20:46:14 -0400
Subject: [PATCH] Configurable Chunk Inhabited Timer
@ -9,7 +9,7 @@ aspects of vanilla gameplay to this factor.
For people who want all chunks to be treated equally, you can disable the timer.
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index b3b3baddc..613964ce0 100644
index b3b3baddc0..613964ce04 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -222,4 +222,9 @@ public class PaperWorldConfig {
@ -23,7 +23,7 @@ index b3b3baddc..613964ce0 100644
+ }
}
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
index 5d1812ab0..695c6d3b7 100644
index b8e3307f36..00f55355f6 100644
--- a/src/main/java/net/minecraft/server/Chunk.java
+++ b/src/main/java/net/minecraft/server/Chunk.java
@@ -55,7 +55,7 @@ public class Chunk implements IChunkAccess {
@ -35,7 +35,7 @@ index 5d1812ab0..695c6d3b7 100644
private int B;
private final ConcurrentLinkedQueue<BlockPosition> C;
public boolean d;
@@ -1228,7 +1228,7 @@ public class Chunk implements IChunkAccess {
@@ -1229,7 +1229,7 @@ public class Chunk implements IChunkAccess {
}
public long m() {

View File

@ -1,4 +1,4 @@
From cfaacd1e20ab7cd9ecb5cca91fe53e601d362c28 Mon Sep 17 00:00:00 2001
From 038b2b417070812666a5b72ccf29309d9ea7833f Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Mon, 19 Sep 2016 23:16:39 -0400
Subject: [PATCH] Auto Save Improvements
@ -64,7 +64,7 @@ index ec6b550ff6..499230af60 100644
+ }
}
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
index c27073d27c..06d6814b83 100644
index 74ff495ad4..7dd1887762 100644
--- a/src/main/java/net/minecraft/server/Chunk.java
+++ b/src/main/java/net/minecraft/server/Chunk.java
@@ -52,9 +52,9 @@ public class Chunk implements IChunkAccess {
@ -79,7 +79,7 @@ index c27073d27c..06d6814b83 100644
private int z;
private long A; public long getInhabitedTime() { return A; } // Paper - OBFHELPER
private int B;
@@ -1010,11 +1010,11 @@ public class Chunk implements IChunkAccess {
@@ -1011,11 +1011,11 @@ public class Chunk implements IChunkAccess {
if (this.w && this.world.getTime() != this.lastSaved || this.y) {
return true;
}
@ -128,7 +128,7 @@ index 982e18f8af..1879c32381 100644
public final MinecraftServer server;
public final PlayerInteractManager playerInteractManager;
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index d25e5c508a..3447afcad8 100644
index e3469cacff..02daa43c68 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -144,6 +144,7 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati

View File

@ -1,4 +1,4 @@
From 709cfcc4c85d60b64d01b4e435fd050436fa9990 Mon Sep 17 00:00:00 2001
From a0fd8d4331087f2561345829c3ce613fe3cfbef2 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Mon, 23 Jul 2018 22:44:23 -0400
Subject: [PATCH] Add some Debug to Chunk Entity slices
@ -9,7 +9,7 @@ This should hopefully avoid duplicate entities ever being created
if the entity was to end up in 2 different chunk slices
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
index 7f882bdca..4e32ae7db 100644
index 982ab51f62..14e98fcedf 100644
--- a/src/main/java/net/minecraft/server/Chunk.java
+++ b/src/main/java/net/minecraft/server/Chunk.java
@@ -712,8 +712,33 @@ public class Chunk implements IChunkAccess {
@ -60,8 +60,16 @@ index 7f882bdca..4e32ae7db 100644
this.markDirty();
if (entity instanceof EntityItem) {
itemCounts[i]--;
@@ -957,6 +988,7 @@ public class Chunk implements IChunkAccess {
}
// Spigot End
entity.setCurrentChunk(null); // Paper
+ entity.entitySlice = null; // Paper
// Do not pass along players, as doing so can get them stuck outside of time.
// (which for example disables inventory icon updates and prevents block breaking)
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index 184d46191..3a5b3f34a 100644
index afbd846aad..181a9b7546 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -63,6 +63,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke