diff --git a/Spigot-Server-Patches/0004-MC-Utils.patch b/Spigot-Server-Patches/0004-MC-Utils.patch index 7e5e65e5f0..b2df067aac 100644 --- a/Spigot-Server-Patches/0004-MC-Utils.patch +++ b/Spigot-Server-Patches/0004-MC-Utils.patch @@ -3005,19 +3005,17 @@ index 774a8f543424853be5fc8c0367d734ddf196d7f9..d5f5a51872dfabdbb828b6c20d61893a this.a(); packetdataserializer.writeByte(this.i); diff --git a/src/main/java/net/minecraft/server/DimensionManager.java b/src/main/java/net/minecraft/server/DimensionManager.java -index 5724fe6e57d3671b4978aecaf217ac4c2e0d7f82..951db04bca7ee9021a5d4707f1907b2c8f734a92 100644 +index 5724fe6e57d3671b4978aecaf217ac4c2e0d7f82..393bc4dc700bbf8653db0662c7957f676b0a647a 100644 --- a/src/main/java/net/minecraft/server/DimensionManager.java +++ b/src/main/java/net/minecraft/server/DimensionManager.java -@@ -55,7 +55,9 @@ public class DimensionManager implements MinecraftSerializable { +@@ -55,6 +55,7 @@ public class DimensionManager implements MinecraftSerializable { return this.folder.isEmpty() ? file : new File(file, this.folder); } + public WorldServer world; // Paper - store ref to world this manager is for public WorldProvider getWorldProvider(World world) { -+ if (this.world == null) this.world = (WorldServer) world; // Paper return (WorldProvider) this.providerFactory.apply(world, this); } - diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java index f4863852b04c5fa55b79acabe40ce59909b9bbbd..7e01f6a1807f9885a7f4b163ce6bb626d8786a9a 100644 --- a/src/main/java/net/minecraft/server/Entity.java @@ -4361,7 +4359,7 @@ index 143be566c683ae035997f9a4058381a109f3de23..0e30d8c9933dc6595b9715ef6dc99cc8 return VoxelShapes.b; } diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 2e1eabba14a3757d03fd90741651001e78c6322f..2a4fa455ff3065f9b1ad9bcf8d236bbb6f830bc9 100644 +index 2e1eabba14a3757d03fd90741651001e78c6322f..d9ff52eda71fcdf88d4c9114450237bcba2ccb08 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java @@ -22,6 +22,7 @@ import org.bukkit.craftbukkit.SpigotTimings; // Spigot @@ -4372,7 +4370,15 @@ index 2e1eabba14a3757d03fd90741651001e78c6322f..2a4fa455ff3065f9b1ad9bcf8d236bbb import org.bukkit.craftbukkit.block.data.CraftBlockData; import org.bukkit.event.block.BlockPhysicsEvent; // CraftBukkit end -@@ -183,6 +184,39 @@ public abstract class World implements GeneratorAccess, AutoCloseable { +@@ -94,6 +95,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { + this.spigotConfig = new org.spigotmc.SpigotWorldConfig( worlddata.getName() ); // Spigot + this.paperConfig = new com.destroystokyo.paper.PaperWorldConfig(worlddata.getName(), this.spigotConfig); // Paper + this.generator = gen; ++ dimensionmanager.world = (WorldServer) this; // Paper + this.world = new CraftWorld((WorldServer) this, gen, env); + this.ticksPerAnimalSpawns = this.getServer().getTicksPerAnimalSpawns(); // CraftBukkit + this.ticksPerMonsterSpawns = this.getServer().getTicksPerMonsterSpawns(); // CraftBukkit +@@ -183,6 +185,39 @@ public abstract class World implements GeneratorAccess, AutoCloseable { return (Chunk) this.getChunkAt(i, j, ChunkStatus.FULL); } @@ -4412,7 +4418,7 @@ index 2e1eabba14a3757d03fd90741651001e78c6322f..2a4fa455ff3065f9b1ad9bcf8d236bbb @Override public IChunkAccess getChunkAt(int i, int j, ChunkStatus chunkstatus, boolean flag) { IChunkAccess ichunkaccess = this.chunkProvider.getChunkAt(i, j, chunkstatus, flag); -@@ -336,8 +370,9 @@ public abstract class World implements GeneratorAccess, AutoCloseable { +@@ -336,8 +371,9 @@ public abstract class World implements GeneratorAccess, AutoCloseable { public void a(BlockPosition blockposition, IBlockData iblockdata, IBlockData iblockdata1) {} diff --git a/Spigot-Server-Patches/0009-Timings-v2.patch b/Spigot-Server-Patches/0009-Timings-v2.patch index 6b2eb74d02..020651c2d0 100644 --- a/Spigot-Server-Patches/0009-Timings-v2.patch +++ b/Spigot-Server-Patches/0009-Timings-v2.patch @@ -1204,7 +1204,7 @@ index 820180ab3f7053c348caa80cc21f15dfa3d26afd..fa6400dccd4df635d696e0858c0c164a private static final CraftPersistentDataTypeRegistry DATA_TYPE_REGISTRY = new CraftPersistentDataTypeRegistry(); public CraftPersistentDataContainer persistentDataContainer; diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 2a4fa455ff3065f9b1ad9bcf8d236bbb6f830bc9..f572c5f22712288cc75fffeae65fc2bd632d2de1 100644 +index d9ff52eda71fcdf88d4c9114450237bcba2ccb08..740c59004514a332ebe556c4e91f84bd9bf4a11d 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java @@ -1,5 +1,7 @@ @@ -1233,7 +1233,7 @@ index 2a4fa455ff3065f9b1ad9bcf8d236bbb6f830bc9..f572c5f22712288cc75fffeae65fc2bd public static BlockPosition lastPhysicsProblem; // Spigot private org.spigotmc.TickLimiter entityLimiter; private org.spigotmc.TickLimiter tileLimiter; -@@ -138,7 +140,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { +@@ -139,7 +141,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { public void c(WorldBorder worldborder, double d0) {} }); // CraftBukkit end @@ -1242,7 +1242,7 @@ index 2a4fa455ff3065f9b1ad9bcf8d236bbb6f830bc9..f572c5f22712288cc75fffeae65fc2bd this.entityLimiter = new org.spigotmc.TickLimiter(spigotConfig.entityMaxTickTime); this.tileLimiter = new org.spigotmc.TickLimiter(spigotConfig.tileMaxTickTime); } -@@ -722,15 +724,14 @@ public abstract class World implements GeneratorAccess, AutoCloseable { +@@ -723,15 +725,14 @@ public abstract class World implements GeneratorAccess, AutoCloseable { } timings.tileEntityPending.stopTiming(); // Spigot diff --git a/Spigot-Server-Patches/0015-Allow-for-toggling-of-spawn-chunks.patch b/Spigot-Server-Patches/0015-Allow-for-toggling-of-spawn-chunks.patch index e7dc4ece78..c3a72a7fe3 100644 --- a/Spigot-Server-Patches/0015-Allow-for-toggling-of-spawn-chunks.patch +++ b/Spigot-Server-Patches/0015-Allow-for-toggling-of-spawn-chunks.patch @@ -20,10 +20,10 @@ index 2845686411615245137cfe1a155088a865a4d3a0..8ee2b9bb1bce698fce50ac1b3fc477fc + } } diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index f572c5f22712288cc75fffeae65fc2bd632d2de1..0332aca8be854fca7444308b9ab5e43f01f8055e 100644 +index 740c59004514a332ebe556c4e91f84bd9bf4a11d..b69d84baf8d318968ef171232e493a315f71814b 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java -@@ -141,6 +141,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { +@@ -142,6 +142,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { }); // CraftBukkit end timings = new co.aikar.timings.WorldTimingsHandler(this); // Paper - code below can generate new world and access timings diff --git a/Spigot-Server-Patches/0026-Prevent-tile-entity-and-entity-crashes.patch b/Spigot-Server-Patches/0026-Prevent-tile-entity-and-entity-crashes.patch index 6dc71a7ec2..fe41d422f0 100644 --- a/Spigot-Server-Patches/0026-Prevent-tile-entity-and-entity-crashes.patch +++ b/Spigot-Server-Patches/0026-Prevent-tile-entity-and-entity-crashes.patch @@ -23,10 +23,10 @@ index fa6400dccd4df635d696e0858c0c164a0f19b4a4..e2f3cec7420edbd284b531ca7d1d1214 } } diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 0332aca8be854fca7444308b9ab5e43f01f8055e..1bb36201544987cf44b9da2494e4cc54385f7e77 100644 +index b69d84baf8d318968ef171232e493a315f71814b..ca3b4c9f2f7e1b5425e8be4c3d11e3e881915e8b 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java -@@ -664,11 +664,13 @@ public abstract class World implements GeneratorAccess, AutoCloseable { +@@ -665,11 +665,13 @@ public abstract class World implements GeneratorAccess, AutoCloseable { gameprofilerfiller.exit(); } catch (Throwable throwable) { @@ -45,7 +45,7 @@ index 0332aca8be854fca7444308b9ab5e43f01f8055e..1bb36201544987cf44b9da2494e4cc54 } // Spigot start finally { -@@ -734,11 +736,12 @@ public abstract class World implements GeneratorAccess, AutoCloseable { +@@ -735,11 +737,12 @@ public abstract class World implements GeneratorAccess, AutoCloseable { try { consumer.accept(entity); } catch (Throwable throwable) { diff --git a/Spigot-Server-Patches/0041-Disable-spigot-tick-limiters.patch b/Spigot-Server-Patches/0041-Disable-spigot-tick-limiters.patch index 62aa75c6df..b50f633927 100644 --- a/Spigot-Server-Patches/0041-Disable-spigot-tick-limiters.patch +++ b/Spigot-Server-Patches/0041-Disable-spigot-tick-limiters.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Disable spigot tick limiters diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 4604634577418be8382a3d84eaaa90869834c88f..4d849719f4b06dad40f96afd27c3ef32092b5bd0 100644 +index 6dfefa3f9ebf6d2ad08ebe6ddd77ca6d95971544..65fc7105c8c93ccee569abb14ccba3f5cf75a7a8 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java -@@ -634,9 +634,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { +@@ -635,9 +635,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { // Spigot start // Iterator iterator = this.tileEntityListTick.iterator(); int tilesThisCycle = 0; diff --git a/Spigot-Server-Patches/0054-Add-exception-reporting-event.patch b/Spigot-Server-Patches/0054-Add-exception-reporting-event.patch index c382297140..840991b711 100644 --- a/Spigot-Server-Patches/0054-Add-exception-reporting-event.patch +++ b/Spigot-Server-Patches/0054-Add-exception-reporting-event.patch @@ -209,7 +209,7 @@ index d5e9bae7097460b44f9061198cf54b421bf2b3cf..1bcf01c09a9ba5168d491797e13eeddc } diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 6e8ac186c9975888fe7403506ad0724fb37ad26c..a6b2867094b6a757b4bc54a947b6972417845f2b 100644 +index fc9bbc4fdd371931ea31c061b9bef0c4f91853d9..6e7d3573ed6f58a9c5f29c8b1b49746f13e21dc7 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java @@ -2,6 +2,9 @@ package net.minecraft.server; @@ -222,7 +222,7 @@ index 6e8ac186c9975888fe7403506ad0724fb37ad26c..a6b2867094b6a757b4bc54a947b69724 import com.google.common.collect.Lists; import java.io.IOException; import java.util.Collection; -@@ -664,8 +667,11 @@ public abstract class World implements GeneratorAccess, AutoCloseable { +@@ -665,8 +668,11 @@ public abstract class World implements GeneratorAccess, AutoCloseable { gameprofilerfiller.exit(); } catch (Throwable throwable) { // Paper start - Prevent tile entity and entity crashes @@ -235,7 +235,7 @@ index 6e8ac186c9975888fe7403506ad0724fb37ad26c..a6b2867094b6a757b4bc54a947b69724 tilesThisCycle--; this.tileEntityListTick.remove(tileTickPosition--); continue; -@@ -736,8 +742,10 @@ public abstract class World implements GeneratorAccess, AutoCloseable { +@@ -737,8 +743,10 @@ public abstract class World implements GeneratorAccess, AutoCloseable { consumer.accept(entity); } catch (Throwable throwable) { // Paper start - Prevent tile entity and entity crashes diff --git a/Spigot-Server-Patches/0066-Add-World-Util-Methods.patch b/Spigot-Server-Patches/0066-Add-World-Util-Methods.patch index e684aa5deb..1114a1ed89 100644 --- a/Spigot-Server-Patches/0066-Add-World-Util-Methods.patch +++ b/Spigot-Server-Patches/0066-Add-World-Util-Methods.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Add World Util Methods Methods that can be used for other patches to help improve logic. diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index a6b2867094b6a757b4bc54a947b6972417845f2b..e7337fc368327876139f4610642a45321d0ecce2 100644 +index 6e7d3573ed6f58a9c5f29c8b1b49746f13e21dc7..a721ad8addfd5a47608e304b372762d3ca89fa65 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java -@@ -222,6 +222,18 @@ public abstract class World implements GeneratorAccess, AutoCloseable { +@@ -223,6 +223,18 @@ public abstract class World implements GeneratorAccess, AutoCloseable { return chunk == null ? null : chunk.getFluid(blockposition); } @@ -29,7 +29,7 @@ index a6b2867094b6a757b4bc54a947b6972417845f2b..e7337fc368327876139f4610642a4532 @Override diff --git a/src/main/java/net/minecraft/server/WorldBorder.java b/src/main/java/net/minecraft/server/WorldBorder.java -index 020e5c171a44f8886395849d718efd6f90659bab..4ee13ac45483022417e08bb7a4461eb34b3ec84a 100644 +index 3db276f176301ebf15d5a2ba44d0edb5c7ec6097..73730fe25c84a867b8d95525c9d76d60a5797396 100644 --- a/src/main/java/net/minecraft/server/WorldBorder.java +++ b/src/main/java/net/minecraft/server/WorldBorder.java @@ -19,6 +19,7 @@ public class WorldBorder { diff --git a/Spigot-Server-Patches/0072-Optimize-isValidLocation-getType-and-getBlockData-fo.patch b/Spigot-Server-Patches/0072-Optimize-isValidLocation-getType-and-getBlockData-fo.patch index a4436e059a..41bf239a03 100644 --- a/Spigot-Server-Patches/0072-Optimize-isValidLocation-getType-and-getBlockData-fo.patch +++ b/Spigot-Server-Patches/0072-Optimize-isValidLocation-getType-and-getBlockData-fo.patch @@ -77,10 +77,10 @@ index 638b0e39798a3f75566fcf9ea48b81024e60b471..e056fbcb216977401fd2778fcd3ee7ed public ChunkSection(int i) { this(i, (short) 0, (short) 0, (short) 0); diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index e7337fc368327876139f4610642a45321d0ecce2..6b1ff8f64f87e1d5fc98fd9733d6b45d312c1f69 100644 +index a721ad8addfd5a47608e304b372762d3ca89fa65..40a51633ed509ca7ae6131e11276f8f3cb7c03ce 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java -@@ -171,11 +171,11 @@ public abstract class World implements GeneratorAccess, AutoCloseable { +@@ -172,11 +172,11 @@ public abstract class World implements GeneratorAccess, AutoCloseable { } public static boolean isValidLocation(BlockPosition blockposition) { diff --git a/Spigot-Server-Patches/0073-Only-process-BlockPhysicsEvent-if-a-plugin-has-a-lis.patch b/Spigot-Server-Patches/0073-Only-process-BlockPhysicsEvent-if-a-plugin-has-a-lis.patch index eb10b6eb47..09ee1b4a66 100644 --- a/Spigot-Server-Patches/0073-Only-process-BlockPhysicsEvent-if-a-plugin-has-a-lis.patch +++ b/Spigot-Server-Patches/0073-Only-process-BlockPhysicsEvent-if-a-plugin-has-a-lis.patch @@ -44,10 +44,10 @@ index a67c31a6021d881b49cfdb75f514404c342eea45..4c7df81217c10d92d05e619ad760bc5d this.methodProfiler.a(() -> { return worldserver.getWorldData().getName() + " " + IRegistry.DIMENSION_TYPE.getKey(worldserver.worldProvider.getDimensionManager()); diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 6b1ff8f64f87e1d5fc98fd9733d6b45d312c1f69..1edd03086535834fc68260f0ee6653d84764ce87 100644 +index 40a51633ed509ca7ae6131e11276f8f3cb7c03ce..7278242d569dafd99984921a3a3b86de46d8287f 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java -@@ -369,7 +369,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { +@@ -370,7 +370,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { // CraftBukkit start iblockdata1.b(this, blockposition, j); // Don't call an event for the old block to limit event spam CraftWorld world = ((WorldServer) this).getWorld(); @@ -56,7 +56,7 @@ index 6b1ff8f64f87e1d5fc98fd9733d6b45d312c1f69..1edd03086535834fc68260f0ee6653d8 BlockPhysicsEvent event = new BlockPhysicsEvent(world.getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()), CraftBlockData.fromData(iblockdata)); this.getServer().getPluginManager().callEvent(event); -@@ -481,7 +481,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { +@@ -482,7 +482,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { try { // CraftBukkit start CraftWorld world = ((WorldServer) this).getWorld(); diff --git a/Spigot-Server-Patches/0082-Fix-Cancelling-BlockPlaceEvent-triggering-physics.patch b/Spigot-Server-Patches/0082-Fix-Cancelling-BlockPlaceEvent-triggering-physics.patch index a53ee4bf9a..d88c6fc35b 100644 --- a/Spigot-Server-Patches/0082-Fix-Cancelling-BlockPlaceEvent-triggering-physics.patch +++ b/Spigot-Server-Patches/0082-Fix-Cancelling-BlockPlaceEvent-triggering-physics.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Fix Cancelling BlockPlaceEvent triggering physics diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 1edd03086535834fc68260f0ee6653d84764ce87..aaedbaf4d7eb7750b356e184ac4a4f5e38d91b54 100644 +index 7278242d569dafd99984921a3a3b86de46d8287f..491e491895246063c4df38e1a90693bfc730ef33 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java -@@ -439,6 +439,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { +@@ -440,6 +440,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { public void b(BlockPosition blockposition, IBlockData iblockdata, IBlockData iblockdata1) {} public void applyPhysics(BlockPosition blockposition, Block block) { diff --git a/Spigot-Server-Patches/0086-Remove-unused-World-Tile-Entity-List.patch b/Spigot-Server-Patches/0086-Remove-unused-World-Tile-Entity-List.patch index 40d174b13f..0e9f14b4f4 100644 --- a/Spigot-Server-Patches/0086-Remove-unused-World-Tile-Entity-List.patch +++ b/Spigot-Server-Patches/0086-Remove-unused-World-Tile-Entity-List.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Remove unused World Tile Entity List Massive hit to performance and it is completely unnecessary. diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index aaedbaf4d7eb7750b356e184ac4a4f5e38d91b54..0e8d31babd39857c2754c19ddc780f8c840a443c 100644 +index 491e491895246063c4df38e1a90693bfc730ef33..a3de9ae44acb3736394ac97c730d1b1cc2d5b914 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java @@ -36,7 +36,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { @@ -18,7 +18,7 @@ index aaedbaf4d7eb7750b356e184ac4a4f5e38d91b54..0e8d31babd39857c2754c19ddc780f8c public final List tileEntityListTick = Lists.newArrayList(); protected final List tileEntityListPending = Lists.newArrayList(); protected final java.util.Set tileEntityListUnload = com.google.common.collect.Sets.newHashSet(); -@@ -604,9 +604,9 @@ public abstract class World implements GeneratorAccess, AutoCloseable { +@@ -605,9 +605,9 @@ public abstract class World implements GeneratorAccess, AutoCloseable { }, tileentity::getPosition}); } @@ -30,7 +30,7 @@ index aaedbaf4d7eb7750b356e184ac4a4f5e38d91b54..0e8d31babd39857c2754c19ddc780f8c this.tileEntityListTick.add(tileentity); } -@@ -642,7 +642,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { +@@ -643,7 +643,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { timings.tileEntityTick.startTiming(); // Spigot if (!this.tileEntityListUnload.isEmpty()) { this.tileEntityListTick.removeAll(this.tileEntityListUnload); @@ -39,7 +39,7 @@ index aaedbaf4d7eb7750b356e184ac4a4f5e38d91b54..0e8d31babd39857c2754c19ddc780f8c this.tileEntityListUnload.clear(); } -@@ -703,7 +703,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { +@@ -704,7 +704,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { tilesThisCycle--; this.tileEntityListTick.remove(tileTickPosition--); // Spigot end @@ -48,7 +48,7 @@ index aaedbaf4d7eb7750b356e184ac4a4f5e38d91b54..0e8d31babd39857c2754c19ddc780f8c if (this.isLoaded(tileentity.getPosition())) { this.getChunkAtWorldCoords(tileentity.getPosition()).removeTileEntity(tileentity.getPosition()); } -@@ -733,7 +733,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { +@@ -734,7 +734,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { this.notify(tileentity1.getPosition(), iblockdata, iblockdata, 3); // CraftBukkit start // From above, don't screw this up - SPIGOT-1746 @@ -57,7 +57,7 @@ index aaedbaf4d7eb7750b356e184ac4a4f5e38d91b54..0e8d31babd39857c2754c19ddc780f8c this.a(tileentity1); } // CraftBukkit end -@@ -999,7 +999,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { +@@ -1000,7 +1000,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { } else { if (tileentity != null) { this.tileEntityListPending.remove(tileentity); diff --git a/Spigot-Server-Patches/0127-Optimize-World.isLoaded-BlockPosition-Z.patch b/Spigot-Server-Patches/0127-Optimize-World.isLoaded-BlockPosition-Z.patch index d330c98763..8a7422d28f 100644 --- a/Spigot-Server-Patches/0127-Optimize-World.isLoaded-BlockPosition-Z.patch +++ b/Spigot-Server-Patches/0127-Optimize-World.isLoaded-BlockPosition-Z.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Optimize World.isLoaded(BlockPosition)Z Reduce method invocations for World.isLoaded(BlockPosition)Z diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 86de3c634de0e9b9a320e1e71d2fb01fddd1a1e8..9632839598c0d6a24894780dd2f68b9abeb33a31 100644 +index fd8724c755d4129c0f3fbd6e0730def09dba1e55..184ea74726078809ae1b6df320d37532fa0d26ab 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java -@@ -224,6 +224,11 @@ public abstract class World implements GeneratorAccess, AutoCloseable { +@@ -225,6 +225,11 @@ public abstract class World implements GeneratorAccess, AutoCloseable { return chunk == null ? null : chunk.getFluid(blockposition); } diff --git a/Spigot-Server-Patches/0166-Fix-MC-117075-TE-Unload-Lag-Spike.patch b/Spigot-Server-Patches/0166-Fix-MC-117075-TE-Unload-Lag-Spike.patch index 8e8043de1f..927fe63722 100644 --- a/Spigot-Server-Patches/0166-Fix-MC-117075-TE-Unload-Lag-Spike.patch +++ b/Spigot-Server-Patches/0166-Fix-MC-117075-TE-Unload-Lag-Spike.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Fix MC-117075: TE Unload Lag Spike diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 9632839598c0d6a24894780dd2f68b9abeb33a31..14c97a163c53a9ca0fae55a01d2ca861712b1c07 100644 +index 184ea74726078809ae1b6df320d37532fa0d26ab..08f22545393148e91bec3d4a091092eab6828711 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java -@@ -647,7 +647,11 @@ public abstract class World implements GeneratorAccess, AutoCloseable { +@@ -648,7 +648,11 @@ public abstract class World implements GeneratorAccess, AutoCloseable { gameprofilerfiller.enter("blockEntities"); timings.tileEntityTick.startTiming(); // Spigot if (!this.tileEntityListUnload.isEmpty()) { diff --git a/Spigot-Server-Patches/0177-Send-attack-SoundEffects-only-to-players-who-can-see.patch b/Spigot-Server-Patches/0177-Send-attack-SoundEffects-only-to-players-who-can-see.patch index d50437eb16..ecbbf5a655 100644 --- a/Spigot-Server-Patches/0177-Send-attack-SoundEffects-only-to-players-who-can-see.patch +++ b/Spigot-Server-Patches/0177-Send-attack-SoundEffects-only-to-players-who-can-see.patch @@ -72,10 +72,10 @@ index 8e5edd2c9b7cc9a441969efeb666061515188486..542f935b4e7a027b3df82f037fcd6523 entity.extinguish(); } diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 14c97a163c53a9ca0fae55a01d2ca861712b1c07..a956dbc3d4ea1f20b0be28ed4f54f55474e89a5c 100644 +index 08f22545393148e91bec3d4a091092eab6828711..b3e01415110d6a714b6cd5a94bf747a1481d72ab 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java -@@ -584,6 +584,11 @@ public abstract class World implements GeneratorAccess, AutoCloseable { +@@ -585,6 +585,11 @@ public abstract class World implements GeneratorAccess, AutoCloseable { this.playSound(entityhuman, (double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D, soundeffect, soundcategory, f, f1); } diff --git a/Spigot-Server-Patches/0181-use-CB-BlockState-implementations-for-captured-block.patch b/Spigot-Server-Patches/0181-use-CB-BlockState-implementations-for-captured-block.patch index f38b5ac734..89e508c6ed 100644 --- a/Spigot-Server-Patches/0181-use-CB-BlockState-implementations-for-captured-block.patch +++ b/Spigot-Server-Patches/0181-use-CB-BlockState-implementations-for-captured-block.patch @@ -18,7 +18,7 @@ the blockstate that will be valid for restoration, as opposed to dropping information on restoration when the event is cancelled. diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index a956dbc3d4ea1f20b0be28ed4f54f55474e89a5c..2f57c7bc76ddd8fd4b796d85eaa7200d8da41865 100644 +index b3e01415110d6a714b6cd5a94bf747a1481d72ab..08bed18ad6f78c6aad444eeb5a321887d90e5829 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java @@ -66,7 +66,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { @@ -30,7 +30,7 @@ index a956dbc3d4ea1f20b0be28ed4f54f55474e89a5c..2f57c7bc76ddd8fd4b796d85eaa7200d public Map capturedTileEntities = new HashMap<>(); public List captureDrops; public long ticksPerAnimalSpawns; -@@ -257,7 +257,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { +@@ -258,7 +258,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { public boolean setTypeAndData(BlockPosition blockposition, IBlockData iblockdata, int i) { // CraftBukkit start - tree generation if (this.captureTreeGeneration) { @@ -39,7 +39,7 @@ index a956dbc3d4ea1f20b0be28ed4f54f55474e89a5c..2f57c7bc76ddd8fd4b796d85eaa7200d if (blockstate == null) { blockstate = CapturedBlockState.getTreeBlockState(this, blockposition, i); this.capturedBlockStates.put(blockposition.immutableCopy(), blockstate); -@@ -277,7 +277,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { +@@ -278,7 +278,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { // CraftBukkit start - capture blockstates boolean captured = false; if (this.captureBlockStates && !this.capturedBlockStates.containsKey(blockposition)) { @@ -48,7 +48,7 @@ index a956dbc3d4ea1f20b0be28ed4f54f55474e89a5c..2f57c7bc76ddd8fd4b796d85eaa7200d this.capturedBlockStates.put(blockposition.immutableCopy(), blockstate); captured = true; } -@@ -545,7 +545,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { +@@ -546,7 +546,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { public IBlockData getType(BlockPosition blockposition) { // CraftBukkit start - tree generation if (captureTreeGeneration) { diff --git a/Spigot-Server-Patches/0253-Option-to-prevent-armor-stands-from-doing-entity-loo.patch b/Spigot-Server-Patches/0253-Option-to-prevent-armor-stands-from-doing-entity-loo.patch index 78de25dbcc..036d18d06a 100644 --- a/Spigot-Server-Patches/0253-Option-to-prevent-armor-stands-from-doing-entity-loo.patch +++ b/Spigot-Server-Patches/0253-Option-to-prevent-armor-stands-from-doing-entity-loo.patch @@ -19,10 +19,10 @@ index 387e0dcb9f01ad947daaa19211331a96742ce004..eaaa51e4bf761f41fd516402ce1ad0f9 + } } diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index a1c33c525ce8ae0f4736198658174f8d67ab6320..2261c42ab69e260d3533cdff1149b83acea8ccb4 100644 +index 9a001a2a7934dc87f3e57d3388a8a888ec43908b..688d98dd1e6e5d2e17c8fc04e105fdc0ee649574 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java -@@ -781,6 +781,14 @@ public abstract class World implements GeneratorAccess, AutoCloseable { +@@ -782,6 +782,14 @@ public abstract class World implements GeneratorAccess, AutoCloseable { } } diff --git a/Spigot-Server-Patches/0254-Vanished-players-don-t-have-rights.patch b/Spigot-Server-Patches/0254-Vanished-players-don-t-have-rights.patch index 560ab67cb5..9d2d19bd03 100644 --- a/Spigot-Server-Patches/0254-Vanished-players-don-t-have-rights.patch +++ b/Spigot-Server-Patches/0254-Vanished-players-don-t-have-rights.patch @@ -97,10 +97,10 @@ index 0e30d8c9933dc6595b9715ef6dc99cc8910892cb..335142ec0dfad822cfe40877e99dec0f if (operatorboolean.apply(false, false)) { throw (IllegalArgumentException) SystemUtils.c(new IllegalArgumentException()); diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 2261c42ab69e260d3533cdff1149b83acea8ccb4..378ac5ae86e337f27975bc7935c4f25fce767eaf 100644 +index 688d98dd1e6e5d2e17c8fc04e105fdc0ee649574..037770cde15a72192f0f45fdac33f8bd66ba646c 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java -@@ -152,6 +152,46 @@ public abstract class World implements GeneratorAccess, AutoCloseable { +@@ -153,6 +153,46 @@ public abstract class World implements GeneratorAccess, AutoCloseable { this.tileLimiter = new org.spigotmc.TickLimiter(spigotConfig.tileMaxTickTime); } diff --git a/Spigot-Server-Patches/0326-Optimize-redstone-algorithm.patch b/Spigot-Server-Patches/0326-Optimize-redstone-algorithm.patch index 953754dee6..db09569768 100644 --- a/Spigot-Server-Patches/0326-Optimize-redstone-algorithm.patch +++ b/Spigot-Server-Patches/0326-Optimize-redstone-algorithm.patch @@ -1127,10 +1127,10 @@ index 5bf2fc0b3f0a5209682b6056a6512ba9dbdca6d0..52a4982ecd7e4346e55c6fbab80032ed c(iblockdata, world, blockposition); world.a(blockposition, false); diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 378ac5ae86e337f27975bc7935c4f25fce767eaf..f8619578422f9e1e5368c97588cc5ec265788a1d 100644 +index 037770cde15a72192f0f45fdac33f8bd66ba646c..e3253bd36b08dc0963a69d8bd417c9f666ea4406 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java -@@ -522,6 +522,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { +@@ -523,6 +523,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { } @@ -1138,7 +1138,7 @@ index 378ac5ae86e337f27975bc7935c4f25fce767eaf..f8619578422f9e1e5368c97588cc5ec2 public void a(BlockPosition blockposition, Block block, BlockPosition blockposition1) { if (!this.isClientSide) { IBlockData iblockdata = this.getType(blockposition); -@@ -1277,6 +1278,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { +@@ -1278,6 +1279,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { return this.getBlockFacePower(blockposition.down(), EnumDirection.DOWN) > 0 ? true : (this.getBlockFacePower(blockposition.up(), EnumDirection.UP) > 0 ? true : (this.getBlockFacePower(blockposition.north(), EnumDirection.NORTH) > 0 ? true : (this.getBlockFacePower(blockposition.south(), EnumDirection.SOUTH) > 0 ? true : (this.getBlockFacePower(blockposition.west(), EnumDirection.WEST) > 0 ? true : this.getBlockFacePower(blockposition.east(), EnumDirection.EAST) > 0)))); } diff --git a/Spigot-Server-Patches/0341-BlockDestroyEvent.patch b/Spigot-Server-Patches/0341-BlockDestroyEvent.patch index ffcf450a86..a9bd1c15c7 100644 --- a/Spigot-Server-Patches/0341-BlockDestroyEvent.patch +++ b/Spigot-Server-Patches/0341-BlockDestroyEvent.patch @@ -11,10 +11,10 @@ floating in the air. This can replace many uses of BlockPhysicsEvent diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index f8619578422f9e1e5368c97588cc5ec265788a1d..a3fbdf5db5cd1f08e9920bbc786705f69f465efd 100644 +index e3253bd36b08dc0963a69d8bd417c9f666ea4406..98ea9bb98a1a447e1ab8a54839d263ee1cad58ff 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java -@@ -452,8 +452,20 @@ public abstract class World implements GeneratorAccess, AutoCloseable { +@@ -453,8 +453,20 @@ public abstract class World implements GeneratorAccess, AutoCloseable { return false; } else { Fluid fluid = this.getFluid(blockposition); diff --git a/Spigot-Server-Patches/0362-Optimize-Captured-TileEntity-Lookup.patch b/Spigot-Server-Patches/0362-Optimize-Captured-TileEntity-Lookup.patch index facb96139e..356527ebc6 100644 --- a/Spigot-Server-Patches/0362-Optimize-Captured-TileEntity-Lookup.patch +++ b/Spigot-Server-Patches/0362-Optimize-Captured-TileEntity-Lookup.patch @@ -10,10 +10,10 @@ Optimize to check if the captured list even has values in it, and also to just do a get call since the value can never be null. diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index a3fbdf5db5cd1f08e9920bbc786705f69f465efd..f797d737a374f222e94c132dea7fada5374b49e4 100644 +index 98ea9bb98a1a447e1ab8a54839d263ee1cad58ff..7821d4cd05200ca32ba7e2c7cc7e9ff476d3a236 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java -@@ -998,12 +998,13 @@ public abstract class World implements GeneratorAccess, AutoCloseable { +@@ -999,12 +999,13 @@ public abstract class World implements GeneratorAccess, AutoCloseable { return null; } else { // CraftBukkit start diff --git a/Spigot-Server-Patches/0363-Add-Heightmap-API.patch b/Spigot-Server-Patches/0363-Add-Heightmap-API.patch index 288cecdad0..b926ef671b 100644 --- a/Spigot-Server-Patches/0363-Add-Heightmap-API.patch +++ b/Spigot-Server-Patches/0363-Add-Heightmap-API.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add Heightmap API diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index f797d737a374f222e94c132dea7fada5374b49e4..983bc1c7d9c0745b34fac8afc27ed8a275c0ad78 100644 +index 7821d4cd05200ca32ba7e2c7cc7e9ff476d3a236..ee08cdcffc9237ee4154b7c756ba032b7723bd1f 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java -@@ -573,8 +573,8 @@ public abstract class World implements GeneratorAccess, AutoCloseable { +@@ -574,8 +574,8 @@ public abstract class World implements GeneratorAccess, AutoCloseable { } } diff --git a/Spigot-Server-Patches/0384-Anti-Xray.patch b/Spigot-Server-Patches/0384-Anti-Xray.patch index 5521cf2ecb..7d8227ad6c 100644 --- a/Spigot-Server-Patches/0384-Anti-Xray.patch +++ b/Spigot-Server-Patches/0384-Anti-Xray.patch @@ -1392,7 +1392,7 @@ index 01bf28dc34dd69dbcee5f470cc71ec2fbb2fcc12..caa18b046cd4231b1caa9c70e766ab60 } diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 8cf3c10274b8320bf1938b95dd9f447deeb2c4d0..0bde1717431d770a9a73e83b56388d6f4923e404 100644 +index 74709dff3f87e929f1583be524d4e53ad3be6728..7faaef50a5430c8bdf85ca0e37a4ad24ad56b1ef 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java @@ -2,6 +2,8 @@ package net.minecraft.server; @@ -1418,9 +1418,9 @@ index 8cf3c10274b8320bf1938b95dd9f447deeb2c4d0..0bde1717431d770a9a73e83b56388d6f this.paperConfig = new com.destroystokyo.paper.PaperWorldConfig(worlddata.getName(), this.spigotConfig); // Paper + this.chunkPacketBlockController = this.paperConfig.antiXray ? new ChunkPacketBlockControllerAntiXray(this.paperConfig) : ChunkPacketBlockController.NO_OPERATION_INSTANCE; // Paper - Anti-Xray this.generator = gen; + dimensionmanager.world = (WorldServer) this; // Paper this.world = new CraftWorld((WorldServer) this, gen, env); - this.ticksPerAnimalSpawns = this.getServer().getTicksPerAnimalSpawns(); // CraftBukkit -@@ -342,6 +346,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { +@@ -343,6 +347,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { // CraftBukkit end IBlockData iblockdata1 = chunk.setType(blockposition, iblockdata, (i & 64) != 0, (i & 1024) == 0); // CraftBukkit custom NO_PLACE flag diff --git a/Spigot-Server-Patches/0391-Use-getChunkIfLoadedImmediately-in-places.patch b/Spigot-Server-Patches/0391-Use-getChunkIfLoadedImmediately-in-places.patch index 8f04073351..2aae4dadef 100644 --- a/Spigot-Server-Patches/0391-Use-getChunkIfLoadedImmediately-in-places.patch +++ b/Spigot-Server-Patches/0391-Use-getChunkIfLoadedImmediately-in-places.patch @@ -8,7 +8,7 @@ ticket level 33 (yes getChunkIfLoaded will actually perform a chunk load in that case). diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index 0a06ed36795afad00839174fc1a7e7f7b9e4a8c8..cf3e15e70ac22bbdd39153956cfdc6d2f8f44e2b 100644 +index 9d001f816d0b8b6d6cf80ee6bce548f1017960b7..6ba6fd6157985ae9d7bb048c2d42b268d08697bc 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java @@ -996,7 +996,7 @@ public class PlayerConnection implements PacketListenerPlayIn { @@ -21,7 +21,7 @@ index 0a06ed36795afad00839174fc1a7e7f7b9e4a8c8..cf3e15e70ac22bbdd39153956cfdc6d2 return; } diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 0bde1717431d770a9a73e83b56388d6f4923e404..311685180fe720706dfb6c82b1b54f9876187b73 100644 +index 7faaef50a5430c8bdf85ca0e37a4ad24ad56b1ef..21bb992cad2fd2692940ebe26360b8014c1df136 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java @@ -116,8 +116,16 @@ public abstract class World implements GeneratorAccess, AutoCloseable { @@ -42,7 +42,7 @@ index 0bde1717431d770a9a73e83b56388d6f4923e404..311685180fe720706dfb6c82b1b54f98 protected World(WorldData worlddata, DimensionManager dimensionmanager, BiFunction bifunction, GameProfilerFiller gameprofilerfiller, boolean flag, org.bukkit.generator.ChunkGenerator gen, org.bukkit.World.Environment env) { this.spigotConfig = new org.spigotmc.SpigotWorldConfig( worlddata.getName() ); // Spigot -@@ -1109,14 +1117,14 @@ public abstract class World implements GeneratorAccess, AutoCloseable { +@@ -1110,14 +1118,14 @@ public abstract class World implements GeneratorAccess, AutoCloseable { } public boolean n(BlockPosition blockposition) { @@ -59,7 +59,7 @@ index 0bde1717431d770a9a73e83b56388d6f4923e404..311685180fe720706dfb6c82b1b54f98 return ichunkaccess == null ? false : ichunkaccess.getType(blockposition).a((IBlockAccess) this, blockposition, entity); } -@@ -1232,7 +1240,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { +@@ -1233,7 +1241,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { for (int i1 = i; i1 < j; ++i1) { for (int j1 = k; j1 < l; ++j1) { diff --git a/Spigot-Server-Patches/0392-Reduce-sync-loads.patch b/Spigot-Server-Patches/0392-Reduce-sync-loads.patch index e665656e25..4d1b785979 100644 --- a/Spigot-Server-Patches/0392-Reduce-sync-loads.patch +++ b/Spigot-Server-Patches/0392-Reduce-sync-loads.patch @@ -298,10 +298,10 @@ index a88e8598aab55ac769a5f186507f362e4f99cef4..21e444e6ad78081353a7330b60c74164 this.serverThreadQueue.awaitTasks(completablefuture::isDone); com.destroystokyo.paper.io.chunk.ChunkTaskManager.popChunkWait(); // Paper - async chunk debug diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 311685180fe720706dfb6c82b1b54f9876187b73..568e04faa314552e14286efdfcdfb79e682fda95 100644 +index 21bb992cad2fd2692940ebe26360b8014c1df136..d46f09f684b0b49e84b86fab5f10ac83b4b64d0b 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java -@@ -1173,7 +1173,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { +@@ -1174,7 +1174,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { for (int i1 = i; i1 <= j; ++i1) { for (int j1 = k; j1 <= l; ++j1) { @@ -310,7 +310,7 @@ index 311685180fe720706dfb6c82b1b54f9876187b73..568e04faa314552e14286efdfcdfb79e if (chunk != null) { chunk.a(entity, axisalignedbb, list, predicate); -@@ -1194,7 +1194,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { +@@ -1195,7 +1195,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { for (int i1 = i; i1 < j; ++i1) { for (int j1 = k; j1 < l; ++j1) { @@ -319,7 +319,7 @@ index 311685180fe720706dfb6c82b1b54f9876187b73..568e04faa314552e14286efdfcdfb79e if (chunk != null) { chunk.a(entitytypes, axisalignedbb, list, predicate); -@@ -1217,7 +1217,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { +@@ -1218,7 +1218,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { for (int i1 = i; i1 < j; ++i1) { for (int j1 = k; j1 < l; ++j1) { diff --git a/Spigot-Server-Patches/0414-Optimize-Hoppers.patch b/Spigot-Server-Patches/0414-Optimize-Hoppers.patch index 168c3b0af7..64062d35fa 100644 --- a/Spigot-Server-Patches/0414-Optimize-Hoppers.patch +++ b/Spigot-Server-Patches/0414-Optimize-Hoppers.patch @@ -481,10 +481,10 @@ index d4cbce3243fe1f4973c9c0ae0dbdab10e3390897..3b394c2726e0fbe595641a022e59c896 } diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 568e04faa314552e14286efdfcdfb79e682fda95..9e161746f2acbe544140979bddb51ac26ee0d20f 100644 +index d46f09f684b0b49e84b86fab5f10ac83b4b64d0b..6b6612de65081895825858f52d0f1c6f23c8edb6 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java -@@ -1205,8 +1205,8 @@ public abstract class World implements GeneratorAccess, AutoCloseable { +@@ -1206,8 +1206,8 @@ public abstract class World implements GeneratorAccess, AutoCloseable { return list; } diff --git a/Spigot-Server-Patches/0429-Seed-based-feature-search.patch b/Spigot-Server-Patches/0429-Seed-based-feature-search.patch index 17e9a84772..f068ce7dbb 100644 --- a/Spigot-Server-Patches/0429-Seed-based-feature-search.patch +++ b/Spigot-Server-Patches/0429-Seed-based-feature-search.patch @@ -94,10 +94,10 @@ index e8ce2ecf23e58d82febf6b9441e0004e69cdc858..acfe732af5b9f63fc2f6b78499defabe public abstract StructureGenerator.a a(); diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 228e6e9ab997394dc99775a5f787455b8b7d6d63..f1d072a39cc2f0f7b214e7794f8dc5dcc282d6b3 100644 +index 3742be65afebcf4c61a9efbd1c207f968e5f7473..b9685abed74fd1fb239b0940751fde65cceb6f57 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java -@@ -1569,8 +1569,8 @@ public abstract class World implements GeneratorAccess, AutoCloseable { +@@ -1570,8 +1570,8 @@ public abstract class World implements GeneratorAccess, AutoCloseable { return this.methodProfiler; } diff --git a/Spigot-Server-Patches/0431-Optimise-getChunkAt-calls-for-loaded-chunks.patch b/Spigot-Server-Patches/0431-Optimise-getChunkAt-calls-for-loaded-chunks.patch index daeb97a82a..bf4279931a 100644 --- a/Spigot-Server-Patches/0431-Optimise-getChunkAt-calls-for-loaded-chunks.patch +++ b/Spigot-Server-Patches/0431-Optimise-getChunkAt-calls-for-loaded-chunks.patch @@ -65,10 +65,10 @@ index 927abc78e973e6f0f87e12303409fd808b3cf6ab..6688b1340e2cc8fb13a7e80c9b7c37b8 } diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index f1d072a39cc2f0f7b214e7794f8dc5dcc282d6b3..0c23fc89d7ad980aa8b094784e88e2d91fb4f07b 100644 +index b9685abed74fd1fb239b0940751fde65cceb6f57..d8eb8a59da36215334582ae73822e1fd4a5b2df1 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java -@@ -265,6 +265,14 @@ public abstract class World implements GeneratorAccess, AutoCloseable { +@@ -266,6 +266,14 @@ public abstract class World implements GeneratorAccess, AutoCloseable { @Override public Chunk getChunkAt(int i, int j) { diff --git a/Spigot-Server-Patches/0435-Optimise-random-block-ticking.patch b/Spigot-Server-Patches/0435-Optimise-random-block-ticking.patch index 4348e8daab..7f2855fb5d 100644 --- a/Spigot-Server-Patches/0435-Optimise-random-block-ticking.patch +++ b/Spigot-Server-Patches/0435-Optimise-random-block-ticking.patch @@ -338,10 +338,10 @@ index 321eae23c575528788b1b575f17593580d6ba737..b19bbbbc81376177751396a2de9452ce public final SoundEffectType getStepSound() { return this.r(); } // Paper - OBFHELPER diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 0c23fc89d7ad980aa8b094784e88e2d91fb4f07b..de9f49b884838105c537b73d69234eb26fddb708 100644 +index d8eb8a59da36215334582ae73822e1fd4a5b2df1..ac8b21e69b198612427a81a16fc1a3ff0b0cb558 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java -@@ -1563,10 +1563,19 @@ public abstract class World implements GeneratorAccess, AutoCloseable { +@@ -1564,10 +1564,19 @@ public abstract class World implements GeneratorAccess, AutoCloseable { public abstract TagRegistry t(); public BlockPosition a(int i, int j, int k, int l) { @@ -363,7 +363,7 @@ index 0c23fc89d7ad980aa8b094784e88e2d91fb4f07b..de9f49b884838105c537b73d69234eb2 public boolean isSavingDisabled() { diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index 0d6abbab237916df4f7d7d79f2f4725018d8edf9..cb2ae8eff36f46b6963ee45d7740ac48afac1ab0 100644 +index 1f28e24f4f056c1f72293a3004c6dbdb8f8d1f9e..5519fb529dd8e1f93aab79dbc434715e08edb94f 100644 --- a/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java @@ -531,7 +531,12 @@ public class WorldServer extends World { diff --git a/Spigot-Server-Patches/0467-Improved-Watchdog-Support.patch b/Spigot-Server-Patches/0467-Improved-Watchdog-Support.patch index 05bfedbd0c..615bcecdf7 100644 --- a/Spigot-Server-Patches/0467-Improved-Watchdog-Support.patch +++ b/Spigot-Server-Patches/0467-Improved-Watchdog-Support.patch @@ -236,10 +236,10 @@ index 47dbcb70a6b41438a5bf3196495cfdaf02bd2b74..0d12c3657304ccf7ab25a2614c380ee7 SystemUtils.c.shutdown(); diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index de9f49b884838105c537b73d69234eb26fddb708..c8619af2cf43041e3eebec74e24c7f127a662efe 100644 +index ac8b21e69b198612427a81a16fc1a3ff0b0cb558..42be4edb36200626913fa99b1e67956933022531 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java -@@ -792,6 +792,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { +@@ -793,6 +793,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { gameprofilerfiller.exit(); } catch (Throwable throwable) { @@ -247,7 +247,7 @@ index de9f49b884838105c537b73d69234eb26fddb708..c8619af2cf43041e3eebec74e24c7f12 // Paper start - Prevent tile entity and entity crashes String msg = "TileEntity threw exception at " + tileentity.world.getWorld().getName() + ":" + tileentity.position.getX() + "," + tileentity.position.getY() + "," + tileentity.position.getZ(); System.err.println(msg); -@@ -867,6 +868,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { +@@ -868,6 +869,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { try { consumer.accept(entity); } catch (Throwable throwable) { diff --git a/Spigot-Server-Patches/0477-Optimise-entity-hard-collision-checking.patch b/Spigot-Server-Patches/0477-Optimise-entity-hard-collision-checking.patch index 757dc5573f..2596e3deda 100644 --- a/Spigot-Server-Patches/0477-Optimise-entity-hard-collision-checking.patch +++ b/Spigot-Server-Patches/0477-Optimise-entity-hard-collision-checking.patch @@ -178,10 +178,10 @@ index 4157e50e4d99c029759bffcb48a8d645487554c8..5135308fb6137a34ed6fd061f0a210de return stream.filter(axisalignedbb1::c).map(VoxelShapes::a); diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index c8619af2cf43041e3eebec74e24c7f127a662efe..899c535c4056cd2375ab8f834f03267d405f4bda 100644 +index 42be4edb36200626913fa99b1e67956933022531..4dc03c27bba5cd2dd1d6cb2e82087ef834f41d81 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java -@@ -1178,6 +1178,32 @@ public abstract class World implements GeneratorAccess, AutoCloseable { +@@ -1179,6 +1179,32 @@ public abstract class World implements GeneratorAccess, AutoCloseable { return this.getChunkAt(i, j, ChunkStatus.FULL, false); } diff --git a/Spigot-Server-Patches/0505-No-Tick-view-distance-implementation.patch b/Spigot-Server-Patches/0505-No-Tick-view-distance-implementation.patch index cb9207ae60..9f3f02c615 100644 --- a/Spigot-Server-Patches/0505-No-Tick-view-distance-implementation.patch +++ b/Spigot-Server-Patches/0505-No-Tick-view-distance-implementation.patch @@ -570,10 +570,10 @@ index 60af90bf8c376ab8ab61b16ae38886149faa88cc..9b726de6daeba42120f3a948fbdcf080 while (iterator.hasNext()) { diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 899c535c4056cd2375ab8f834f03267d405f4bda..0e6368d0fb3beccb492ae3867fb4e22825f928a2 100644 +index 4dc03c27bba5cd2dd1d6cb2e82087ef834f41d81..e82b8b9a4dbc9a595df7d8e56596a93fde7b687a 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java -@@ -443,8 +443,13 @@ public abstract class World implements GeneratorAccess, AutoCloseable { +@@ -444,8 +444,13 @@ public abstract class World implements GeneratorAccess, AutoCloseable { this.b(blockposition, iblockdata1, iblockdata2); } diff --git a/Spigot-Server-Patches/0521-Protect-Bedrock-and-End-Portal-Frames-from-being-des.patch b/Spigot-Server-Patches/0521-Protect-Bedrock-and-End-Portal-Frames-from-being-des.patch index c3752e05e9..cbe1ba1594 100644 --- a/Spigot-Server-Patches/0521-Protect-Bedrock-and-End-Portal-Frames-from-being-des.patch +++ b/Spigot-Server-Patches/0521-Protect-Bedrock-and-End-Portal-Frames-from-being-des.patch @@ -101,10 +101,10 @@ index b19bbbbc81376177751396a2de9452ce1f84c06b..296b41bf36ee1ace5bd9db2b810bf926 public Material getMaterial() { return this.getBlock().k(this); diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 0e6368d0fb3beccb492ae3867fb4e22825f928a2..508a3ed1ed041c21f5ec1fd18dfb01311e5310bf 100644 +index e82b8b9a4dbc9a595df7d8e56596a93fde7b687a..561b42472261a973fea6344d76ca7ea1993aee27 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java -@@ -341,6 +341,10 @@ public abstract class World implements GeneratorAccess, AutoCloseable { +@@ -342,6 +342,10 @@ public abstract class World implements GeneratorAccess, AutoCloseable { public boolean setTypeAndData(BlockPosition blockposition, IBlockData iblockdata, int i) { // CraftBukkit start - tree generation if (this.captureTreeGeneration) { diff --git a/Spigot-Server-Patches/0531-Optimize-sending-packets-to-nearby-locations-sounds-.patch b/Spigot-Server-Patches/0531-Optimize-sending-packets-to-nearby-locations-sounds-.patch index fe9acb9b60..c1ce8f0f55 100644 --- a/Spigot-Server-Patches/0531-Optimize-sending-packets-to-nearby-locations-sounds-.patch +++ b/Spigot-Server-Patches/0531-Optimize-sending-packets-to-nearby-locations-sounds-.patch @@ -11,10 +11,10 @@ This will drastically cut down on packet sending cost for worlds with lots of players in them. diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java -index 9b726de6daeba42120f3a948fbdcf080d0e72917..cc5d75049d3553e0b01068e4e0c5677fe81f8387 100644 +index 9b726de6daeba42120f3a948fbdcf080d0e72917..269580ae2a6edca979ccc1e46df144468ea70a18 100644 --- a/src/main/java/net/minecraft/server/PlayerList.java +++ b/src/main/java/net/minecraft/server/PlayerList.java -@@ -1027,11 +1027,22 @@ public abstract class PlayerList { +@@ -1027,11 +1027,27 @@ public abstract class PlayerList { world = (WorldServer) entityhuman.world; } @@ -31,7 +31,12 @@ index 9b726de6daeba42120f3a948fbdcf080d0e72917..cc5d75049d3553e0b01068e4e0c5677f + LOGGER.error("Sending packet to invalid world" + entityhuman + " " + dimensionmanager + " - " + packet.getClass().getName(), new Throwable()); + return; // ??? shouldn't happen... + } -+ com.destroystokyo.paper.util.misc.PooledLinkedHashSets.PooledObjectLinkedOpenHashSet nearbyPlayers = world.getChunkProvider().playerChunkMap.playerViewDistanceBroadcastMap.getObjectsInRange(MCUtil.fastFloor(d0) >> 4, MCUtil.fastFloor(d2) >> 4); ++ ChunkProviderServer chunkProvider = (ChunkProviderServer) world.chunkProvider; ++ if (chunkProvider == null) { ++ // ??? Shouldn't be possible but seem some hacky plugins apparently do hack things. ++ return; ++ } ++ com.destroystokyo.paper.util.misc.PooledLinkedHashSets.PooledObjectLinkedOpenHashSet nearbyPlayers = chunkProvider.playerChunkMap.playerViewDistanceBroadcastMap.getObjectsInRange(MCUtil.fastFloor(d0) >> 4, MCUtil.fastFloor(d2) >> 4); + if (nearbyPlayers == null) { + return; + }