diff --git a/patches/unapplied/server/0769-Use-Velocity-compression-and-cipher-natives.patch b/patches/server/0761-Use-Velocity-compression-and-cipher-natives.patch similarity index 96% rename from patches/unapplied/server/0769-Use-Velocity-compression-and-cipher-natives.patch rename to patches/server/0761-Use-Velocity-compression-and-cipher-natives.patch index 6d5ea4a511..94e1ccf61f 100644 --- a/patches/unapplied/server/0769-Use-Velocity-compression-and-cipher-natives.patch +++ b/patches/server/0761-Use-Velocity-compression-and-cipher-natives.patch @@ -5,11 +5,11 @@ Subject: [PATCH] Use Velocity compression and cipher natives diff --git a/build.gradle.kts b/build.gradle.kts -index 6b46f9c94dc051579ca5b51755caad19505e874a..4715d1386afd939628c392a7d8062e5887d7a507 100644 +index 8c597c2671746ecf89d53704fba4d85d61dc316c..a7c7d450f22f9642fadeac9cb601214cfa9a2b02 100644 --- a/build.gradle.kts +++ b/build.gradle.kts -@@ -35,6 +35,11 @@ dependencies { - runtimeOnly("org.apache.maven.resolver:maven-resolver-transport-http:1.7.2") +@@ -36,6 +36,11 @@ dependencies { + runtimeOnly("org.apache.maven.resolver:maven-resolver-transport-http:1.7.3") implementation("net.fabricmc:mapping-io:0.3.0") // Paper - needed to read mappings for stacktrace deobfuscation + // Paper start - Use Velocity cipher @@ -268,10 +268,10 @@ index 792883afe53d2b7989c25a81c2f9a639d5e21d20..c04379ca8a4db0f4de46ad2b3b338431 return this.threshold; } diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java/net/minecraft/network/Connection.java -index d3a25cc5262843b5c9736ff32e300264d9847c9b..42400b6f0b693dd0ec4a2303a82bd131753a24ba 100644 +index 1e4b75ab79a1d63a82498907d72932d644552635..7030c38980dbebfd374c2369294555650cf7880b 100644 --- a/src/main/java/net/minecraft/network/Connection.java +++ b/src/main/java/net/minecraft/network/Connection.java -@@ -640,11 +640,28 @@ public class Connection extends SimpleChannelInboundHandler> { +@@ -642,11 +642,28 @@ public class Connection extends SimpleChannelInboundHandler> { return networkmanager; } @@ -304,7 +304,7 @@ index d3a25cc5262843b5c9736ff32e300264d9847c9b..42400b6f0b693dd0ec4a2303a82bd131 public boolean isEncrypted() { return this.encrypted; -@@ -673,16 +690,17 @@ public class Connection extends SimpleChannelInboundHandler> { +@@ -675,16 +692,17 @@ public class Connection extends SimpleChannelInboundHandler> { public void setupCompression(int compressionThreshold, boolean rejectsBadPackets) { if (compressionThreshold >= 0) { @@ -325,10 +325,10 @@ index d3a25cc5262843b5c9736ff32e300264d9847c9b..42400b6f0b693dd0ec4a2303a82bd131 } else { if (this.channel.pipeline().get("decompress") instanceof CompressionDecoder) { diff --git a/src/main/java/net/minecraft/server/network/ServerConnectionListener.java b/src/main/java/net/minecraft/server/network/ServerConnectionListener.java -index bfa519b9335c960a5baec50b0da95d95cd5ee958..af4d9244102bd0ac204f44a8de7f3a7706e3692d 100644 +index 9e7154c9df96d5a0577886d43a98a73626a8f189..af3e70920221b6bd127bb3aed7f1e0a7e9e4c322 100644 --- a/src/main/java/net/minecraft/server/network/ServerConnectionListener.java +++ b/src/main/java/net/minecraft/server/network/ServerConnectionListener.java -@@ -104,6 +104,11 @@ public class ServerConnectionListener { +@@ -105,6 +105,11 @@ public class ServerConnectionListener { ServerConnectionListener.LOGGER.info("Using default channel type"); } @@ -341,10 +341,10 @@ index bfa519b9335c960a5baec50b0da95d95cd5ee958..af4d9244102bd0ac204f44a8de7f3a77 protected void initChannel(Channel channel) { try { diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java -index 4e23e9ac3579dd0cedf0dfdbb231f6fae111745c..4cd92875d60c2f1dcce67ac99e9ba257a10f87b1 100644 +index ffbd711375c400c9faaa4c984463a24af2f4993f..b146fc81ebd4adb8c15b10ed05c92db202a2c89e 100644 --- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java -@@ -279,12 +279,14 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener +@@ -339,12 +339,14 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener } SecretKey secretkey = packet.getSecretKey(privatekey); diff --git a/patches/unapplied/server/0770-Reduce-worldgen-thread-worker-count-for-low-core-cou.patch b/patches/server/0762-Reduce-worldgen-thread-worker-count-for-low-core-cou.patch similarity index 90% rename from patches/unapplied/server/0770-Reduce-worldgen-thread-worker-count-for-low-core-cou.patch rename to patches/server/0762-Reduce-worldgen-thread-worker-count-for-low-core-cou.patch index 5b7dedcdeb..7291e1cb36 100644 --- a/patches/unapplied/server/0770-Reduce-worldgen-thread-worker-count-for-low-core-cou.patch +++ b/patches/server/0762-Reduce-worldgen-thread-worker-count-for-low-core-cou.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Reduce worldgen thread worker count for low core count CPUs diff --git a/src/main/java/net/minecraft/Util.java b/src/main/java/net/minecraft/Util.java -index da55a78b28b463f737464ebc818e918425903571..ab524d5bd579ad56fd6fc7808e9060953a1c21c3 100644 +index 206c6ce227ba19620185ac835af28d67caa76c40..e8f5f87962cd3dbd383096fc4df9c3f0d5399211 100644 --- a/src/main/java/net/minecraft/Util.java +++ b/src/main/java/net/minecraft/Util.java -@@ -130,7 +130,19 @@ public class Util { +@@ -140,7 +140,19 @@ public class Util { private static ExecutorService makeExecutor(String s, int priorityModifier) { // Paper - add priority // Paper start - use simpler thread pool that allows 1 thread diff --git a/patches/unapplied/server/0771-Do-not-process-entity-loads-in-CraftChunk-getEntitie.patch b/patches/server/0763-Do-not-process-entity-loads-in-CraftChunk-getEntitie.patch similarity index 95% rename from patches/unapplied/server/0771-Do-not-process-entity-loads-in-CraftChunk-getEntitie.patch rename to patches/server/0763-Do-not-process-entity-loads-in-CraftChunk-getEntitie.patch index 5c0a433617..cf30363447 100644 --- a/patches/unapplied/server/0771-Do-not-process-entity-loads-in-CraftChunk-getEntitie.patch +++ b/patches/server/0763-Do-not-process-entity-loads-in-CraftChunk-getEntitie.patch @@ -16,10 +16,10 @@ of a chance that we're about to eat a dirtload of chunk load callbacks, thus making this issue much more of an issue diff --git a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java -index 0085a4dd0f0def1ba71342e20aecdd46a3761b02..0cf67d55ab30ab145ffb2ff562c26c47c2e2879e 100644 +index 4a9b20e0dae3d502738e71e0f6119bdb3e0e2f16..7fd9f20d60339270d5e4adbf098ac38a832fb224 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java -@@ -129,46 +129,6 @@ public class CraftChunk implements Chunk { +@@ -130,46 +130,6 @@ public class CraftChunk implements Chunk { this.getWorld().getChunkAt(x, z); // Transient load for this tick } diff --git a/patches/unapplied/server/0772-Async-catch-modifications-to-critical-entity-state.patch b/patches/server/0764-Async-catch-modifications-to-critical-entity-state.patch similarity index 97% rename from patches/unapplied/server/0772-Async-catch-modifications-to-critical-entity-state.patch rename to patches/server/0764-Async-catch-modifications-to-critical-entity-state.patch index 305329fc53..b1d608ada3 100644 --- a/patches/unapplied/server/0772-Async-catch-modifications-to-critical-entity-state.patch +++ b/patches/server/0764-Async-catch-modifications-to-critical-entity-state.patch @@ -8,7 +8,7 @@ Now in 1.17, this state is _even more_ critical than it was before, so these must exist to catch stupid plugins. diff --git a/src/main/java/net/minecraft/world/level/entity/PersistentEntitySectionManager.java b/src/main/java/net/minecraft/world/level/entity/PersistentEntitySectionManager.java -index db2ef605bccbb9024f787cd58f3cb93df03d5532..3d5f38a1ca0206e5bcae4ed49d3df7ce0967f722 100644 +index 90dff6b5786933577cf070fe723872041e050738..9a3364241a6f96b16644bf598fa2afd7bcd7972b 100644 --- a/src/main/java/net/minecraft/world/level/entity/PersistentEntitySectionManager.java +++ b/src/main/java/net/minecraft/world/level/entity/PersistentEntitySectionManager.java @@ -138,6 +138,7 @@ public class PersistentEntitySectionManager implements A @@ -123,7 +123,7 @@ index db2ef605bccbb9024f787cd58f3cb93df03d5532..3d5f38a1ca0206e5bcae4ed49d3df7ce PersistentEntitySectionManager.this.entitySliceManager.moveEntity((Entity)this.entity); // Paper Visibility visibility = this.currentSection.getStatus(); final Visibility oldVisibility = visibility; // Paper - diff on change - this should be OLD section visibility // Paper start -@@ -583,6 +598,7 @@ public class PersistentEntitySectionManager implements A +@@ -592,6 +607,7 @@ public class PersistentEntitySectionManager implements A @Override public void onRemove(Entity.RemovalReason reason) { diff --git a/patches/unapplied/server/0773-Fix-Bukkit-NamespacedKey-shenanigans.patch b/patches/server/0765-Fix-Bukkit-NamespacedKey-shenanigans.patch similarity index 73% rename from patches/unapplied/server/0773-Fix-Bukkit-NamespacedKey-shenanigans.patch rename to patches/server/0765-Fix-Bukkit-NamespacedKey-shenanigans.patch index 8f152dd0e7..283d481666 100644 --- a/patches/unapplied/server/0773-Fix-Bukkit-NamespacedKey-shenanigans.patch +++ b/patches/server/0765-Fix-Bukkit-NamespacedKey-shenanigans.patch @@ -4,16 +4,16 @@ Date: Sun, 24 Oct 2021 15:49:35 +0200 Subject: [PATCH] Fix Bukkit NamespacedKey shenanigans -diff --git a/src/main/java/com/destroystokyo/paper/loottable/PaperMinecartLootableInventory.java b/src/main/java/com/destroystokyo/paper/loottable/PaperMinecartLootableInventory.java -index 6d2e0493729b7b4e109ff103a6ac36c9901568c0..83dd3c254fd10e4596e454cc75c8e5e976b73ac0 100644 ---- a/src/main/java/com/destroystokyo/paper/loottable/PaperMinecartLootableInventory.java -+++ b/src/main/java/com/destroystokyo/paper/loottable/PaperMinecartLootableInventory.java -@@ -16,7 +16,7 @@ public class PaperMinecartLootableInventory implements PaperLootableEntityInvent +diff --git a/src/main/java/com/destroystokyo/paper/loottable/PaperContainerEntityLootableInventory.java b/src/main/java/com/destroystokyo/paper/loottable/PaperContainerEntityLootableInventory.java +index 88e32ed64f90bfd277dac84ba4bd84f0d943f5f8..d4a8c1bbb8fef27ac42bdf27dde495b4c649e6cb 100644 +--- a/src/main/java/com/destroystokyo/paper/loottable/PaperContainerEntityLootableInventory.java ++++ b/src/main/java/com/destroystokyo/paper/loottable/PaperContainerEntityLootableInventory.java +@@ -17,7 +17,7 @@ public class PaperContainerEntityLootableInventory implements PaperLootableEntit @Override public org.bukkit.loot.LootTable getLootTable() { -- return entity.lootTable != null ? Bukkit.getLootTable(CraftNamespacedKey.fromMinecraft(entity.lootTable)) : null; -+ return entity.lootTable != null && !entity.lootTable.getPath().isEmpty() ? Bukkit.getLootTable(CraftNamespacedKey.fromMinecraft(entity.lootTable)) : null; +- return entity.getLootTable() != null ? Bukkit.getLootTable(CraftNamespacedKey.fromMinecraft(entity.getLootTable())) : null; ++ return entity.getLootTable() != null && !entity.getLootTable().getPath().isEmpty() ? Bukkit.getLootTable(CraftNamespacedKey.fromMinecraft(entity.getLootTable())) : null; } @Override diff --git a/patches/unapplied/server/0774-Fix-merchant-inventory-not-closing-on-entity-removal.patch b/patches/server/0766-Fix-merchant-inventory-not-closing-on-entity-removal.patch similarity index 90% rename from patches/unapplied/server/0774-Fix-merchant-inventory-not-closing-on-entity-removal.patch rename to patches/server/0766-Fix-merchant-inventory-not-closing-on-entity-removal.patch index 68a4c86bc0..b9b239ff61 100644 --- a/patches/unapplied/server/0774-Fix-merchant-inventory-not-closing-on-entity-removal.patch +++ b/patches/server/0766-Fix-merchant-inventory-not-closing-on-entity-removal.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Fix merchant inventory not closing on entity removal diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 7922ecc1bfeb2d00a7a1bce0431efec4f8c57eec..4c9832ccede082a468e97870b5f6b07bbed652f3 100644 +index d5585e1723eebce14c47c4a92ce339915cd936db..fb5c42755703ade855ab727c55c8d72456b59141 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -2491,6 +2491,11 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -2569,6 +2569,11 @@ public class ServerLevel extends Level implements WorldGenLevel { // Spigot end // Spigot Start if (entity.getBukkitEntity() instanceof org.bukkit.inventory.InventoryHolder && (!(entity instanceof ServerPlayer) || entity.getRemovalReason() != Entity.RemovalReason.KILLED)) { // SPIGOT-6876: closeInventory clears death message diff --git a/patches/unapplied/server/0775-Check-requirement-before-suggesting-root-nodes.patch b/patches/server/0767-Check-requirement-before-suggesting-root-nodes.patch similarity index 100% rename from patches/unapplied/server/0775-Check-requirement-before-suggesting-root-nodes.patch rename to patches/server/0767-Check-requirement-before-suggesting-root-nodes.patch diff --git a/patches/unapplied/server/0776-Don-t-respond-to-ServerboundCommandSuggestionPacket-.patch b/patches/server/0768-Don-t-respond-to-ServerboundCommandSuggestionPacket-.patch similarity index 86% rename from patches/unapplied/server/0776-Don-t-respond-to-ServerboundCommandSuggestionPacket-.patch rename to patches/server/0768-Don-t-respond-to-ServerboundCommandSuggestionPacket-.patch index cbcf450be8..cd37a8fd84 100644 --- a/patches/unapplied/server/0776-Don-t-respond-to-ServerboundCommandSuggestionPacket-.patch +++ b/patches/server/0768-Don-t-respond-to-ServerboundCommandSuggestionPacket-.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Don't respond to ServerboundCommandSuggestionPacket when diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index eeb21a890480f5cae2a25a4af215bd56778b83e5..6d1e3104750b23e9d4b0ddea35e1241f8434a1ac 100644 +index 8ceae524899d6aa739f358b8c88968fb4df56481..9c7d1ce759e119b21e942add5e42ad203226d72b 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -770,6 +770,11 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -801,6 +801,11 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser } // Paper end // CraftBukkit end diff --git a/patches/unapplied/server/0777-Fix-setPatternColor-on-tropical-fish-bucket-meta.patch b/patches/server/0769-Fix-setPatternColor-on-tropical-fish-bucket-meta.patch similarity index 100% rename from patches/unapplied/server/0777-Fix-setPatternColor-on-tropical-fish-bucket-meta.patch rename to patches/server/0769-Fix-setPatternColor-on-tropical-fish-bucket-meta.patch diff --git a/patches/unapplied/server/0778-Ensure-valid-vehicle-status.patch b/patches/server/0770-Ensure-valid-vehicle-status.patch similarity index 84% rename from patches/unapplied/server/0778-Ensure-valid-vehicle-status.patch rename to patches/server/0770-Ensure-valid-vehicle-status.patch index b350b5122a..e6645e4390 100644 --- a/patches/unapplied/server/0778-Ensure-valid-vehicle-status.patch +++ b/patches/server/0770-Ensure-valid-vehicle-status.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Ensure valid vehicle status diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 6f55fa61f4c3291413aab076a46cec2cc103dac5..6b9622c41966843411184493f42b3d4005be533e 100644 +index 866e4aa0080363976861fcbfe6aedc380bbc5e53..0a4934cabf5d04b0561d33f5e777f38b2e721608 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java -@@ -504,7 +504,7 @@ public class ServerPlayer extends Player { +@@ -511,7 +511,7 @@ public class ServerPlayer extends Player { } } diff --git a/patches/unapplied/server/0779-Prevent-softlocked-end-exit-portal-generation.patch b/patches/server/0771-Prevent-softlocked-end-exit-portal-generation.patch similarity index 79% rename from patches/unapplied/server/0779-Prevent-softlocked-end-exit-portal-generation.patch rename to patches/server/0771-Prevent-softlocked-end-exit-portal-generation.patch index 855c2ec833..6f764a27ec 100644 --- a/patches/unapplied/server/0779-Prevent-softlocked-end-exit-portal-generation.patch +++ b/patches/server/0771-Prevent-softlocked-end-exit-portal-generation.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Prevent softlocked end exit portal generation diff --git a/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java b/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java -index 7dbe0bc8082c8e7741f40bbd69bc7d7407945754..ed6ff35a2112cea4faa6e1458d1effc40fce5dd2 100644 +index ad5b20fb16b19bb2099c2fd840e8f5c20f345577..d0c864277886d67362d5389e71095020f69abfc3 100644 --- a/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java +++ b/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java -@@ -412,6 +412,11 @@ public class EndDragonFight { +@@ -413,6 +413,11 @@ public class EndDragonFight { } } @@ -17,6 +17,6 @@ index 7dbe0bc8082c8e7741f40bbd69bc7d7407945754..ed6ff35a2112cea4faa6e1458d1effc4 + this.portalLocation = this.portalLocation.atY(this.level.getMinBuildHeight() + 1); + } + // Paper end - endPodiumFeature.place(FeatureConfiguration.NONE, this.level, this.level.getChunkSource().getGenerator(), new Random(), this.portalLocation); + endPodiumFeature.place(FeatureConfiguration.NONE, this.level, this.level.getChunkSource().getGenerator(), RandomSource.create(), this.portalLocation); } diff --git a/patches/unapplied/server/0780-Fix-CocaoDecorator-causing-a-crash-when-trying-to-ge.patch b/patches/server/0772-Fix-CocaoDecorator-causing-a-crash-when-trying-to-ge.patch similarity index 54% rename from patches/unapplied/server/0780-Fix-CocaoDecorator-causing-a-crash-when-trying-to-ge.patch rename to patches/server/0772-Fix-CocaoDecorator-causing-a-crash-when-trying-to-ge.patch index 2ce994e362..b415f668ab 100644 --- a/patches/unapplied/server/0780-Fix-CocaoDecorator-causing-a-crash-when-trying-to-ge.patch +++ b/patches/server/0772-Fix-CocaoDecorator-causing-a-crash-when-trying-to-ge.patch @@ -6,14 +6,14 @@ Subject: [PATCH] Fix CocaoDecorator causing a crash when trying to generate diff --git a/src/main/java/net/minecraft/world/level/levelgen/feature/treedecorators/CocoaDecorator.java b/src/main/java/net/minecraft/world/level/levelgen/feature/treedecorators/CocoaDecorator.java -index c1d220726ca0877fb526e710ae07329b4705a8e5..4474586d199a12f1311ee3ad307b342f4be3690e 100644 +index 42b4b306ee89a9e422d234bdaa9b43b118f8bd0a..0fc355bd847749f7ce716b283dd571f143824795 100644 --- a/src/main/java/net/minecraft/world/level/levelgen/feature/treedecorators/CocoaDecorator.java +++ b/src/main/java/net/minecraft/world/level/levelgen/feature/treedecorators/CocoaDecorator.java -@@ -29,6 +29,7 @@ public class CocoaDecorator extends TreeDecorator { +@@ -25,6 +25,7 @@ public class CocoaDecorator extends TreeDecorator { @Override - public void place(LevelSimulatedReader world, BiConsumer replacer, Random random, List logPositions, List leavesPositions) { -+ if (logPositions.isEmpty()) return; // Paper - if (!(random.nextFloat() >= this.probability)) { - int i = logPositions.get(0).getY(); - logPositions.stream().filter((pos) -> { + public void place(TreeDecorator.Context generator) { ++ if (generator.logs().isEmpty()) return; // Paper + RandomSource randomSource = generator.random(); + if (!(randomSource.nextFloat() >= this.probability)) { + List list = generator.logs(); diff --git a/patches/unapplied/server/0781-Don-t-log-debug-logging-being-disabled.patch b/patches/server/0773-Don-t-log-debug-logging-being-disabled.patch similarity index 100% rename from patches/unapplied/server/0781-Don-t-log-debug-logging-being-disabled.patch rename to patches/server/0773-Don-t-log-debug-logging-being-disabled.patch diff --git a/patches/unapplied/server/0782-fix-various-menus-with-empty-level-accesses.patch b/patches/server/0774-fix-various-menus-with-empty-level-accesses.patch similarity index 100% rename from patches/unapplied/server/0782-fix-various-menus-with-empty-level-accesses.patch rename to patches/server/0774-fix-various-menus-with-empty-level-accesses.patch diff --git a/patches/unapplied/server/0783-Do-not-overload-I-O-threads-with-chunk-data-while-fl.patch b/patches/server/0775-Do-not-overload-I-O-threads-with-chunk-data-while-fl.patch similarity index 90% rename from patches/unapplied/server/0783-Do-not-overload-I-O-threads-with-chunk-data-while-fl.patch rename to patches/server/0775-Do-not-overload-I-O-threads-with-chunk-data-while-fl.patch index 6e988a6c7e..2ef119c552 100644 --- a/patches/unapplied/server/0783-Do-not-overload-I-O-threads-with-chunk-data-while-fl.patch +++ b/patches/server/0775-Do-not-overload-I-O-threads-with-chunk-data-while-fl.patch @@ -12,10 +12,10 @@ time to save, as flush saving performs a full flush at the end anyways. diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index a578ff8a88ef944516150303e96f8b49bc797f64..9999f9743184ba929635d625c60836c046ededd4 100644 +index 3dd3ed91e702858f07c811afdcfa6c111f9e3d61..85c0d3f07b4ede0864f6ab54ad9392b4708330cb 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java -@@ -928,6 +928,16 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -944,6 +944,16 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider // Paper end protected void saveAllChunks(boolean flush) { @@ -32,7 +32,7 @@ index a578ff8a88ef944516150303e96f8b49bc797f64..9999f9743184ba929635d625c60836c0 if (flush) { List list = (List) this.updatingChunks.getVisibleValuesCopy().stream().filter(ChunkHolder::wasAccessibleSinceLastSave).peek(ChunkHolder::refreshAccessibility).collect(Collectors.toList()); // Paper MutableBoolean mutableboolean = new MutableBoolean(); -@@ -950,6 +960,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -966,6 +976,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider }).filter((ichunkaccess) -> { return ichunkaccess instanceof ImposterProtoChunk || ichunkaccess instanceof LevelChunk; }).filter(this::save).forEach((ichunkaccess) -> { diff --git a/patches/unapplied/server/0784-Preserve-overstacked-loot.patch b/patches/server/0776-Preserve-overstacked-loot.patch similarity index 94% rename from patches/unapplied/server/0784-Preserve-overstacked-loot.patch rename to patches/server/0776-Preserve-overstacked-loot.patch index ff9e2c9e41..9f560636ac 100644 --- a/patches/unapplied/server/0784-Preserve-overstacked-loot.patch +++ b/patches/server/0776-Preserve-overstacked-loot.patch @@ -26,10 +26,10 @@ index a3e25ebe096a687de0b63f9618c49198ebea2074..98bcdc50770d9ebd5a07b20f872cfc7e private com.google.common.collect.Table behaviorTickRates; private void tickRates() { diff --git a/src/main/java/net/minecraft/world/level/storage/loot/LootTable.java b/src/main/java/net/minecraft/world/level/storage/loot/LootTable.java -index e3897785b055a859bccf6d67eb1a5157f5b54348..ca5d0bb8a8666285075e23f58b7d34ea34f3d94c 100644 +index 9459b912615c692de7d0ceb6cf5a1cd3516d438b..c115bb501e971c6479455dd68e85ebdd180b024a 100644 --- a/src/main/java/net/minecraft/world/level/storage/loot/LootTable.java +++ b/src/main/java/net/minecraft/world/level/storage/loot/LootTable.java -@@ -54,9 +54,17 @@ public class LootTable { +@@ -56,9 +56,17 @@ public class LootTable { this.compositeFunction = LootItemFunctions.compose(functions); } @@ -48,7 +48,7 @@ index e3897785b055a859bccf6d67eb1a5157f5b54348..ca5d0bb8a8666285075e23f58b7d34ea lootConsumer.accept(itemstack); } else { int i = itemstack.getCount(); -@@ -93,7 +101,7 @@ public class LootTable { +@@ -95,7 +103,7 @@ public class LootTable { } public void getRandomItems(LootContext context, Consumer lootConsumer) { @@ -56,7 +56,7 @@ index e3897785b055a859bccf6d67eb1a5157f5b54348..ca5d0bb8a8666285075e23f58b7d34ea + this.getRandomItemsRaw(context, LootTable.createStackSplitter(lootConsumer, context.getLevel())); // Paper - preserve overstacked items } - public List getRandomItems(LootContext context) { + public ObjectArrayList getRandomItems(LootContext context) { diff --git a/src/main/java/net/minecraft/world/level/storage/loot/functions/SetContainerContents.java b/src/main/java/net/minecraft/world/level/storage/loot/functions/SetContainerContents.java index 057676201aa2d19032537832849f3857425d357a..b5c6b7280a9c6964e2ad4aa9bd4517146c98e727 100644 --- a/src/main/java/net/minecraft/world/level/storage/loot/functions/SetContainerContents.java diff --git a/patches/unapplied/server/0785-Update-head-rotation-in-missing-places.patch b/patches/server/0777-Update-head-rotation-in-missing-places.patch similarity index 84% rename from patches/unapplied/server/0785-Update-head-rotation-in-missing-places.patch rename to patches/server/0777-Update-head-rotation-in-missing-places.patch index af1ce3e6a7..54eae07e97 100644 --- a/patches/unapplied/server/0785-Update-head-rotation-in-missing-places.patch +++ b/patches/server/0777-Update-head-rotation-in-missing-places.patch @@ -8,10 +8,10 @@ This is because bukkit uses a separate head rotation field for yaw. This issue only applies to players. diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index d3b78f536806246d0474a00bd482b69651455ccf..ac6e01dbf4fe30b9e8301d995392a9c6581eae7b 100644 +index 406cf22d8b8ad4f3a19ce8091c290f22be05e6bb..d5c715f436afe3adbe63cc6958318a50fbd2b87e 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -1665,6 +1665,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { +@@ -1713,6 +1713,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { this.setXRot(Mth.clamp(pitch, -90.0F, 90.0F) % 360.0F); this.yRotO = this.getYRot(); this.xRotO = this.getXRot(); @@ -19,7 +19,7 @@ index d3b78f536806246d0474a00bd482b69651455ccf..ac6e01dbf4fe30b9e8301d995392a9c6 } public void absMoveTo(double x, double y, double z) { -@@ -1703,6 +1704,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { +@@ -1751,6 +1752,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { this.setXRot(pitch); this.setOldPosAndRot(); this.reapplyPosition(); diff --git a/patches/unapplied/server/0786-prevent-unintended-light-block-manipulation.patch b/patches/server/0778-prevent-unintended-light-block-manipulation.patch similarity index 100% rename from patches/unapplied/server/0786-prevent-unintended-light-block-manipulation.patch rename to patches/server/0778-prevent-unintended-light-block-manipulation.patch diff --git a/patches/unapplied/server/0787-Fix-CraftCriteria-defaults-map.patch b/patches/server/0779-Fix-CraftCriteria-defaults-map.patch similarity index 100% rename from patches/unapplied/server/0787-Fix-CraftCriteria-defaults-map.patch rename to patches/server/0779-Fix-CraftCriteria-defaults-map.patch diff --git a/patches/unapplied/server/0788-Fix-upstreams-block-state-factories.patch b/patches/server/0780-Fix-upstreams-block-state-factories.patch similarity index 94% rename from patches/unapplied/server/0788-Fix-upstreams-block-state-factories.patch rename to patches/server/0780-Fix-upstreams-block-state-factories.patch index b5a4b68ac1..221799c0b1 100644 --- a/patches/unapplied/server/0788-Fix-upstreams-block-state-factories.patch +++ b/patches/server/0780-Fix-upstreams-block-state-factories.patch @@ -36,7 +36,7 @@ index 87c25170fbe8b0591d452612496ee1a627138de7..a2894f02ceb7c58f6eafe055e1ff47b1 private final T tileEntity; private final T snapshot; diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockStates.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockStates.java -index 93a8aeb5545c794ac425c35f8af52a443cd060ca..9a4d79973af25853c4173a1df0131830505b623b 100644 +index e609cfeaf5aa6807f57360dde9b0dccf40a23eb1..594b071cbb25d6e8f184c8558c3d1f490fe4712f 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockStates.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockStates.java @@ -19,6 +19,7 @@ import net.minecraft.world.level.block.entity.BeehiveBlockEntity; @@ -47,7 +47,7 @@ index 93a8aeb5545c794ac425c35f8af52a443cd060ca..9a4d79973af25853c4173a1df0131830 import net.minecraft.world.level.block.entity.BrewingStandBlockEntity; import net.minecraft.world.level.block.entity.CampfireBlockEntity; import net.minecraft.world.level.block.entity.ChestBlockEntity; -@@ -105,188 +106,55 @@ public final class CraftBlockStates { +@@ -108,187 +109,57 @@ public final class CraftBlockStates { private static final BlockStateFactory DEFAULT_FACTORY = new BlockStateFactory(CraftBlockState.class) { @Override public CraftBlockState createBlockState(World world, BlockPos blockPosition, net.minecraft.world.level.block.state.BlockState blockData, BlockEntity tileEntity) { @@ -81,6 +81,8 @@ index 93a8aeb5545c794ac425c35f8af52a443cd060ca..9a4d79973af25853c4173a1df0131830 - Material.DARK_OAK_WALL_SIGN, - Material.JUNGLE_SIGN, - Material.JUNGLE_WALL_SIGN, +- Material.MANGROVE_SIGN, +- Material.MANGROVE_WALL_SIGN, - Material.OAK_SIGN, - Material.OAK_WALL_SIGN, - Material.SPRUCE_SIGN, @@ -209,18 +211,12 @@ index 93a8aeb5545c794ac425c35f8af52a443cd060ca..9a4d79973af25853c4173a1df0131830 - ), CraftCampfire.class, CraftCampfire::new, CampfireBlockEntity::new - ); - -- register( -- Arrays.asList( -- Material.CHEST, -- Material.TRAPPED_CHEST -- ), CraftChest.class, CraftChest::new, ChestBlockEntity::new -- ); -- - register(Material.BARREL, CraftBarrel.class, CraftBarrel::new, BarrelBlockEntity::new); - register(Material.BEACON, CraftBeacon.class, CraftBeacon::new, BeaconBlockEntity::new); - register(Material.BELL, CraftBell.class, CraftBell::new, BellBlockEntity::new); - register(Material.BLAST_FURNACE, CraftBlastFurnace.class, CraftBlastFurnace::new, BlastFurnaceBlockEntity::new); - register(Material.BREWING_STAND, CraftBrewingStand.class, CraftBrewingStand::new, BrewingStandBlockEntity::new); +- register(Material.CHEST, CraftChest.class, CraftChest::new, ChestBlockEntity::new); - register(Material.COMPARATOR, CraftComparator.class, CraftComparator::new, ComparatorBlockEntity::new); - register(Material.CONDUIT, CraftConduit.class, CraftConduit::new, ConduitBlockEntity::new); - register(Material.DAYLIGHT_DETECTOR, CraftDaylightDetector.class, CraftDaylightDetector::new, DaylightDetectorBlockEntity::new); @@ -236,10 +232,13 @@ index 93a8aeb5545c794ac425c35f8af52a443cd060ca..9a4d79973af25853c4173a1df0131830 - register(Material.JUKEBOX, CraftJukebox.class, CraftJukebox::new, JukeboxBlockEntity::new); - register(Material.LECTERN, CraftLectern.class, CraftLectern::new, LecternBlockEntity::new); - register(Material.MOVING_PISTON, CraftMovingPiston.class, CraftMovingPiston::new, PistonMovingBlockEntity::new); +- register(Material.SCULK_CATALYST, CraftSculkCatalyst.class, CraftSculkCatalyst::new, SculkCatalystBlockEntity::new); - register(Material.SCULK_SENSOR, CraftSculkSensor.class, CraftSculkSensor::new, SculkSensorBlockEntity::new); +- register(Material.SCULK_SHRIEKER, CraftSculkShrieker.class, CraftSculkShrieker::new, SculkShriekerBlockEntity::new); - register(Material.SMOKER, CraftSmoker.class, CraftSmoker::new, SmokerBlockEntity::new); - register(Material.SPAWNER, CraftCreatureSpawner.class, CraftCreatureSpawner::new, SpawnerBlockEntity::new); - register(Material.STRUCTURE_BLOCK, CraftStructureBlock.class, CraftStructureBlock::new, StructureBlockEntity::new); +- register(Material.TRAPPED_CHEST, CraftChest.class, CraftChest::new, TrappedChestBlockEntity::new); + // Paper start - simplify + register(BlockEntityType.SIGN, CraftSign.class, CraftSign::new); + register(BlockEntityType.SKULL, CraftSkull.class, CraftSkull::new); @@ -249,13 +248,12 @@ index 93a8aeb5545c794ac425c35f8af52a443cd060ca..9a4d79973af25853c4173a1df0131830 + register(BlockEntityType.BED, CraftBed.class, CraftBed::new); + register(BlockEntityType.BEEHIVE, CraftBeehive.class, CraftBeehive::new); + register(BlockEntityType.CAMPFIRE, CraftCampfire.class, CraftCampfire::new); -+ register(BlockEntityType.CHEST, CraftChest.class, CraftChest::new); // Paper - split up chests due to different block entity types -+ register(BlockEntityType.TRAPPED_CHEST, CraftChest.class, CraftChest::new); // Paper - split up chests due to different block entity types + register(BlockEntityType.BARREL, CraftBarrel.class, CraftBarrel::new); + register(BlockEntityType.BEACON, CraftBeacon.class, CraftBeacon::new); + register(BlockEntityType.BELL, CraftBell.class, CraftBell::new); + register(BlockEntityType.BLAST_FURNACE, CraftBlastFurnace.class, CraftBlastFurnace::new); + register(BlockEntityType.BREWING_STAND, CraftBrewingStand.class, CraftBrewingStand::new); ++ register(BlockEntityType.CHEST, CraftChest.class, CraftChest::new); + register(BlockEntityType.COMPARATOR, CraftComparator.class, CraftComparator::new); + register(BlockEntityType.CONDUIT, CraftConduit.class, CraftConduit::new); + register(BlockEntityType.DAYLIGHT_DETECTOR, CraftDaylightDetector.class, CraftDaylightDetector::new); @@ -271,34 +269,37 @@ index 93a8aeb5545c794ac425c35f8af52a443cd060ca..9a4d79973af25853c4173a1df0131830 + register(BlockEntityType.JUKEBOX, CraftJukebox.class, CraftJukebox::new); + register(BlockEntityType.LECTERN, CraftLectern.class, CraftLectern::new); + register(BlockEntityType.PISTON, CraftMovingPiston.class, CraftMovingPiston::new); ++ register(BlockEntityType.SCULK_CATALYST, CraftSculkCatalyst.class, CraftSculkCatalyst::new); + register(BlockEntityType.SCULK_SENSOR, CraftSculkSensor.class, CraftSculkSensor::new); ++ register(BlockEntityType.SCULK_SHRIEKER, CraftSculkShrieker.class, CraftSculkShrieker::new); + register(BlockEntityType.SMOKER, CraftSmoker.class, CraftSmoker::new); + register(BlockEntityType.MOB_SPAWNER, CraftCreatureSpawner.class, CraftCreatureSpawner::new); + register(BlockEntityType.STRUCTURE_BLOCK, CraftStructureBlock.class, CraftStructureBlock::new); ++ register(BlockEntityType.TRAPPED_CHEST, CraftChest.class, CraftChest::new); + // Paper end } private static void register(Material blockType, BlockStateFactory factory) { -@@ -294,35 +162,45 @@ public final class CraftBlockStates { +@@ -296,30 +167,33 @@ public final class CraftBlockStates { } private static > void register( - Material blockType, +- Class blockStateType, +- BiFunction blockStateConstructor, +- BiFunction tileEntityConstructor +- ) { +- CraftBlockStates.register(Collections.singletonList(blockType), blockStateType, blockStateConstructor, tileEntityConstructor); +- } +- +- private static > void register( +- List blockTypes, + net.minecraft.world.level.block.entity.BlockEntityType blockEntityType, // Paper Class blockStateType, - BiFunction blockStateConstructor, - BiFunction tileEntityConstructor + BiFunction blockStateConstructor // Paper ) { -- CraftBlockStates.register(Collections.singletonList(blockType), blockStateType, blockStateConstructor, tileEntityConstructor); -- } -- -- private static > void register( -- List blockTypes, -- Class blockStateType, -- BiFunction blockStateConstructor, -- BiFunction tileEntityConstructor -- ) { - BlockStateFactory factory = new BlockEntityStateFactory<>(blockStateType, blockStateConstructor, tileEntityConstructor); - for (Material blockType : blockTypes) { - CraftBlockStates.register(blockType, factory); @@ -328,6 +329,8 @@ index 93a8aeb5545c794ac425c35f8af52a443cd060ca..9a4d79973af25853c4173a1df0131830 public static Class getBlockStateType(Material material) { Preconditions.checkNotNull(material, "material is null"); return CraftBlockStates.getFactory(material).blockStateType; +@@ -335,6 +209,13 @@ public final class CraftBlockStates { + return null; } + // Paper start @@ -340,7 +343,7 @@ index 93a8aeb5545c794ac425c35f8af52a443cd060ca..9a4d79973af25853c4173a1df0131830 public static BlockState getBlockState(Block block) { // Paper start return CraftBlockStates.getBlockState(block, true); -@@ -380,7 +258,7 @@ public final class CraftBlockStates { +@@ -392,7 +273,7 @@ public final class CraftBlockStates { if (world != null && tileEntity == null && CraftBlockStates.isTileEntityOptional(material)) { factory = CraftBlockStates.DEFAULT_FACTORY; } else { @@ -350,10 +353,10 @@ index 93a8aeb5545c794ac425c35f8af52a443cd060ca..9a4d79973af25853c4173a1df0131830 return factory.createBlockState(world, blockPosition, blockData, tileEntity); } diff --git a/src/test/java/org/bukkit/craftbukkit/block/BlockStateTest.java b/src/test/java/org/bukkit/craftbukkit/block/BlockStateTest.java -index 738227d8dbab8460d2bd7f75098e91bcae2d1ff3..8980163dabdd21d040bc7e622e9a22d01f73005b 100644 +index 15f760c4c71a0493c7c18c3908d229f6b8778a43..95e4a4080a4a168b53f69d9cd7d67c27263c1b7f 100644 --- a/src/test/java/org/bukkit/craftbukkit/block/BlockStateTest.java +++ b/src/test/java/org/bukkit/craftbukkit/block/BlockStateTest.java -@@ -26,4 +26,11 @@ public class BlockStateTest extends AbstractTestingBase { +@@ -45,4 +45,11 @@ public class BlockStateTest extends AbstractTestingBase { } } } diff --git a/patches/unapplied/server/0789-Add-config-option-for-logging-player-ip-addresses.patch b/patches/server/0781-Add-config-option-for-logging-player-ip-addresses.patch similarity index 86% rename from patches/unapplied/server/0789-Add-config-option-for-logging-player-ip-addresses.patch rename to patches/server/0781-Add-config-option-for-logging-player-ip-addresses.patch index 37d2285462..8c262f6c18 100644 --- a/patches/unapplied/server/0789-Add-config-option-for-logging-player-ip-addresses.patch +++ b/patches/server/0781-Add-config-option-for-logging-player-ip-addresses.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add config option for logging player ip addresses diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java -index 5203a43d707010f6ba43be2d6627d48560b77731..fa912cffb2349914d1a550d3d1c69ba5934658dc 100644 +index 4b828da7f8dbadb8af66ffc04d631273cfccdf36..a98cd0aecc034038d81194fd87c4f8df65b86095 100644 --- a/src/main/java/com/destroystokyo/paper/PaperConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java @@ -91,6 +91,11 @@ public class PaperConfig { @@ -21,7 +21,7 @@ index 5203a43d707010f6ba43be2d6627d48560b77731..fa912cffb2349914d1a550d3d1c69ba5 private static void maxJoinsPerTick() { maxJoinsPerTick = getInt("settings.max-joins-per-tick", 3); diff --git a/src/main/java/net/minecraft/network/protocol/PacketUtils.java b/src/main/java/net/minecraft/network/protocol/PacketUtils.java -index f7bb26e8b7a74a9ae5b469351b2fccc6fc80ab6a..230f5adc4df1679597f5b9aa9fcd36501efbebdd 100644 +index c8012de68b997d6270ba4a5d79bc93c09ff4354f..2c593125f74c4ffe2b8bf542311cd5525f600f4b 100644 --- a/src/main/java/net/minecraft/network/protocol/PacketUtils.java +++ b/src/main/java/net/minecraft/network/protocol/PacketUtils.java @@ -51,10 +51,11 @@ public class PacketUtils { @@ -36,7 +36,7 @@ index f7bb26e8b7a74a9ae5b469351b2fccc6fc80ab6a..230f5adc4df1679597f5b9aa9fcd3650 - LOGGER.error("Error whilst processing packet {} for connection from {}", packet, networkmanager.getRemoteAddress(), exception); + LOGGER.error("Error whilst processing packet {} for connection from {}", packet, playerIP, exception); // Paper } - net.minecraft.network.chat.TextComponent error = new net.minecraft.network.chat.TextComponent("Packet processing error"); + net.minecraft.network.chat.Component error = net.minecraft.network.chat.Component.literal("Packet processing error"); networkmanager.send(new net.minecraft.network.protocol.game.ClientboundDisconnectPacket(error), (future) -> { diff --git a/src/main/java/net/minecraft/server/network/LegacyQueryHandler.java b/src/main/java/net/minecraft/server/network/LegacyQueryHandler.java index 53e87ea23dacd123cc47bd8ca43d0f19e69acaf2..a03cb44f2296b7df60fa39879e54a5c56b22a3d5 100644 @@ -52,23 +52,23 @@ index 53e87ea23dacd123cc47bd8ca43d0f19e69acaf2..a03cb44f2296b7df60fa39879e54a5c5 InetSocketAddress virtualHost = com.destroystokyo.paper.network.PaperNetworkClient.prepareVirtualHost(host, port); com.destroystokyo.paper.event.server.PaperServerListPingEvent event = com.destroystokyo.paper.network.PaperLegacyStatusClient.processRequest( diff --git a/src/main/java/net/minecraft/server/network/ServerConnectionListener.java b/src/main/java/net/minecraft/server/network/ServerConnectionListener.java -index af4d9244102bd0ac204f44a8de7f3a7706e3692d..058fb3696c7ece4a7b6971886b1760b26add733b 100644 +index af3e70920221b6bd127bb3aed7f1e0a7e9e4c322..510a1fc4e315483809035b1e5c28b441f18a7c14 100644 --- a/src/main/java/net/minecraft/server/network/ServerConnectionListener.java +++ b/src/main/java/net/minecraft/server/network/ServerConnectionListener.java -@@ -204,7 +204,7 @@ public class ServerConnectionListener { +@@ -205,7 +205,7 @@ public class ServerConnectionListener { throw new ReportedException(CrashReport.forThrowable(exception, "Ticking memory connection")); } - ServerConnectionListener.LOGGER.warn("Failed to handle packet for {}", networkmanager.getRemoteAddress(), exception); + ServerConnectionListener.LOGGER.warn("Failed to handle packet for {}", com.destroystokyo.paper.PaperConfig.logPlayerIpAddresses ? String.valueOf(networkmanager.getRemoteAddress()) : "", exception); // Paper - TextComponent chatcomponenttext = new TextComponent("Internal server error"); + MutableComponent ichatmutablecomponent = Component.literal("Internal server error"); - networkmanager.send(new ClientboundDisconnectPacket(chatcomponenttext), (future) -> { + networkmanager.send(new ClientboundDisconnectPacket(ichatmutablecomponent), (future) -> { diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java -index 4cd92875d60c2f1dcce67ac99e9ba257a10f87b1..f5c1dff1d571e89f960f11400edbcbbea0620575 100644 +index b146fc81ebd4adb8c15b10ed05c92db202a2c89e..38521660c6fa7c1a19c5268dac05928b5ec983f4 100644 --- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java -@@ -220,7 +220,10 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener +@@ -230,7 +230,10 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener } public String getUserName() { @@ -79,12 +79,12 @@ index 4cd92875d60c2f1dcce67ac99e9ba257a10f87b1..f5c1dff1d571e89f960f11400edbcbbe + // Paper end } - @Override + @Nullable diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index 6b3ab58a4446e9ce6f91f870ef8b2511522e0da0..2aa31d8ad15100b3a25dd7da41bf17b126ba937e 100644 +index ed0e162c39f1f1ed9b02cdb2fc353a3fcbe79182..082a16f49c07faadce68fc118b2fff859da422d0 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java -@@ -238,7 +238,7 @@ public abstract class PlayerList { +@@ -240,7 +240,7 @@ public abstract class PlayerList { final String s1; if (connection.getRemoteAddress() != null) { diff --git a/patches/unapplied/server/0790-Configurable-feature-seeds.patch b/patches/server/0782-Configurable-feature-seeds.patch similarity index 95% rename from patches/unapplied/server/0790-Configurable-feature-seeds.patch rename to patches/server/0782-Configurable-feature-seeds.patch index a1a4ab8892..e0d2817cbd 100644 --- a/patches/unapplied/server/0790-Configurable-feature-seeds.patch +++ b/patches/server/0782-Configurable-feature-seeds.patch @@ -79,10 +79,10 @@ index 98bcdc50770d9ebd5a07b20f872cfc7ef78daa94..409cffcf74b32beba09b2fe800d1329e return getIntOrDefault(behaviorTickRates, typeName, entityType, def); } diff --git a/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java b/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java -index a3af8b892a01756addc8c24e0726b5a8a700cbba..d5930d8ced9566c5494bed3685cf2d536eef6d50 100644 +index 36940a873b2f891a50009fd44a2793c1940d2b05..05c8b3f54ecb4221dcbf37574240401d93e14e7a 100644 --- a/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java +++ b/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java -@@ -535,7 +535,7 @@ public abstract class ChunkGenerator implements BiomeManager.NoiseBiomeSource { +@@ -530,7 +530,7 @@ public abstract class ChunkGenerator { int j = list.size(); try { @@ -91,7 +91,7 @@ index a3af8b892a01756addc8c24e0726b5a8a700cbba..d5930d8ced9566c5494bed3685cf2d53 int k = Math.max(GenerationStep.Decoration.values().length, j); for (int l = 0; l < k; ++l) { -@@ -608,7 +608,15 @@ public abstract class ChunkGenerator implements BiomeManager.NoiseBiomeSource { +@@ -603,7 +603,15 @@ public abstract class ChunkGenerator { return (String) optional.orElseGet(placedfeature::toString); }; diff --git a/patches/unapplied/server/0791-VanillaCommandWrapper-didnt-account-for-entity-sende.patch b/patches/server/0783-VanillaCommandWrapper-didnt-account-for-entity-sende.patch similarity index 92% rename from patches/unapplied/server/0791-VanillaCommandWrapper-didnt-account-for-entity-sende.patch rename to patches/server/0783-VanillaCommandWrapper-didnt-account-for-entity-sende.patch index 6e33709dbe..54bf3f7028 100644 --- a/patches/unapplied/server/0791-VanillaCommandWrapper-didnt-account-for-entity-sende.patch +++ b/patches/server/0783-VanillaCommandWrapper-didnt-account-for-entity-sende.patch @@ -5,7 +5,7 @@ Subject: [PATCH] VanillaCommandWrapper didnt account for entity senders diff --git a/src/main/java/org/bukkit/craftbukkit/command/VanillaCommandWrapper.java b/src/main/java/org/bukkit/craftbukkit/command/VanillaCommandWrapper.java -index e9d1fb479855194da5a05e86861848158736cbb4..4aa1dc543950b5de64345b3403a6d0bc41c521df 100644 +index 8dca2ad7d25f740941187698d77819af8ebc2805..6df44aa60d2b41b95fe79ed4cf92a6d3369400ea 100644 --- a/src/main/java/org/bukkit/craftbukkit/command/VanillaCommandWrapper.java +++ b/src/main/java/org/bukkit/craftbukkit/command/VanillaCommandWrapper.java @@ -64,8 +64,10 @@ public final class VanillaCommandWrapper extends BukkitCommand { diff --git a/patches/unapplied/server/0792-Add-root-admin-user-detection.patch b/patches/server/0784-Add-root-admin-user-detection.patch similarity index 96% rename from patches/unapplied/server/0792-Add-root-admin-user-detection.patch rename to patches/server/0784-Add-root-admin-user-detection.patch index 86c355de50..8627b3890f 100644 --- a/patches/unapplied/server/0792-Add-root-admin-user-detection.patch +++ b/patches/server/0784-Add-root-admin-user-detection.patch @@ -57,10 +57,10 @@ index 0000000000000000000000000000000000000000..6bd0afddbcc461149dfe9a5c7a86fff6 + } +} diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java -index 939745227346e6d23e50f942eb48ab97c4ab6190..e28e09aae1d95d9bed50a137e999e6d457e62478 100644 +index 5cc3a55b90135f0aa97c5faaf6c1b6f4d6fe9a0e..1236c3ce776ad6bea9a3a5156e89b0e9c0b9afb5 100644 --- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java +++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java -@@ -191,6 +191,16 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface +@@ -184,6 +184,16 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface DedicatedServer.LOGGER.warn("To start the server with more ram, launch it as \"java -Xmx1024M -Xms1024M -jar minecraft_server.jar\""); } diff --git a/patches/unapplied/server/0793-Always-allow-item-changing-in-Fireball.patch b/patches/server/0785-Always-allow-item-changing-in-Fireball.patch similarity index 100% rename from patches/unapplied/server/0793-Always-allow-item-changing-in-Fireball.patch rename to patches/server/0785-Always-allow-item-changing-in-Fireball.patch diff --git a/patches/unapplied/server/0794-don-t-attempt-to-teleport-dead-entities.patch b/patches/server/0786-don-t-attempt-to-teleport-dead-entities.patch similarity index 85% rename from patches/unapplied/server/0794-don-t-attempt-to-teleport-dead-entities.patch rename to patches/server/0786-don-t-attempt-to-teleport-dead-entities.patch index 33a676d580..d4fc9f1a81 100644 --- a/patches/unapplied/server/0794-don-t-attempt-to-teleport-dead-entities.patch +++ b/patches/server/0786-don-t-attempt-to-teleport-dead-entities.patch @@ -5,10 +5,10 @@ Subject: [PATCH] don't attempt to teleport dead entities diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index ac6e01dbf4fe30b9e8301d995392a9c6581eae7b..53588a621fb922112da7c585a09ba331fa03e858 100644 +index d5c715f436afe3adbe63cc6958318a50fbd2b87e..757abf11362fa9e402dd6dd44c3bfc0ad74c5021 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -716,7 +716,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { +@@ -738,7 +738,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { // CraftBukkit start public void postTick() { // No clean way to break out of ticking once the entity has been copied to a new world, so instead we move the portalling later in the tick cycle diff --git a/patches/unapplied/server/0795-Prevent-excessive-velocity-through-repeated-crits.patch b/patches/server/0787-Prevent-excessive-velocity-through-repeated-crits.patch similarity index 90% rename from patches/unapplied/server/0795-Prevent-excessive-velocity-through-repeated-crits.patch rename to patches/server/0787-Prevent-excessive-velocity-through-repeated-crits.patch index 3be98b5047..93fa9450ba 100644 --- a/patches/unapplied/server/0795-Prevent-excessive-velocity-through-repeated-crits.patch +++ b/patches/server/0787-Prevent-excessive-velocity-through-repeated-crits.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Prevent excessive velocity through repeated crits diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index d49d9d60a839d5ac5d67a677fcbae2897e54dada..18dfc235f17510ae9eda3ffd7c04b7aa8c4aac89 100644 +index a32aa337c890eabeb400903df153aff323bc8645..abae967b466ed64c2c995130589320c8a58128d2 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java -@@ -2594,14 +2594,27 @@ public abstract class LivingEntity extends Entity { +@@ -2626,14 +2626,27 @@ public abstract class LivingEntity extends Entity { return this.hasEffect(MobEffects.JUMP) ? (double) (0.1F * (float) (this.getEffect(MobEffects.JUMP).getAmplifier() + 1)) : 0.0D; } diff --git a/patches/unapplied/server/0796-Remove-client-side-code-using-deprecated-for-removal.patch b/patches/server/0788-Remove-client-side-code-using-deprecated-for-removal.patch similarity index 90% rename from patches/unapplied/server/0796-Remove-client-side-code-using-deprecated-for-removal.patch rename to patches/server/0788-Remove-client-side-code-using-deprecated-for-removal.patch index da2436d274..a08f54ceee 100644 --- a/patches/unapplied/server/0796-Remove-client-side-code-using-deprecated-for-removal.patch +++ b/patches/server/0788-Remove-client-side-code-using-deprecated-for-removal.patch @@ -7,10 +7,10 @@ Subject: [PATCH] Remove client-side code using deprecated for removal Fixes warnings on build diff --git a/src/main/java/net/minecraft/Util.java b/src/main/java/net/minecraft/Util.java -index ab524d5bd579ad56fd6fc7808e9060953a1c21c3..f09ac28a49863c02491d38342ecd6237c0511d5c 100644 +index e8f5f87962cd3dbd383096fc4df9c3f0d5399211..c540b695282e2cca97cc4e3320d641befa19c1c6 100644 --- a/src/main/java/net/minecraft/Util.java +++ b/src/main/java/net/minecraft/Util.java -@@ -23,7 +23,6 @@ import java.net.URL; +@@ -27,7 +27,6 @@ import java.net.URL; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.spi.FileSystemProvider; @@ -18,7 +18,7 @@ index ab524d5bd579ad56fd6fc7808e9060953a1c21c3..f09ac28a49863c02491d38342ecd6237 import java.security.PrivilegedActionException; import java.security.PrivilegedExceptionAction; import java.time.Duration; -@@ -763,21 +762,7 @@ public class Util { +@@ -883,21 +882,7 @@ public class Util { } public void openUrl(URL url) { diff --git a/patches/unapplied/server/0797-Rewrite-the-light-engine.patch b/patches/server/0789-Rewrite-the-light-engine.patch similarity index 97% rename from patches/unapplied/server/0797-Rewrite-the-light-engine.patch rename to patches/server/0789-Rewrite-the-light-engine.patch index e7830ea3aa..a662eea7ff 100644 --- a/patches/unapplied/server/0797-Rewrite-the-light-engine.patch +++ b/patches/server/0789-Rewrite-the-light-engine.patch @@ -332,10 +332,10 @@ index 0000000000000000000000000000000000000000..4a04eb6449d33d3f15c354b2ac98198f +} diff --git a/src/main/java/ca/spottedleaf/starlight/common/light/SWMRNibbleArray.java b/src/main/java/ca/spottedleaf/starlight/common/light/SWMRNibbleArray.java new file mode 100644 -index 0000000000000000000000000000000000000000..5d4feec98b0d2ca014fe963daccebebb07af6394 +index 0000000000000000000000000000000000000000..4ffb4ffe01c4628d52742c5c0bbd35220eea6294 --- /dev/null +++ b/src/main/java/ca/spottedleaf/starlight/common/light/SWMRNibbleArray.java -@@ -0,0 +1,436 @@ +@@ -0,0 +1,440 @@ +package ca.spottedleaf.starlight.common.light; + +import net.minecraft.world.level.chunk.DataLayer; @@ -515,13 +515,17 @@ index 0000000000000000000000000000000000000000..5d4feec98b0d2ca014fe963daccebebb + final byte[] src = other.storageUpdating; + final byte[] into; + -+ if (this.storageUpdating != null) { -+ into = this.storageUpdating; ++ if (!this.updatingDirty) { ++ if (this.storageUpdating != null) { ++ into = this.storageUpdating = allocateBytes(); ++ } else { ++ this.storageUpdating = into = allocateBytes(); ++ this.stateUpdating = INIT_STATE_INIT; ++ } ++ this.updatingDirty = true; + } else { -+ this.storageUpdating = into = allocateBytes(); -+ this.stateUpdating = INIT_STATE_INIT; ++ into = this.storageUpdating; + } -+ this.updatingDirty = true; + + final int start = 0; + final int end = (15 | (15 << 4)) >>> 1; @@ -4104,10 +4108,10 @@ index 0000000000000000000000000000000000000000..177d0a969f3d72a34e773e8309c3719a +} diff --git a/src/main/java/ca/spottedleaf/starlight/common/util/SaveUtil.java b/src/main/java/ca/spottedleaf/starlight/common/util/SaveUtil.java new file mode 100644 -index 0000000000000000000000000000000000000000..28c946390221613a442fba90901ba6af94e38902 +index 0000000000000000000000000000000000000000..9892863af9f94ab8e378652df2a7ccfebb8c7f41 --- /dev/null +++ b/src/main/java/ca/spottedleaf/starlight/common/util/SaveUtil.java -@@ -0,0 +1,183 @@ +@@ -0,0 +1,187 @@ +package ca.spottedleaf.starlight.common.util; + +import ca.spottedleaf.starlight.common.light.SWMRNibbleArray; @@ -4126,7 +4130,11 @@ index 0000000000000000000000000000000000000000..28c946390221613a442fba90901ba6af + + private static final Logger LOGGER = LogUtils.getLogger(); + -+ private static final int STARLIGHT_LIGHT_VERSION = 6; ++ private static final int STARLIGHT_LIGHT_VERSION = 8; ++ ++ public static int getLightVersion() { ++ return STARLIGHT_LIGHT_VERSION; ++ } + + private static final String BLOCKLIGHT_STATE_TAG = "starlight.blocklight_state"; + private static final String SKYLIGHT_STATE_TAG = "starlight.skylight_state"; @@ -4249,7 +4257,7 @@ index 0000000000000000000000000000000000000000..28c946390221613a442fba90901ba6af + SWMRNibbleArray[] skyNibbles = StarLightEngine.getFilledEmptyLight(world); + + -+ // start copy from from the original method ++ // start copy from the original method + boolean lit = tag.get("isLightOn") != null && tag.getInt(STARLIGHT_VERSION_TAG) == STARLIGHT_LIGHT_VERSION; + boolean canReadSky = world.dimensionType().hasSkyLight(); + ChunkStatus status = ChunkStatus.byName(tag.getString("Status")); @@ -4419,7 +4427,7 @@ index dcda01dd8668c7ef7c63709179135deafb83eee5..5f079cf06b0d1505bfb3fda5c326b2d7 Deque queue = new ArrayDeque<>(MCUtil.getSpiralOutChunks(center, radius)); updateLight(sender, world, lightengine, queue); diff --git a/src/main/java/net/minecraft/server/level/ChunkHolder.java b/src/main/java/net/minecraft/server/level/ChunkHolder.java -index 09616415e8f11d40435dc81282b818ac9cbbdcbe..d061dc4b5de6b629d6ddcdbfe9ca652dfcec8952 100644 +index 7471e5e94b9b4a4f9100b445ca85c74875007330..100c33b8c96c9e0b20a641e31f671147c04df94e 100644 --- a/src/main/java/net/minecraft/server/level/ChunkHolder.java +++ b/src/main/java/net/minecraft/server/level/ChunkHolder.java @@ -55,7 +55,7 @@ public class ChunkHolder { @@ -4432,10 +4440,10 @@ index 09616415e8f11d40435dc81282b818ac9cbbdcbe..d061dc4b5de6b629d6ddcdbfe9ca652d private final DebugBuffer chunkToSaveHistory; public int oldTicketLevel; diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index 9999f9743184ba929635d625c60836c046ededd4..727ee42ec573fd1d008f526f49d0e63396ef0a9d 100644 +index 85c0d3f07b4ede0864f6ab54ad9392b4708330cb..6bae8378c14aa1ae35cf31f284bda2fcc61f1322 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java -@@ -133,7 +133,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -136,7 +136,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider public final LongSet entitiesInLevel; public final ServerLevel level; private final ThreadedLevelLightEngine lightEngine; @@ -4443,7 +4451,7 @@ index 9999f9743184ba929635d625c60836c046ededd4..727ee42ec573fd1d008f526f49d0e633 + public final BlockableEventLoop mainThreadExecutor; // Paper - public final java.util.concurrent.Executor mainInvokingExecutor; // Paper public ChunkGenerator generator; - public final Supplier overworldDataStorage; + private RandomState randomState; diff --git a/src/main/java/net/minecraft/server/level/DistanceManager.java b/src/main/java/net/minecraft/server/level/DistanceManager.java index ea4e46c113d3f0a5db6c891021e2e4c5eb275cd4..b22c771ca35466574d5a73f2da3fc8762cb29487 100644 --- a/src/main/java/net/minecraft/server/level/DistanceManager.java @@ -4458,7 +4466,7 @@ index ea4e46c113d3f0a5db6c891021e2e4c5eb275cd4..b22c771ca35466574d5a73f2da3fc876 while (objectiterator.hasNext()) { diff --git a/src/main/java/net/minecraft/server/level/ThreadedLevelLightEngine.java b/src/main/java/net/minecraft/server/level/ThreadedLevelLightEngine.java -index bd475554a630fb68433dd6e6640586cf5240cfed..d572d44bdc053c29b2b10f4720d4b940fc47252f 100644 +index 5539f2a7e069cbe98997b734f3b1cd498148f09b..53a4bf5815eb05bf1a4c82c08dd5a51c9ce913b8 100644 --- a/src/main/java/net/minecraft/server/level/ThreadedLevelLightEngine.java +++ b/src/main/java/net/minecraft/server/level/ThreadedLevelLightEngine.java @@ -23,6 +23,17 @@ import net.minecraft.world.level.chunk.LightChunkGetter; @@ -4712,7 +4720,7 @@ index bd475554a630fb68433dd6e6640586cf5240cfed..d572d44bdc053c29b2b10f4720d4b940 this.addTask(pos.x, pos.z, () -> { return 0; }, ThreadedLevelLightEngine.TaskType.PRE_UPDATE, Util.name(() -> { -@@ -262,6 +430,37 @@ public class ThreadedLevelLightEngine extends LevelLightEngine implements AutoCl +@@ -274,6 +442,37 @@ public class ThreadedLevelLightEngine extends LevelLightEngine implements AutoCl } public CompletableFuture lightChunk(ChunkAccess chunk, boolean excludeBlocks) { @@ -4750,7 +4758,7 @@ index bd475554a630fb68433dd6e6640586cf5240cfed..d572d44bdc053c29b2b10f4720d4b940 ChunkPos chunkPos = chunk.getPos(); // Paper start //ichunkaccess.b(false); // Don't need to disable this -@@ -304,7 +503,7 @@ public class ThreadedLevelLightEngine extends LevelLightEngine implements AutoCl +@@ -316,7 +515,7 @@ public class ThreadedLevelLightEngine extends LevelLightEngine implements AutoCl } public void tryScheduleUpdate() { @@ -4759,7 +4767,7 @@ index bd475554a630fb68433dd6e6640586cf5240cfed..d572d44bdc053c29b2b10f4720d4b940 this.taskMailbox.tell(() -> { this.runUpdate(); this.scheduled.set(false); -@@ -321,12 +520,12 @@ public class ThreadedLevelLightEngine extends LevelLightEngine implements AutoCl +@@ -333,12 +532,12 @@ public class ThreadedLevelLightEngine extends LevelLightEngine implements AutoCl if (queue.poll(pre, post)) { pre.forEach(Runnable::run); pre.clear(); @@ -4787,18 +4795,18 @@ index 41ddcf6775f99c56cf4b13b284420061e5dd6bdc..ae46429264e6a7e5c88b6b6a41a6df4d public static TicketType create(String name, Comparator argumentComparator) { return new TicketType<>(name, argumentComparator, 0L); diff --git a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java -index 471c4600c6663375eb340c190edaee330bf59ef2..d545b05cfbb14e5a15b26efe372509e498605016 100644 +index 254ac28e692cf06c3286c8f4c6edb9de412851a2..b8541b54886fc1f48b4c99cf449284ffece1a78a 100644 --- a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java +++ b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java -@@ -686,6 +686,7 @@ public abstract class BlockBehaviour { - this.isViewBlocking = blockbase_info.isViewBlocking; +@@ -700,6 +700,7 @@ public abstract class BlockBehaviour { this.hasPostProcess = blockbase_info.hasPostProcess; this.emissiveRendering = blockbase_info.emissiveRendering; + this.offsetType = (BlockBehaviour.OffsetType) blockbase_info.offsetType.apply(this.asState()); + this.conditionallyFullOpaque = this.isOpaque() & this.isTransparentOnSomeFaces(); // Paper } // Paper start - impl cached craft block data, lazy load to fix issue with loading at the wrong time private org.bukkit.craftbukkit.block.data.CraftBlockData cachedCraftBlockData; -@@ -706,6 +707,18 @@ public abstract class BlockBehaviour { +@@ -720,6 +721,18 @@ public abstract class BlockBehaviour { protected boolean isTicking; protected FluidState fluid; // Paper end @@ -4817,7 +4825,7 @@ index 471c4600c6663375eb340c190edaee330bf59ef2..d545b05cfbb14e5a15b26efe372509e4 public void initCache() { this.fluid = this.getBlock().getFluidState(this.asState()); // Paper - moved from getFluid() -@@ -714,6 +727,7 @@ public abstract class BlockBehaviour { +@@ -728,6 +741,7 @@ public abstract class BlockBehaviour { this.cache = new BlockBehaviour.BlockStateBase.Cache(this.asState()); } this.shapeExceedsCube = this.cache == null || this.cache.largeCollisionShape; // Paper - moved from actual method to here @@ -4826,10 +4834,10 @@ index 471c4600c6663375eb340c190edaee330bf59ef2..d545b05cfbb14e5a15b26efe372509e4 } diff --git a/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java b/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java -index 20b288fdef75c9994b174cb4d7d082c5e69eb26b..08433670b54c67319ce13ac3ef0f24bd3f819ea0 100644 +index bef890d2e8d883165a48a7f5b39a865198749a0b..8d7d10f620b30c35d2ef580ea914f2c62054a785 100644 --- a/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java +++ b/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java -@@ -84,6 +84,47 @@ public abstract class ChunkAccess implements BlockGetter, BiomeManager.NoiseBiom +@@ -81,6 +81,47 @@ public abstract class ChunkAccess implements BlockGetter, BiomeManager.NoiseBiom private static final org.bukkit.craftbukkit.persistence.CraftPersistentDataTypeRegistry DATA_TYPE_REGISTRY = new org.bukkit.craftbukkit.persistence.CraftPersistentDataTypeRegistry(); public org.bukkit.craftbukkit.persistence.DirtyCraftPersistentDataContainer persistentDataContainer = new org.bukkit.craftbukkit.persistence.DirtyCraftPersistentDataContainer(ChunkAccess.DATA_TYPE_REGISTRY); // CraftBukkit end @@ -4921,7 +4929,7 @@ index a9c65c8d36e5c7080133706df1363b3ce52e3370..d1b175f2bb1bc96e4f044a97b14721fe @Override public BlockState getBlockState(int x, int y, int z) { diff --git a/src/main/java/net/minecraft/world/level/chunk/ImposterProtoChunk.java b/src/main/java/net/minecraft/world/level/chunk/ImposterProtoChunk.java -index 37e7f766e0de7b47c7240c9365bb134fda26a756..cac036ac3c7abb520fbd97b9cea4fb1c275a494b 100644 +index ca46ed27fdc1eef979829d19b9e90db6d5c59e09..c37bb3125334a3a4c6c05e57289d758ffabe0558 100644 --- a/src/main/java/net/minecraft/world/level/chunk/ImposterProtoChunk.java +++ b/src/main/java/net/minecraft/world/level/chunk/ImposterProtoChunk.java @@ -31,6 +31,48 @@ public class ImposterProtoChunk extends ProtoChunk { @@ -4974,7 +4982,7 @@ index 37e7f766e0de7b47c7240c9365bb134fda26a756..cac036ac3c7abb520fbd97b9cea4fb1c super(wrapped.getPos(), UpgradeData.EMPTY, wrapped.levelHeightAccessor, wrapped.getLevel().registryAccess().registryOrThrow(Registry.BIOME_REGISTRY), wrapped.getBlendingData()); this.wrapped = wrapped; diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java -index 14f956ad7c305a4d22370d705a70f77e65861007..72b5d63127fbcd2913309f2c3c438b88728b4673 100644 +index b57e8e21d75fae24a31effedce2e3c53d9e7d66f..9cce218623a71955687817a6317ed519f3300368 100644 --- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java +++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java @@ -100,6 +100,10 @@ public class LevelChunk extends ChunkAccess { @@ -5002,10 +5010,10 @@ index 14f956ad7c305a4d22370d705a70f77e65861007..72b5d63127fbcd2913309f2c3c438b88 while (iterator.hasNext()) { diff --git a/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java b/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java -index 73d0a52e0b9bcd81caf5c8a91c3d8052ad6d1da8..a34a52c827a631336ec08d037fd662ed1a026742 100644 +index 6fb87dcdc4fab4b430a5c9003548c874e6b26734..08e1309e618377d170c446a1568c21b7bf4e5683 100644 --- a/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java +++ b/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java -@@ -186,7 +186,7 @@ public class PalettedContainer implements PaletteResize { +@@ -204,7 +204,7 @@ public class PalettedContainer implements PaletteResize, PalettedContainer return this.get(this.strategy.getIndex(x, y, z)); } @@ -5015,7 +5023,7 @@ index 73d0a52e0b9bcd81caf5c8a91c3d8052ad6d1da8..a34a52c827a631336ec08d037fd662ed return data.palette.valueFor(data.storage.get(index)); } diff --git a/src/main/java/net/minecraft/world/level/chunk/ProtoChunk.java b/src/main/java/net/minecraft/world/level/chunk/ProtoChunk.java -index d3d2bd5ea57254a4af0572d5dab460127718ce09..3cd5c346425c63e511324ad11b120e281df4a56a 100644 +index 5ce6a2b83546f4dbc3183a386f51b4bacc173744..a7231ceda4f3e96c0e0c11eee953f129dc9e4487 100644 --- a/src/main/java/net/minecraft/world/level/chunk/ProtoChunk.java +++ b/src/main/java/net/minecraft/world/level/chunk/ProtoChunk.java @@ -55,6 +55,12 @@ public class ProtoChunk extends ChunkAccess { @@ -5032,12 +5040,12 @@ index d3d2bd5ea57254a4af0572d5dab460127718ce09..3cd5c346425c63e511324ad11b120e28 this.fluidTicks = fluidTickScheduler; } diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java -index 61b26c2cb332afd7215c013fbdf144b4a023d898..54ade15cdab222e9818f2635a8a12418e78e1ce6 100644 +index be9c15fe141ede1132dbe07ba4bfcf22036ab194..3c220d833ca6bb9409bc71d6f61e61783dba236b 100644 --- a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java +++ b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java -@@ -87,6 +87,14 @@ public class ChunkSerializer { - private static final String BLOCK_TICKS_TAG = "block_ticks"; - private static final String FLUID_TICKS_TAG = "fluid_ticks"; +@@ -94,6 +94,14 @@ public class ChunkSerializer { + public static final String BLOCK_LIGHT_TAG = "BlockLight"; + public static final String SKY_LIGHT_TAG = "SkyLight"; + // Paper start - replace light engine impl + private static final int STARLIGHT_LIGHT_VERSION = 7; @@ -5050,7 +5058,7 @@ index 61b26c2cb332afd7215c013fbdf144b4a023d898..54ade15cdab222e9818f2635a8a12418 public ChunkSerializer() {} // Paper start - guard against serializing mismatching coordinates -@@ -146,13 +154,20 @@ public class ChunkSerializer { +@@ -153,13 +161,20 @@ public class ChunkSerializer { } UpgradeData chunkconverter = nbt.contains("UpgradeData", 10) ? new UpgradeData(nbt.getCompound("UpgradeData"), world) : UpgradeData.EMPTY; @@ -5069,10 +5077,10 @@ index 61b26c2cb332afd7215c013fbdf144b4a023d898..54ade15cdab222e9818f2635a8a12418 + final int maxSection = io.papermc.paper.util.WorldUtil.getMaxLightSection(world); + boolean canReadSky = world.dimensionType().hasSkyLight(); + // Paper end - - if (flag) { - tasksToExecuteOnMain.add(() -> { // Paper - delay this task since we're executing off-main -@@ -166,7 +181,7 @@ public class ChunkSerializer { + Registry iregistry = world.registryAccess().registryOrThrow(Registry.BIOME_REGISTRY); + Codec>> codec = ChunkSerializer.makeBiomeCodecRW(iregistry); // CraftBukkit - read/write + boolean flag2 = false; +@@ -167,7 +182,7 @@ public class ChunkSerializer { DataResult dataresult; for (int j = 0; j < nbttaglist.size(); ++j) { @@ -5081,69 +5089,72 @@ index 61b26c2cb332afd7215c013fbdf144b4a023d898..54ade15cdab222e9818f2635a8a12418 byte b0 = nbttagcompound1.getByte("Y"); int k = world.getSectionIndexFromSectionY(b0); -@@ -211,23 +226,29 @@ public class ChunkSerializer { - } +@@ -214,31 +229,32 @@ public class ChunkSerializer { + boolean flag3 = nbttagcompound1.contains("BlockLight", 7); + boolean flag4 = flag1 && nbttagcompound1.contains("SkyLight", 7); - if (flag) { -- if (nbttagcompound1.contains("BlockLight", 7)) { +- if (flag3 || flag4) { +- if (!flag2) { ++ // Paper start - rewrite the light engine ++ if (true || flag3 || flag4) { ++ if ((flag3 || flag4) && !flag2) { + tasksToExecuteOnMain.add(() -> { // Paper - delay this task since we're executing off-main + lightengine.retainData(chunkPos, true); + }); // Paper - delay this task since we're executing off-main + flag2 = true; + } + ++ int y = sectionData.getByte("Y"); + if (flag3) { - // Paper start - delay this task since we're executing off-main -- DataLayer blockLight = new DataLayer(nbttagcompound1.getByteArray("BlockLight")); +- DataLayer blockLight = new DataLayer(nbttagcompound1.getByteArray("BlockLight").clone()); - tasksToExecuteOnMain.add(() -> { -- lightengine.queueSectionData(LightLayer.BLOCK, SectionPos.of(chunkcoordintpair1, b0), blockLight, true); +- lightengine.queueSectionData(LightLayer.BLOCK, SectionPos.of(chunkPos, b0), blockLight, true); - }); - // Paper end - delay this task since we're executing off-main -+ // Paper start - rewrite light engine -+ int y = sectionData.getByte("Y"); -+ -+ if (sectionData.contains("BlockLight", 7)) { + // this is where our diff is + blockNibbles[y - minSection] = new ca.spottedleaf.starlight.common.light.SWMRNibbleArray(sectionData.getByteArray("BlockLight").clone(), sectionData.getInt(BLOCKLIGHT_STATE_TAG)); // clone for data safety + } else { + blockNibbles[y - minSection] = new ca.spottedleaf.starlight.common.light.SWMRNibbleArray(null, sectionData.getInt(BLOCKLIGHT_STATE_TAG)); } -- if (flag1 && nbttagcompound1.contains("SkyLight", 7)) { + if (flag4) { - // Paper start - delay this task since we're executing off-main -- DataLayer skyLight = new DataLayer(nbttagcompound1.getByteArray("SkyLight")); +- DataLayer skyLight = new DataLayer(nbttagcompound1.getByteArray("SkyLight").clone()); - tasksToExecuteOnMain.add(() -> { -- lightengine.queueSectionData(LightLayer.SKY, SectionPos.of(chunkcoordintpair1, b0), skyLight, true); +- lightengine.queueSectionData(LightLayer.SKY, SectionPos.of(chunkPos, b0), skyLight, true); - }); - // Paper end - delay this task since we're executing off-mai -+ if (canReadSky) { -+ if (sectionData.contains("SkyLight", 7)) { -+ // we store under the same key so mod programs editing nbt -+ // can still read the data, hopefully. -+ // however, for compatibility we store chunks as unlit so vanilla -+ // is forced to re-light them if it encounters our data. It's too much of a burden -+ // to try and maintain compatibility with a broken and inferior skylight management system. -+ skyNibbles[y - minSection] = new ca.spottedleaf.starlight.common.light.SWMRNibbleArray(sectionData.getByteArray("SkyLight").clone(), sectionData.getInt(SKYLIGHT_STATE_TAG)); // clone for data safety -+ } else { -+ skyNibbles[y - minSection] = new ca.spottedleaf.starlight.common.light.SWMRNibbleArray(null, sectionData.getInt(SKYLIGHT_STATE_TAG)); -+ } ++ // we store under the same key so mod programs editing nbt ++ // can still read the data, hopefully. ++ // however, for compatibility we store chunks as unlit so vanilla ++ // is forced to re-light them if it encounters our data. It's too much of a burden ++ // to try and maintain compatibility with a broken and inferior skylight management system. ++ skyNibbles[y - minSection] = new ca.spottedleaf.starlight.common.light.SWMRNibbleArray(sectionData.getByteArray("SkyLight").clone(), sectionData.getInt(SKYLIGHT_STATE_TAG)); // clone for data safety } + // Paper end - rewrite light engine } } -@@ -256,6 +277,8 @@ public class ChunkSerializer { +@@ -267,6 +283,8 @@ public class ChunkSerializer { }, chunkPos); - object = new LevelChunk(world.getLevel(), chunkPos, chunkconverter, levelchunkticks, levelchunkticks1, l, achunksection, ChunkSerializer.postLoadChunk(world, nbt), blendingdata); -+ ((LevelChunk)object).setBlockNibbles(blockNibbles); // Paper - replace light impl -+ ((LevelChunk)object).setSkyNibbles(skyNibbles); // Paper - replace light impl + object1 = new LevelChunk(world.getLevel(), chunkPos, chunkconverter, levelchunkticks, levelchunkticks1, l, achunksection, ChunkSerializer.postLoadChunk(world, nbt), blendingdata); ++ ((LevelChunk)object1).setBlockNibbles(blockNibbles); // Paper - replace light impl ++ ((LevelChunk)object1).setSkyNibbles(skyNibbles); // Paper - replace light impl } else { ProtoChunkTicks protochunkticklist = ProtoChunkTicks.load(nbt.getList("block_ticks", 10), (s) -> { return Registry.BLOCK.getOptional(ResourceLocation.tryParse(s)); -@@ -264,6 +287,8 @@ public class ChunkSerializer { +@@ -275,6 +293,8 @@ public class ChunkSerializer { return Registry.FLUID.getOptional(ResourceLocation.tryParse(s)); }, chunkPos); ProtoChunk protochunk = new ProtoChunk(chunkPos, chunkconverter, achunksection, protochunkticklist, protochunkticklist1, world, iregistry, blendingdata); + protochunk.setBlockNibbles(blockNibbles); // Paper - replace light impl + protochunk.setSkyNibbles(skyNibbles); // Paper - replace light impl - object = protochunk; + object1 = protochunk; protochunk.setInhabitedTime(l); -@@ -409,7 +434,7 @@ public class ChunkSerializer { +@@ -420,7 +440,7 @@ public class ChunkSerializer { DataLayer[] blockLight = new DataLayer[lightenginethreaded.getMaxLightSection() - lightenginethreaded.getMinLightSection()]; DataLayer[] skyLight = new DataLayer[lightenginethreaded.getMaxLightSection() - lightenginethreaded.getMinLightSection()]; @@ -5152,7 +5163,7 @@ index 61b26c2cb332afd7215c013fbdf144b4a023d898..54ade15cdab222e9818f2635a8a12418 DataLayer blockArray = lightenginethreaded.getLayerListener(LightLayer.BLOCK).getDataLayerData(SectionPos.of(chunkPos, i)); DataLayer skyArray = lightenginethreaded.getLayerListener(LightLayer.SKY).getDataLayerData(SectionPos.of(chunkPos, i)); -@@ -461,6 +486,12 @@ public class ChunkSerializer { +@@ -478,6 +498,12 @@ public class ChunkSerializer { } public static CompoundTag saveChunk(ServerLevel world, ChunkAccess chunk, @org.checkerframework.checker.nullness.qual.Nullable AsyncSaveData asyncsavedata) { // Paper end @@ -5165,7 +5176,7 @@ index 61b26c2cb332afd7215c013fbdf144b4a023d898..54ade15cdab222e9818f2635a8a12418 ChunkPos chunkcoordintpair = chunk.getPos(); CompoundTag nbttagcompound = new CompoundTag(); -@@ -511,20 +542,14 @@ public class ChunkSerializer { +@@ -528,20 +554,14 @@ public class ChunkSerializer { for (int i = lightenginethreaded.getMinLightSection(); i < lightenginethreaded.getMaxLightSection(); ++i) { int j = chunk.getSectionIndexFromSectionY(i); boolean flag1 = j >= 0 && j < achunksection.length; @@ -5193,7 +5204,7 @@ index 61b26c2cb332afd7215c013fbdf144b4a023d898..54ade15cdab222e9818f2635a8a12418 if (flag1) { LevelChunkSection chunksection = achunksection[j]; -@@ -539,13 +564,27 @@ public class ChunkSerializer { +@@ -556,13 +576,27 @@ public class ChunkSerializer { nbttagcompound1.put("biomes", (Tag) dataresult1.getOrThrow(false, logger1::error)); } @@ -5225,7 +5236,7 @@ index 61b26c2cb332afd7215c013fbdf144b4a023d898..54ade15cdab222e9818f2635a8a12418 if (!nbttagcompound1.isEmpty()) { nbttagcompound1.putByte("Y", (byte) i); -@@ -556,7 +595,8 @@ public class ChunkSerializer { +@@ -573,7 +607,8 @@ public class ChunkSerializer { nbttagcompound.put("sections", nbttaglist); if (flag) {