From df3df43dea38ec114310c13a6635aa7e376acd4d Mon Sep 17 00:00:00 2001 From: Mark Vainomaa Date: Wed, 30 May 2018 23:31:55 +0300 Subject: [PATCH] Skip Entity and Tile Entity ticking in chunks scheduled for unload (#1132) Fixes #1131 --- ...ke-parrots-stay-on-shoulders-despite.patch | 2 +- Spigot-Server-Patches/Anti-Xray.patch | 4 +- .../Auto-Save-Improvements.patch | 16 +++--- .../Block-Enderpearl-Travel-Exploit.patch | 4 +- .../Cap-Entity-Collisions.patch | 6 +-- .../Chunk-registration-fixes.patch | 2 +- ...Allowance-of-Permanent-Chunk-Loaders.patch | 4 +- ...figurable-Cartographer-Treasure-Maps.patch | 4 +- ...urable-Chunks-Sends-per-Tick-setting.patch | 2 +- ...Configurable-Max-Chunk-Gens-per-Tick.patch | 4 +- ...urable-sprint-interruption-on-attack.patch | 2 +- ...unk-Unloads-based-on-Player-Movement.patch | 51 ++++++++++++++++--- ...llow-entities-to-ride-themselves-572.patch | 2 +- ...a-from-ArmorStand-and-SpawnEgg-items.patch | 6 +-- ...x-inter-world-teleportation-glitches.patch | 4 +- ...-max-squid-spawn-height-configurable.patch | 2 +- Spigot-Server-Patches/Optimize-Hoppers.patch | 4 +- ...-maximum-exp-value-when-merging-orbs.patch | 4 +- ...t-armor-stands-from-doing-entity-loo.patch | 4 +- ...tion-to-remove-corrupt-tile-entities.patch | 4 +- ...vent-Auto-Save-if-Save-Queue-is-full.patch | 6 +-- .../Toggleable-Elytra-Wall-Damage.patch | 8 +-- .../Vanished-players-don-t-have-rights.patch | 8 +-- ...urable-option-to-disable-creeper-lin.patch | 2 +- 24 files changed, 97 insertions(+), 58 deletions(-) diff --git a/Spigot-Server-Patches/Add-option-to-make-parrots-stay-on-shoulders-despite.patch b/Spigot-Server-Patches/Add-option-to-make-parrots-stay-on-shoulders-despite.patch index 6dfdee8748..12ae936b4e 100644 --- a/Spigot-Server-Patches/Add-option-to-make-parrots-stay-on-shoulders-despite.patch +++ b/Spigot-Server-Patches/Add-option-to-make-parrots-stay-on-shoulders-despite.patch @@ -11,7 +11,7 @@ I suspect Mojang may switch to this behavior before full release. To be converted into a Paper-API event at some point in the future? diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 3ba46530..79b12a6e 100644 +index 0ea2a856..bf6b20f7 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java @@ -0,0 +0,0 @@ public class PaperWorldConfig { diff --git a/Spigot-Server-Patches/Anti-Xray.patch b/Spigot-Server-Patches/Anti-Xray.patch index 5f5632b9b7..83d807cc22 100644 --- a/Spigot-Server-Patches/Anti-Xray.patch +++ b/Spigot-Server-Patches/Anti-Xray.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Anti-Xray diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 7802cc1f..30307da0 100644 +index 601eb08b..fef49cf7 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java @@ -0,0 +0,0 @@ @@ -1518,7 +1518,7 @@ index 8860a012..fa0d66d6 100644 return this.a.size(); } diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 00513d02..592e5b3b 100644 +index 57bc9165..de1954a2 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java @@ -0,0 +0,0 @@ import org.bukkit.generator.ChunkGenerator; diff --git a/Spigot-Server-Patches/Auto-Save-Improvements.patch b/Spigot-Server-Patches/Auto-Save-Improvements.patch index 9c4abbff55..3ec7f3d728 100644 --- a/Spigot-Server-Patches/Auto-Save-Improvements.patch +++ b/Spigot-Server-Patches/Auto-Save-Improvements.patch @@ -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 621c585e..459c86bc 100644 --- a/src/main/java/com/destroystokyo/paper/PaperConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java @@ -0,0 +0,0 @@ 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 d182e716a..d1655de42 100644 +index 3aa6f89e..f3c0bbde 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java @@ -0,0 +0,0 @@ package com.destroystokyo.paper; @@ -64,7 +64,7 @@ index d182e716a..d1655de42 100644 + } } diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java -index 8ec26b97c..87730aec3 100644 +index 8ec26b97..87730aec 100644 --- a/src/main/java/net/minecraft/server/Chunk.java +++ b/src/main/java/net/minecraft/server/Chunk.java @@ -0,0 +0,0 @@ public class Chunk { @@ -82,7 +82,7 @@ index 8ec26b97c..87730aec3 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 47159bff..db81b4a8 100644 --- a/src/main/java/net/minecraft/server/ChunkProviderServer.java +++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java @@ -0,0 +0,0 @@ @@ -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 2391adac..8b7eb47a 100644 --- a/src/main/java/net/minecraft/server/EntityPlayer.java +++ b/src/main/java/net/minecraft/server/EntityPlayer.java @@ -0,0 +0,0 @@ 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 ab793307..5c09c6ff 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -0,0 +0,0 @@ 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 3fc242e4b..90f6e2e04 100644 +index 3fc242e4..90f6e2e0 100644 --- a/src/main/java/net/minecraft/server/PlayerList.java +++ b/src/main/java/net/minecraft/server/PlayerList.java @@ -0,0 +0,0 @@ public abstract class PlayerList { @@ -200,7 +200,7 @@ index 3fc242e4b..90f6e2e04 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 ebe39711..53cea76e 100644 --- a/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java @@ -0,0 +0,0 @@ public class WorldServer extends World implements IAsyncTaskHandler { diff --git a/Spigot-Server-Patches/Block-Enderpearl-Travel-Exploit.patch b/Spigot-Server-Patches/Block-Enderpearl-Travel-Exploit.patch index 8155ab10ad..9311f1308a 100644 --- a/Spigot-Server-Patches/Block-Enderpearl-Travel-Exploit.patch +++ b/Spigot-Server-Patches/Block-Enderpearl-Travel-Exploit.patch @@ -12,7 +12,7 @@ This disables that by not saving the thrower when the chunk is unloaded. This is mainly useful for survival servers that do not allow freeform teleporting. diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index cc1914d8c..606c0bed8 100644 +index ba5332c3..d1acf678 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java @@ -0,0 +0,0 @@ public class PaperWorldConfig { @@ -27,7 +27,7 @@ index cc1914d8c..606c0bed8 100644 + } } diff --git a/src/main/java/net/minecraft/server/EntityProjectile.java b/src/main/java/net/minecraft/server/EntityProjectile.java -index 01c7fcc8b..8e6428a0c 100644 +index 01c7fcc8..8e6428a0 100644 --- a/src/main/java/net/minecraft/server/EntityProjectile.java +++ b/src/main/java/net/minecraft/server/EntityProjectile.java @@ -0,0 +0,0 @@ public abstract class EntityProjectile extends Entity implements IProjectile { diff --git a/Spigot-Server-Patches/Cap-Entity-Collisions.patch b/Spigot-Server-Patches/Cap-Entity-Collisions.patch index 74eae6bcad..d4cb751da9 100644 --- a/Spigot-Server-Patches/Cap-Entity-Collisions.patch +++ b/Spigot-Server-Patches/Cap-Entity-Collisions.patch @@ -12,7 +12,7 @@ just as it does in Vanilla, but entity pushing logic will be capped. You can set this to 0 to disable collisions. diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 7871406e..3ba46530 100644 +index f65a3fe8..0ea2a856 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java @@ -0,0 +0,0 @@ public class PaperWorldConfig { @@ -27,7 +27,7 @@ index 7871406e..3ba46530 100644 + } } diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index 54605941..a5ed651d 100644 +index 3f1c78af..04bc05d3 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 { @@ -39,7 +39,7 @@ index 54605941..a5ed651d 100644 // Spigot end diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java -index 91e8c1d7..adb04593 100644 +index 38c04337..c97ee68a 100644 --- a/src/main/java/net/minecraft/server/EntityLiving.java +++ b/src/main/java/net/minecraft/server/EntityLiving.java @@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity { diff --git a/Spigot-Server-Patches/Chunk-registration-fixes.patch b/Spigot-Server-Patches/Chunk-registration-fixes.patch index 611e9b327e..c01bd6d744 100644 --- a/Spigot-Server-Patches/Chunk-registration-fixes.patch +++ b/Spigot-Server-Patches/Chunk-registration-fixes.patch @@ -8,7 +8,7 @@ World checks and the Chunk Add logic are inconsistent on how Y > 256, < 0, is tr Keep them consistent diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index bafa37f64..d5e338eb3 100644 +index 3051a3e4..5cd7b22f 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java @@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { diff --git a/Spigot-Server-Patches/Configurable-Allowance-of-Permanent-Chunk-Loaders.patch b/Spigot-Server-Patches/Configurable-Allowance-of-Permanent-Chunk-Loaders.patch index 71aa127d18..3e1b9e7639 100644 --- a/Spigot-Server-Patches/Configurable-Allowance-of-Permanent-Chunk-Loaders.patch +++ b/Spigot-Server-Patches/Configurable-Allowance-of-Permanent-Chunk-Loaders.patch @@ -7,7 +7,7 @@ This disables the behavior that allows players to keep chunks permanently loaded by default and allows server operators to enable it if they wish. diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 9ef2b1635..cc1914d8c 100644 +index 2bdedd83..ba5332c3 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java @@ -0,0 +0,0 @@ public class PaperWorldConfig { @@ -22,7 +22,7 @@ index 9ef2b1635..cc1914d8c 100644 + } } diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java -index 55dada668..0eba3df57 100644 +index 55dada66..0eba3df5 100644 --- a/src/main/java/net/minecraft/server/ChunkProviderServer.java +++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java @@ -0,0 +0,0 @@ public class ChunkProviderServer implements IChunkProvider { diff --git a/Spigot-Server-Patches/Configurable-Cartographer-Treasure-Maps.patch b/Spigot-Server-Patches/Configurable-Cartographer-Treasure-Maps.patch index 8ae273077f..d47e8ebaea 100644 --- a/Spigot-Server-Patches/Configurable-Cartographer-Treasure-Maps.patch +++ b/Spigot-Server-Patches/Configurable-Cartographer-Treasure-Maps.patch @@ -9,7 +9,7 @@ Also allow turning off treasure maps all together as they can eat up Map ID's which are limited in quantity. diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 513c4b020..631aa6eb9 100644 +index 06911639..50dc50a7 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java @@ -0,0 +0,0 @@ public class PaperWorldConfig { @@ -28,7 +28,7 @@ index 513c4b020..631aa6eb9 100644 + } } diff --git a/src/main/java/net/minecraft/server/EntityVillager.java b/src/main/java/net/minecraft/server/EntityVillager.java -index 9d201b14e..57fcc3c05 100644 +index 9d201b14..57fcc3c0 100644 --- a/src/main/java/net/minecraft/server/EntityVillager.java +++ b/src/main/java/net/minecraft/server/EntityVillager.java @@ -0,0 +0,0 @@ public class EntityVillager extends EntityAgeable implements NPC, IMerchant { diff --git a/Spigot-Server-Patches/Configurable-Chunks-Sends-per-Tick-setting.patch b/Spigot-Server-Patches/Configurable-Chunks-Sends-per-Tick-setting.patch index 1e0992ea53..145ba66201 100644 --- a/Spigot-Server-Patches/Configurable-Chunks-Sends-per-Tick-setting.patch +++ b/Spigot-Server-Patches/Configurable-Chunks-Sends-per-Tick-setting.patch @@ -8,7 +8,7 @@ Vanilla already had this limited, make it configurable. Limit how much exploration lags the server diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index a3119cd1..259f5c70 100644 +index 57cf49a7..d5babe47 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java @@ -0,0 +0,0 @@ public class PaperWorldConfig { diff --git a/Spigot-Server-Patches/Configurable-Max-Chunk-Gens-per-Tick.patch b/Spigot-Server-Patches/Configurable-Max-Chunk-Gens-per-Tick.patch index e31402fd5c..1834483697 100644 --- a/Spigot-Server-Patches/Configurable-Max-Chunk-Gens-per-Tick.patch +++ b/Spigot-Server-Patches/Configurable-Max-Chunk-Gens-per-Tick.patch @@ -13,7 +13,7 @@ This should result in no noticeable speed reduction in generation for servers no lagging, and let larger servers reduce this value according to their own desires. diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 259f5c70..3df3b433 100644 +index d5babe47..99bc456e 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java @@ -0,0 +0,0 @@ public class PaperWorldConfig { @@ -34,7 +34,7 @@ index 259f5c70..3df3b433 100644 + } diff --git a/src/main/java/net/minecraft/server/PlayerChunk.java b/src/main/java/net/minecraft/server/PlayerChunk.java -index 045adbd3..20e734bc 100644 +index 395386f2..baf72404 100644 --- a/src/main/java/net/minecraft/server/PlayerChunk.java +++ b/src/main/java/net/minecraft/server/PlayerChunk.java @@ -0,0 +0,0 @@ public class PlayerChunk { diff --git a/Spigot-Server-Patches/Configurable-sprint-interruption-on-attack.patch b/Spigot-Server-Patches/Configurable-sprint-interruption-on-attack.patch index db3561f64c..67b4133ff0 100644 --- a/Spigot-Server-Patches/Configurable-sprint-interruption-on-attack.patch +++ b/Spigot-Server-Patches/Configurable-sprint-interruption-on-attack.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Configurable sprint interruption on attack If the sprint interruption is disabled players continue sprinting when they attack entities. diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 7a03f885..9ef2b163 100644 +index 9a5939a7..2bdedd83 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java @@ -0,0 +0,0 @@ public class PaperWorldConfig { diff --git a/Spigot-Server-Patches/Delay-Chunk-Unloads-based-on-Player-Movement.patch b/Spigot-Server-Patches/Delay-Chunk-Unloads-based-on-Player-Movement.patch index 297c0bf350..0407d38a9c 100644 --- a/Spigot-Server-Patches/Delay-Chunk-Unloads-based-on-Player-Movement.patch +++ b/Spigot-Server-Patches/Delay-Chunk-Unloads-based-on-Player-Movement.patch @@ -17,7 +17,7 @@ This allows servers with smaller worlds who do less long distance exploring to s wasting cpu cycles on saving/unloading/reloading chunks repeatedly. diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index ce43e7bb7..112c447e2 100644 +index ce43e7bb..5367fead 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java @@ -0,0 +0,0 @@ public class PaperWorldConfig { @@ -32,10 +32,15 @@ index ce43e7bb7..112c447e2 100644 + log("Delaying chunk unloads by " + delayChunkUnloadsBy + " seconds"); + delayChunkUnloadsBy *= 1000; + } ++ } ++ ++ public boolean skipEntityTickingInChunksScheduledForUnload = true; ++ private void skipEntityTickingInChunksScheduledForUnload() { ++ skipEntityTickingInChunksScheduledForUnload = getBoolean("settings.skip-entity-ticking-in-chunks-scheduled-for-unload", skipEntityTickingInChunksScheduledForUnload); + } } diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java -index a847aa079..8ec26b97c 100644 +index a847aa07..8ec26b97 100644 --- a/src/main/java/net/minecraft/server/Chunk.java +++ b/src/main/java/net/minecraft/server/Chunk.java @@ -0,0 +0,0 @@ public class Chunk { @@ -47,7 +52,7 @@ index a847aa079..8ec26b97c 100644 public final int locZ; private boolean m; diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java -index c7af8da61..0adfcaa8b 100644 +index 5cc192bb..47159bff 100644 --- a/src/main/java/net/minecraft/server/ChunkProviderServer.java +++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java @@ -0,0 +0,0 @@ public class ChunkProviderServer implements IChunkProvider { @@ -71,7 +76,7 @@ index c7af8da61..0adfcaa8b 100644 this.chunkLoader.b(); } diff --git a/src/main/java/net/minecraft/server/PlayerChunk.java b/src/main/java/net/minecraft/server/PlayerChunk.java -index 3d30e1831..48a008e0a 100644 +index 3d30e183..48a008e0 100644 --- a/src/main/java/net/minecraft/server/PlayerChunk.java +++ b/src/main/java/net/minecraft/server/PlayerChunk.java @@ -0,0 +0,0 @@ public class PlayerChunk { @@ -108,7 +113,7 @@ index 3d30e1831..48a008e0a 100644 // CraftBukkit end diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java -index ad1d90b56..0b10f1684 100644 +index ad1d90b5..0b10f168 100644 --- a/src/main/java/net/minecraft/server/PlayerChunkMap.java +++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java @@ -0,0 +0,0 @@ public class PlayerChunkMap { @@ -126,8 +131,27 @@ index ad1d90b56..0b10f1684 100644 } } +diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java +index bce3fca8..fccfd3dd 100644 +--- a/src/main/java/net/minecraft/server/World.java ++++ b/src/main/java/net/minecraft/server/World.java +@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { + if (!tileentity.y() && tileentity.u()) { + BlockPosition blockposition = tileentity.getPosition(); + +- if (this.isLoaded(blockposition) && this.P.a(blockposition)) { ++ // Paper start - Skip ticking in chunks scheduled for unload ++ net.minecraft.server.Chunk chunk = this.getChunkIfLoaded(blockposition); ++ boolean shouldTick = chunk != null; ++ if(this.paperConfig.skipEntityTickingInChunksScheduledForUnload) ++ shouldTick = shouldTick && !chunk.isUnloading() && chunk.scheduledForUnload == null; ++ if (shouldTick && this.P.a(blockposition)) { ++ // Paper end + try { + this.methodProfiler.a(() -> { + return String.valueOf(TileEntity.a(tileentity.getClass())); diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index 69dc11e2b..284dc6391 100644 +index 69dc11e2..284dc639 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -0,0 +0,0 @@ public class CraftWorld implements World { @@ -139,4 +163,19 @@ index 69dc11e2b..284dc6391 100644 continue; } +diff --git a/src/main/java/org/spigotmc/ActivationRange.java b/src/main/java/org/spigotmc/ActivationRange.java +index 47865c02..b79bf70f 100644 +--- a/src/main/java/org/spigotmc/ActivationRange.java ++++ b/src/main/java/org/spigotmc/ActivationRange.java +@@ -0,0 +0,0 @@ public class ActivationRange + { + isActive = false; + } ++ // Paper start - Skip ticking in chunks scheduled for unload ++ if(entity.world.paperConfig.skipEntityTickingInChunksScheduledForUnload && (chunk == null || chunk.isUnloading() || chunk.scheduledForUnload != null)) ++ isActive = false; ++ // Paper end + return isActive; + } + } -- \ No newline at end of file diff --git a/Spigot-Server-Patches/Don-t-allow-entities-to-ride-themselves-572.patch b/Spigot-Server-Patches/Don-t-allow-entities-to-ride-themselves-572.patch index 9bb8304dcb..52f1d3fe94 100644 --- a/Spigot-Server-Patches/Don-t-allow-entities-to-ride-themselves-572.patch +++ b/Spigot-Server-Patches/Don-t-allow-entities-to-ride-themselves-572.patch @@ -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 36914ed94..546059414 100644 +index 36914ed9..54605941 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 { diff --git a/Spigot-Server-Patches/Filter-bad-data-from-ArmorStand-and-SpawnEgg-items.patch b/Spigot-Server-Patches/Filter-bad-data-from-ArmorStand-and-SpawnEgg-items.patch index 959f503191..bc347810ee 100644 --- a/Spigot-Server-Patches/Filter-bad-data-from-ArmorStand-and-SpawnEgg-items.patch +++ b/Spigot-Server-Patches/Filter-bad-data-from-ArmorStand-and-SpawnEgg-items.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Filter bad data from ArmorStand and SpawnEgg items diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index f84fc54ec..513c4b020 100644 +index 43c38f67..06911639 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java @@ -0,0 +0,0 @@ package com.destroystokyo.paper; @@ -30,7 +30,7 @@ index f84fc54ec..513c4b020 100644 + } } diff --git a/src/main/java/net/minecraft/server/EntityFallingBlock.java b/src/main/java/net/minecraft/server/EntityFallingBlock.java -index 59acc9088..d0b67d8fd 100644 +index 59acc908..d0b67d8f 100644 --- a/src/main/java/net/minecraft/server/EntityFallingBlock.java +++ b/src/main/java/net/minecraft/server/EntityFallingBlock.java @@ -0,0 +0,0 @@ public class EntityFallingBlock extends Entity { @@ -49,7 +49,7 @@ index 59acc9088..d0b67d8fd 100644 Block block = this.block.getBlock(); diff --git a/src/main/java/net/minecraft/server/ItemMonsterEgg.java b/src/main/java/net/minecraft/server/ItemMonsterEgg.java -index b24f7d8b2..5a08f6b4e 100644 +index b24f7d8b..5a08f6b4 100644 --- a/src/main/java/net/minecraft/server/ItemMonsterEgg.java +++ b/src/main/java/net/minecraft/server/ItemMonsterEgg.java @@ -0,0 +0,0 @@ public class ItemMonsterEgg extends Item { diff --git a/Spigot-Server-Patches/Fix-inter-world-teleportation-glitches.patch b/Spigot-Server-Patches/Fix-inter-world-teleportation-glitches.patch index 632f6e4e57..4304d67c83 100644 --- a/Spigot-Server-Patches/Fix-inter-world-teleportation-glitches.patch +++ b/Spigot-Server-Patches/Fix-inter-world-teleportation-glitches.patch @@ -11,7 +11,7 @@ Example setup to perform the glitch: http://puu.sh/ng3PC/cf072dcbdb.png The wanted destination was on top of the emerald block however the player ended on top of the diamond block. This only is the case if the player is teleporting between worlds. diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 38ccabc0d..b241c0380 100644 +index 38ccabc0..b241c038 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java @@ -0,0 +0,0 @@ public class PaperWorldConfig { @@ -25,7 +25,7 @@ index 38ccabc0d..b241c0380 100644 + } } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index c14100ac6..6a43f5674 100644 +index c14100ac..6a43f567 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -0,0 +0,0 @@ public class CraftPlayer extends CraftHumanEntity implements Player { diff --git a/Spigot-Server-Patches/Make-max-squid-spawn-height-configurable.patch b/Spigot-Server-Patches/Make-max-squid-spawn-height-configurable.patch index ed4f3133c9..c0eb6a251c 100644 --- a/Spigot-Server-Patches/Make-max-squid-spawn-height-configurable.patch +++ b/Spigot-Server-Patches/Make-max-squid-spawn-height-configurable.patch @@ -7,7 +7,7 @@ I don't know why upstream made only the minimum height configurable but whatever diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 3df3b433..be4431c1 100644 +index 99bc456e..f6a8fcae 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java @@ -0,0 +0,0 @@ public class PaperWorldConfig { diff --git a/Spigot-Server-Patches/Optimize-Hoppers.patch b/Spigot-Server-Patches/Optimize-Hoppers.patch index 949c2f072c..faf3fab6b7 100644 --- a/Spigot-Server-Patches/Optimize-Hoppers.patch +++ b/Spigot-Server-Patches/Optimize-Hoppers.patch @@ -11,7 +11,7 @@ Subject: [PATCH] Optimize Hoppers * Skip subsequent InventoryMoveItemEvents if a plugin does not use the item after first event fire for an iteration diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index be4431c1..9d2fe4a8 100644 +index f6a8fcae..5e930d79 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java @@ -0,0 +0,0 @@ public class PaperWorldConfig { @@ -28,7 +28,7 @@ index be4431c1..9d2fe4a8 100644 + } } diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index ed0e2acc..579f0ba0 100644 +index fcf6bac0..3092913f 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs diff --git a/Spigot-Server-Patches/Option-for-maximum-exp-value-when-merging-orbs.patch b/Spigot-Server-Patches/Option-for-maximum-exp-value-when-merging-orbs.patch index e27719d43a..13f1ee7db4 100644 --- a/Spigot-Server-Patches/Option-for-maximum-exp-value-when-merging-orbs.patch +++ b/Spigot-Server-Patches/Option-for-maximum-exp-value-when-merging-orbs.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Option for maximum exp value when merging orbs diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 30307da0..a3119cd1 100644 +index fef49cf7..57cf49a7 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java @@ -0,0 +0,0 @@ public class PaperWorldConfig { @@ -20,7 +20,7 @@ index 30307da0..a3119cd1 100644 + } } diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index a4bdaa71..362f0545 100644 +index 8a249af0..b193e051 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java @@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { diff --git a/Spigot-Server-Patches/Option-to-prevent-armor-stands-from-doing-entity-loo.patch b/Spigot-Server-Patches/Option-to-prevent-armor-stands-from-doing-entity-loo.patch index fa684e2096..114335f77f 100644 --- a/Spigot-Server-Patches/Option-to-prevent-armor-stands-from-doing-entity-loo.patch +++ b/Spigot-Server-Patches/Option-to-prevent-armor-stands-from-doing-entity-loo.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Option to prevent armor stands from doing entity lookups diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 631aa6eb9..7871406e4 100644 +index 50dc50a7..f65a3fe8 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java @@ -0,0 +0,0 @@ public class PaperWorldConfig { @@ -19,7 +19,7 @@ index 631aa6eb9..7871406e4 100644 + } } diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 01dba285a..b0139fff6 100644 +index 5925fd96..07ecded6 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java @@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { diff --git a/Spigot-Server-Patches/Option-to-remove-corrupt-tile-entities.patch b/Spigot-Server-Patches/Option-to-remove-corrupt-tile-entities.patch index 26e79685eb..56666f6d2e 100644 --- a/Spigot-Server-Patches/Option-to-remove-corrupt-tile-entities.patch +++ b/Spigot-Server-Patches/Option-to-remove-corrupt-tile-entities.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Option to remove corrupt tile entities diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index d1655de42..21ae11e0a 100644 +index f3c0bbde..f30e36f3 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java @@ -0,0 +0,0 @@ public class PaperWorldConfig { @@ -19,7 +19,7 @@ index d1655de42..21ae11e0a 100644 + } } diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java -index 87730aec3..1d056031b 100644 +index 87730aec..1d056031 100644 --- a/src/main/java/net/minecraft/server/Chunk.java +++ b/src/main/java/net/minecraft/server/Chunk.java @@ -0,0 +0,0 @@ public class Chunk { diff --git a/Spigot-Server-Patches/Prevent-Auto-Save-if-Save-Queue-is-full.patch b/Spigot-Server-Patches/Prevent-Auto-Save-if-Save-Queue-is-full.patch index 58e1247212..2a86911e59 100644 --- a/Spigot-Server-Patches/Prevent-Auto-Save-if-Save-Queue-is-full.patch +++ b/Spigot-Server-Patches/Prevent-Auto-Save-if-Save-Queue-is-full.patch @@ -7,7 +7,7 @@ If the save queue already has 50 (configurable) of chunks pending, then avoid processing auto save (which would add more) diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 21ae11e0a..f84fc54ec 100644 +index f30e36f3..43c38f67 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java @@ -0,0 +0,0 @@ public class PaperWorldConfig { @@ -23,7 +23,7 @@ index 21ae11e0a..f84fc54ec 100644 private void removeCorruptTEs() { removeCorruptTEs = getBoolean("remove-corrupt-tile-entities", false); diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java -index 9e8f67ffd..2b87329f4 100644 +index db81b4a8..93e938a9 100644 --- a/src/main/java/net/minecraft/server/ChunkProviderServer.java +++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java @@ -0,0 +0,0 @@ public class ChunkProviderServer implements IChunkProvider { @@ -51,7 +51,7 @@ index 9e8f67ffd..2b87329f4 100644 } } diff --git a/src/main/java/net/minecraft/server/ChunkRegionLoader.java b/src/main/java/net/minecraft/server/ChunkRegionLoader.java -index 8747d9a45..77943821e 100644 +index 8747d9a4..77943821 100644 --- a/src/main/java/net/minecraft/server/ChunkRegionLoader.java +++ b/src/main/java/net/minecraft/server/ChunkRegionLoader.java @@ -0,0 +0,0 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver { diff --git a/Spigot-Server-Patches/Toggleable-Elytra-Wall-Damage.patch b/Spigot-Server-Patches/Toggleable-Elytra-Wall-Damage.patch index 5f420bcd50..a05f7bf594 100644 --- a/Spigot-Server-Patches/Toggleable-Elytra-Wall-Damage.patch +++ b/Spigot-Server-Patches/Toggleable-Elytra-Wall-Damage.patch @@ -7,12 +7,12 @@ Instead of calculating the damage taken from hitting a wall, you can disable it in the config. diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 112c447e2..d182e716a 100644 +index 5367fead..3aa6f89e 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java @@ -0,0 +0,0 @@ public class PaperWorldConfig { - delayChunkUnloadsBy *= 1000; - } + private void skipEntityTickingInChunksScheduledForUnload() { + skipEntityTickingInChunksScheduledForUnload = getBoolean("settings.skip-entity-ticking-in-chunks-scheduled-for-unload", skipEntityTickingInChunksScheduledForUnload); } + + public boolean elytraHitWallDamage = true; @@ -21,7 +21,7 @@ index 112c447e2..d182e716a 100644 + } } diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java -index 4b6bb38ae..dda6219a7 100644 +index 4b6bb38a..dda6219a 100644 --- a/src/main/java/net/minecraft/server/EntityLiving.java +++ b/src/main/java/net/minecraft/server/EntityLiving.java @@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity { diff --git a/Spigot-Server-Patches/Vanished-players-don-t-have-rights.patch b/Spigot-Server-Patches/Vanished-players-don-t-have-rights.patch index 83ca3bdc9c..d6fa2093b6 100644 --- a/Spigot-Server-Patches/Vanished-players-don-t-have-rights.patch +++ b/Spigot-Server-Patches/Vanished-players-don-t-have-rights.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Vanished players don't have rights diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index f444465ca..36914ed94 100644 +index 4341a947..6dab8940 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 { @@ -18,7 +18,7 @@ index f444465ca..36914ed94 100644 protected int j; private Entity au;public void setVehicle(Entity entity) { this.au = entity; } // Paper // OBFHELPER diff --git a/src/main/java/net/minecraft/server/ItemBlock.java b/src/main/java/net/minecraft/server/ItemBlock.java -index 60149c1ca..a5730d1c7 100644 +index 60149c1c..a5730d1c 100644 --- a/src/main/java/net/minecraft/server/ItemBlock.java +++ b/src/main/java/net/minecraft/server/ItemBlock.java @@ -0,0 +0,0 @@ public class ItemBlock extends Item { @@ -31,7 +31,7 @@ index 60149c1ca..a5730d1c7 100644 IBlockData iblockdata1 = this.a.getPlacedState(world, blockposition, enumdirection, f, f1, f2, i, entityhuman); diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index ea6f46522..01dba285a 100644 +index 51ab06f9..5925fd96 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java @@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { @@ -78,7 +78,7 @@ index ea6f46522..01dba285a 100644 this.getServer().getPluginManager().callEvent(event); diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index 06a277b3b..5f816e44f 100644 +index 06a277b3..5f816e44 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java @@ -0,0 +0,0 @@ public class CraftEventFactory { diff --git a/Spigot-Server-Patches/provide-a-configurable-option-to-disable-creeper-lin.patch b/Spigot-Server-Patches/provide-a-configurable-option-to-disable-creeper-lin.patch index 4557d8eebf..f8f26988b8 100644 --- a/Spigot-Server-Patches/provide-a-configurable-option-to-disable-creeper-lin.patch +++ b/Spigot-Server-Patches/provide-a-configurable-option-to-disable-creeper-lin.patch @@ -6,7 +6,7 @@ Subject: [PATCH] provide a configurable option to disable creeper lingering diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 79b12a6e..7802cc1f 100644 +index bf6b20f7..601eb08b 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java @@ -0,0 +0,0 @@ public class PaperWorldConfig {