clear current chunk and entity slice on chunk unload

ideally this should of never mattered, as it will only
be hit if you teleport out of an unloaded chunk...

But apparently some people are triggering this.

See #1223
This commit is contained in:
Aikar 2018-07-30 00:51:58 -04:00
parent fb19b8c1c1
commit e7a59cde75
No known key found for this signature in database
GPG key ID: 401ADFC9891FAAFE
9 changed files with 92 additions and 76 deletions

View file

@ -1,4 +1,4 @@
From ab050c94d0a74f405ae49fce43faf3ee265d9a39 Mon Sep 17 00:00:00 2001
From a888d340ea17fc233b7d2e7e47f2eac246a71dbe 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 4bbebb25a..ea167a17b 100644
index 4bbebb25af..f74ed3a143 100644
--- a/src/main/java/net/minecraft/server/Chunk.java
+++ b/src/main/java/net/minecraft/server/Chunk.java
@@ -25,7 +25,7 @@ public class Chunk {
@ -80,8 +80,16 @@ index 4bbebb25a..ea167a17b 100644
// Spigot start - decrement creature type count
// Keep this synced up with World.a(Class)
if (entity instanceof EntityInsentient) {
@@ -798,6 +828,7 @@ public class Chunk {
}
}
// 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 06c72b95f..0e3a94ab8 100644
index 06c72b95f3..0e3a94ab8c 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -121,7 +121,7 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
@ -133,7 +141,7 @@ index 06c72b95f..0e3a94ab8 100644
private MinecraftKey entityKey = getMinecraftKey();
diff --git a/src/main/java/net/minecraft/server/TileEntity.java b/src/main/java/net/minecraft/server/TileEntity.java
index 0176ca530..29069b753 100644
index 0176ca530c..29069b753e 100644
--- a/src/main/java/net/minecraft/server/TileEntity.java
+++ b/src/main/java/net/minecraft/server/TileEntity.java
@@ -28,6 +28,14 @@ public abstract class TileEntity implements KeyedObject {
@ -152,7 +160,7 @@ index 0176ca530..29069b753 100644
private MinecraftKey tileEntityKey = getMinecraftKey();
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
index c5a194ffe..833e3111d 100644
index c5a194ffea..833e3111de 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
@@ -9,6 +9,7 @@ import java.util.UUID;

View file

@ -1,4 +1,4 @@
From e22eabf390b42d414ad3af7a6d453ef84da87692 Mon Sep 17 00:00:00 2001
From 353f4b4a2bb1ad9b48b72f6db5cbf5a61a2dd53c Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Thu, 3 Mar 2016 04:00:11 -0600
Subject: [PATCH] Timings v2
@ -6,7 +6,7 @@ Subject: [PATCH] Timings v2
diff --git a/src/main/java/co/aikar/timings/MinecraftTimings.java b/src/main/java/co/aikar/timings/MinecraftTimings.java
new file mode 100644
index 000000000..1b33390de
index 0000000000..1b33390de5
--- /dev/null
+++ b/src/main/java/co/aikar/timings/MinecraftTimings.java
@@ -0,0 +1,125 @@
@ -137,7 +137,7 @@ index 000000000..1b33390de
+}
diff --git a/src/main/java/co/aikar/timings/TimedChunkGenerator.java b/src/main/java/co/aikar/timings/TimedChunkGenerator.java
new file mode 100644
index 000000000..089154f62
index 0000000000..089154f626
--- /dev/null
+++ b/src/main/java/co/aikar/timings/TimedChunkGenerator.java
@@ -0,0 +1,131 @@
@ -274,7 +274,7 @@ index 000000000..089154f62
+}
diff --git a/src/main/java/co/aikar/timings/WorldTimingsHandler.java b/src/main/java/co/aikar/timings/WorldTimingsHandler.java
new file mode 100644
index 000000000..e0ad559b7
index 0000000000..e0ad559b74
--- /dev/null
+++ b/src/main/java/co/aikar/timings/WorldTimingsHandler.java
@@ -0,0 +1,99 @@
@ -378,7 +378,7 @@ index 000000000..e0ad559b7
+ }
+}
diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java
index 5ab2cf6ee..b5795b6d3 100644
index 5ab2cf6eec..b5795b6d34 100644
--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java
@@ -14,11 +14,14 @@ import java.util.concurrent.TimeUnit;
@ -422,7 +422,7 @@ index 5ab2cf6ee..b5795b6d3 100644
+ }
}
diff --git a/src/main/java/net/minecraft/server/Block.java b/src/main/java/net/minecraft/server/Block.java
index 2dca6dbcb..352310960 100644
index 2dca6dbcb9..3523109603 100644
--- a/src/main/java/net/minecraft/server/Block.java
+++ b/src/main/java/net/minecraft/server/Block.java
@@ -35,6 +35,15 @@ public class Block {
@ -442,10 +442,10 @@ index 2dca6dbcb..352310960 100644
public static int getId(Block block) {
return Block.REGISTRY.a(block); // CraftBukkit - decompile error
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
index f540b14a2..472b9c1c3 100644
index e5f29d3c11..fe1fe28957 100644
--- a/src/main/java/net/minecraft/server/Chunk.java
+++ b/src/main/java/net/minecraft/server/Chunk.java
@@ -937,7 +937,7 @@ public class Chunk {
@@ -938,7 +938,7 @@ public class Chunk {
// CraftBukkit start
public void loadNearby(IChunkProvider ichunkprovider, ChunkGenerator chunkgenerator, boolean newChunk) {
@ -454,7 +454,7 @@ index f540b14a2..472b9c1c3 100644
Server server = world.getServer();
if (server != null) {
/*
@@ -963,7 +963,8 @@ public class Chunk {
@@ -964,7 +964,8 @@ public class Chunk {
}
}
// CraftBukkit end
@ -464,7 +464,7 @@ index f540b14a2..472b9c1c3 100644
Chunk chunk = ichunkprovider.getLoadedChunkAt(this.locX, this.locZ - 1);
Chunk chunk1 = ichunkprovider.getLoadedChunkAt(this.locX + 1, this.locZ);
Chunk chunk2 = ichunkprovider.getLoadedChunkAt(this.locX, this.locZ + 1);
@@ -988,7 +989,7 @@ public class Chunk {
@@ -989,7 +990,7 @@ public class Chunk {
chunk4.a(chunkgenerator);
}
}
@ -473,7 +473,7 @@ index f540b14a2..472b9c1c3 100644
}
@@ -1201,6 +1202,7 @@ public class Chunk {
@@ -1202,6 +1203,7 @@ public class Chunk {
}
public void o() {
@ -481,7 +481,7 @@ index f540b14a2..472b9c1c3 100644
this.done = true;
this.lit = true;
BlockPosition blockposition = new BlockPosition(this.locX << 4, 0, this.locZ << 4);
@@ -1234,6 +1236,7 @@ public class Chunk {
@@ -1235,6 +1237,7 @@ public class Chunk {
}
}
@ -490,7 +490,7 @@ index f540b14a2..472b9c1c3 100644
private void z() {
diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java
index 86973cb98..bd006ef74 100644
index 86973cb988..bd006ef741 100644
--- a/src/main/java/net/minecraft/server/ChunkProviderServer.java
+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java
@@ -204,7 +204,7 @@ public class ChunkProviderServer implements IChunkProvider {
@ -503,7 +503,7 @@ index 86973cb98..bd006ef74 100644
this.chunkLoader.saveChunk(this.world, chunk, unloaded); // Spigot
} catch (IOException ioexception) {
diff --git a/src/main/java/net/minecraft/server/ChunkRegionLoader.java b/src/main/java/net/minecraft/server/ChunkRegionLoader.java
index 50ec3adb8..a401dec60 100644
index 50ec3adb87..a401dec60d 100644
--- a/src/main/java/net/minecraft/server/ChunkRegionLoader.java
+++ b/src/main/java/net/minecraft/server/ChunkRegionLoader.java
@@ -423,7 +423,7 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver {
@ -543,7 +543,7 @@ index 50ec3adb8..a401dec60 100644
// return chunk; // CraftBukkit
}
diff --git a/src/main/java/net/minecraft/server/DedicatedServer.java b/src/main/java/net/minecraft/server/DedicatedServer.java
index e1cb96a88..8f2afcc32 100644
index e1cb96a88a..8f2afcc32f 100644
--- a/src/main/java/net/minecraft/server/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/DedicatedServer.java
@@ -24,7 +24,7 @@ import java.io.PrintStream;
@ -596,7 +596,7 @@ index e1cb96a88..8f2afcc32 100644
return waitable.get();
} catch (java.util.concurrent.ExecutionException e) {
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index f140d5e28..05aad7dd0 100644
index 0e3a94ab8c..c88143964b 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -25,7 +25,8 @@ import org.bukkit.block.BlockFace;
@ -635,7 +635,7 @@ index f140d5e28..05aad7dd0 100644
public void recalcPosition() {
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
index 0026f29d5..d15cfdd76 100644
index 0026f29d5f..d15cfdd763 100644
--- a/src/main/java/net/minecraft/server/EntityLiving.java
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
@@ -31,7 +31,7 @@ import org.bukkit.event.entity.EntityTeleportEvent;
@ -706,7 +706,7 @@ index 0026f29d5..d15cfdd76 100644
}
diff --git a/src/main/java/net/minecraft/server/EntityTracker.java b/src/main/java/net/minecraft/server/EntityTracker.java
index ce0124020..a60f94608 100644
index ce01240204..a60f946085 100644
--- a/src/main/java/net/minecraft/server/EntityTracker.java
+++ b/src/main/java/net/minecraft/server/EntityTracker.java
@@ -175,7 +175,7 @@ public class EntityTracker {
@ -737,7 +737,7 @@ index ce0124020..a60f94608 100644
}
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index c1a8816b4..8d08b536a 100644
index c1a8816b40..8d08b536a9 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -48,8 +48,8 @@ import org.bukkit.Bukkit;
@ -884,7 +884,7 @@ index c1a8816b4..8d08b536a 100644
this.methodProfiler.b();
}
diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java
index eeac34998..e4ed2e991 100644
index eeac349987..e4ed2e9917 100644
--- a/src/main/java/net/minecraft/server/PlayerChunkMap.java
+++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java
@@ -1,5 +1,6 @@
@ -984,7 +984,7 @@ index eeac34998..e4ed2e991 100644
}
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index ec3e08336..dacf9261a 100644
index ec3e083368..dacf9261a7 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -56,6 +56,7 @@ import org.bukkit.inventory.CraftingInventory;
@ -1032,7 +1032,7 @@ index ec3e08336..dacf9261a 100644
// CraftBukkit end
}
diff --git a/src/main/java/net/minecraft/server/PlayerConnectionUtils.java b/src/main/java/net/minecraft/server/PlayerConnectionUtils.java
index f74b06794..1fc632e0c 100644
index f74b067943..1fc632e0ce 100644
--- a/src/main/java/net/minecraft/server/PlayerConnectionUtils.java
+++ b/src/main/java/net/minecraft/server/PlayerConnectionUtils.java
@@ -1,15 +1,21 @@
@ -1062,7 +1062,7 @@ index f74b06794..1fc632e0c 100644
+ // Paper end
}
diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java
index d4acbed0c..1d9f3e3dd 100644
index d4acbed0cf..1d9f3e3ddc 100644
--- a/src/main/java/net/minecraft/server/PlayerList.java
+++ b/src/main/java/net/minecraft/server/PlayerList.java
@@ -1,5 +1,6 @@
@ -1086,7 +1086,7 @@ index d4acbed0c..1d9f3e3dd 100644
public void addWhitelist(GameProfile gameprofile) {
diff --git a/src/main/java/net/minecraft/server/StructureGenerator.java b/src/main/java/net/minecraft/server/StructureGenerator.java
index 74e3f42cd..66a80a776 100644
index 74e3f42cd0..66a80a7765 100644
--- a/src/main/java/net/minecraft/server/StructureGenerator.java
+++ b/src/main/java/net/minecraft/server/StructureGenerator.java
@@ -1,5 +1,7 @@
@ -1128,7 +1128,7 @@ index 74e3f42cd..66a80a776 100644
return flag;
}
diff --git a/src/main/java/net/minecraft/server/TileEntity.java b/src/main/java/net/minecraft/server/TileEntity.java
index d7132c3c0..15f18ba1d 100644
index 29069b753e..081e56f481 100644
--- a/src/main/java/net/minecraft/server/TileEntity.java
+++ b/src/main/java/net/minecraft/server/TileEntity.java
@@ -4,12 +4,13 @@ import javax.annotation.Nullable;
@ -1148,7 +1148,7 @@ index d7132c3c0..15f18ba1d 100644
private static final RegistryMaterials<MinecraftKey, Class<? extends TileEntity>> f = new RegistryMaterials();
protected World world;
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 843320ffb..d902e2630 100644
index 843320ffbb..d902e2630b 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -19,11 +19,11 @@ import com.google.common.collect.Maps;
@ -1254,7 +1254,7 @@ index 843320ffb..d902e2630 100644
public boolean b(AxisAlignedBB axisalignedbb) {
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
index c891629bd..95964c550 100644
index c891629bd4..95964c550a 100644
--- a/src/main/java/net/minecraft/server/WorldServer.java
+++ b/src/main/java/net/minecraft/server/WorldServer.java
@@ -308,13 +308,13 @@ public class WorldServer extends World implements IAsyncTaskHandler {
@ -1388,7 +1388,7 @@ index c891629bd..95964c550 100644
// CraftBukkit start
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 14851a3a5..9042deed6 100644
index 14851a3a56..9042deed67 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -1756,12 +1756,31 @@ public final class CraftServer implements Server {
@ -1425,7 +1425,7 @@ index 14851a3a5..9042deed6 100644
org.spigotmc.RestartCommand.restart();
diff --git a/src/main/java/org/bukkit/craftbukkit/SpigotTimings.java b/src/main/java/org/bukkit/craftbukkit/SpigotTimings.java
deleted file mode 100644
index 4c8ab2bc9..000000000
index 4c8ab2bc97..0000000000
--- a/src/main/java/org/bukkit/craftbukkit/SpigotTimings.java
+++ /dev/null
@@ -1,174 +0,0 @@
@ -1604,7 +1604,7 @@ index 4c8ab2bc9..000000000
- }
-}
diff --git a/src/main/java/org/bukkit/craftbukkit/chunkio/ChunkIOProvider.java b/src/main/java/org/bukkit/craftbukkit/chunkio/ChunkIOProvider.java
index 3a95b4465..b5efb9c3f 100644
index 3a95b4465a..b5efb9c3f0 100644
--- a/src/main/java/org/bukkit/craftbukkit/chunkio/ChunkIOProvider.java
+++ b/src/main/java/org/bukkit/craftbukkit/chunkio/ChunkIOProvider.java
@@ -1,6 +1,8 @@
@ -1648,7 +1648,7 @@ index 3a95b4465..b5efb9c3f 100644
public void callStage3(QueuedChunk queuedChunk, Chunk chunk, Runnable runnable) throws RuntimeException {
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 137b101a7..cd99801ff 100644
index 137b101a72..cd99801ffe 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -41,7 +41,7 @@ import org.bukkit.configuration.serialization.DelegateDeserialization;
@ -1674,7 +1674,7 @@ index 137b101a7..cd99801ff 100644
public Player.Spigot spigot()
diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
index f11bd7545..93b9134d6 100644
index f11bd7545f..93b9134d6e 100644
--- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
+++ b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
@@ -14,6 +14,7 @@ import java.util.concurrent.atomic.AtomicInteger;
@ -1750,7 +1750,7 @@ index f11bd7545..93b9134d6 100644
private boolean isReady(final int currentTick) {
diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftTask.java b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftTask.java
index 7e7ce9a81..46029ce24 100644
index 7e7ce9a81b..46029ce246 100644
--- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftTask.java
+++ b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftTask.java
@@ -1,8 +1,8 @@
@ -1832,7 +1832,7 @@ index 7e7ce9a81..46029ce24 100644
- // Spigot end
}
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftIconCache.java b/src/main/java/org/bukkit/craftbukkit/util/CraftIconCache.java
index e52ef47b7..3d90b3426 100644
index e52ef47b78..3d90b34268 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftIconCache.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftIconCache.java
@@ -5,6 +5,7 @@ import org.bukkit.util.CachedServerIcon;
@ -1844,7 +1844,7 @@ index e52ef47b7..3d90b3426 100644
this.value = value;
}
diff --git a/src/main/java/org/spigotmc/ActivationRange.java b/src/main/java/org/spigotmc/ActivationRange.java
index 2bd690fdf..38be7ed71 100644
index 2bd690fdf2..38be7ed71e 100644
--- a/src/main/java/org/spigotmc/ActivationRange.java
+++ b/src/main/java/org/spigotmc/ActivationRange.java
@@ -29,7 +29,7 @@ import net.minecraft.server.EntityWither;

View file

@ -1,4 +1,4 @@
From eff7f534ce1d3c0f5c1e12bfae87996f1a22dbcc Mon Sep 17 00:00:00 2001
From 14b86189f568dce175fc701ddf661c17f9726448 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
@ -6,7 +6,7 @@ Subject: [PATCH] Lighting Queue
This provides option to queue lighting updates to ensure they do not cause the server lag
diff --git a/src/main/java/co/aikar/timings/WorldTimingsHandler.java b/src/main/java/co/aikar/timings/WorldTimingsHandler.java
index e0ad559b7..4eebd9fae 100644
index e0ad559b74..4eebd9fae9 100644
--- a/src/main/java/co/aikar/timings/WorldTimingsHandler.java
+++ b/src/main/java/co/aikar/timings/WorldTimingsHandler.java
@@ -49,6 +49,8 @@ public class WorldTimingsHandler {
@ -27,7 +27,7 @@ index e0ad559b7..4eebd9fae 100644
}
}
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index bf7af475c..94a173045 100644
index bf7af475ce..94a1730459 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -135,4 +135,10 @@ public class PaperWorldConfig {
@ -42,7 +42,7 @@ index bf7af475c..94a173045 100644
+ }
}
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
index 50113c303..aaf253c89 100644
index d3b4145046..f98fe73efa 100644
--- a/src/main/java/net/minecraft/server/Chunk.java
+++ b/src/main/java/net/minecraft/server/Chunk.java
@@ -61,6 +61,7 @@ public class Chunk {
@ -83,7 +83,7 @@ index 50113c303..aaf253c89 100644
}
TileEntity tileentity;
@@ -1377,6 +1387,16 @@ public class Chunk {
@@ -1378,6 +1388,16 @@ public class Chunk {
this.w = i;
}
@ -101,7 +101,7 @@ index 50113c303..aaf253c89 100644
IMMEDIATE, QUEUED, CHECK;
diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java
index bd006ef74..2b320cbd1 100644
index bd006ef741..2b320cbd18 100644
--- a/src/main/java/net/minecraft/server/ChunkProviderServer.java
+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java
@@ -295,6 +295,7 @@ public class ChunkProviderServer implements IChunkProvider {
@ -113,7 +113,7 @@ index bd006ef74..2b320cbd1 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 47fe9262a..d63a243f3 100644
index 47fe9262a5..d63a243f31 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -722,7 +722,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs
@ -135,7 +135,7 @@ index 47fe9262a..d63a243f3 100644
}
diff --git a/src/main/java/net/minecraft/server/PaperLightingQueue.java b/src/main/java/net/minecraft/server/PaperLightingQueue.java
new file mode 100644
index 000000000..345cd5824
index 0000000000..345cd58240
--- /dev/null
+++ b/src/main/java/net/minecraft/server/PaperLightingQueue.java
@@ -0,0 +1,92 @@
@ -232,7 +232,7 @@ index 000000000..345cd5824
+ }
+}
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index fd5f8102a..77ed2d249 100644
index fd5f8102af..77ed2d2494 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -391,7 +391,7 @@ public abstract class World implements IBlockAccess {

View file

@ -1,4 +1,4 @@
From 4e0067394fe5e3d753349255621049ff01869afb Mon Sep 17 00:00:00 2001
From df5be5320addd4ba09e5a65dee413e3eaa6f8dfb 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 42d27e0362..be386716be 100644
index f98fe73efa..996a5e71c4 100644
--- a/src/main/java/net/minecraft/server/Chunk.java
+++ b/src/main/java/net/minecraft/server/Chunk.java
@@ -76,6 +76,13 @@ public class Chunk {
@ -55,7 +55,7 @@ index 42d27e0362..be386716be 100644
// Paper end
// Spigot start - decrement creature type count
// Keep this synced up with World.a(Class)
@@ -879,6 +896,15 @@ public class Chunk {
@@ -880,6 +897,15 @@ public class Chunk {
if (!this.entitySlices[k].isEmpty()) {
Iterator iterator = this.entitySlices[k].iterator();
@ -71,7 +71,7 @@ index 42d27e0362..be386716be 100644
while (iterator.hasNext()) {
Entity entity1 = (Entity) iterator.next();
@@ -915,7 +941,18 @@ public class Chunk {
@@ -916,7 +942,18 @@ public class Chunk {
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 b0b7b1aef28c4017f37927c00042e87384f5a9bc Mon Sep 17 00:00:00 2001
From ddb482eabc50035402277af07395e5cb1e477bcc 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 e634c3afd..54f23ea75 100644
index e634c3afdc..54f23ea75a 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -271,4 +271,9 @@ public class PaperWorldConfig {
@ -23,10 +23,10 @@ index e634c3afd..54f23ea75 100644
+ }
}
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
index d84cc9843..da7b59434 100644
index 5940fc2883..9613a31b9d 100644
--- a/src/main/java/net/minecraft/server/Chunk.java
+++ b/src/main/java/net/minecraft/server/Chunk.java
@@ -1441,7 +1441,7 @@ public class Chunk {
@@ -1442,7 +1442,7 @@ public class Chunk {
}
public long x() {

View file

@ -1,4 +1,4 @@
From 6a04d822bcaed5049e8c100649a084511ddf364b Mon Sep 17 00:00:00 2001
From da41bfcfc0c3551c6e69f6b4db194fac8c49bb58 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Thu, 12 May 2016 01:55:17 -0400
Subject: [PATCH] Do not mark chunks as active for neighbor updates
@ -6,10 +6,10 @@ Subject: [PATCH] Do not mark chunks as active for neighbor updates
Fixes chunk unload issues
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
index 1157bc7eb..f3f4b7fe5 100644
index dfa4aee0b7..acb69a962a 100644
--- a/src/main/java/net/minecraft/server/Chunk.java
+++ b/src/main/java/net/minecraft/server/Chunk.java
@@ -1040,25 +1040,25 @@ public class Chunk {
@@ -1041,25 +1041,25 @@ public class Chunk {
// CraftBukkit end
world.timings.syncChunkLoadPostTimer.stopTiming(); // Paper
world.timings.syncChunkLoadPopulateNeighbors.startTiming(); // Paper

View file

@ -1,4 +1,4 @@
From d8b347ac8d0edf9680b00ec72d12945dea811afb Mon Sep 17 00:00:00 2001
From 603a10033e83fdc9d8757814dd91d03c03f90d9d 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
@ -12,7 +12,7 @@ Re-introduce a cap per tick for auto save (Spigot disabled the vanilla cap) and
Adds incremental player auto saving too
diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java
index 621c585e7..459c86bce 100644
index 621c585e7e..459c86bce2 100644
--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java
@@ -251,4 +251,15 @@ public class PaperConfig {
@ -32,7 +32,7 @@ index 621c585e7..459c86bce 100644
+ }
}
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 1b9eb7f45..ce848d63e 100644
index 1b9eb7f45a..ce848d63e3 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -2,6 +2,7 @@ package com.destroystokyo.paper;
@ -64,10 +64,10 @@ index 1b9eb7f45..ce848d63e 100644
+ }
}
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
index 62767a383..798522fa7 100644
index 178604c50d..ad8a3acabb 100644
--- a/src/main/java/net/minecraft/server/Chunk.java
+++ b/src/main/java/net/minecraft/server/Chunk.java
@@ -996,11 +996,9 @@ public class Chunk {
@@ -997,11 +997,9 @@ public class Chunk {
if (this.t && this.world.getTime() != this.lastSaved || this.s) {
return true;
}
@ -82,7 +82,7 @@ index 62767a383..798522fa7 100644
public Random a(long i) {
diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java
index 47159bff3..db81b4a8c 100644
index 47159bff3c..db81b4a8cf 100644
--- a/src/main/java/net/minecraft/server/ChunkProviderServer.java
+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java
@@ -1,5 +1,6 @@
@ -102,7 +102,7 @@ index 47159bff3..db81b4a8c 100644
}
}
diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java
index 2391adac7..8b7eb47a2 100644
index 2391adac7f..8b7eb47a28 100644
--- a/src/main/java/net/minecraft/server/EntityPlayer.java
+++ b/src/main/java/net/minecraft/server/EntityPlayer.java
@@ -32,6 +32,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
@ -114,7 +114,7 @@ index 2391adac7..8b7eb47a2 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 ab7933079..5c09c6ff7 100644
index ab79330791..5c09c6ff7c 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -119,6 +119,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs
@ -161,7 +161,7 @@ index ab7933079..5c09c6ff7 100644
this.methodProfiler.a("tallying");
// Spigot start
diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java
index 950dbdc50..23ed9efbf 100644
index 950dbdc508..23ed9efbfa 100644
--- a/src/main/java/net/minecraft/server/PlayerList.java
+++ b/src/main/java/net/minecraft/server/PlayerList.java
@@ -343,6 +343,7 @@ public abstract class PlayerList {
@ -200,7 +200,7 @@ index 950dbdc50..23ed9efbf 100644
public void addWhitelist(GameProfile gameprofile) {
this.whitelist.add(new WhiteListEntry(gameprofile));
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
index ebe397116..53cea76e2 100644
index ebe397116e..53cea76e21 100644
--- a/src/main/java/net/minecraft/server/WorldServer.java
+++ b/src/main/java/net/minecraft/server/WorldServer.java
@@ -1053,8 +1053,9 @@ public class WorldServer extends World implements IAsyncTaskHandler {

View file

@ -1,4 +1,4 @@
From 308db0274f868def0d98c712102ba50e26a35685 Mon Sep 17 00:00:00 2001
From a8a22980dc19c2c484b6abecee5029bb927fea4a Mon Sep 17 00:00:00 2001
From: Shane Freeder <theboyetronic@gmail.com>
Date: Mon, 18 Dec 2017 07:26:56 +0000
Subject: [PATCH] Don't blindly send unlit chunks when lighting updates are
@ -18,7 +18,7 @@ only send chunks which are actually ready to be sent, otherwise, we
will always send chunks.
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
index 9c88effef..51e7a4ad8 100644
index 59793763ee..97485cf89e 100644
--- a/src/main/java/net/minecraft/server/Chunk.java
+++ b/src/main/java/net/minecraft/server/Chunk.java
@@ -68,7 +68,7 @@ public class Chunk {
@ -30,7 +30,7 @@ index 9c88effef..51e7a4ad8 100644
private boolean s;
private boolean t;
private long lastSaved;
@@ -1170,7 +1170,11 @@ public class Chunk {
@@ -1171,7 +1171,11 @@ public class Chunk {
* We cannot unfortunately do this lighting stage during chunk gen as it appears to put a lot more noticeable load on the server, than when it is done at play time.
* For now at least we will simply send all chunks, in accordance with pre 1.7 behaviour.
*/

View file

@ -1,4 +1,4 @@
From f66a29c8dbea9062242445480ebaf1db98c8b0f7 Mon Sep 17 00:00:00 2001
From 5e0068199fd5fce71ab1d880e43f090574f87ebc 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 eaee492010..1787607622 100644
index 27b73acdee..be3ac2d940 100644
--- a/src/main/java/net/minecraft/server/Chunk.java
+++ b/src/main/java/net/minecraft/server/Chunk.java
@@ -681,8 +681,33 @@ public class Chunk {
@ -60,8 +60,16 @@ index eaee492010..1787607622 100644
this.markDirty();
entity.setCurrentChunk(null);
entityCounts.decrement(entity.getMinecraftKeyString());
@@ -943,6 +974,7 @@ public class Chunk {
}
// 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 fdabb1e369..89f9bd347b 100644
index eb8904a728..1e64d5fcd6 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -59,6 +59,7 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper