From a9c507310b02836e37d5d1e3ed9ba9620289fdb1 Mon Sep 17 00:00:00 2001 From: Nassim Jahnke Date: Tue, 7 Jun 2022 20:12:34 +0200 Subject: [PATCH] First server patches --- build-data/dev-imports.txt | 1 + .../server/0001-Setup-Gradle-project.patch | 4 +- .../server/0002-Remap-fixes.patch | 12 +- .../server/0003-Build-system-changes.patch | 18 +- .../server/0004-Paper-config-files.patch | 40 +-- patches/server/0005-MC-Dev-fixes.patch | 284 ++++++++++++++++ .../server/0006-CB-fixes.patch | 52 ++- .../server/0007-MC-Utils.patch | 209 ++++++------ .../server/0008-Adventure.patch | 308 +++++++++++------- .../unapplied/server/0005-MC-Dev-fixes.patch | 284 ---------------- 10 files changed, 622 insertions(+), 590 deletions(-) rename patches/{unapplied => }/server/0002-Remap-fixes.patch (94%) rename patches/{unapplied => }/server/0003-Build-system-changes.patch (86%) rename patches/{unapplied => }/server/0004-Paper-config-files.patch (93%) create mode 100644 patches/server/0005-MC-Dev-fixes.patch rename patches/{unapplied => }/server/0006-CB-fixes.patch (67%) rename patches/{unapplied => }/server/0007-MC-Utils.patch (96%) rename patches/{unapplied => }/server/0008-Adventure.patch (93%) delete mode 100644 patches/unapplied/server/0005-MC-Dev-fixes.patch diff --git a/build-data/dev-imports.txt b/build-data/dev-imports.txt index 286aeeaaa9..dfa2024f41 100644 --- a/build-data/dev-imports.txt +++ b/build-data/dev-imports.txt @@ -9,3 +9,4 @@ # minecraft net.minecraft.world.level.entity.LevelEntityGetterAdapter # minecraft net/minecraft/world/level/entity/LevelEntityGetter.java +minecraft net.minecraft.network.protocol.game.ClientboundPlayerChatPacket diff --git a/patches/server/0001-Setup-Gradle-project.patch b/patches/server/0001-Setup-Gradle-project.patch index 31ae6fcd71..4434559cc5 100644 --- a/patches/server/0001-Setup-Gradle-project.patch +++ b/patches/server/0001-Setup-Gradle-project.patch @@ -28,7 +28,7 @@ index 67fb370cad6924895a6b27052dbd5c1767e3f0c9..bb338269c9e3bef4c274157c490d8b8f +/.factorypath diff --git a/build.gradle.kts b/build.gradle.kts new file mode 100644 -index 0000000000000000000000000000000000000000..3451ca066dc093879d540b6c297f8814f40c15f2 +index 0000000000000000000000000000000000000000..25104e978c36adc91a65d81c5c8effc064c93091 --- /dev/null +++ b/build.gradle.kts @@ -0,0 +1,138 @@ @@ -59,7 +59,7 @@ index 0000000000000000000000000000000000000000..3451ca066dc093879d540b6c297f8814 + testImplementation("org.hamcrest:hamcrest-library:1.3") +} + -+val craftbukkitPackageVersion = "1_18_R2" // Paper ++val craftbukkitPackageVersion = "1_19_R1" // Paper +tasks.jar { + archiveClassifier.set("dev") + diff --git a/patches/unapplied/server/0002-Remap-fixes.patch b/patches/server/0002-Remap-fixes.patch similarity index 94% rename from patches/unapplied/server/0002-Remap-fixes.patch rename to patches/server/0002-Remap-fixes.patch index 72fee8c2e0..2b81da438a 100644 --- a/patches/unapplied/server/0002-Remap-fixes.patch +++ b/patches/server/0002-Remap-fixes.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Remap fixes diff --git a/src/main/java/net/minecraft/core/BlockPos.java b/src/main/java/net/minecraft/core/BlockPos.java -index cdd5d95326c663c1c493c45a28918a12ac6b449f..5311c40d9bf22b423a69bc722a6125493e616eac 100644 +index 700fd7f0ef6ba5798389b41a52f887e76917893d..eabf34265470e68b56c0d8787a7acffcf9b49e83 100644 --- a/src/main/java/net/minecraft/core/BlockPos.java +++ b/src/main/java/net/minecraft/core/BlockPos.java @@ -270,9 +270,11 @@ public class BlockPos extends Vec3i { @@ -42,7 +42,7 @@ index cdd5d95326c663c1c493c45a28918a12ac6b449f..5311c40d9bf22b423a69bc722a612549 } diff --git a/src/main/java/net/minecraft/server/commands/SummonCommand.java b/src/main/java/net/minecraft/server/commands/SummonCommand.java -index bb57dacc71711abfd9fb22a395ff798920564e5a..f6aed91482d9c7bf8b56fb7c53f938a4f37b9605 100644 +index da83a40a74b291879d236ffccf36ee7a626a811e..556c4fe8d0d044c2995533f4f20cbde7283a2711 100644 --- a/src/main/java/net/minecraft/server/commands/SummonCommand.java +++ b/src/main/java/net/minecraft/server/commands/SummonCommand.java @@ -53,9 +53,9 @@ public class SummonCommand { @@ -59,10 +59,10 @@ index bb57dacc71711abfd9fb22a395ff798920564e5a..f6aed91482d9c7bf8b56fb7c53f938a4 if (entity1 == null) { diff --git a/src/main/java/net/minecraft/world/entity/ai/behavior/BehaviorUtils.java b/src/main/java/net/minecraft/world/entity/ai/behavior/BehaviorUtils.java -index 88258cc1971c0764912d2f3cbfcd426d8f26cd62..e51a78e52969ec687956d16566494fc524e50cb8 100644 +index b2e9418aaf2b2c87f396304287595e519e72e3ad..098253e92bd95159de93fbbdf95daee341fc5752 100644 --- a/src/main/java/net/minecraft/world/entity/ai/behavior/BehaviorUtils.java +++ b/src/main/java/net/minecraft/world/entity/ai/behavior/BehaviorUtils.java -@@ -172,11 +172,11 @@ public class BehaviorUtils { +@@ -174,11 +174,11 @@ public class BehaviorUtils { return optional.map((uuid) -> { return ((ServerLevel) entity.level).getEntity(uuid); @@ -78,10 +78,10 @@ index 88258cc1971c0764912d2f3cbfcd426d8f26cd62..e51a78e52969ec687956d16566494fc5 entityliving1 = entityliving2; } else { diff --git a/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java b/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java -index babb59497fcd9b5e20d8b3b13ceb9a7856edbb63..92650d816113a0f1c2b589691895ebba3424d661 100644 +index 228e402a4efb6289fba58df3c0eac4cc608d4596..17c72a767e7b749ed78a9b54af19bae5381b296c 100644 --- a/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java +++ b/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java -@@ -174,7 +174,7 @@ public class RecipeManager extends SimpleJsonResourceReloadListener { +@@ -192,7 +192,7 @@ public class RecipeManager extends SimpleJsonResourceReloadListener { Builder> builder = ImmutableMap.builder(); recipes.forEach((irecipe) -> { diff --git a/patches/unapplied/server/0003-Build-system-changes.patch b/patches/server/0003-Build-system-changes.patch similarity index 86% rename from patches/unapplied/server/0003-Build-system-changes.patch rename to patches/server/0003-Build-system-changes.patch index 0b8ff48e40..42762184ca 100644 --- a/patches/unapplied/server/0003-Build-system-changes.patch +++ b/patches/server/0003-Build-system-changes.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Build system changes diff --git a/build.gradle.kts b/build.gradle.kts -index 3167619a2466fe1d3678828437b7eb17bb78ecce..9af9165b900d18baffb736b7105409210717ccef 100644 +index 3451ca066dc093879d540b6c297f8814f40c15f2..3f43a130ee7e7bd5c5178a108f3e7f23337cc83f 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -9,10 +9,9 @@ plugins { @@ -16,12 +16,12 @@ index 3167619a2466fe1d3678828437b7eb17bb78ecce..9af9165b900d18baffb736b710540921 - exclude(group = "org.apache.logging.log4j", module = "log4j-api") - } + implementation("org.apache.logging.log4j:log4j-iostreams:2.17.1") // Paper - implementation("org.ow2.asm:asm:9.2") -+ implementation("org.ow2.asm:asm-commons:9.2") // Paper - ASM event executor generation + implementation("org.ow2.asm:asm:9.3") ++ implementation("org.ow2.asm:asm-commons:9.3") // Paper - ASM event executor generation + implementation("commons-lang:commons-lang:2.6") runtimeOnly("org.xerial:sqlite-jdbc:3.36.0.3") - runtimeOnly("mysql:mysql-connector-java:8.0.27") - -@@ -33,6 +32,7 @@ tasks.jar { + runtimeOnly("mysql:mysql-connector-java:8.0.29") +@@ -34,6 +33,7 @@ tasks.jar { val gitHash = git("rev-parse", "--short=7", "HEAD").getText().trim() val implementationVersion = System.getenv("BUILD_NUMBER") ?: "\"$gitHash\"" val date = git("show", "-s", "--format=%ci", gitHash).getText().trim() // Paper @@ -29,7 +29,7 @@ index 3167619a2466fe1d3678828437b7eb17bb78ecce..9af9165b900d18baffb736b710540921 attributes( "Main-Class" to "org.bukkit.craftbukkit.Main", "Implementation-Title" to "CraftBukkit", -@@ -41,6 +41,9 @@ tasks.jar { +@@ -42,6 +42,9 @@ tasks.jar { "Specification-Title" to "Bukkit", "Specification-Version" to project.version, "Specification-Vendor" to "Bukkit Team", @@ -40,7 +40,7 @@ index 3167619a2466fe1d3678828437b7eb17bb78ecce..9af9165b900d18baffb736b710540921 for (tld in setOf("net", "com", "org")) { attributes("$tld/bukkit", "Sealed" to true) diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java -index 2c90c116d87e060b6da4a8ce79f839fff80db86d..e75ff70c52b097af447b7a91ef2c20c08a904d92 100644 +index 21a2be907f67d39605210d6bee53b3442665f65f..e5008c75054df38356af193fd049110d7d56e2d4 100644 --- a/src/main/java/org/bukkit/craftbukkit/Main.java +++ b/src/main/java/org/bukkit/craftbukkit/Main.java @@ -190,7 +190,7 @@ public class Main { @@ -51,7 +51,7 @@ index 2c90c116d87e060b6da4a8ce79f839fff80db86d..e75ff70c52b097af447b7a91ef2c20c0 + Date buildDate = new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss Z").parse(Main.class.getPackage().getImplementationVendor()); // Paper Calendar deadline = Calendar.getInstance(); - deadline.add(Calendar.DAY_OF_YEAR, -21); + deadline.add(Calendar.DAY_OF_YEAR, -3); diff --git a/src/main/java/org/bukkit/craftbukkit/util/Versioning.java b/src/main/java/org/bukkit/craftbukkit/util/Versioning.java index 93046379d0cefd5d3236fc59e698809acdc18f80..774556a62eb240da42e84db4502e2ed43495be17 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/Versioning.java diff --git a/patches/unapplied/server/0004-Paper-config-files.patch b/patches/server/0004-Paper-config-files.patch similarity index 93% rename from patches/unapplied/server/0004-Paper-config-files.patch rename to patches/server/0004-Paper-config-files.patch index 8f9b8949d4..1f6e7246ac 100644 --- a/patches/unapplied/server/0004-Paper-config-files.patch +++ b/patches/server/0004-Paper-config-files.patch @@ -310,10 +310,10 @@ index 0000000000000000000000000000000000000000..0853ff7641103447f458b2dc08076c27 + } +} diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java -index 9e4cca119722c2edc478fdd1a34af4370649aa5c..b49528d8a2c577def4f74ee694ffd53b481acb32 100644 +index 853e7c2019f5147e9681e95a82eaef0825b6341e..97dc1d188a57b9f499c9cdc2ec54535af380e5cb 100644 --- a/src/main/java/net/minecraft/server/Main.java +++ b/src/main/java/net/minecraft/server/Main.java -@@ -109,6 +109,12 @@ public class Main { +@@ -110,6 +110,12 @@ public class Main { DedicatedServerSettings dedicatedserversettings = new DedicatedServerSettings(optionset); // CraftBukkit - CLI argument support dedicatedserversettings.forceSave(); @@ -326,7 +326,7 @@ index 9e4cca119722c2edc478fdd1a34af4370649aa5c..b49528d8a2c577def4f74ee694ffd53b Path path1 = Paths.get("eula.txt"); Eula eula = new Eula(path1); -@@ -284,6 +290,20 @@ public class Main { +@@ -280,6 +286,20 @@ public class Main { } @@ -348,10 +348,10 @@ index 9e4cca119722c2edc478fdd1a34af4370649aa5c..b49528d8a2c577def4f74ee694ffd53b Main.LOGGER.info("Forcing world upgrade! {}", session.getLevelId()); // CraftBukkit WorldUpgrader worldupgrader = new WorldUpgrader(session, dataFixer, generatorOptions, eraseCache); diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 6016216921232bedba84acc1f6a87a3cfbb75850..ef128de5fe17231b39edb12a7014291d03cf79ec 100644 +index 6cc81495d8d09ff1fbb09f2e63a16ec4fa6138ec..e24b27eb8647a90eb83ec0f78f3bb9568161ba9b 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -601,6 +601,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop implements EntityTypeTest { +@@ -673,4 +673,10 @@ public class EntityType implements EntityTypeTest { T create(EntityType type, Level world); } @@ -412,10 +412,10 @@ index ec57266d48998ed0c656006834c82342236ea4c9..d790c37753f019b682fe00bea392359b + // Paper end } diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index 3dce5044332ee4a8f685ab1cde02cd4c72a85b63..6ded806628f2f3fd5b357eed41990abd7e06a372 100644 +index c1194f459414dc6ca9626ab8cec48cb48cdd926b..5576da91821926cdd9c5ef09534deb843986d202 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java -@@ -144,6 +144,8 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -150,6 +150,8 @@ public abstract class Level implements LevelAccessor, AutoCloseable { public boolean populating; public final org.spigotmc.SpigotWorldConfig spigotConfig; // Spigot @@ -424,19 +424,19 @@ index 3dce5044332ee4a8f685ab1cde02cd4c72a85b63..6ded806628f2f3fd5b357eed41990abd public final SpigotTimings.WorldTimingsHandler timings; // Spigot public static BlockPos lastPhysicsProblem; // Spigot private org.spigotmc.TickLimiter entityLimiter; -@@ -162,6 +164,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -168,6 +170,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { - protected Level(WritableLevelData worlddatamutable, ResourceKey resourcekey, Holder holder, Supplier supplier, boolean flag, boolean flag1, long i, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider, org.bukkit.World.Environment env) { + protected Level(WritableLevelData worlddatamutable, ResourceKey resourcekey, Holder holder, Supplier supplier, boolean flag, boolean flag1, long i, int j, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider, org.bukkit.World.Environment env) { this.spigotConfig = new org.spigotmc.SpigotWorldConfig(((net.minecraft.world.level.storage.PrimaryLevelData) worlddatamutable).getLevelName()); // Spigot + this.paperConfig = new com.destroystokyo.paper.PaperWorldConfig(((net.minecraft.world.level.storage.PrimaryLevelData) worlddatamutable).getLevelName(), this.spigotConfig); // Paper this.generator = gen; this.world = new CraftWorld((ServerLevel) this, gen, biomeProvider, env); diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 6657edb762d234ab388b0bf7dd52f910e0e0af8b..d29c6d0536619fab5a48fbb52115dac09e7d7ca3 100644 +index 1d94c0fbdead83155aefc8d4a16dbcb95b3c9838..cd6ef8cfba7367fec87dd238add23cfd365a5ceb 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -866,6 +866,7 @@ public final class CraftServer implements Server { +@@ -861,6 +861,7 @@ public final class CraftServer implements Server { } org.spigotmc.SpigotConfig.init((File) console.options.valueOf("spigot-settings")); // Spigot @@ -444,7 +444,7 @@ index 6657edb762d234ab388b0bf7dd52f910e0e0af8b..d29c6d0536619fab5a48fbb52115dac0 for (ServerLevel world : this.console.getAllLevels()) { world.serverLevelData.setDifficulty(config.difficulty); world.setSpawnSettings(config.spawnMonsters, config.spawnAnimals); -@@ -881,12 +882,14 @@ public final class CraftServer implements Server { +@@ -876,12 +877,14 @@ public final class CraftServer implements Server { } } world.spigotConfig.init(); // Spigot @@ -459,7 +459,7 @@ index 6657edb762d234ab388b0bf7dd52f910e0e0af8b..d29c6d0536619fab5a48fbb52115dac0 this.overrideAllCommandBlockCommands = this.commandsConfiguration.getStringList("command-block-overrides").contains("*"); this.ignoreVanillaPermissions = this.commandsConfiguration.getBoolean("ignore-vanilla-permissions"); -@@ -2331,4 +2334,35 @@ public final class CraftServer implements Server { +@@ -2314,4 +2317,35 @@ public final class CraftServer implements Server { return this.spigot; } // Spigot end @@ -496,7 +496,7 @@ index 6657edb762d234ab388b0bf7dd52f910e0e0af8b..d29c6d0536619fab5a48fbb52115dac0 + // Paper end } diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java -index e75ff70c52b097af447b7a91ef2c20c08a904d92..fae37b7b353cb7b0f8d4a79407fcc219a3c45b64 100644 +index e5008c75054df38356af193fd049110d7d56e2d4..c694c6dfed0b3aa098b1822676e39bd3eb04b45a 100644 --- a/src/main/java/org/bukkit/craftbukkit/Main.java +++ b/src/main/java/org/bukkit/craftbukkit/Main.java @@ -129,6 +129,14 @@ public class Main { diff --git a/patches/server/0005-MC-Dev-fixes.patch b/patches/server/0005-MC-Dev-fixes.patch new file mode 100644 index 0000000000..6e707d7f08 --- /dev/null +++ b/patches/server/0005-MC-Dev-fixes.patch @@ -0,0 +1,284 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Aikar +Date: Wed, 30 Mar 2016 19:36:20 -0400 +Subject: [PATCH] MC Dev fixes + + +diff --git a/src/main/java/net/minecraft/Util.java b/src/main/java/net/minecraft/Util.java +index 1eaf731486d458223dc8ff0629a1a2422e6664da..9f1bd2de71381140736ef1dbcc5b75e8bdcee0e8 100644 +--- a/src/main/java/net/minecraft/Util.java ++++ b/src/main/java/net/minecraft/Util.java +@@ -370,7 +370,7 @@ public class Util { + } + + public static Hash.Strategy identityStrategy() { +- return Util.IdentityStrategy.INSTANCE; ++ return (Hash.Strategy) Util.IdentityStrategy.INSTANCE; // Paper - decompile fix + } + + public static CompletableFuture> sequence(List> futures) { +diff --git a/src/main/java/net/minecraft/core/BlockPos.java b/src/main/java/net/minecraft/core/BlockPos.java +index eabf34265470e68b56c0d8787a7acffcf9b49e83..c94084aee70d269a71a5423c13a5eba2babd9a6b 100644 +--- a/src/main/java/net/minecraft/core/BlockPos.java ++++ b/src/main/java/net/minecraft/core/BlockPos.java +@@ -375,12 +375,12 @@ public class BlockPos extends Vec3i { + if (this.index == l) { + return this.endOfData(); + } else { +- int i = this.index % i; +- int j = this.index / i; +- int k = j % j; +- int l = j / j; ++ int offsetX = this.index % i; // Paper - decomp fix ++ int u = this.index / i; // Paper - decomp fix ++ int offsetY = u % j; // Paper - decomp fix ++ int offsetZ = u / j; // Paper - decomp fix + ++this.index; +- return this.cursor.set(startX + i, startY + k, startZ + l); ++ return this.cursor.set(startX + offsetX, startY + offsetY, startZ + offsetZ); // Paper - decomp fix + } + } + }; +diff --git a/src/main/java/net/minecraft/nbt/ListTag.java b/src/main/java/net/minecraft/nbt/ListTag.java +index f346306d61854bdc6b395f5d8f799909537a1b50..69423244a1b6658e2c6ad4a7c5329e140b7155a8 100644 +--- a/src/main/java/net/minecraft/nbt/ListTag.java ++++ b/src/main/java/net/minecraft/nbt/ListTag.java +@@ -2,9 +2,12 @@ package net.minecraft.nbt; + + import com.google.common.collect.Iterables; + import com.google.common.collect.Lists; ++import it.unimi.dsi.fastutil.bytes.ByteOpenHashSet; ++import it.unimi.dsi.fastutil.bytes.ByteSet; + import java.io.DataInput; + import java.io.DataOutput; + import java.io.IOException; ++import java.util.Arrays; + import java.util.List; + import java.util.Objects; + +@@ -102,6 +105,7 @@ public class ListTag extends CollectionTag { + return "TAG_List"; + } + }; ++ private static final ByteSet INLINE_ELEMENT_TYPES = new ByteOpenHashSet(Arrays.asList((byte) 1, (byte) 2, (byte) 3, (byte) 4, (byte) 5, (byte) 6)); // Paper - decompiler fix // todo: what is this + private final List list; + private byte type; + +diff --git a/src/main/java/net/minecraft/nbt/NbtUtils.java b/src/main/java/net/minecraft/nbt/NbtUtils.java +index 423c750d4a5d719f7bc593aff5b1298e5c3c417b..2df77845b78b9d5fae0a36103d42c8202ee2af9e 100644 +--- a/src/main/java/net/minecraft/nbt/NbtUtils.java ++++ b/src/main/java/net/minecraft/nbt/NbtUtils.java +@@ -39,14 +39,14 @@ import net.minecraft.world.level.material.FluidState; + import org.slf4j.Logger; + + public final class NbtUtils { +- private static final Comparator YXZ_LISTTAG_INT_COMPARATOR = Comparator.comparingInt((nbt) -> { ++ private static final Comparator YXZ_LISTTAG_INT_COMPARATOR = Comparator.comparingInt((nbt) -> { // Paper - decompile fix + return nbt.getInt(1); + }).thenComparingInt((nbt) -> { + return nbt.getInt(0); + }).thenComparingInt((nbt) -> { + return nbt.getInt(2); + }); +- private static final Comparator YXZ_LISTTAG_DOUBLE_COMPARATOR = Comparator.comparingDouble((nbt) -> { ++ private static final Comparator YXZ_LISTTAG_DOUBLE_COMPARATOR = Comparator.comparingDouble((nbt) -> { // Paper - decompile fix + return nbt.getDouble(1); + }).thenComparingDouble((nbt) -> { + return nbt.getDouble(0); +@@ -494,7 +494,7 @@ public final class NbtUtils { + } + + public static CompoundTag update(DataFixer fixer, DataFixTypes fixTypes, CompoundTag compound, int oldVersion, int targetVersion) { +- return fixer.update(fixTypes.getType(), new Dynamic<>(NbtOps.INSTANCE, compound), oldVersion, targetVersion).getValue(); ++ return (CompoundTag) fixer.update(fixTypes.getType(), new Dynamic<>(NbtOps.INSTANCE, compound), oldVersion, targetVersion).getValue(); // Paper - decompile fix + } + + public static Component toPrettyComponent(Tag element) { +diff --git a/src/main/java/net/minecraft/network/ConnectionProtocol.java b/src/main/java/net/minecraft/network/ConnectionProtocol.java +index 1acdee3424fa2301e1a7e4807eb817bd0406b84d..d15ef330db69e0c948824d9bf112a26680c90b1b 100644 +--- a/src/main/java/net/minecraft/network/ConnectionProtocol.java ++++ b/src/main/java/net/minecraft/network/ConnectionProtocol.java +@@ -16,6 +16,7 @@ import javax.annotation.Nullable; + import net.minecraft.Util; + import net.minecraft.network.protocol.Packet; + import net.minecraft.network.protocol.PacketFlow; ++import net.minecraft.network.protocol.game.ClientGamePacketListener; + import net.minecraft.network.protocol.game.ClientboundAddEntityPacket; + import net.minecraft.network.protocol.game.ClientboundAddExperienceOrbPacket; + import net.minecraft.network.protocol.game.ClientboundAddPlayerPacket; +@@ -119,6 +120,7 @@ import net.minecraft.network.protocol.game.ClientboundUpdateAttributesPacket; + import net.minecraft.network.protocol.game.ClientboundUpdateMobEffectPacket; + import net.minecraft.network.protocol.game.ClientboundUpdateRecipesPacket; + import net.minecraft.network.protocol.game.ClientboundUpdateTagsPacket; ++import net.minecraft.network.protocol.game.ServerGamePacketListener; + import net.minecraft.network.protocol.game.ServerboundAcceptTeleportationPacket; + import net.minecraft.network.protocol.game.ServerboundBlockEntityTagQuery; + import net.minecraft.network.protocol.game.ServerboundChangeDifficultyPacket; +@@ -167,26 +169,33 @@ import net.minecraft.network.protocol.game.ServerboundTeleportToEntityPacket; + import net.minecraft.network.protocol.game.ServerboundUseItemOnPacket; + import net.minecraft.network.protocol.game.ServerboundUseItemPacket; + import net.minecraft.network.protocol.handshake.ClientIntentionPacket; ++import net.minecraft.network.protocol.handshake.ServerHandshakePacketListener; ++import net.minecraft.network.protocol.login.ClientLoginPacketListener; + import net.minecraft.network.protocol.login.ClientboundCustomQueryPacket; + import net.minecraft.network.protocol.login.ClientboundGameProfilePacket; + import net.minecraft.network.protocol.login.ClientboundHelloPacket; + import net.minecraft.network.protocol.login.ClientboundLoginCompressionPacket; + import net.minecraft.network.protocol.login.ClientboundLoginDisconnectPacket; ++import net.minecraft.network.protocol.login.ServerLoginPacketListener; + import net.minecraft.network.protocol.login.ServerboundCustomQueryPacket; + import net.minecraft.network.protocol.login.ServerboundHelloPacket; + import net.minecraft.network.protocol.login.ServerboundKeyPacket; ++import net.minecraft.network.protocol.status.ClientStatusPacketListener; + import net.minecraft.network.protocol.status.ClientboundPongResponsePacket; + import net.minecraft.network.protocol.status.ClientboundStatusResponsePacket; ++import net.minecraft.network.protocol.status.ServerStatusPacketListener; + import net.minecraft.network.protocol.status.ServerboundPingRequestPacket; + import net.minecraft.network.protocol.status.ServerboundStatusRequestPacket; + import net.minecraft.util.VisibleForDebug; + import org.slf4j.Logger; + + public enum ConnectionProtocol { +- HANDSHAKING(-1, protocol().addFlow(PacketFlow.SERVERBOUND, (new ConnectionProtocol.PacketSet()).addPacket(ClientIntentionPacket.class, ClientIntentionPacket::new))), +- PLAY(0, protocol().addFlow(PacketFlow.CLIENTBOUND, (new ConnectionProtocol.PacketSet()).addPacket(ClientboundAddEntityPacket.class, ClientboundAddEntityPacket::new).addPacket(ClientboundAddExperienceOrbPacket.class, ClientboundAddExperienceOrbPacket::new).addPacket(ClientboundAddPlayerPacket.class, ClientboundAddPlayerPacket::new).addPacket(ClientboundAnimatePacket.class, ClientboundAnimatePacket::new).addPacket(ClientboundAwardStatsPacket.class, ClientboundAwardStatsPacket::new).addPacket(ClientboundBlockChangedAckPacket.class, ClientboundBlockChangedAckPacket::new).addPacket(ClientboundBlockDestructionPacket.class, ClientboundBlockDestructionPacket::new).addPacket(ClientboundBlockEntityDataPacket.class, ClientboundBlockEntityDataPacket::new).addPacket(ClientboundBlockEventPacket.class, ClientboundBlockEventPacket::new).addPacket(ClientboundBlockUpdatePacket.class, ClientboundBlockUpdatePacket::new).addPacket(ClientboundBossEventPacket.class, ClientboundBossEventPacket::new).addPacket(ClientboundChangeDifficultyPacket.class, ClientboundChangeDifficultyPacket::new).addPacket(ClientboundChatPreviewPacket.class, ClientboundChatPreviewPacket::new).addPacket(ClientboundClearTitlesPacket.class, ClientboundClearTitlesPacket::new).addPacket(ClientboundCommandSuggestionsPacket.class, ClientboundCommandSuggestionsPacket::new).addPacket(ClientboundCommandsPacket.class, ClientboundCommandsPacket::new).addPacket(ClientboundContainerClosePacket.class, ClientboundContainerClosePacket::new).addPacket(ClientboundContainerSetContentPacket.class, ClientboundContainerSetContentPacket::new).addPacket(ClientboundContainerSetDataPacket.class, ClientboundContainerSetDataPacket::new).addPacket(ClientboundContainerSetSlotPacket.class, ClientboundContainerSetSlotPacket::new).addPacket(ClientboundCooldownPacket.class, ClientboundCooldownPacket::new).addPacket(ClientboundCustomPayloadPacket.class, ClientboundCustomPayloadPacket::new).addPacket(ClientboundCustomSoundPacket.class, ClientboundCustomSoundPacket::new).addPacket(ClientboundDisconnectPacket.class, ClientboundDisconnectPacket::new).addPacket(ClientboundEntityEventPacket.class, ClientboundEntityEventPacket::new).addPacket(ClientboundExplodePacket.class, ClientboundExplodePacket::new).addPacket(ClientboundForgetLevelChunkPacket.class, ClientboundForgetLevelChunkPacket::new).addPacket(ClientboundGameEventPacket.class, ClientboundGameEventPacket::new).addPacket(ClientboundHorseScreenOpenPacket.class, ClientboundHorseScreenOpenPacket::new).addPacket(ClientboundInitializeBorderPacket.class, ClientboundInitializeBorderPacket::new).addPacket(ClientboundKeepAlivePacket.class, ClientboundKeepAlivePacket::new).addPacket(ClientboundLevelChunkWithLightPacket.class, ClientboundLevelChunkWithLightPacket::new).addPacket(ClientboundLevelEventPacket.class, ClientboundLevelEventPacket::new).addPacket(ClientboundLevelParticlesPacket.class, ClientboundLevelParticlesPacket::new).addPacket(ClientboundLightUpdatePacket.class, ClientboundLightUpdatePacket::new).addPacket(ClientboundLoginPacket.class, ClientboundLoginPacket::new).addPacket(ClientboundMapItemDataPacket.class, ClientboundMapItemDataPacket::new).addPacket(ClientboundMerchantOffersPacket.class, ClientboundMerchantOffersPacket::new).addPacket(ClientboundMoveEntityPacket.Pos.class, ClientboundMoveEntityPacket.Pos::read).addPacket(ClientboundMoveEntityPacket.PosRot.class, ClientboundMoveEntityPacket.PosRot::read).addPacket(ClientboundMoveEntityPacket.Rot.class, ClientboundMoveEntityPacket.Rot::read).addPacket(ClientboundMoveVehiclePacket.class, ClientboundMoveVehiclePacket::new).addPacket(ClientboundOpenBookPacket.class, ClientboundOpenBookPacket::new).addPacket(ClientboundOpenScreenPacket.class, ClientboundOpenScreenPacket::new).addPacket(ClientboundOpenSignEditorPacket.class, ClientboundOpenSignEditorPacket::new).addPacket(ClientboundPingPacket.class, ClientboundPingPacket::new).addPacket(ClientboundPlaceGhostRecipePacket.class, ClientboundPlaceGhostRecipePacket::new).addPacket(ClientboundPlayerAbilitiesPacket.class, ClientboundPlayerAbilitiesPacket::new).addPacket(ClientboundPlayerChatPacket.class, ClientboundPlayerChatPacket::new).addPacket(ClientboundPlayerCombatEndPacket.class, ClientboundPlayerCombatEndPacket::new).addPacket(ClientboundPlayerCombatEnterPacket.class, ClientboundPlayerCombatEnterPacket::new).addPacket(ClientboundPlayerCombatKillPacket.class, ClientboundPlayerCombatKillPacket::new).addPacket(ClientboundPlayerInfoPacket.class, ClientboundPlayerInfoPacket::new).addPacket(ClientboundPlayerLookAtPacket.class, ClientboundPlayerLookAtPacket::new).addPacket(ClientboundPlayerPositionPacket.class, ClientboundPlayerPositionPacket::new).addPacket(ClientboundRecipePacket.class, ClientboundRecipePacket::new).addPacket(ClientboundRemoveEntitiesPacket.class, ClientboundRemoveEntitiesPacket::new).addPacket(ClientboundRemoveMobEffectPacket.class, ClientboundRemoveMobEffectPacket::new).addPacket(ClientboundResourcePackPacket.class, ClientboundResourcePackPacket::new).addPacket(ClientboundRespawnPacket.class, ClientboundRespawnPacket::new).addPacket(ClientboundRotateHeadPacket.class, ClientboundRotateHeadPacket::new).addPacket(ClientboundSectionBlocksUpdatePacket.class, ClientboundSectionBlocksUpdatePacket::new).addPacket(ClientboundSelectAdvancementsTabPacket.class, ClientboundSelectAdvancementsTabPacket::new).addPacket(ClientboundServerDataPacket.class, ClientboundServerDataPacket::new).addPacket(ClientboundSetActionBarTextPacket.class, ClientboundSetActionBarTextPacket::new).addPacket(ClientboundSetBorderCenterPacket.class, ClientboundSetBorderCenterPacket::new).addPacket(ClientboundSetBorderLerpSizePacket.class, ClientboundSetBorderLerpSizePacket::new).addPacket(ClientboundSetBorderSizePacket.class, ClientboundSetBorderSizePacket::new).addPacket(ClientboundSetBorderWarningDelayPacket.class, ClientboundSetBorderWarningDelayPacket::new).addPacket(ClientboundSetBorderWarningDistancePacket.class, ClientboundSetBorderWarningDistancePacket::new).addPacket(ClientboundSetCameraPacket.class, ClientboundSetCameraPacket::new).addPacket(ClientboundSetCarriedItemPacket.class, ClientboundSetCarriedItemPacket::new).addPacket(ClientboundSetChunkCacheCenterPacket.class, ClientboundSetChunkCacheCenterPacket::new).addPacket(ClientboundSetChunkCacheRadiusPacket.class, ClientboundSetChunkCacheRadiusPacket::new).addPacket(ClientboundSetDefaultSpawnPositionPacket.class, ClientboundSetDefaultSpawnPositionPacket::new).addPacket(ClientboundSetDisplayChatPreviewPacket.class, ClientboundSetDisplayChatPreviewPacket::new).addPacket(ClientboundSetDisplayObjectivePacket.class, ClientboundSetDisplayObjectivePacket::new).addPacket(ClientboundSetEntityDataPacket.class, ClientboundSetEntityDataPacket::new).addPacket(ClientboundSetEntityLinkPacket.class, ClientboundSetEntityLinkPacket::new).addPacket(ClientboundSetEntityMotionPacket.class, ClientboundSetEntityMotionPacket::new).addPacket(ClientboundSetEquipmentPacket.class, ClientboundSetEquipmentPacket::new).addPacket(ClientboundSetExperiencePacket.class, ClientboundSetExperiencePacket::new).addPacket(ClientboundSetHealthPacket.class, ClientboundSetHealthPacket::new).addPacket(ClientboundSetObjectivePacket.class, ClientboundSetObjectivePacket::new).addPacket(ClientboundSetPassengersPacket.class, ClientboundSetPassengersPacket::new).addPacket(ClientboundSetPlayerTeamPacket.class, ClientboundSetPlayerTeamPacket::new).addPacket(ClientboundSetScorePacket.class, ClientboundSetScorePacket::new).addPacket(ClientboundSetSimulationDistancePacket.class, ClientboundSetSimulationDistancePacket::new).addPacket(ClientboundSetSubtitleTextPacket.class, ClientboundSetSubtitleTextPacket::new).addPacket(ClientboundSetTimePacket.class, ClientboundSetTimePacket::new).addPacket(ClientboundSetTitleTextPacket.class, ClientboundSetTitleTextPacket::new).addPacket(ClientboundSetTitlesAnimationPacket.class, ClientboundSetTitlesAnimationPacket::new).addPacket(ClientboundSoundEntityPacket.class, ClientboundSoundEntityPacket::new).addPacket(ClientboundSoundPacket.class, ClientboundSoundPacket::new).addPacket(ClientboundStopSoundPacket.class, ClientboundStopSoundPacket::new).addPacket(ClientboundSystemChatPacket.class, ClientboundSystemChatPacket::new).addPacket(ClientboundTabListPacket.class, ClientboundTabListPacket::new).addPacket(ClientboundTagQueryPacket.class, ClientboundTagQueryPacket::new).addPacket(ClientboundTakeItemEntityPacket.class, ClientboundTakeItemEntityPacket::new).addPacket(ClientboundTeleportEntityPacket.class, ClientboundTeleportEntityPacket::new).addPacket(ClientboundUpdateAdvancementsPacket.class, ClientboundUpdateAdvancementsPacket::new).addPacket(ClientboundUpdateAttributesPacket.class, ClientboundUpdateAttributesPacket::new).addPacket(ClientboundUpdateMobEffectPacket.class, ClientboundUpdateMobEffectPacket::new).addPacket(ClientboundUpdateRecipesPacket.class, ClientboundUpdateRecipesPacket::new).addPacket(ClientboundUpdateTagsPacket.class, ClientboundUpdateTagsPacket::new)).addFlow(PacketFlow.SERVERBOUND, (new ConnectionProtocol.PacketSet()).addPacket(ServerboundAcceptTeleportationPacket.class, ServerboundAcceptTeleportationPacket::new).addPacket(ServerboundBlockEntityTagQuery.class, ServerboundBlockEntityTagQuery::new).addPacket(ServerboundChangeDifficultyPacket.class, ServerboundChangeDifficultyPacket::new).addPacket(ServerboundChatCommandPacket.class, ServerboundChatCommandPacket::new).addPacket(ServerboundChatPacket.class, ServerboundChatPacket::new).addPacket(ServerboundChatPreviewPacket.class, ServerboundChatPreviewPacket::new).addPacket(ServerboundClientCommandPacket.class, ServerboundClientCommandPacket::new).addPacket(ServerboundClientInformationPacket.class, ServerboundClientInformationPacket::new).addPacket(ServerboundCommandSuggestionPacket.class, ServerboundCommandSuggestionPacket::new).addPacket(ServerboundContainerButtonClickPacket.class, ServerboundContainerButtonClickPacket::new).addPacket(ServerboundContainerClickPacket.class, ServerboundContainerClickPacket::new).addPacket(ServerboundContainerClosePacket.class, ServerboundContainerClosePacket::new).addPacket(ServerboundCustomPayloadPacket.class, ServerboundCustomPayloadPacket::new).addPacket(ServerboundEditBookPacket.class, ServerboundEditBookPacket::new).addPacket(ServerboundEntityTagQuery.class, ServerboundEntityTagQuery::new).addPacket(ServerboundInteractPacket.class, ServerboundInteractPacket::new).addPacket(ServerboundJigsawGeneratePacket.class, ServerboundJigsawGeneratePacket::new).addPacket(ServerboundKeepAlivePacket.class, ServerboundKeepAlivePacket::new).addPacket(ServerboundLockDifficultyPacket.class, ServerboundLockDifficultyPacket::new).addPacket(ServerboundMovePlayerPacket.Pos.class, ServerboundMovePlayerPacket.Pos::read).addPacket(ServerboundMovePlayerPacket.PosRot.class, ServerboundMovePlayerPacket.PosRot::read).addPacket(ServerboundMovePlayerPacket.Rot.class, ServerboundMovePlayerPacket.Rot::read).addPacket(ServerboundMovePlayerPacket.StatusOnly.class, ServerboundMovePlayerPacket.StatusOnly::read).addPacket(ServerboundMoveVehiclePacket.class, ServerboundMoveVehiclePacket::new).addPacket(ServerboundPaddleBoatPacket.class, ServerboundPaddleBoatPacket::new).addPacket(ServerboundPickItemPacket.class, ServerboundPickItemPacket::new).addPacket(ServerboundPlaceRecipePacket.class, ServerboundPlaceRecipePacket::new).addPacket(ServerboundPlayerAbilitiesPacket.class, ServerboundPlayerAbilitiesPacket::new).addPacket(ServerboundPlayerActionPacket.class, ServerboundPlayerActionPacket::new).addPacket(ServerboundPlayerCommandPacket.class, ServerboundPlayerCommandPacket::new).addPacket(ServerboundPlayerInputPacket.class, ServerboundPlayerInputPacket::new).addPacket(ServerboundPongPacket.class, ServerboundPongPacket::new).addPacket(ServerboundRecipeBookChangeSettingsPacket.class, ServerboundRecipeBookChangeSettingsPacket::new).addPacket(ServerboundRecipeBookSeenRecipePacket.class, ServerboundRecipeBookSeenRecipePacket::new).addPacket(ServerboundRenameItemPacket.class, ServerboundRenameItemPacket::new).addPacket(ServerboundResourcePackPacket.class, ServerboundResourcePackPacket::new).addPacket(ServerboundSeenAdvancementsPacket.class, ServerboundSeenAdvancementsPacket::new).addPacket(ServerboundSelectTradePacket.class, ServerboundSelectTradePacket::new).addPacket(ServerboundSetBeaconPacket.class, ServerboundSetBeaconPacket::new).addPacket(ServerboundSetCarriedItemPacket.class, ServerboundSetCarriedItemPacket::new).addPacket(ServerboundSetCommandBlockPacket.class, ServerboundSetCommandBlockPacket::new).addPacket(ServerboundSetCommandMinecartPacket.class, ServerboundSetCommandMinecartPacket::new).addPacket(ServerboundSetCreativeModeSlotPacket.class, ServerboundSetCreativeModeSlotPacket::new).addPacket(ServerboundSetJigsawBlockPacket.class, ServerboundSetJigsawBlockPacket::new).addPacket(ServerboundSetStructureBlockPacket.class, ServerboundSetStructureBlockPacket::new).addPacket(ServerboundSignUpdatePacket.class, ServerboundSignUpdatePacket::new).addPacket(ServerboundSwingPacket.class, ServerboundSwingPacket::new).addPacket(ServerboundTeleportToEntityPacket.class, ServerboundTeleportToEntityPacket::new).addPacket(ServerboundUseItemOnPacket.class, ServerboundUseItemOnPacket::new).addPacket(ServerboundUseItemPacket.class, ServerboundUseItemPacket::new))), +- STATUS(1, protocol().addFlow(PacketFlow.SERVERBOUND, (new ConnectionProtocol.PacketSet()).addPacket(ServerboundStatusRequestPacket.class, ServerboundStatusRequestPacket::new).addPacket(ServerboundPingRequestPacket.class, ServerboundPingRequestPacket::new)).addFlow(PacketFlow.CLIENTBOUND, (new ConnectionProtocol.PacketSet()).addPacket(ClientboundStatusResponsePacket.class, ClientboundStatusResponsePacket::new).addPacket(ClientboundPongResponsePacket.class, ClientboundPongResponsePacket::new))), +- LOGIN(2, protocol().addFlow(PacketFlow.CLIENTBOUND, (new ConnectionProtocol.PacketSet()).addPacket(ClientboundLoginDisconnectPacket.class, ClientboundLoginDisconnectPacket::new).addPacket(ClientboundHelloPacket.class, ClientboundHelloPacket::new).addPacket(ClientboundGameProfilePacket.class, ClientboundGameProfilePacket::new).addPacket(ClientboundLoginCompressionPacket.class, ClientboundLoginCompressionPacket::new).addPacket(ClientboundCustomQueryPacket.class, ClientboundCustomQueryPacket::new)).addFlow(PacketFlow.SERVERBOUND, (new ConnectionProtocol.PacketSet()).addPacket(ServerboundHelloPacket.class, ServerboundHelloPacket::new).addPacket(ServerboundKeyPacket.class, ServerboundKeyPacket::new).addPacket(ServerboundCustomQueryPacket.class, ServerboundCustomQueryPacket::new))); ++ // Paper start - fix decompile error - add correct generic packet listeners (e.g. ServerHandshakePacketListener) to PacketSet's generic type, matching the packet flow direction ++ HANDSHAKING(-1, protocol().addFlow(PacketFlow.SERVERBOUND, (new ConnectionProtocol.PacketSet()).addPacket(ClientIntentionPacket.class, ClientIntentionPacket::new))), ++ PLAY(0, protocol().addFlow(PacketFlow.CLIENTBOUND, (new ConnectionProtocol.PacketSet()).addPacket(ClientboundAddEntityPacket.class, ClientboundAddEntityPacket::new).addPacket(ClientboundAddExperienceOrbPacket.class, ClientboundAddExperienceOrbPacket::new).addPacket(ClientboundAddPlayerPacket.class, ClientboundAddPlayerPacket::new).addPacket(ClientboundAnimatePacket.class, ClientboundAnimatePacket::new).addPacket(ClientboundAwardStatsPacket.class, ClientboundAwardStatsPacket::new).addPacket(ClientboundBlockChangedAckPacket.class, ClientboundBlockChangedAckPacket::new).addPacket(ClientboundBlockDestructionPacket.class, ClientboundBlockDestructionPacket::new).addPacket(ClientboundBlockEntityDataPacket.class, ClientboundBlockEntityDataPacket::new).addPacket(ClientboundBlockEventPacket.class, ClientboundBlockEventPacket::new).addPacket(ClientboundBlockUpdatePacket.class, ClientboundBlockUpdatePacket::new).addPacket(ClientboundBossEventPacket.class, ClientboundBossEventPacket::new).addPacket(ClientboundChangeDifficultyPacket.class, ClientboundChangeDifficultyPacket::new).addPacket(ClientboundChatPreviewPacket.class, ClientboundChatPreviewPacket::new).addPacket(ClientboundClearTitlesPacket.class, ClientboundClearTitlesPacket::new).addPacket(ClientboundCommandSuggestionsPacket.class, ClientboundCommandSuggestionsPacket::new).addPacket(ClientboundCommandsPacket.class, ClientboundCommandsPacket::new).addPacket(ClientboundContainerClosePacket.class, ClientboundContainerClosePacket::new).addPacket(ClientboundContainerSetContentPacket.class, ClientboundContainerSetContentPacket::new).addPacket(ClientboundContainerSetDataPacket.class, ClientboundContainerSetDataPacket::new).addPacket(ClientboundContainerSetSlotPacket.class, ClientboundContainerSetSlotPacket::new).addPacket(ClientboundCooldownPacket.class, ClientboundCooldownPacket::new).addPacket(ClientboundCustomPayloadPacket.class, ClientboundCustomPayloadPacket::new).addPacket(ClientboundCustomSoundPacket.class, ClientboundCustomSoundPacket::new).addPacket(ClientboundDisconnectPacket.class, ClientboundDisconnectPacket::new).addPacket(ClientboundEntityEventPacket.class, ClientboundEntityEventPacket::new).addPacket(ClientboundExplodePacket.class, ClientboundExplodePacket::new).addPacket(ClientboundForgetLevelChunkPacket.class, ClientboundForgetLevelChunkPacket::new).addPacket(ClientboundGameEventPacket.class, ClientboundGameEventPacket::new).addPacket(ClientboundHorseScreenOpenPacket.class, ClientboundHorseScreenOpenPacket::new).addPacket(ClientboundInitializeBorderPacket.class, ClientboundInitializeBorderPacket::new).addPacket(ClientboundKeepAlivePacket.class, ClientboundKeepAlivePacket::new).addPacket(ClientboundLevelChunkWithLightPacket.class, ClientboundLevelChunkWithLightPacket::new).addPacket(ClientboundLevelEventPacket.class, ClientboundLevelEventPacket::new).addPacket(ClientboundLevelParticlesPacket.class, ClientboundLevelParticlesPacket::new).addPacket(ClientboundLightUpdatePacket.class, ClientboundLightUpdatePacket::new).addPacket(ClientboundLoginPacket.class, ClientboundLoginPacket::new).addPacket(ClientboundMapItemDataPacket.class, ClientboundMapItemDataPacket::new).addPacket(ClientboundMerchantOffersPacket.class, ClientboundMerchantOffersPacket::new).addPacket(ClientboundMoveEntityPacket.Pos.class, ClientboundMoveEntityPacket.Pos::read).addPacket(ClientboundMoveEntityPacket.PosRot.class, ClientboundMoveEntityPacket.PosRot::read).addPacket(ClientboundMoveEntityPacket.Rot.class, ClientboundMoveEntityPacket.Rot::read).addPacket(ClientboundMoveVehiclePacket.class, ClientboundMoveVehiclePacket::new).addPacket(ClientboundOpenBookPacket.class, ClientboundOpenBookPacket::new).addPacket(ClientboundOpenScreenPacket.class, ClientboundOpenScreenPacket::new).addPacket(ClientboundOpenSignEditorPacket.class, ClientboundOpenSignEditorPacket::new).addPacket(ClientboundPingPacket.class, ClientboundPingPacket::new).addPacket(ClientboundPlaceGhostRecipePacket.class, ClientboundPlaceGhostRecipePacket::new).addPacket(ClientboundPlayerAbilitiesPacket.class, ClientboundPlayerAbilitiesPacket::new).addPacket(ClientboundPlayerChatPacket.class, ClientboundPlayerChatPacket::new).addPacket(ClientboundPlayerCombatEndPacket.class, ClientboundPlayerCombatEndPacket::new).addPacket(ClientboundPlayerCombatEnterPacket.class, ClientboundPlayerCombatEnterPacket::new).addPacket(ClientboundPlayerCombatKillPacket.class, ClientboundPlayerCombatKillPacket::new).addPacket(ClientboundPlayerInfoPacket.class, ClientboundPlayerInfoPacket::new).addPacket(ClientboundPlayerLookAtPacket.class, ClientboundPlayerLookAtPacket::new).addPacket(ClientboundPlayerPositionPacket.class, ClientboundPlayerPositionPacket::new).addPacket(ClientboundRecipePacket.class, ClientboundRecipePacket::new).addPacket(ClientboundRemoveEntitiesPacket.class, ClientboundRemoveEntitiesPacket::new).addPacket(ClientboundRemoveMobEffectPacket.class, ClientboundRemoveMobEffectPacket::new).addPacket(ClientboundResourcePackPacket.class, ClientboundResourcePackPacket::new).addPacket(ClientboundRespawnPacket.class, ClientboundRespawnPacket::new).addPacket(ClientboundRotateHeadPacket.class, ClientboundRotateHeadPacket::new).addPacket(ClientboundSectionBlocksUpdatePacket.class, ClientboundSectionBlocksUpdatePacket::new).addPacket(ClientboundSelectAdvancementsTabPacket.class, ClientboundSelectAdvancementsTabPacket::new).addPacket(ClientboundServerDataPacket.class, ClientboundServerDataPacket::new).addPacket(ClientboundSetActionBarTextPacket.class, ClientboundSetActionBarTextPacket::new).addPacket(ClientboundSetBorderCenterPacket.class, ClientboundSetBorderCenterPacket::new).addPacket(ClientboundSetBorderLerpSizePacket.class, ClientboundSetBorderLerpSizePacket::new).addPacket(ClientboundSetBorderSizePacket.class, ClientboundSetBorderSizePacket::new).addPacket(ClientboundSetBorderWarningDelayPacket.class, ClientboundSetBorderWarningDelayPacket::new).addPacket(ClientboundSetBorderWarningDistancePacket.class, ClientboundSetBorderWarningDistancePacket::new).addPacket(ClientboundSetCameraPacket.class, ClientboundSetCameraPacket::new).addPacket(ClientboundSetCarriedItemPacket.class, ClientboundSetCarriedItemPacket::new).addPacket(ClientboundSetChunkCacheCenterPacket.class, ClientboundSetChunkCacheCenterPacket::new).addPacket(ClientboundSetChunkCacheRadiusPacket.class, ClientboundSetChunkCacheRadiusPacket::new).addPacket(ClientboundSetDefaultSpawnPositionPacket.class, ClientboundSetDefaultSpawnPositionPacket::new).addPacket(ClientboundSetDisplayChatPreviewPacket.class, ClientboundSetDisplayChatPreviewPacket::new).addPacket(ClientboundSetDisplayObjectivePacket.class, ClientboundSetDisplayObjectivePacket::new).addPacket(ClientboundSetEntityDataPacket.class, ClientboundSetEntityDataPacket::new).addPacket(ClientboundSetEntityLinkPacket.class, ClientboundSetEntityLinkPacket::new).addPacket(ClientboundSetEntityMotionPacket.class, ClientboundSetEntityMotionPacket::new).addPacket(ClientboundSetEquipmentPacket.class, ClientboundSetEquipmentPacket::new).addPacket(ClientboundSetExperiencePacket.class, ClientboundSetExperiencePacket::new).addPacket(ClientboundSetHealthPacket.class, ClientboundSetHealthPacket::new).addPacket(ClientboundSetObjectivePacket.class, ClientboundSetObjectivePacket::new).addPacket(ClientboundSetPassengersPacket.class, ClientboundSetPassengersPacket::new).addPacket(ClientboundSetPlayerTeamPacket.class, ClientboundSetPlayerTeamPacket::new).addPacket(ClientboundSetScorePacket.class, ClientboundSetScorePacket::new).addPacket(ClientboundSetSimulationDistancePacket.class, ClientboundSetSimulationDistancePacket::new).addPacket(ClientboundSetSubtitleTextPacket.class, ClientboundSetSubtitleTextPacket::new).addPacket(ClientboundSetTimePacket.class, ClientboundSetTimePacket::new).addPacket(ClientboundSetTitleTextPacket.class, ClientboundSetTitleTextPacket::new).addPacket(ClientboundSetTitlesAnimationPacket.class, ClientboundSetTitlesAnimationPacket::new).addPacket(ClientboundSoundEntityPacket.class, ClientboundSoundEntityPacket::new).addPacket(ClientboundSoundPacket.class, ClientboundSoundPacket::new).addPacket(ClientboundStopSoundPacket.class, ClientboundStopSoundPacket::new).addPacket(ClientboundSystemChatPacket.class, ClientboundSystemChatPacket::new).addPacket(ClientboundTabListPacket.class, ClientboundTabListPacket::new).addPacket(ClientboundTagQueryPacket.class, ClientboundTagQueryPacket::new).addPacket(ClientboundTakeItemEntityPacket.class, ClientboundTakeItemEntityPacket::new).addPacket(ClientboundTeleportEntityPacket.class, ClientboundTeleportEntityPacket::new).addPacket(ClientboundUpdateAdvancementsPacket.class, ClientboundUpdateAdvancementsPacket::new).addPacket(ClientboundUpdateAttributesPacket.class, ClientboundUpdateAttributesPacket::new).addPacket(ClientboundUpdateMobEffectPacket.class, ClientboundUpdateMobEffectPacket::new).addPacket(ClientboundUpdateRecipesPacket.class, ClientboundUpdateRecipesPacket::new).addPacket(ClientboundUpdateTagsPacket.class, ClientboundUpdateTagsPacket::new)).addFlow(PacketFlow.SERVERBOUND, (new ConnectionProtocol.PacketSet()).addPacket(ServerboundAcceptTeleportationPacket.class, ServerboundAcceptTeleportationPacket::new).addPacket(ServerboundBlockEntityTagQuery.class, ServerboundBlockEntityTagQuery::new).addPacket(ServerboundChangeDifficultyPacket.class, ServerboundChangeDifficultyPacket::new).addPacket(ServerboundChatCommandPacket.class, ServerboundChatCommandPacket::new).addPacket(ServerboundChatPacket.class, ServerboundChatPacket::new).addPacket(ServerboundChatPreviewPacket.class, ServerboundChatPreviewPacket::new).addPacket(ServerboundClientCommandPacket.class, ServerboundClientCommandPacket::new).addPacket(ServerboundClientInformationPacket.class, ServerboundClientInformationPacket::new).addPacket(ServerboundCommandSuggestionPacket.class, ServerboundCommandSuggestionPacket::new).addPacket(ServerboundContainerButtonClickPacket.class, ServerboundContainerButtonClickPacket::new).addPacket(ServerboundContainerClickPacket.class, ServerboundContainerClickPacket::new).addPacket(ServerboundContainerClosePacket.class, ServerboundContainerClosePacket::new).addPacket(ServerboundCustomPayloadPacket.class, ServerboundCustomPayloadPacket::new).addPacket(ServerboundEditBookPacket.class, ServerboundEditBookPacket::new).addPacket(ServerboundEntityTagQuery.class, ServerboundEntityTagQuery::new).addPacket(ServerboundInteractPacket.class, ServerboundInteractPacket::new).addPacket(ServerboundJigsawGeneratePacket.class, ServerboundJigsawGeneratePacket::new).addPacket(ServerboundKeepAlivePacket.class, ServerboundKeepAlivePacket::new).addPacket(ServerboundLockDifficultyPacket.class, ServerboundLockDifficultyPacket::new).addPacket(ServerboundMovePlayerPacket.Pos.class, ServerboundMovePlayerPacket.Pos::read).addPacket(ServerboundMovePlayerPacket.PosRot.class, ServerboundMovePlayerPacket.PosRot::read).addPacket(ServerboundMovePlayerPacket.Rot.class, ServerboundMovePlayerPacket.Rot::read).addPacket(ServerboundMovePlayerPacket.StatusOnly.class, ServerboundMovePlayerPacket.StatusOnly::read).addPacket(ServerboundMoveVehiclePacket.class, ServerboundMoveVehiclePacket::new).addPacket(ServerboundPaddleBoatPacket.class, ServerboundPaddleBoatPacket::new).addPacket(ServerboundPickItemPacket.class, ServerboundPickItemPacket::new).addPacket(ServerboundPlaceRecipePacket.class, ServerboundPlaceRecipePacket::new).addPacket(ServerboundPlayerAbilitiesPacket.class, ServerboundPlayerAbilitiesPacket::new).addPacket(ServerboundPlayerActionPacket.class, ServerboundPlayerActionPacket::new).addPacket(ServerboundPlayerCommandPacket.class, ServerboundPlayerCommandPacket::new).addPacket(ServerboundPlayerInputPacket.class, ServerboundPlayerInputPacket::new).addPacket(ServerboundPongPacket.class, ServerboundPongPacket::new).addPacket(ServerboundRecipeBookChangeSettingsPacket.class, ServerboundRecipeBookChangeSettingsPacket::new).addPacket(ServerboundRecipeBookSeenRecipePacket.class, ServerboundRecipeBookSeenRecipePacket::new).addPacket(ServerboundRenameItemPacket.class, ServerboundRenameItemPacket::new).addPacket(ServerboundResourcePackPacket.class, ServerboundResourcePackPacket::new).addPacket(ServerboundSeenAdvancementsPacket.class, ServerboundSeenAdvancementsPacket::new).addPacket(ServerboundSelectTradePacket.class, ServerboundSelectTradePacket::new).addPacket(ServerboundSetBeaconPacket.class, ServerboundSetBeaconPacket::new).addPacket(ServerboundSetCarriedItemPacket.class, ServerboundSetCarriedItemPacket::new).addPacket(ServerboundSetCommandBlockPacket.class, ServerboundSetCommandBlockPacket::new).addPacket(ServerboundSetCommandMinecartPacket.class, ServerboundSetCommandMinecartPacket::new).addPacket(ServerboundSetCreativeModeSlotPacket.class, ServerboundSetCreativeModeSlotPacket::new).addPacket(ServerboundSetJigsawBlockPacket.class, ServerboundSetJigsawBlockPacket::new).addPacket(ServerboundSetStructureBlockPacket.class, ServerboundSetStructureBlockPacket::new).addPacket(ServerboundSignUpdatePacket.class, ServerboundSignUpdatePacket::new).addPacket(ServerboundSwingPacket.class, ServerboundSwingPacket::new).addPacket(ServerboundTeleportToEntityPacket.class, ServerboundTeleportToEntityPacket::new).addPacket(ServerboundUseItemOnPacket.class, ServerboundUseItemOnPacket::new).addPacket(ServerboundUseItemPacket.class, ServerboundUseItemPacket::new))), ++ STATUS(1, protocol().addFlow(PacketFlow.SERVERBOUND, (new ConnectionProtocol.PacketSet()).addPacket(ServerboundStatusRequestPacket.class, ServerboundStatusRequestPacket::new).addPacket(ServerboundPingRequestPacket.class, ServerboundPingRequestPacket::new)).addFlow(PacketFlow.CLIENTBOUND, (new ConnectionProtocol.PacketSet()).addPacket(ClientboundStatusResponsePacket.class, ClientboundStatusResponsePacket::new).addPacket(ClientboundPongResponsePacket.class, ClientboundPongResponsePacket::new))), ++ LOGIN(2, protocol().addFlow(PacketFlow.CLIENTBOUND, (new ConnectionProtocol.PacketSet()).addPacket(ClientboundLoginDisconnectPacket.class, ClientboundLoginDisconnectPacket::new).addPacket(ClientboundHelloPacket.class, ClientboundHelloPacket::new).addPacket(ClientboundGameProfilePacket.class, ClientboundGameProfilePacket::new).addPacket(ClientboundLoginCompressionPacket.class, ClientboundLoginCompressionPacket::new).addPacket(ClientboundCustomQueryPacket.class, ClientboundCustomQueryPacket::new)).addFlow(PacketFlow.SERVERBOUND, (new ConnectionProtocol.PacketSet()).addPacket(ServerboundHelloPacket.class, ServerboundHelloPacket::new).addPacket(ServerboundKeyPacket.class, ServerboundKeyPacket::new).addPacket(ServerboundCustomQueryPacket.class, ServerboundCustomQueryPacket::new))); ++ // Paper end + + private static final int MIN_PROTOCOL_ID = -1; + private static final int MAX_PROTOCOL_ID = 2; +diff --git a/src/main/java/net/minecraft/resources/RegistryLoader.java b/src/main/java/net/minecraft/resources/RegistryLoader.java +index 82764c462f82163ee49f4e9466f383366cd23b8b..8da1226a6c293abb038d10c7921a77ed71ad06cc 100644 +--- a/src/main/java/net/minecraft/resources/RegistryLoader.java ++++ b/src/main/java/net/minecraft/resources/RegistryLoader.java +@@ -76,7 +76,7 @@ public class RegistryLoader { + } + + private RegistryLoader.ReadCache readCache(ResourceKey> registryRef) { +- return this.readCache.computeIfAbsent(registryRef, (ref) -> { ++ return (RegistryLoader.ReadCache) this.readCache.computeIfAbsent(registryRef, (ref) -> { // Paper - decompile fix + return new RegistryLoader.ReadCache(); + }); + } +diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java +index e24b27eb8647a90eb83ec0f78f3bb9568161ba9b..46fb83911e353f3682a250e62c4ecd7aceabaff8 100644 +--- a/src/main/java/net/minecraft/server/MinecraftServer.java ++++ b/src/main/java/net/minecraft/server/MinecraftServer.java +@@ -1736,7 +1736,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoopmap(resourcepackrepository::getPack).filter(Objects::nonNull).map(Pack::open).collect(ImmutableList.toImmutableList()); // CraftBukkit - decompile error // Paper - decompile error // todo: is this needed anymore? + }, this).thenCompose((immutablelist) -> { + MultiPackResourceManager resourcemanager = new MultiPackResourceManager(PackType.SERVER_DATA, immutablelist); + +diff --git a/src/main/java/net/minecraft/server/level/Ticket.java b/src/main/java/net/minecraft/server/level/Ticket.java +index 062da1bddd9704f5fbc46e974e13e60cd500bbe2..ffc43e5d3d0563c9e9c171064511b2c65ddf67e1 100644 +--- a/src/main/java/net/minecraft/server/level/Ticket.java ++++ b/src/main/java/net/minecraft/server/level/Ticket.java +@@ -21,7 +21,7 @@ public final class Ticket implements Comparable> { + return i; + } else { + int j = Integer.compare(System.identityHashCode(this.type), System.identityHashCode(ticket.type)); +- return j != 0 ? j : this.type.getComparator().compare(this.key, ticket.key); ++ return j != 0 ? j : this.type.getComparator().compare(this.key, (T)ticket.key); // Paper - decompile fix + } + } + +diff --git a/src/main/java/net/minecraft/util/SortedArraySet.java b/src/main/java/net/minecraft/util/SortedArraySet.java +index d0f6eb3981a171c0f34870cb0472599d6cca9642..d1b2ba24ef54e01c6249c3b2ca16e80f03c001a6 100644 +--- a/src/main/java/net/minecraft/util/SortedArraySet.java ++++ b/src/main/java/net/minecraft/util/SortedArraySet.java +@@ -28,7 +28,7 @@ public class SortedArraySet extends AbstractSet { + } + + public static > SortedArraySet create(int initialCapacity) { +- return new SortedArraySet<>(initialCapacity, Comparator.naturalOrder()); ++ return new SortedArraySet<>(initialCapacity, Comparator.naturalOrder()); // Paper - decompile fix + } + + public static SortedArraySet create(Comparator comparator) { +diff --git a/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiSection.java b/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiSection.java +index 8760e4199a1c8ae1a784f885923616f3740fe120..bb2be6eea7a0cff4cc70bd43738b1ce213e43558 100644 +--- a/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiSection.java ++++ b/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiSection.java +@@ -31,7 +31,7 @@ public class PoiSection { + private boolean isValid; + + public static Codec codec(Runnable updateListener) { +- return RecordCodecBuilder.create((instance) -> { ++ return RecordCodecBuilder.create((instance) -> { // Paper - decompile fix + return instance.group(RecordCodecBuilder.point(updateListener), Codec.BOOL.optionalFieldOf("Valid", Boolean.valueOf(false)).forGetter((poiSet) -> { + return poiSet.isValid; + }), PoiRecord.codec(updateListener).listOf().fieldOf("Records").forGetter((poiSet) -> { +diff --git a/src/main/java/net/minecraft/world/entity/monster/hoglin/Hoglin.java b/src/main/java/net/minecraft/world/entity/monster/hoglin/Hoglin.java +index 64314cf4dc53a1a0a5f676fa00503858e0120dfa..45741410a13cffe3419e34b5607b048bbcf1c3ff 100644 +--- a/src/main/java/net/minecraft/world/entity/monster/hoglin/Hoglin.java ++++ b/src/main/java/net/minecraft/world/entity/monster/hoglin/Hoglin.java +@@ -123,7 +123,7 @@ public class Hoglin extends Animal implements Enemy, HoglinBase { + + @Override + public Brain getBrain() { +- return super.getBrain(); ++ return (Brain) super.getBrain(); // Paper - decompile fix + } + + @Override +diff --git a/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java b/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java +index 17c72a767e7b749ed78a9b54af19bae5381b296c..4872f70977e73c889fe6e2339d00ebc64459613d 100644 +--- a/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java ++++ b/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java +@@ -78,7 +78,7 @@ public class RecipeManager extends SimpleJsonResourceReloadListener { + } + + this.recipes = (Map) map1.entrySet().stream().collect(ImmutableMap.toImmutableMap(Entry::getKey, (entry1) -> { +- return (entry1.getValue()); // CraftBukkit ++ return entry1.getValue(); // CraftBukkit // Paper - decompile fix - *shrugs internally* // todo: is this needed anymore? + })); + this.byName = Maps.newHashMap(builder.build()); // CraftBukkit + RecipeManager.LOGGER.info("Loaded {} recipes", map1.size()); +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 df2aa5d917a1742e3b82e27c8aa19de7c51bdba1..1152bf7f7a7784457c778b215db91b9e02066fba 100644 +--- a/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java ++++ b/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java +@@ -56,7 +56,7 @@ public class PalettedContainer implements PaletteResize, PalettedContainer + } + + private static > Codec codec(IdMap idMap, Codec entryCodec, PalettedContainer.Strategy provider, T object, PalettedContainerRO.Unpacker unpacker) { +- return RecordCodecBuilder.create((instance) -> { ++ return RecordCodecBuilder.>create((instance) -> { // Paper - decompile fix + return instance.group(entryCodec.mapResult(ExtraCodecs.orElsePartial(object)).listOf().fieldOf("palette").forGetter(PalettedContainerRO.PackedData::paletteEntries), Codec.LONG_STREAM.optionalFieldOf("data").forGetter(PalettedContainerRO.PackedData::storage)).apply(instance, PalettedContainerRO.PackedData::new); + }).comapFlatMap((packedData) -> { + return unpacker.read(idMap, provider, packedData); +diff --git a/src/main/java/net/minecraft/world/level/entity/EntityLookup.java b/src/main/java/net/minecraft/world/level/entity/EntityLookup.java +index 3864da01056970ae05cc3ca094f923178b4ffc97..e6b9f812e521abd552e0c7dc0429d5a62f2bfc35 100644 +--- a/src/main/java/net/minecraft/world/level/entity/EntityLookup.java ++++ b/src/main/java/net/minecraft/world/level/entity/EntityLookup.java +@@ -20,7 +20,7 @@ public class EntityLookup { + for(T entityAccess : this.byId.values()) { + U entityAccess2 = (U)((EntityAccess)filter.tryCast(entityAccess)); + if (entityAccess2 != null) { +- action.accept((T)entityAccess2); ++ action.accept(entityAccess2); // Paper - decompile fix + } + } + +diff --git a/src/main/java/net/minecraft/world/level/entity/EntitySection.java b/src/main/java/net/minecraft/world/level/entity/EntitySection.java +index e6b1663d4ccdd3842f711ad7547df8ccf973e4b1..524f3c42964eb83c9109bcc548a1075f1e295411 100644 +--- a/src/main/java/net/minecraft/world/level/entity/EntitySection.java ++++ b/src/main/java/net/minecraft/world/level/entity/EntitySection.java +@@ -42,7 +42,7 @@ public class EntitySection { + for(T entityAccess : collection) { + U entityAccess2 = (U)((EntityAccess)type.tryCast(entityAccess)); + if (entityAccess2 != null && entityAccess.getBoundingBox().intersects(box)) { +- action.accept((T)entityAccess2); ++ action.accept(entityAccess2); // Paper - decompile fix + } + } + diff --git a/patches/unapplied/server/0006-CB-fixes.patch b/patches/server/0006-CB-fixes.patch similarity index 67% rename from patches/unapplied/server/0006-CB-fixes.patch rename to patches/server/0006-CB-fixes.patch index 31fa0cf74e..65a80921ba 100644 --- a/patches/unapplied/server/0006-CB-fixes.patch +++ b/patches/server/0006-CB-fixes.patch @@ -17,17 +17,17 @@ Subject: [PATCH] CB fixes Co-authored-by: Spottedleaf diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index a480e20ac456a3169c67d2d43c191b7807a8ef10..1427b76110a02cee15865173e06e7b7bb4231ae7 100644 +index 5f7965076b14a694f644bf8fef9ba4f7b7a473ad..44f6e5cfdceb30934c2aafa85dc5492677d177d7 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -273,7 +273,7 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -289,7 +289,7 @@ public class ServerLevel extends Level implements WorldGenLevel { long l = minecraftserver.getWorldData().worldGenSettings().seed(); -- this.structureCheck = new StructureCheck(this.chunkSource.chunkScanner(), this.registryAccess(), minecraftserver.getStructureManager(), resourcekey, chunkgenerator, this, chunkgenerator.getBiomeSource(), l, datafixer); -+ this.structureCheck = new StructureCheck(this.chunkSource.chunkScanner(), this.registryAccess(), minecraftserver.getStructureManager(), this.getTypeKey(), chunkgenerator, this, chunkgenerator.getBiomeSource(), l, datafixer); // Paper - Fix missing CB diff - this.structureFeatureManager = new StructureFeatureManager(this, this.serverLevelData.worldGenSettings(), this.structureCheck); // CraftBukkit - if (this.dimensionType().createDragonFight()) { +- this.structureCheck = new StructureCheck(this.chunkSource.chunkScanner(), this.registryAccess(), minecraftserver.getStructureManager(), resourcekey, chunkgenerator, this.chunkSource.randomState(), this, chunkgenerator.getBiomeSource(), l, datafixer); ++ this.structureCheck = new StructureCheck(this.chunkSource.chunkScanner(), this.registryAccess(), minecraftserver.getStructureManager(), this.getTypeKey(), chunkgenerator, this.chunkSource.randomState(), this, chunkgenerator.getBiomeSource(), l, datafixer); // Paper - Fix missing CB diff + this.structureManager = new StructureManager(this, this.serverLevelData.worldGenSettings(), this.structureCheck); // CraftBukkit + if (this.dimension() == Level.END && this.dimensionTypeRegistration().is(BuiltinDimensionTypes.END)) { this.dragonFight = new EndDragonFight(this, this.serverLevelData.worldGenSettings().seed(), this.serverLevelData.endDragonFightData()); // CraftBukkit diff --git a/src/main/java/net/minecraft/world/entity/Marker.java b/src/main/java/net/minecraft/world/entity/Marker.java index aef33a96cf8df9400cc60285ef1f7c5ded03b495..059c4c3b59f66ea2b2b23fe1eb106bf9447b607c 100644 @@ -45,32 +45,32 @@ index aef33a96cf8df9400cc60285ef1f7c5ded03b495..059c4c3b59f66ea2b2b23fe1eb106bf9 @Override diff --git a/src/main/java/net/minecraft/world/level/levelgen/structure/StructureCheck.java b/src/main/java/net/minecraft/world/level/levelgen/structure/StructureCheck.java -index ac1373b8c4411298f881f9d569bf984704eeadc4..469d3d7fb69829595abd221c700fcf79d2c42fd0 100644 +index 9998e1c94b72b90dd3ba4bcce1b4b3653b9b1b2b..963ad3ce1ef83888ae1537ff01accdbb5b04ffa1 100644 --- a/src/main/java/net/minecraft/world/level/levelgen/structure/StructureCheck.java +++ b/src/main/java/net/minecraft/world/level/levelgen/structure/StructureCheck.java -@@ -45,7 +45,7 @@ public class StructureCheck { +@@ -43,7 +43,7 @@ public class StructureCheck { private final Registry biomes; - private final Registry> structureConfigs; - private final StructureManager structureManager; + private final Registry structureConfigs; + private final StructureTemplateManager structureTemplateManager; - private final ResourceKey dimension; + private final ResourceKey dimension; // Paper - fix missing CB diff private final ChunkGenerator chunkGenerator; + private final RandomState randomState; private final LevelHeightAccessor heightAccessor; - private final BiomeSource biomeSource; -@@ -54,7 +54,7 @@ public class StructureCheck { - private final Long2ObjectMap>> loadedChunks = new Long2ObjectOpenHashMap<>(); - private final Map, Long2BooleanMap> featureChecks = new HashMap<>(); +@@ -53,7 +53,7 @@ public class StructureCheck { + private final Long2ObjectMap> loadedChunks = new Long2ObjectOpenHashMap<>(); + private final Map featureChecks = new HashMap<>(); -- public StructureCheck(ChunkScanAccess chunkIoWorker, RegistryAccess registryManager, StructureManager structureManager, ResourceKey worldKey, ChunkGenerator chunkGenerator, LevelHeightAccessor world, BiomeSource biomeSource, long seed, DataFixer dataFixer) { -+ public StructureCheck(ChunkScanAccess chunkIoWorker, RegistryAccess registryManager, StructureManager structureManager, ResourceKey worldKey, ChunkGenerator chunkGenerator, LevelHeightAccessor world, BiomeSource biomeSource, long seed, DataFixer dataFixer) { // Paper - fix missing CB diff +- public StructureCheck(ChunkScanAccess chunkIoWorker, RegistryAccess registryManager, StructureTemplateManager structureTemplateManager, ResourceKey worldKey, ChunkGenerator chunkGenerator, RandomState noiseConfig, LevelHeightAccessor world, BiomeSource biomeSource, long seed, DataFixer dataFixer) { ++ public StructureCheck(ChunkScanAccess chunkIoWorker, RegistryAccess registryManager, StructureTemplateManager structureTemplateManager, ResourceKey worldKey, ChunkGenerator chunkGenerator, RandomState noiseConfig, LevelHeightAccessor world, BiomeSource biomeSource, long seed, DataFixer dataFixer) { // Paper - fix missing CB diff this.storageAccess = chunkIoWorker; this.registryAccess = registryManager; - this.structureManager = structureManager; + this.structureTemplateManager = structureTemplateManager; diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index d29c6d0536619fab5a48fbb52115dac09e7d7ca3..66e8fea6bd10af2e19a4f49c556e66a63e6205b6 100644 +index cd6ef8cfba7367fec87dd238add23cfd365a5ceb..daf5dc59a1883570569798630c4991e676e34c1c 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -2266,7 +2266,13 @@ public final class CraftServer implements Server { +@@ -2249,7 +2249,13 @@ public final class CraftServer implements Server { Validate.notNull(key, "NamespacedKey cannot be null"); LootTables registry = this.getServer().getLootTables(); @@ -84,20 +84,6 @@ index d29c6d0536619fab5a48fbb52115dac09e7d7ca3..66e8fea6bd10af2e19a4f49c556e66a6 + // Paper end } - @Override -diff --git a/src/main/java/org/bukkit/craftbukkit/generator/CustomWorldChunkManager.java b/src/main/java/org/bukkit/craftbukkit/generator/CustomWorldChunkManager.java -index 6f1855d1fed73b694b0eaf581231359a66ae48e2..0238db9d5ffebe597534ec283f173ee2da19946d 100644 ---- a/src/main/java/org/bukkit/craftbukkit/generator/CustomWorldChunkManager.java -+++ b/src/main/java/org/bukkit/craftbukkit/generator/CustomWorldChunkManager.java -@@ -45,8 +45,7 @@ public class CustomWorldChunkManager extends BiomeSource { - - @Override - public BiomeSource withSeed(long seed) { -- // TODO check method further -- throw new UnsupportedOperationException("Cannot copy CustomWorldChunkManager"); -+ return this; // Paper - Since this doesn't take a seed, no need to throw UOE - } - @Override diff --git a/src/main/java/org/bukkit/craftbukkit/util/permissions/CraftDefaultPermissions.java b/src/main/java/org/bukkit/craftbukkit/util/permissions/CraftDefaultPermissions.java index c93eec7a81ed83dc9190417dd51acb2780d3b60d..70d3949616c63038ad3e9bd1069db5ea2fb3f3b8 100644 diff --git a/patches/unapplied/server/0007-MC-Utils.patch b/patches/server/0007-MC-Utils.patch similarity index 96% rename from patches/unapplied/server/0007-MC-Utils.patch rename to patches/server/0007-MC-Utils.patch index 95806ea935..a187708d75 100644 --- a/patches/unapplied/server/0007-MC-Utils.patch +++ b/patches/server/0007-MC-Utils.patch @@ -4429,10 +4429,10 @@ index 0000000000000000000000000000000000000000..4d3dc8fba51bf5c0dceb06744781d1df + } +} diff --git a/src/main/java/net/minecraft/Util.java b/src/main/java/net/minecraft/Util.java -index c1af79f65a1a6ba970764983cf666cb4b7fe36de..307c930d6d295012c8ec6332314b4043befbdafd 100644 +index 9f1bd2de71381140736ef1dbcc5b75e8bdcee0e8..d7e22ddf89619b58516ccef1d75a4c33df61b73c 100644 --- a/src/main/java/net/minecraft/Util.java +++ b/src/main/java/net/minecraft/Util.java -@@ -104,7 +104,7 @@ public class Util { +@@ -114,7 +114,7 @@ public class Util { } public static long getNanos() { @@ -4442,7 +4442,7 @@ index c1af79f65a1a6ba970764983cf666cb4b7fe36de..307c930d6d295012c8ec6332314b4043 public static long getEpochMillis() { diff --git a/src/main/java/net/minecraft/core/BlockPos.java b/src/main/java/net/minecraft/core/BlockPos.java -index 79c7e30d510bdbd4def3b03474f72af0f355091c..d425adc1f37b9f926d6ee0c90d2237d89355e1a6 100644 +index c94084aee70d269a71a5423c13a5eba2babd9a6b..abd6fcab220d5616131e5bdd2f6a68a9105b7891 100644 --- a/src/main/java/net/minecraft/core/BlockPos.java +++ b/src/main/java/net/minecraft/core/BlockPos.java @@ -531,6 +531,7 @@ public class BlockPos extends Vec3i { @@ -5016,10 +5016,10 @@ index 0000000000000000000000000000000000000000..9f292deee1b793d52b5774304318e940 + } +} diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 868f6799a0e406401eecf18bc939fbdf88f534a2..dd8d14a1b128f801a4e1c811de5990d2602feeb2 100644 +index 46fb83911e353f3682a250e62c4ecd7aceabaff8..c763b4d9cc16f8c3ced91ce8656bd238205dedc0 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -294,6 +294,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop S spin(Function serverFactory) { AtomicReference atomicreference = new AtomicReference(); -@@ -961,6 +962,9 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop mainThreadExecutor, LightChunkGetter chunkProvider, ChunkGenerator chunkGenerator, ChunkProgressListener worldGenerationProgressListener, ChunkStatusUpdateListener chunkStatusChangeListener, Supplier persistentStateManagerFactory, int viewDistance, boolean dsync) { + public ChunkMap(ServerLevel world, LevelStorageSource.LevelStorageAccess session, DataFixer dataFixer, StructureTemplateManager structureTemplateManager, Executor executor, BlockableEventLoop mainThreadExecutor, LightChunkGetter chunkProvider, ChunkGenerator chunkGenerator, ChunkProgressListener worldGenerationProgressListener, ChunkStatusUpdateListener chunkStatusChangeListener, Supplier persistentStateManagerFactory, int viewDistance, boolean dsync) { super(session.getDimensionPath(world.dimension()).resolve("region"), dataFixer, dsync); this.visibleChunkMap = this.updatingChunkMap.clone(); -@@ -198,6 +249,10 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -211,6 +262,10 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider this.overworldDataStorage = persistentStateManagerFactory; - this.poiManager = new PoiManager(path.resolve("poi"), dataFixer, dsync, world); + this.poiManager = new PoiManager(path.resolve("poi"), dataFixer, dsync, world.registryAccess(), world); this.setViewDistance(viewDistance); + // Paper start + this.dataRegionManager = new io.papermc.paper.chunk.SingleThreadChunkRegionManager(this.level, 2, (1.0 / 3.0), 1, 6, "Data", DataRegionData::new, DataRegionSectionData::new); @@ -5383,7 +5383,7 @@ index aa9bde92a48ab151145c3b0a77aa8beb6ecc1b5e..d9202f7a5b17d8a5c063c8aba4ce22a5 } protected ChunkGenerator generator() { -@@ -287,6 +342,14 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -304,6 +359,14 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider } } @@ -5398,7 +5398,7 @@ index aa9bde92a48ab151145c3b0a77aa8beb6ecc1b5e..d9202f7a5b17d8a5c063c8aba4ce22a5 private CompletableFuture, ChunkHolder.ChunkLoadingFailure>> getChunkRangeFuture(ChunkPos centerChunk, int margin, IntFunction distanceToStatus) { List>> list = new ArrayList(); List list1 = new ArrayList(); -@@ -418,6 +481,11 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -435,6 +498,11 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider holder.setTicketLevel(level); } else { holder = new ChunkHolder(new ChunkPos(pos), level, this.level, this.lightEngine, this.queueSorter, this); @@ -5410,7 +5410,7 @@ index aa9bde92a48ab151145c3b0a77aa8beb6ecc1b5e..d9202f7a5b17d8a5c063c8aba4ce22a5 } this.updatingChunkMap.put(pos, holder); -@@ -535,7 +603,13 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -552,7 +620,13 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider if (completablefuture1 != completablefuture) { this.scheduleUnload(pos, holder); } else { @@ -5425,7 +5425,7 @@ index aa9bde92a48ab151145c3b0a77aa8beb6ecc1b5e..d9202f7a5b17d8a5c063c8aba4ce22a5 if (ichunkaccess instanceof LevelChunk) { ((LevelChunk) ichunkaccess).setLoaded(false); } -@@ -551,7 +625,11 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -568,7 +642,11 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider this.lightEngine.tryScheduleUpdate(); this.progressListener.onStatusChange(ichunkaccess.getPos(), (ChunkStatus) null); this.chunkSaveCooldowns.remove(ichunkaccess.getPos().toLong()); @@ -5437,15 +5437,15 @@ index aa9bde92a48ab151145c3b0a77aa8beb6ecc1b5e..d9202f7a5b17d8a5c063c8aba4ce22a5 } }; -@@ -1099,6 +1177,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1138,6 +1216,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider if (!flag1) { - this.distanceManager.addPlayer(SectionPos.of((Entity) player), player); + this.distanceManager.addPlayer(SectionPos.of((EntityAccess) player), player); } + this.addPlayerToDistanceMaps(player); // Paper - distance maps } else { SectionPos sectionposition = player.getLastSectionPos(); -@@ -1106,6 +1185,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1145,6 +1224,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider if (!flag2) { this.distanceManager.removePlayer(sectionposition, player); } @@ -5453,7 +5453,7 @@ index aa9bde92a48ab151145c3b0a77aa8beb6ecc1b5e..d9202f7a5b17d8a5c063c8aba4ce22a5 } for (int k = i - this.viewDistance - 1; k <= i + this.viewDistance + 1; ++k) { -@@ -1218,6 +1298,8 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1257,6 +1337,8 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider } } @@ -5462,7 +5462,7 @@ index aa9bde92a48ab151145c3b0a77aa8beb6ecc1b5e..d9202f7a5b17d8a5c063c8aba4ce22a5 } @Override -@@ -1421,7 +1503,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1460,7 +1542,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider public class ChunkDistanceManager extends DistanceManager { protected ChunkDistanceManager(Executor workerExecutor, Executor mainThreadExecutor) { @@ -5504,10 +5504,10 @@ index 6c98676827ceb6999f340fa2b06a0b3e1cb4cae2..f08089b8672454acf8c2309e850466b3 while (objectiterator.hasNext()) { diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -index 7c034b62dbebbbc4c9c4ceb427b1509fe8f986e3..e4d0035bbf17008642cdcc0e1dca5bae832bbbaa 100644 +index d0b3fdec88ca7e8b1a57b742c1c9b785750123e8..b0c46312dfb00c13421bb643dbf246610aff897b 100644 --- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java +++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -@@ -49,6 +49,7 @@ import net.minecraft.world.level.storage.LevelStorageSource; +@@ -50,6 +50,7 @@ import net.minecraft.world.level.storage.LevelStorageSource; public class ServerChunkCache extends ChunkSource { @@ -5515,7 +5515,7 @@ index 7c034b62dbebbbc4c9c4ceb427b1509fe8f986e3..e4d0035bbf17008642cdcc0e1dca5bae public static final List CHUNK_STATUSES = ChunkStatus.getStatusList(); private final DistanceManager distanceManager; final ServerLevel level; -@@ -67,6 +68,334 @@ public class ServerChunkCache extends ChunkSource { +@@ -68,6 +69,334 @@ public class ServerChunkCache extends ChunkSource { @Nullable @VisibleForDebug private NaturalSpawner.SpawnState lastSpawnState; @@ -5848,9 +5848,9 @@ index 7c034b62dbebbbc4c9c4ceb427b1509fe8f986e3..e4d0035bbf17008642cdcc0e1dca5bae + final io.papermc.paper.util.maplist.IteratorSafeOrderedReferenceSet entityTickingChunks = new io.papermc.paper.util.maplist.IteratorSafeOrderedReferenceSet<>(4096, 0.75f, 4096, 0.15, true); + // Paper end - public ServerChunkCache(ServerLevel world, LevelStorageSource.LevelStorageAccess session, DataFixer dataFixer, StructureManager structureManager, Executor workerExecutor, ChunkGenerator chunkGenerator, int viewDistance, int simulationDistance, boolean dsync, ChunkProgressListener worldGenerationProgressListener, ChunkStatusUpdateListener chunkStatusChangeListener, Supplier persistentStateManagerFactory) { + public ServerChunkCache(ServerLevel world, LevelStorageSource.LevelStorageAccess session, DataFixer dataFixer, StructureTemplateManager structureTemplateManager, Executor workerExecutor, ChunkGenerator chunkGenerator, int viewDistance, int simulationDistance, boolean dsync, ChunkProgressListener worldGenerationProgressListener, ChunkStatusUpdateListener chunkStatusChangeListener, Supplier persistentStateManagerFactory) { this.level = world; -@@ -119,6 +448,49 @@ public class ServerChunkCache extends ChunkSource { +@@ -120,6 +449,49 @@ public class ServerChunkCache extends ChunkSource { this.lastChunk[0] = chunk; } @@ -5901,18 +5901,18 @@ index 7c034b62dbebbbc4c9c4ceb427b1509fe8f986e3..e4d0035bbf17008642cdcc0e1dca5bae @Override public ChunkAccess getChunk(int x, int z, ChunkStatus leastStatus, boolean create) { diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 1427b76110a02cee15865173e06e7b7bb4231ae7..de0f49f3e9134c068aa479067ee2986c981167b8 100644 +index 44f6e5cfdceb30934c2aafa85dc5492677d177d7..501fd02fedf1a47da28d07fd04b63f89368723ce 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -160,6 +160,7 @@ import org.bukkit.event.server.MapInitializeEvent; - import org.bukkit.event.weather.LightningStrikeEvent; +@@ -166,6 +166,7 @@ import org.bukkit.event.weather.LightningStrikeEvent; + import org.bukkit.event.world.GenericGameEvent; import org.bukkit.event.world.TimeSkipEvent; // CraftBukkit end +import it.unimi.dsi.fastutil.ints.IntArrayList; // Paper public class ServerLevel extends Level implements WorldGenLevel { -@@ -216,6 +217,96 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -221,6 +222,96 @@ public class ServerLevel extends Level implements WorldGenLevel { return convertable.dimensionType; } @@ -6006,23 +6006,23 @@ index 1427b76110a02cee15865173e06e7b7bb4231ae7..de0f49f3e9134c068aa479067ee2986c + } + // Paper end + - // Add env and gen to constructor, WorldData -> WorldDataServer - public ServerLevel(MinecraftServer minecraftserver, Executor executor, LevelStorageSource.LevelStorageAccess convertable_conversionsession, ServerLevelData iworlddataserver, ResourceKey resourcekey, Holder holder, ChunkProgressListener worldloadlistener, ChunkGenerator chunkgenerator, boolean flag, long i, List list, boolean flag1, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider) { - // Objects.requireNonNull(minecraftserver); // CraftBukkit - decompile error + // Add env and gen to constructor, IWorldDataServer -> WorldDataServer + public ServerLevel(MinecraftServer minecraftserver, Executor executor, LevelStorageSource.LevelStorageAccess convertable_conversionsession, PrimaryLevelData iworlddataserver, ResourceKey resourcekey, LevelStem worlddimension, ChunkProgressListener worldloadlistener, boolean flag, long i, List list, boolean flag1, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider) { + // Holder holder = worlddimension.typeHolder(); // CraftBukkit - decompile error diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 43e8ef374d88cc60642a3008792a8785fbefb75a..3431a70a07c08fdc20c7a8d667e6275f212b549e 100644 +index dde3ad5a7c5a127c16e493231a6fe4a5436b5615..56996af65ef7478adb90d3b2f4cd3351fc49200b 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java -@@ -234,6 +234,8 @@ public class ServerPlayer extends Player { +@@ -241,6 +241,8 @@ public class ServerPlayer extends Player { public String kickLeaveMessage = null; // SPIGOT-3034: Forward leave message to PlayerQuitEvent // CraftBukkit end + public final com.destroystokyo.paper.util.misc.PooledLinkedHashSets.PooledObjectLinkedOpenHashSet cachedSingleHashSet; // Paper + - public ServerPlayer(MinecraftServer server, ServerLevel world, GameProfile profile) { - super(world, world.getSharedSpawnPos(), world.getSharedSpawnAngle(), profile); + public ServerPlayer(MinecraftServer server, ServerLevel world, GameProfile profile, @Nullable ProfilePublicKey publicKey) { + super(world, world.getSharedSpawnPos(), world.getSharedSpawnAngle(), profile, publicKey); this.chatVisibility = ChatVisiblity.FULL; -@@ -297,6 +299,8 @@ public class ServerPlayer extends Player { +@@ -304,6 +306,8 @@ public class ServerPlayer extends Player { this.maxUpStep = 1.0F; this.fudgeSpawnLocation(world); @@ -6044,10 +6044,10 @@ index 3a4f026c73cdd22d30bdadabbcf24bef969b73e4..0d536d72ac918fbd403397ff369d1014 private final String name; private final Comparator comparator; diff --git a/src/main/java/net/minecraft/server/level/WorldGenRegion.java b/src/main/java/net/minecraft/server/level/WorldGenRegion.java -index 0d33910768b111863816f84393613c0cc5142691..8fdda1e5805534d08c0a06b15e89d85b3d9c21e9 100644 +index ced08665126a88d68ccd7cfb858b3268ab5680c2..ba3023c7dd5b3bcf66f829fe5dc9757f96d16b45 100644 --- a/src/main/java/net/minecraft/server/level/WorldGenRegion.java +++ b/src/main/java/net/minecraft/server/level/WorldGenRegion.java -@@ -151,6 +151,26 @@ public class WorldGenRegion implements WorldGenLevel { +@@ -158,6 +158,26 @@ public class WorldGenRegion implements WorldGenLevel { return chunkX >= this.firstPos.x && chunkX <= this.lastPos.x && chunkZ >= this.firstPos.z && chunkZ <= this.lastPos.z; } @@ -6074,23 +6074,6 @@ index 0d33910768b111863816f84393613c0cc5142691..8fdda1e5805534d08c0a06b15e89d85b @Override public BlockState getBlockState(BlockPos pos) { return this.getChunk(SectionPos.blockToSectionCoord(pos.getX()), SectionPos.blockToSectionCoord(pos.getZ())).getBlockState(pos); -diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 92ca91b804b8a06299b006c67006ff1f2cd44fd3..3d9a2d4ff540f02163edd023ff86815fda5a35b8 100644 ---- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -218,9 +218,9 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser - private final MinecraftServer server; - public ServerPlayer player; - private int tickCount; -- private long keepAliveTime; -- private boolean keepAlivePending; -- private long keepAliveChallenge; -+ private long keepAliveTime; @Deprecated private void setLastPing(long lastPing) { this.keepAliveTime = lastPing;}; @Deprecated private long getLastPing() { return this.keepAliveTime;}; // Paper - OBFHELPER -+ private boolean keepAlivePending; @Deprecated private void setPendingPing(boolean isPending) { this.keepAlivePending = isPending;}; @Deprecated private boolean isPendingPing() { return this.keepAlivePending;}; // Paper - OBFHELPER -+ private long keepAliveChallenge; @Deprecated private void setKeepAliveID(long keepAliveID) { this.keepAliveChallenge = keepAliveID;}; @Deprecated private long getKeepAliveID() {return this.keepAliveChallenge; }; // Paper - OBFHELPER - // CraftBukkit start - multithreaded fields - private final AtomicInteger chatSpamTickCount = new AtomicInteger(); - // CraftBukkit end diff --git a/src/main/java/net/minecraft/util/thread/BlockableEventLoop.java b/src/main/java/net/minecraft/util/thread/BlockableEventLoop.java index 288fdbef407d11ab430d5d7026dfad148c3c1065..6fefa619299d3202158490630d62c16aef71e831 100644 --- a/src/main/java/net/minecraft/util/thread/BlockableEventLoop.java @@ -6110,10 +6093,10 @@ index 288fdbef407d11ab430d5d7026dfad148c3c1065..6fefa619299d3202158490630d62c16a @Override public void tell(R runnable) { diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 7e4e947f2be4d5ef0f6f1b3eb10a5b8d5018e918..e99f7f5eae48e635f167744394ce559ea06971ea 100644 +index b878882dc03ebf1d2f5dcbd47cac7fea88b1caa2..277a9fc7b61361f472eae171a3546c85da4f30b4 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -311,6 +311,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { +@@ -314,6 +314,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { return this.level.hasChunk((int) Math.floor(this.getX()) >> 4, (int) Math.floor(this.getZ()) >> 4); } // CraftBukkit end @@ -6126,10 +6109,10 @@ index 7e4e947f2be4d5ef0f6f1b3eb10a5b8d5018e918..e99f7f5eae48e635f167744394ce559e public Entity(EntityType type, Level world) { this.id = Entity.ENTITY_COUNTER.incrementAndGet(); diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 2f5bd8d2dd2f185c8d1d397a6bd83b46071cc6f3..c2b768c949cbf8d5e1db5a99812eb31c47194e0e 100644 +index a7a5ab0e718d2ee81fd8d3585d2d92df591deb64..ba7037a44b2fba6aafcbc4081c5c481a2cdcfd3b 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java -@@ -258,6 +258,7 @@ public abstract class LivingEntity extends Entity { +@@ -260,6 +260,7 @@ public abstract class LivingEntity extends Entity { public boolean collides = true; public Set collidableExemptions = new HashSet<>(); public boolean bukkitPickUpLoot; @@ -6138,10 +6121,10 @@ index 2f5bd8d2dd2f185c8d1d397a6bd83b46071cc6f3..c2b768c949cbf8d5e1db5a99812eb31c @Override public float getBukkitYaw() { diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java -index 0b4dd7b91faf293d876ee703207a96f7b0987f84..625641be06b7afafec59ce19ecd39c54bf840351 100644 +index 77a91fe6fd028291e9c66163714ab53f9cf031ed..decf753d088983ef6bbf32a32a6ee8d3cca3ee69 100644 --- a/src/main/java/net/minecraft/world/entity/Mob.java +++ b/src/main/java/net/minecraft/world/entity/Mob.java -@@ -237,6 +237,7 @@ public abstract class Mob extends LivingEntity { +@@ -242,6 +242,7 @@ public abstract class Mob extends LivingEntity { return this.target; } @@ -6150,7 +6133,7 @@ index 0b4dd7b91faf293d876ee703207a96f7b0987f84..625641be06b7afafec59ce19ecd39c54 // CraftBukkit start - fire event this.setTarget(target, EntityTargetEvent.TargetReason.UNKNOWN, true); diff --git a/src/main/java/net/minecraft/world/entity/PathfinderMob.java b/src/main/java/net/minecraft/world/entity/PathfinderMob.java -index 422b4730a99541b1fa64c439ec126c0cef1f3cb1..ff458abb221daaddaa734811eaaa35ea43883343 100644 +index dc8f9714311248bce3facbd879667e4c395fd5e2..2df5b50be11297941d13ec9d17001f488af11750 100644 --- a/src/main/java/net/minecraft/world/entity/PathfinderMob.java +++ b/src/main/java/net/minecraft/world/entity/PathfinderMob.java @@ -18,6 +18,8 @@ public abstract class PathfinderMob extends Mob { @@ -6163,11 +6146,11 @@ index 422b4730a99541b1fa64c439ec126c0cef1f3cb1..ff458abb221daaddaa734811eaaa35ea return this.getWalkTargetValue(pos, this.level); } diff --git a/src/main/java/net/minecraft/world/entity/monster/Monster.java b/src/main/java/net/minecraft/world/entity/monster/Monster.java -index 6c3044b6194dfd3037389d717bbe6783f58b951d..457880c9e894a83d88505cf0b7235df919eea591 100644 +index a0b5895abc88d297045e05f25bb09527991d43f0..6e0bd0eab0b06a4ac3042496bbb91292544e9f3c 100644 --- a/src/main/java/net/minecraft/world/entity/monster/Monster.java +++ b/src/main/java/net/minecraft/world/entity/monster/Monster.java -@@ -26,6 +26,7 @@ import net.minecraft.world.level.LightLayer; - import net.minecraft.world.level.ServerLevelAccessor; +@@ -27,6 +27,7 @@ import net.minecraft.world.level.ServerLevelAccessor; + import net.minecraft.world.level.dimension.DimensionType; public abstract class Monster extends PathfinderMob implements Enemy { + public org.bukkit.craftbukkit.entity.CraftMonster getBukkitMonster() { return (org.bukkit.craftbukkit.entity.CraftMonster) super.getBukkitEntity(); } // Paper @@ -6175,10 +6158,10 @@ index 6c3044b6194dfd3037389d717bbe6783f58b951d..457880c9e894a83d88505cf0b7235df9 super(type, world); this.xpReward = 5; diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java -index 62253b9fac567b515bafa06d00c6583b9ac1e216..1a52db84d9630a095347a85e136a9ad118f77325 100644 +index e7e831f0e179ec6740e6a5271d63a76a3d699159..7f778e037c1821cc45236bf2a95c28243d0ec126 100644 --- a/src/main/java/net/minecraft/world/item/ItemStack.java +++ b/src/main/java/net/minecraft/world/item/ItemStack.java -@@ -737,6 +737,25 @@ public final class ItemStack { +@@ -751,6 +751,25 @@ public final class ItemStack { return this.tag != null ? this.tag.getList("Enchantments", 10) : new ListTag(); } @@ -6204,7 +6187,7 @@ index 62253b9fac567b515bafa06d00c6583b9ac1e216..1a52db84d9630a095347a85e136a9ad1 public void setTag(@Nullable CompoundTag nbt) { this.tag = nbt; if (this.getItem().canBeDepleted()) { -@@ -1135,6 +1154,7 @@ public final class ItemStack { +@@ -1133,6 +1152,7 @@ public final class ItemStack { // CraftBukkit start @Deprecated public void setItem(Item item) { @@ -6250,18 +6233,18 @@ index 76251b5adf41f8e5bf2c07145abe3108fcde8669..8a979600b49e8a11982577fb6dd79503 FluidState getFluidState(BlockPos pos); diff --git a/src/main/java/net/minecraft/world/level/ChunkPos.java b/src/main/java/net/minecraft/world/level/ChunkPos.java -index 788f92f1ede5a6fbf47f65d6c69a7b631c9456ac..4335132883e959f0c9649d5640b703a291d8a7aa 100644 +index a3040440ed34a1c2adca2d57d458504a4a48282f..2d41f619577b41d6420159668bbab70fb6c762eb 100644 --- a/src/main/java/net/minecraft/world/level/ChunkPos.java +++ b/src/main/java/net/minecraft/world/level/ChunkPos.java -@@ -18,6 +18,7 @@ public class ChunkPos { - private static final int REGION_MASK = 31; +@@ -20,6 +20,7 @@ public class ChunkPos { + public static final int REGION_MAX_INDEX = 31; public final int x; public final int z; + public final long longKey; // Paper private static final int HASH_A = 1664525; private static final int HASH_C = 1013904223; private static final int HASH_Z_XOR = -559038737; -@@ -25,23 +26,26 @@ public class ChunkPos { +@@ -27,16 +28,19 @@ public class ChunkPos { public ChunkPos(int x, int z) { this.x = x; this.z = z; @@ -6280,6 +6263,10 @@ index 788f92f1ede5a6fbf47f65d6c69a7b631c9456ac..4335132883e959f0c9649d5640b703a2 + this.longKey = asLong(this.x, this.z); // Paper } + public static ChunkPos minFromRegion(int x, int z) { +@@ -48,10 +52,10 @@ public class ChunkPos { + } + public long toLong() { - return asLong(this.x, this.z); + return longKey; // Paper @@ -6314,10 +6301,10 @@ index 3c707d6674b2594b09503b959a31c1f4ad3981e6..db61b6b0158a9bcc0e1d735e34fe3671 public BlockState getBlockState(BlockPos pos) { return Blocks.AIR.defaultBlockState(); diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index 6ded806628f2f3fd5b357eed41990abd7e06a372..47f625a30f3f2aa95d94f571abf5af95eee68912 100644 +index 5576da91821926cdd9c5ef09534deb843986d202..914e42e983d56d9c85b1583f57afab699054f4d6 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java -@@ -83,6 +83,7 @@ import org.bukkit.craftbukkit.CraftServer; +@@ -85,6 +85,7 @@ import org.bukkit.craftbukkit.CraftServer; import org.bukkit.craftbukkit.CraftWorld; import org.bukkit.craftbukkit.SpigotTimings; // Spigot import org.bukkit.craftbukkit.block.CapturedBlockState; @@ -6325,7 +6312,7 @@ index 6ded806628f2f3fd5b357eed41990abd7e06a372..47f625a30f3f2aa95d94f571abf5af95 import org.bukkit.craftbukkit.block.data.CraftBlockData; import org.bukkit.craftbukkit.util.CraftSpawnCategory; import org.bukkit.craftbukkit.util.CraftNamespacedKey; -@@ -269,18 +270,51 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -280,18 +281,51 @@ public abstract class Level implements LevelAccessor, AutoCloseable { return y < -20000000 || y >= 20000000; } @@ -6381,7 +6368,7 @@ index 6ded806628f2f3fd5b357eed41990abd7e06a372..47f625a30f3f2aa95d94f571abf5af95 ChunkAccess ichunkaccess = this.getChunkSource().getChunk(chunkX, chunkZ, leastStatus, create); if (ichunkaccess == null && create) { -@@ -291,7 +325,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -302,7 +336,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { } @Override @@ -6390,7 +6377,7 @@ index 6ded806628f2f3fd5b357eed41990abd7e06a372..47f625a30f3f2aa95d94f571abf5af95 return this.setBlock(pos, state, flags, 512); } -@@ -596,7 +630,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -546,7 +580,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { if (this.isOutsideBuildHeight(pos)) { return Blocks.VOID_AIR.defaultBlockState(); } else { @@ -6400,7 +6387,7 @@ index 6ded806628f2f3fd5b357eed41990abd7e06a372..47f625a30f3f2aa95d94f571abf5af95 return chunk.getBlockState(pos); } diff --git a/src/main/java/net/minecraft/world/level/LevelReader.java b/src/main/java/net/minecraft/world/level/LevelReader.java -index fb6ee169e6faa0dfc402f414ada10abbad57189e..34b26ee897209034c9be4d3e61acfd18d59e5e1e 100644 +index 6d32473b64df28dfe0e668df7abb58d930d14005..4404fa3a083d7ef4578244c924fa4859b9b6edfd 100644 --- a/src/main/java/net/minecraft/world/level/LevelReader.java +++ b/src/main/java/net/minecraft/world/level/LevelReader.java @@ -19,6 +19,7 @@ import net.minecraft.world.level.levelgen.Heightmap; @@ -6464,10 +6451,10 @@ index ccf37eb05846f825d9acc874455cbbcdcdd2ecc2..138f5576a1df6714e754d9829f209f1a public WorldBorder getWorldBorder() { return this.level.getWorldBorder(); 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 42d68e0df3ff4476a248044c7a727c0c2d3b828a..2b88ea323b7e179015751e87d1a4303bffed7f51 100644 +index 6aba60bc79d373f098e97a7f9d8be0a78fb776a3..06525d7687fec5b37cd6020ad1bac998b194e89f 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 -@@ -646,14 +646,14 @@ public abstract class BlockBehaviour { +@@ -658,14 +658,14 @@ public abstract class BlockBehaviour { public abstract static class BlockStateBase extends StateHolder { @@ -6485,8 +6472,8 @@ index 42d68e0df3ff4476a248044c7a727c0c2d3b828a..2b88ea323b7e179015751e87d1a4303b private final BlockBehaviour.StatePredicate isRedstoneConductor; private final BlockBehaviour.StatePredicate isSuffocating; private final BlockBehaviour.StatePredicate isViewBlocking; -@@ -681,10 +681,18 @@ public abstract class BlockBehaviour { - this.emissiveRendering = blockbase_info.emissiveRendering; +@@ -695,10 +695,18 @@ public abstract class BlockBehaviour { + this.offsetType = (BlockBehaviour.OffsetType) blockbase_info.offsetType.apply(this.asState()); } + // Paper start @@ -6504,7 +6491,7 @@ index 42d68e0df3ff4476a248044c7a727c0c2d3b828a..2b88ea323b7e179015751e87d1a4303b } -@@ -716,8 +724,8 @@ public abstract class BlockBehaviour { +@@ -734,8 +742,8 @@ public abstract class BlockBehaviour { return this.getBlock().getOcclusionShape(this.asState(), world, pos); } @@ -6516,10 +6503,10 @@ index 42d68e0df3ff4476a248044c7a727c0c2d3b828a..2b88ea323b7e179015751e87d1a4303b public boolean useShapeForLightOcclusion() { 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 b629ce7f1aa4592748f3f47ae3637b20461549d2..847ac56f20ab9c5745f9c0fa0e6f16743ba5e471 100644 +index e71e0c7b00fa8ce2cbac9f17ac00902b05823809..91d2939bde77c52c25d2633dacc461d7284ef2d3 100644 --- a/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java +++ b/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java -@@ -61,7 +61,7 @@ public abstract class ChunkAccess implements BlockGetter, BiomeManager.NoiseBiom +@@ -58,7 +58,7 @@ public abstract class ChunkAccess implements BlockGetter, BiomeManager.NoiseBiom protected final ShortList[] postProcessing; protected volatile boolean unsaved; private volatile boolean isLightCorrect; @@ -6528,7 +6515,7 @@ index b629ce7f1aa4592748f3f47ae3637b20461549d2..847ac56f20ab9c5745f9c0fa0e6f1674 private long inhabitedTime; /** @deprecated */ @Nullable -@@ -86,7 +86,8 @@ public abstract class ChunkAccess implements BlockGetter, BiomeManager.NoiseBiom +@@ -83,7 +83,8 @@ public abstract class ChunkAccess implements BlockGetter, BiomeManager.NoiseBiom // CraftBukkit end public ChunkAccess(ChunkPos pos, UpgradeData upgradeData, LevelHeightAccessor heightLimitView, Registry biome, long inhabitedTime, @Nullable LevelChunkSection[] sectionArrayInitializer, @Nullable BlendingData blendingData) { @@ -6539,7 +6526,7 @@ index b629ce7f1aa4592748f3f47ae3637b20461549d2..847ac56f20ab9c5745f9c0fa0e6f1674 this.levelHeightAccessor = heightLimitView; this.sections = new LevelChunkSection[heightLimitView.getSectionsCount()]; 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 5015d09de59cf184c98b1ea45f25a264c6dab1b1..73a99db6c31dec822514392a6102b7f8cc3b2738 100644 +index e518e8e417f2eee43ff0847c24b6858054e7c9a9..ab986a3d1dc2f605b5b84d2b62cd97007e3a2c22 100644 --- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java +++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java @@ -25,6 +25,7 @@ import net.minecraft.nbt.CompoundTag; @@ -6661,7 +6648,7 @@ index 5015d09de59cf184c98b1ea45f25a264c6dab1b1..73a99db6c31dec822514392a6102b7f8 public LevelChunk(ServerLevel world, ProtoChunk protoChunk, @Nullable LevelChunk.PostLoadProcessor entityLoader) { this(world, protoChunk.getPos(), protoChunk.getUpgradeData(), protoChunk.unpackBlockTicks(), protoChunk.unpackFluidTicks(), protoChunk.getInhabitedTime(), protoChunk.getSections(), entityLoader, protoChunk.getBlendingData()); Iterator iterator = protoChunk.getBlockEntities().values().iterator(); -@@ -225,6 +330,18 @@ public class LevelChunk extends ChunkAccess { +@@ -233,6 +338,18 @@ public class LevelChunk extends ChunkAccess { } } @@ -6680,7 +6667,7 @@ index 5015d09de59cf184c98b1ea45f25a264c6dab1b1..73a99db6c31dec822514392a6102b7f8 @Override public FluidState getFluidState(BlockPos pos) { return this.getFluidState(pos.getX(), pos.getY(), pos.getZ()); -@@ -346,6 +463,7 @@ public class LevelChunk extends ChunkAccess { +@@ -354,6 +471,7 @@ public class LevelChunk extends ChunkAccess { return this.getBlockEntity(pos, LevelChunk.EntityCreationType.CHECK); } @@ -6688,7 +6675,7 @@ index 5015d09de59cf184c98b1ea45f25a264c6dab1b1..73a99db6c31dec822514392a6102b7f8 @Nullable public BlockEntity getBlockEntity(BlockPos pos, LevelChunk.EntityCreationType creationType) { // CraftBukkit start -@@ -515,7 +633,25 @@ public class LevelChunk extends ChunkAccess { +@@ -535,7 +653,25 @@ public class LevelChunk extends ChunkAccess { // CraftBukkit start public void loadCallback() { @@ -6714,7 +6701,7 @@ index 5015d09de59cf184c98b1ea45f25a264c6dab1b1..73a99db6c31dec822514392a6102b7f8 if (server != null) { /* * If it's a new world, the first few chunks are generated inside -@@ -554,6 +690,22 @@ public class LevelChunk extends ChunkAccess { +@@ -574,6 +710,22 @@ public class LevelChunk extends ChunkAccess { server.getPluginManager().callEvent(unloadEvent); // note: saving can be prevented, but not forced if no saving is actually required this.mustNotSave = !unloadEvent.isSaveChunk(); @@ -6738,7 +6725,7 @@ index 5015d09de59cf184c98b1ea45f25a264c6dab1b1..73a99db6c31dec822514392a6102b7f8 @Override 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 28e02151cb56141545c27d0cd9723e742fc420ad..ee0be5163811ea39efcb2092e5f126c3fd9b1523 100644 +index c5af1f7521d87fd5344e01e034c16065ca60d962..3b11824a1b85da437eec108f631eacfb5192459e 100644 --- a/src/main/java/net/minecraft/world/level/chunk/ProtoChunk.java +++ b/src/main/java/net/minecraft/world/level/chunk/ProtoChunk.java @@ -74,6 +74,18 @@ public class ProtoChunk extends ChunkAccess { @@ -6983,7 +6970,7 @@ index 0000000000000000000000000000000000000000..909b2c98e7a9117d2f737245e4661792 + } +} diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index c7b636889cef5c4b3bf0abc3cbf9873baa4f60ad..6e990ab85b1510a952de931a0ae4f5b6356da13f 100644 +index 3e5aba82640e6e5b55c5dc873019b6a36457dd2b..0d0a5b436ff68d49cf7a043127818bd474562b4b 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java @@ -100,8 +100,17 @@ public final class CraftMagicNumbers implements UnsafeValues { @@ -7020,10 +7007,10 @@ index c7b636889cef5c4b3bf0abc3cbf9873baa4f60ad..6e990ab85b1510a952de931a0ae4f5b6 public static byte toLegacyData(BlockState data) { diff --git a/src/main/java/org/bukkit/craftbukkit/util/DummyGeneratorAccess.java b/src/main/java/org/bukkit/craftbukkit/util/DummyGeneratorAccess.java -index b8d50fd20fea9f84af77de69391d670c7b6cf132..13e887e9d06c3eb8649613d1ecb3d26de6b9d6ef 100644 +index 06da639663ead833c620a03d47fa9169c4509183..3bedc22c253c3632b5624c05e78ed3671e5d30ce 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/DummyGeneratorAccess.java +++ b/src/main/java/org/bukkit/craftbukkit/util/DummyGeneratorAccess.java -@@ -205,7 +205,23 @@ public class DummyGeneratorAccess implements WorldGenLevel { +@@ -208,7 +208,23 @@ public class DummyGeneratorAccess implements WorldGenLevel { public FluidState getFluidState(BlockPos pos) { return Fluids.EMPTY.defaultFluidState(); // SPIGOT-6634 } diff --git a/patches/unapplied/server/0008-Adventure.patch b/patches/server/0008-Adventure.patch similarity index 93% rename from patches/unapplied/server/0008-Adventure.patch rename to patches/server/0008-Adventure.patch index c721cded2e..318003319d 100644 --- a/patches/unapplied/server/0008-Adventure.patch +++ b/patches/server/0008-Adventure.patch @@ -1059,10 +1059,10 @@ index 0000000000000000000000000000000000000000..2dc92d8d2764d3e9b621d5c7d5e30c30 + } +} diff --git a/src/main/java/net/minecraft/ChatFormatting.java b/src/main/java/net/minecraft/ChatFormatting.java -index 9143392884801e952a96cb5e7b761c7a827fa648..3a13544bc3b8f8dc6a38aacb6af99b25365dd6d1 100644 +index 98f2def9125d6faf5859572a004fa8d2fa066417..436f381c727cda72c04859c540dce4715b445390 100644 --- a/src/main/java/net/minecraft/ChatFormatting.java +++ b/src/main/java/net/minecraft/ChatFormatting.java -@@ -110,6 +110,18 @@ public enum ChatFormatting { +@@ -113,6 +113,18 @@ public enum ChatFormatting implements StringRepresentable { return name == null ? null : FORMATTING_BY_NAME.get(cleanName(name)); } @@ -1082,10 +1082,10 @@ index 9143392884801e952a96cb5e7b761c7a827fa648..3a13544bc3b8f8dc6a38aacb6af99b25 public static ChatFormatting getById(int colorIndex) { if (colorIndex < 0) { diff --git a/src/main/java/net/minecraft/network/FriendlyByteBuf.java b/src/main/java/net/minecraft/network/FriendlyByteBuf.java -index d5d94ea8070ab5f66f0a3244a5a953b9c9d5c527..0053474ab7c25de6d86c16e3079feb21f75d1c11 100644 +index c4854debe11b8bb61fa49c76c1854f94c1e7777f..42514a0c7066dc79050c0496d6463528b593f9e4 100644 --- a/src/main/java/net/minecraft/network/FriendlyByteBuf.java +++ b/src/main/java/net/minecraft/network/FriendlyByteBuf.java -@@ -14,6 +14,7 @@ import io.netty.handler.codec.EncoderException; +@@ -18,6 +18,7 @@ import io.netty.handler.codec.EncoderException; import io.netty.util.ByteProcessor; import it.unimi.dsi.fastutil.ints.IntArrayList; import it.unimi.dsi.fastutil.ints.IntList; @@ -1093,16 +1093,16 @@ index d5d94ea8070ab5f66f0a3244a5a953b9c9d5c527..0053474ab7c25de6d86c16e3079feb21 import java.io.DataOutput; import java.io.IOException; import java.io.InputStream; -@@ -61,6 +62,7 @@ public class FriendlyByteBuf extends ByteBuf { +@@ -75,6 +76,7 @@ public class FriendlyByteBuf extends ByteBuf { private static final int MAX_VARLONG_SIZE = 10; private static final int DEFAULT_NBT_QUOTA = 2097152; private final ByteBuf source; + public java.util.Locale adventure$locale; // Paper public static final short MAX_STRING_LENGTH = 32767; public static final int MAX_COMPONENT_STRING_LENGTH = 262144; - -@@ -350,8 +352,15 @@ public class FriendlyByteBuf extends ByteBuf { - return Component.Serializer.fromJson(this.readUtf(262144)); + private static final int PUBLIC_KEY_SIZE = 256; +@@ -433,8 +435,15 @@ public class FriendlyByteBuf extends ByteBuf { + } } + // Paper start @@ -1139,7 +1139,7 @@ index 021a26a6b1c258deffc26c035ab52a4ea027d9a1..00d432bd395e7f7fb6ee24e371818d13 try { int i = friendlyByteBuf.writerIndex(); diff --git a/src/main/java/net/minecraft/network/chat/Component.java b/src/main/java/net/minecraft/network/chat/Component.java -index 4d664338f3d5570fd0133ace6b297d70045b34a7..984105c226f16746b43bb2d2932e0b87f3a6a70c 100644 +index d19b8ccc791c3f135603b950008136ae6d2f0bfb..bbfb98618a0b87406cc48465bdda15a0a4974b7e 100644 --- a/src/main/java/net/minecraft/network/chat/Component.java +++ b/src/main/java/net/minecraft/network/chat/Component.java @@ -1,6 +1,7 @@ @@ -1150,7 +1150,7 @@ index 4d664338f3d5570fd0133ace6b297d70045b34a7..984105c226f16746b43bb2d2932e0b87 import com.google.gson.Gson; import com.google.gson.GsonBuilder; import com.google.gson.JsonArray; -@@ -161,6 +162,7 @@ public interface Component extends Message, FormattedText, Iterable { +@@ -200,6 +201,7 @@ public interface Component extends Message, FormattedText, Iterable { GsonBuilder gsonbuilder = new GsonBuilder(); gsonbuilder.disableHtmlEscaping(); @@ -1158,7 +1158,7 @@ index 4d664338f3d5570fd0133ace6b297d70045b34a7..984105c226f16746b43bb2d2932e0b87 gsonbuilder.registerTypeHierarchyAdapter(Component.class, new Component.Serializer()); gsonbuilder.registerTypeHierarchyAdapter(Style.class, new Style.Serializer()); gsonbuilder.registerTypeAdapterFactory(new LowerCaseEnumTypeAdapterFactory()); -@@ -320,6 +322,7 @@ public interface Component extends Message, FormattedText, Iterable { +@@ -375,6 +377,7 @@ public interface Component extends Message, FormattedText, Iterable { } public JsonElement serialize(Component ichatbasecomponent, Type type, JsonSerializationContext jsonserializationcontext) { @@ -1166,30 +1166,43 @@ index 4d664338f3d5570fd0133ace6b297d70045b34a7..984105c226f16746b43bb2d2932e0b87 JsonObject jsonobject = new JsonObject(); if (!ichatbasecomponent.getStyle().isEmpty()) { -diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundChatPacket.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundChatPacket.java -index 743db7bfc58ff9e90a1b6d20d1bf64ecb6906327..f4f52e43852d2b0b56770c3f747a655a3a6dd683 100644 ---- a/src/main/java/net/minecraft/network/protocol/game/ClientboundChatPacket.java -+++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundChatPacket.java -@@ -10,6 +10,7 @@ import net.minecraft.network.protocol.Packet; - public class ClientboundChatPacket implements Packet { +diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundPlayerChatPacket.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundPlayerChatPacket.java +index fc2d39d93f88d71af503c20c497be7385ec312eb..4a3279f9053a3baaa3dd61c53e1bfbbf72f2dadb 100644 +--- a/src/main/java/net/minecraft/network/protocol/game/ClientboundPlayerChatPacket.java ++++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundPlayerChatPacket.java +@@ -14,9 +14,15 @@ import net.minecraft.network.chat.PlayerChatMessage; + import net.minecraft.network.protocol.Packet; + import net.minecraft.util.Crypt; - private final Component message; -+ public net.kyori.adventure.text.Component adventure$message; // Paper - public net.md_5.bungee.api.chat.BaseComponent[] components; // Spigot - private final ChatType type; - private final UUID sender; -@@ -28,6 +29,11 @@ public class ClientboundChatPacket implements Packet { +-public record ClientboundPlayerChatPacket(Component signedContent, Optional unsignedContent, int typeId, ChatSender sender, Instant timeStamp, Crypt.SaltSignaturePair saltSignature) implements Packet { ++// Paper start ++public record ClientboundPlayerChatPacket(@org.jetbrains.annotations.Nullable net.kyori.adventure.text.Component adventure$message, Component signedContent, Optional unsignedContent, int typeId, ChatSender sender, Instant timeStamp, Crypt.SaltSignaturePair saltSignature) implements Packet { + private static final Duration MESSAGE_EXPIRES_AFTER = ServerboundChatPacket.MESSAGE_EXPIRES_AFTER.plus(Duration.ofMinutes(2L)); ++ public ClientboundPlayerChatPacket(Component signedContent, Optional unsignedContent, int typeId, ChatSender sender, Instant timeStamp, Crypt.SaltSignaturePair saltSignature) { ++ this(null, signedContent, unsignedContent, typeId, sender, timeStamp, saltSignature); ++ } ++ // Paper end ++ + public ClientboundPlayerChatPacket(FriendlyByteBuf buf) { + this(buf.readComponent(), buf.readOptional(FriendlyByteBuf::readComponent), buf.readVarInt(), new ChatSender(buf), buf.readInstant(), new Crypt.SaltSignaturePair(buf)); + } +@@ -24,7 +30,15 @@ public record ClientboundPlayerChatPacket(Component signedContent, Optional { ++public record ClientboundSystemChatPacket(@org.jetbrains.annotations.Nullable net.kyori.adventure.text.Component adventure$message, String content, int typeId) implements Packet { ++ ++ public ClientboundSystemChatPacket(String content, int typeId) { ++ this(null, content, typeId); ++ } + + public ClientboundSystemChatPacket(Component content, int typeId) { +- this(Component.Serializer.toJson(content), typeId); ++ this(null, Component.Serializer.toJson(content), typeId); + } + + public ClientboundSystemChatPacket(net.md_5.bungee.api.chat.BaseComponent[] content, int typeId) { +- this(net.md_5.bungee.chat.ComponentSerializer.toString(content), typeId); ++ this(null, net.md_5.bungee.chat.ComponentSerializer.toString(content), typeId); + } + // Spigot end ++ // Paper end + + public ClientboundSystemChatPacket(FriendlyByteBuf buf) { + this(buf.readComponent(), buf.readVarInt()); +@@ -26,7 +32,13 @@ public record ClientboundSystemChatPacket(String content, int typeId) implements + + @Override + public void write(FriendlyByteBuf buf) { +- buf.writeUtf(this.content, 262144); // Spigot ++ // Paper start ++ if (adventure$message != null) { ++ buf.writeComponent(this.adventure$message); ++ } else { ++ buf.writeUtf(this.content, 262144); // Spigot ++ } ++ // Paper end + buf.writeVarInt(this.typeId); + } + diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundTabListPacket.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundTabListPacket.java index 762a9392ffac3042356709dddd15bb3516048bed..3544e2dc2522e9d6305d727d56e73490015662c2 100644 --- a/src/main/java/net/minecraft/network/protocol/game/ClientboundTabListPacket.java @@ -1292,10 +1351,10 @@ index 762a9392ffac3042356709dddd15bb3516048bed..3544e2dc2522e9d6305d727d56e73490 buf.writeComponent(this.footer); } diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 3431a70a07c08fdc20c7a8d667e6275f212b549e..d4d444b5864073fe86bfc7b5a68344b5aae8c05f 100644 +index 56996af65ef7478adb90d3b2f4cd3351fc49200b..7002d5f5700570e32ebf0b63e340d87d58357162 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java -@@ -145,6 +145,7 @@ import net.minecraft.world.scores.Score; +@@ -152,6 +152,7 @@ import net.minecraft.world.scores.Score; import net.minecraft.world.scores.Scoreboard; import net.minecraft.world.scores.Team; import net.minecraft.world.scores.criteria.ObjectiveCriteria; @@ -1303,7 +1362,7 @@ index 3431a70a07c08fdc20c7a8d667e6275f212b549e..d4d444b5864073fe86bfc7b5a68344b5 import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.WeatherType; -@@ -221,6 +222,7 @@ public class ServerPlayer extends Player { +@@ -228,6 +229,7 @@ public class ServerPlayer extends Player { // CraftBukkit start public String displayName; @@ -1311,7 +1370,7 @@ index 3431a70a07c08fdc20c7a8d667e6275f212b549e..d4d444b5864073fe86bfc7b5a68344b5 public Component listName; public org.bukkit.Location compassTarget; public int newExp = 0; -@@ -303,6 +305,7 @@ public class ServerPlayer extends Player { +@@ -310,6 +312,7 @@ public class ServerPlayer extends Player { // CraftBukkit start this.displayName = this.getScoreboardName(); @@ -1319,7 +1378,7 @@ index 3431a70a07c08fdc20c7a8d667e6275f212b549e..d4d444b5864073fe86bfc7b5a68344b5 this.bukkitPickUpLoot = true; this.maxHealthCache = this.getMaxHealth(); } -@@ -778,22 +781,17 @@ public class ServerPlayer extends Player { +@@ -786,22 +789,17 @@ public class ServerPlayer extends Player { String deathmessage = defaultMessage.getString(); this.keepLevel = keepInventory; // SPIGOT-2222: pre-set keepLevel @@ -1346,7 +1405,7 @@ index 3431a70a07c08fdc20c7a8d667e6275f212b549e..d4d444b5864073fe86bfc7b5a68344b5 this.connection.send(new ClientboundPlayerCombatKillPacket(this.getCombatTracker(), ichatbasecomponent), (future) -> { if (!future.isSuccess()) { -@@ -1735,6 +1733,7 @@ public class ServerPlayer extends Player { +@@ -1757,6 +1755,7 @@ public class ServerPlayer extends Player { } public String locale = "en_us"; // CraftBukkit - add, lowercase @@ -1354,7 +1413,7 @@ index 3431a70a07c08fdc20c7a8d667e6275f212b549e..d4d444b5864073fe86bfc7b5a68344b5 public void updateOptions(ServerboundClientInformationPacket packet) { // CraftBukkit start if (getMainArm() != packet.mainHand()) { -@@ -1746,6 +1745,10 @@ public class ServerPlayer extends Player { +@@ -1768,6 +1767,10 @@ public class ServerPlayer extends Player { this.server.server.getPluginManager().callEvent(event); } this.locale = packet.language; @@ -1366,10 +1425,10 @@ index 3431a70a07c08fdc20c7a8d667e6275f212b549e..d4d444b5864073fe86bfc7b5a68344b5 // CraftBukkit end this.chatVisibility = packet.chatVisibility(); diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 3d9a2d4ff540f02163edd023ff86815fda5a35b8..9dd29a669a10735819d3be03e4693850de58bb28 100644 +index 2cbe0230173ad391fe70b0a31d8999927461b5e6..bf00219f3795c0e303960dae3123d1cc6f5b7837 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -155,6 +155,8 @@ import org.apache.commons.lang3.StringUtils; +@@ -172,6 +172,8 @@ import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; // CraftBukkit start @@ -1378,7 +1437,7 @@ index 3d9a2d4ff540f02163edd023ff86815fda5a35b8..9dd29a669a10735819d3be03e4693850 import java.util.concurrent.ExecutionException; import java.util.concurrent.atomic.AtomicInteger; import net.minecraft.world.entity.animal.Bucketable; -@@ -384,21 +386,24 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -412,21 +414,24 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser return this.server.isSingleplayerOwner(this.player.getGameProfile()); } @@ -1411,7 +1470,7 @@ index 3d9a2d4ff540f02163edd023ff86815fda5a35b8..9dd29a669a10735819d3be03e4693850 if (this.cserver.getServer().isRunning()) { this.cserver.getPluginManager().callEvent(event); -@@ -410,8 +415,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -438,8 +443,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser } this.player.kickLeaveMessage = event.getLeaveMessage(); // CraftBukkit - SPIGOT-3034: Forward leave message to PlayerQuitEvent // Send the possibly modified leave message @@ -1421,7 +1480,7 @@ index 3d9a2d4ff540f02163edd023ff86815fda5a35b8..9dd29a669a10735819d3be03e4693850 // CraftBukkit end this.connection.send(new ClientboundDisconnectPacket(ichatbasecomponent), (future) -> { -@@ -1686,9 +1690,11 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -1719,9 +1723,11 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser */ this.player.disconnect(); @@ -1436,7 +1495,7 @@ index 3d9a2d4ff540f02163edd023ff86815fda5a35b8..9dd29a669a10735819d3be03e4693850 } // CraftBukkit end this.player.getTextFilter().leave(); -@@ -1870,7 +1876,12 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -1946,7 +1952,12 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser this.handleCommand(s); } else if (this.player.getChatVisibility() == ChatVisiblity.SYSTEM) { // Do nothing, this is coming from a plugin @@ -1450,7 +1509,7 @@ index 3d9a2d4ff540f02163edd023ff86815fda5a35b8..9dd29a669a10735819d3be03e4693850 Player player = this.getCraftPlayer(); AsyncPlayerChatEvent event = new AsyncPlayerChatEvent(async, player, s, new LazyPlayerSet(this.server)); this.cserver.getPluginManager().callEvent(event); -@@ -2669,30 +2680,30 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -2860,30 +2871,30 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser return; } @@ -1464,15 +1523,14 @@ index 3d9a2d4ff540f02163edd023ff86815fda5a35b8..9dd29a669a10735819d3be03e4693850 + List lines = new java.util.ArrayList<>(); for (int i = 0; i < signText.size(); ++i) { -- TextFilter.FilteredText itextfilter_a = (TextFilter.FilteredText) signText.get(i); -+ TextFilter.FilteredText currentLine = signText.get(i); + FilteredText filteredtext = (signText.get(i)).map(Component::literal); // CraftBukkit - decompile error if (this.player.isTextFilteringEnabled()) { -- lines[i] = ChatFormatting.stripFormatting(new TextComponent(ChatFormatting.stripFormatting(itextfilter_a.getFiltered())).getString()); -+ lines.add(net.kyori.adventure.text.Component.text(currentLine.getFiltered())); +- lines[i] = ChatFormatting.stripFormatting(filteredtext.filteredOrElse(CommonComponents.EMPTY).getString()); ++ lines.add(net.kyori.adventure.text.Component.text(filteredtext.filteredOrElse(CommonComponents.EMPTY).getString())); // Paper - adventure } else { -- lines[i] = ChatFormatting.stripFormatting(new TextComponent(ChatFormatting.stripFormatting(itextfilter_a.getRaw())).getString()); -+ lines.add(net.kyori.adventure.text.Component.text(currentLine.getRaw())); +- lines[i] = ChatFormatting.stripFormatting(filteredtext.raw().getString()); ++ lines.add(net.kyori.adventure.text.Component.text(filteredtext.raw().getString())); // Paper - adventure } } SignChangeEvent event = new SignChangeEvent((org.bukkit.craftbukkit.block.CraftBlock) player.getWorld().getBlockAt(x, y, z), this.player.getBukkitEntity(), lines); @@ -1490,10 +1548,10 @@ index 3d9a2d4ff540f02163edd023ff86815fda5a35b8..9dd29a669a10735819d3be03e4693850 } // CraftBukkit end diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java -index 2b9b60c0010069916dbecd22efdb9cec71180363..627931ec09bfb1a84f0659981491cf3b6425aa32 100644 +index fc2910ee691da96591811e4c97987ebd2cb93ac3..ff8773f3671970bd759303f7a4bbc17d4df5a1de 100644 --- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java -@@ -323,7 +323,7 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener +@@ -377,7 +377,7 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener if (PlayerPreLoginEvent.getHandlerList().getRegisteredListeners().length != 0) { final PlayerPreLoginEvent event = new PlayerPreLoginEvent(playerName, address, uniqueId); if (asyncEvent.getResult() != PlayerPreLoginEvent.Result.ALLOWED) { @@ -1502,7 +1560,7 @@ index 2b9b60c0010069916dbecd22efdb9cec71180363..627931ec09bfb1a84f0659981491cf3b } Waitable waitable = new Waitable() { @Override -@@ -334,12 +334,12 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener +@@ -388,12 +388,12 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener ServerLoginPacketListenerImpl.this.server.processQueue.add(waitable); if (waitable.get() != PlayerPreLoginEvent.Result.ALLOWED) { @@ -1518,10 +1576,10 @@ index 2b9b60c0010069916dbecd22efdb9cec71180363..627931ec09bfb1a84f0659981491cf3b } } diff --git a/src/main/java/net/minecraft/server/network/ServerStatusPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerStatusPacketListenerImpl.java -index c9a8d64ef23def0ad8e986a97c34331b8d54c205..2b24a41587fbe1fba70a0ab42d3dc33358f2ba2e 100644 +index 8670f3fab7ec2a80d69e5dd3f945fc15aaa1a36f..5d368e34c90fc5191d9ed2352f7aa44c4a299eed 100644 --- a/src/main/java/net/minecraft/server/network/ServerStatusPacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerStatusPacketListenerImpl.java -@@ -55,7 +55,7 @@ public class ServerStatusPacketListenerImpl implements ServerStatusPacketListene +@@ -54,7 +54,7 @@ public class ServerStatusPacketListenerImpl implements ServerStatusPacketListene CraftIconCache icon = server.server.getServerIcon(); ServerListPingEvent() { @@ -1531,7 +1589,7 @@ index c9a8d64ef23def0ad8e986a97c34331b8d54c205..2b24a41587fbe1fba70a0ab42d3dc333 @Override diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index 60b4044e3d914ff83a4f37499e278fbcbc65e5c1..fbe28ea0fd3bf85b564cf6156e1a2a7efa75822d 100644 +index 2fc5519020af0f18e93bf11cc0d33f65f1b23b55..821b9c0ba003163195a461dd0bce1fa9ffd0a146 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -8,6 +8,7 @@ import com.mojang.logging.LogUtils; @@ -1542,7 +1600,7 @@ index 60b4044e3d914ff83a4f37499e278fbcbc65e5c1..fbe28ea0fd3bf85b564cf6156e1a2a7e import java.io.File; import java.net.SocketAddress; import java.nio.file.Path; -@@ -90,6 +91,7 @@ import net.minecraft.world.scores.Team; +@@ -100,6 +101,7 @@ import net.minecraft.world.scores.Team; import org.slf4j.Logger; // CraftBukkit start @@ -1550,21 +1608,21 @@ index 60b4044e3d914ff83a4f37499e278fbcbc65e5c1..fbe28ea0fd3bf85b564cf6156e1a2a7e import com.google.common.base.Predicate; import java.util.stream.Collectors; import net.minecraft.server.dedicated.DedicatedServer; -@@ -258,7 +260,7 @@ public abstract class PlayerList { +@@ -262,7 +264,7 @@ public abstract class PlayerList { } // CraftBukkit start - chatmessage.withStyle(ChatFormatting.YELLOW); -- String joinMessage = CraftChatMessage.fromComponent(chatmessage); -+ Component joinMessage = chatmessage; // Paper - Adventure + ichatmutablecomponent.withStyle(ChatFormatting.YELLOW); +- String joinMessage = CraftChatMessage.fromComponent(ichatmutablecomponent); ++ Component joinMessage = ichatmutablecomponent; // Paper - Adventure playerconnection.teleport(player.getX(), player.getY(), player.getZ(), player.getYRot(), player.getXRot()); this.players.add(player); -@@ -272,19 +274,18 @@ public abstract class PlayerList { +@@ -276,19 +278,18 @@ public abstract class PlayerList { // Ensure that player inventory is populated with its viewer player.containerMenu.transferTo(player.containerMenu, bukkitPlayer); - PlayerJoinEvent playerJoinEvent = new PlayerJoinEvent(bukkitPlayer, joinMessage); -+ PlayerJoinEvent playerJoinEvent = new PlayerJoinEvent(bukkitPlayer, PaperAdventure.asAdventure(chatmessage)); // Paper - Adventure ++ PlayerJoinEvent playerJoinEvent = new PlayerJoinEvent(bukkitPlayer, PaperAdventure.asAdventure(ichatmutablecomponent)); // Paper - Adventure this.cserver.getPluginManager().callEvent(playerJoinEvent); if (!player.connection.connection.isConnected()) { @@ -1576,15 +1634,15 @@ index 60b4044e3d914ff83a4f37499e278fbcbc65e5c1..fbe28ea0fd3bf85b564cf6156e1a2a7e - if (joinMessage != null && joinMessage.length() > 0) { - for (Component line : org.bukkit.craftbukkit.util.CraftChatMessage.fromString(joinMessage)) { -- this.server.getPlayerList().broadcastAll(new ClientboundChatPacket(line, ChatType.SYSTEM, Util.NIL_UUID)); +- this.server.getPlayerList().broadcastSystemMessage(line, ChatType.SYSTEM); - } + if (jm != null && !jm.equals(net.kyori.adventure.text.Component.empty())) { // Paper - Adventure + joinMessage = PaperAdventure.asVanilla(jm); // Paper - Adventure -+ this.server.getPlayerList().broadcastAll(new ClientboundChatPacket(joinMessage, ChatType.SYSTEM, Util.NIL_UUID)); // Paper - Adventure ++ this.server.getPlayerList().broadcastSystemMessage(joinMessage, ChatType.SYSTEM); // Paper - Adventure } // CraftBukkit end -@@ -481,7 +482,7 @@ public abstract class PlayerList { +@@ -485,7 +486,7 @@ public abstract class PlayerList { } @@ -1593,7 +1651,7 @@ index 60b4044e3d914ff83a4f37499e278fbcbc65e5c1..fbe28ea0fd3bf85b564cf6156e1a2a7e ServerLevel worldserver = entityplayer.getLevel(); entityplayer.awardStat(Stats.LEAVE_GAME); -@@ -492,7 +493,7 @@ public abstract class PlayerList { +@@ -496,7 +497,7 @@ public abstract class PlayerList { entityplayer.closeContainer(); } @@ -1602,7 +1660,7 @@ index 60b4044e3d914ff83a4f37499e278fbcbc65e5c1..fbe28ea0fd3bf85b564cf6156e1a2a7e this.cserver.getPluginManager().callEvent(playerQuitEvent); entityplayer.getBukkitEntity().disconnect(playerQuitEvent.getQuitMessage()); -@@ -545,7 +546,7 @@ public abstract class PlayerList { +@@ -549,7 +550,7 @@ public abstract class PlayerList { this.cserver.getScoreboardManager().removePlayer(entityplayer.getBukkitEntity()); // CraftBukkit end @@ -1611,27 +1669,27 @@ index 60b4044e3d914ff83a4f37499e278fbcbc65e5c1..fbe28ea0fd3bf85b564cf6156e1a2a7e } // CraftBukkit start - Whole method, SocketAddress to LoginListener, added hostname to signature, return EntityPlayer -@@ -591,10 +592,10 @@ public abstract class PlayerList { +@@ -595,10 +596,10 @@ public abstract class PlayerList { } // return chatmessage; -- event.disallow(PlayerLoginEvent.Result.KICK_BANNED, CraftChatMessage.fromComponent(chatmessage)); -+ event.disallow(PlayerLoginEvent.Result.KICK_BANNED, PaperAdventure.asAdventure(chatmessage)); // Paper - Adventure +- event.disallow(PlayerLoginEvent.Result.KICK_BANNED, CraftChatMessage.fromComponent(ichatmutablecomponent)); ++ event.disallow(PlayerLoginEvent.Result.KICK_BANNED, PaperAdventure.asAdventure(ichatmutablecomponent)); // Paper - Adventure } else if (!this.isWhiteListed(gameprofile)) { - chatmessage = new TranslatableComponent("multiplayer.disconnect.not_whitelisted"); + ichatmutablecomponent = Component.translatable("multiplayer.disconnect.not_whitelisted"); - event.disallow(PlayerLoginEvent.Result.KICK_WHITELIST, org.spigotmc.SpigotConfig.whitelistMessage); // Spigot + event.disallow(PlayerLoginEvent.Result.KICK_WHITELIST, net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(org.spigotmc.SpigotConfig.whitelistMessage)); // Spigot // Paper - Adventure } else if (this.getIpBans().isBanned(socketaddress) && !this.getIpBans().get(socketaddress).hasExpired()) { IpBanListEntry ipbanentry = this.ipBans.get(socketaddress); -@@ -604,17 +605,17 @@ public abstract class PlayerList { +@@ -608,17 +609,17 @@ public abstract class PlayerList { } // return chatmessage; -- event.disallow(PlayerLoginEvent.Result.KICK_BANNED, CraftChatMessage.fromComponent(chatmessage)); -+ event.disallow(PlayerLoginEvent.Result.KICK_BANNED, PaperAdventure.asAdventure(chatmessage)); // Paper - Adventure +- event.disallow(PlayerLoginEvent.Result.KICK_BANNED, CraftChatMessage.fromComponent(ichatmutablecomponent)); ++ event.disallow(PlayerLoginEvent.Result.KICK_BANNED, PaperAdventure.asAdventure(ichatmutablecomponent)); // Paper - Adventure } else { - // return this.players.size() >= this.maxPlayers && !this.canBypassPlayerLimit(gameprofile) ? new ChatMessage("multiplayer.disconnect.server_full") : null; + // return this.players.size() >= this.maxPlayers && !this.canBypassPlayerLimit(gameprofile) ? IChatBaseComponent.translatable("multiplayer.disconnect.server_full") : null; if (this.players.size() >= this.maxPlayers && !this.canBypassPlayerLimit(gameprofile)) { - event.disallow(PlayerLoginEvent.Result.KICK_FULL, org.spigotmc.SpigotConfig.serverFullMessage); // Spigot + event.disallow(PlayerLoginEvent.Result.KICK_FULL, net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(org.spigotmc.SpigotConfig.serverFullMessage)); // Spigot // Paper - Adventure @@ -1645,7 +1703,7 @@ index 60b4044e3d914ff83a4f37499e278fbcbc65e5c1..fbe28ea0fd3bf85b564cf6156e1a2a7e return null; } return entity; -@@ -1122,7 +1123,7 @@ public abstract class PlayerList { +@@ -1126,7 +1127,7 @@ public abstract class PlayerList { public void removeAll() { // CraftBukkit start - disconnect safely for (ServerPlayer player : this.players) { @@ -1764,10 +1822,10 @@ index 595b56b2ab9a813ba71399d306117294fa90dc65..3527d40102d512d0e276edc969ea3c18 } collection = icons; diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 66e8fea6bd10af2e19a4f49c556e66a63e6205b6..81e78644417764cee33f81cdb116a91fb1d8ccf3 100644 +index daf5dc59a1883570569798630c4991e676e34c1c..5408ba255ee04b75e2f4977fc7aa73866945037c 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -586,8 +586,10 @@ public final class CraftServer implements Server { +@@ -581,8 +581,10 @@ public final class CraftServer implements Server { } @Override @@ -1778,7 +1836,7 @@ index 66e8fea6bd10af2e19a4f49c556e66a63e6205b6..81e78644417764cee33f81cdb116a91f } @Override -@@ -1421,7 +1423,15 @@ public final class CraftServer implements Server { +@@ -1404,7 +1406,15 @@ public final class CraftServer implements Server { return this.configuration.getInt("settings.spawn-radius", -1); } @@ -1794,7 +1852,7 @@ index 66e8fea6bd10af2e19a4f49c556e66a63e6205b6..81e78644417764cee33f81cdb116a91f public String getShutdownMessage() { return this.configuration.getString("settings.shutdown-message"); } -@@ -1579,7 +1589,20 @@ public final class CraftServer implements Server { +@@ -1562,7 +1572,20 @@ public final class CraftServer implements Server { } @Override @@ -1815,7 +1873,7 @@ index 66e8fea6bd10af2e19a4f49c556e66a63e6205b6..81e78644417764cee33f81cdb116a91f Set recipients = new HashSet<>(); for (Permissible permissible : this.getPluginManager().getPermissionSubscriptions(permission)) { if (permissible instanceof CommandSender && permissible.hasPermission(permission)) { -@@ -1587,14 +1610,14 @@ public final class CraftServer implements Server { +@@ -1570,14 +1593,14 @@ public final class CraftServer implements Server { } } @@ -1832,7 +1890,7 @@ index 66e8fea6bd10af2e19a4f49c556e66a63e6205b6..81e78644417764cee33f81cdb116a91f for (CommandSender recipient : recipients) { recipient.sendMessage(message); -@@ -1845,6 +1868,14 @@ public final class CraftServer implements Server { +@@ -1828,6 +1851,14 @@ public final class CraftServer implements Server { return CraftInventoryCreator.INSTANCE.createInventory(owner, type); } @@ -1847,7 +1905,7 @@ index 66e8fea6bd10af2e19a4f49c556e66a63e6205b6..81e78644417764cee33f81cdb116a91f @Override public Inventory createInventory(InventoryHolder owner, InventoryType type, String title) { Validate.isTrue(type.isCreatable(), "Cannot open an inventory of type ", type); -@@ -1857,13 +1888,28 @@ public final class CraftServer implements Server { +@@ -1840,13 +1871,28 @@ public final class CraftServer implements Server { return CraftInventoryCreator.INSTANCE.createInventory(owner, size); } @@ -1876,7 +1934,7 @@ index 66e8fea6bd10af2e19a4f49c556e66a63e6205b6..81e78644417764cee33f81cdb116a91f public Merchant createMerchant(String title) { return new CraftMerchantCustom(title == null ? InventoryType.MERCHANT.getDefaultTitle() : title); } -@@ -1923,6 +1969,12 @@ public final class CraftServer implements Server { +@@ -1906,6 +1952,12 @@ public final class CraftServer implements Server { return Thread.currentThread().equals(console.serverThread) || this.console.hasStopped() || !org.spigotmc.AsyncCatcher.enabled; // All bets are off if we have shut down (e.g. due to watchdog) } @@ -1889,7 +1947,7 @@ index 66e8fea6bd10af2e19a4f49c556e66a63e6205b6..81e78644417764cee33f81cdb116a91f @Override public String getMotd() { return this.console.getMotd(); -@@ -2370,5 +2422,15 @@ public final class CraftServer implements Server { +@@ -2353,5 +2405,15 @@ public final class CraftServer implements Server { return null; } } @@ -1906,10 +1964,10 @@ index 66e8fea6bd10af2e19a4f49c556e66a63e6205b6..81e78644417764cee33f81cdb116a91f // Paper end } diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index b8b47416b66ec2272ce9ffdc06b0a1dd91b4c05a..5476dc1e80093d7684bc238bae102cbb691cec4f 100644 +index 40421cc8ef25f1bef32a0a5d2f0f25165efe230a..1357bc97801f892e59fc8e89c3cc2d697894ccfb 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -@@ -143,6 +143,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { +@@ -144,6 +144,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { private final BlockMetadataStore blockMetadata = new BlockMetadataStore(this); private final Object2IntOpenHashMap spawnCategoryLimit = new Object2IntOpenHashMap<>(); private final CraftPersistentDataContainer persistentDataContainer = new CraftPersistentDataContainer(CraftWorld.DATA_TYPE_REGISTRY); @@ -1917,7 +1975,7 @@ index b8b47416b66ec2272ce9ffdc06b0a1dd91b4c05a..5476dc1e80093d7684bc238bae102cbb private static final Random rand = new Random(); -@@ -1863,4 +1864,18 @@ public class CraftWorld extends CraftRegionAccessor implements World { +@@ -1864,4 +1865,18 @@ public class CraftWorld extends CraftRegionAccessor implements World { return this.spigot; } // Spigot end @@ -1937,7 +1995,7 @@ index b8b47416b66ec2272ce9ffdc06b0a1dd91b4c05a..5476dc1e80093d7684bc238bae102cbb + // Paper end } diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java -index fae37b7b353cb7b0f8d4a79407fcc219a3c45b64..aff3116c77277dcb4d3825d33f40a0b17258a0ba 100644 +index c694c6dfed0b3aa098b1822676e39bd3eb04b45a..0d427758182ebe01d612d5140e4a0d519a96d8c0 100644 --- a/src/main/java/org/bukkit/craftbukkit/Main.java +++ b/src/main/java/org/bukkit/craftbukkit/Main.java @@ -19,6 +19,12 @@ public class Main { @@ -2047,10 +2105,10 @@ index 0beb96dc896f63003e1b1ae458b73902bdbe648a..102eb86bad3000f258775ac06ecd1a6d public String getCustomName() { EnchantmentTableBlockEntity enchant = this.getSnapshot(); diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftSign.java b/src/main/java/org/bukkit/craftbukkit/block/CraftSign.java -index 9e68893b189ad05e4d2a5e8788e93e10670ac824..26f21754b5ec3d1cbd455c4d9d04af299fc10b1b 100644 +index 3f5292deeeddb8a6a5df57aac01f48ba11be6d7c..541f943d307f5307460ea049294fd98d53054d52 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftSign.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftSign.java -@@ -14,34 +14,60 @@ import org.bukkit.entity.Player; +@@ -13,34 +13,60 @@ import org.bukkit.entity.Player; public class CraftSign extends CraftBlockEntityState implements Sign { // Lazily initialized only if requested: @@ -2124,7 +2182,7 @@ index 9e68893b189ad05e4d2a5e8788e93e10670ac824..26f21754b5ec3d1cbd455c4d9d04af29 } @Override -@@ -79,13 +105,16 @@ public class CraftSign extends CraftBlockEntityState implements +@@ -78,13 +104,16 @@ public class CraftSign extends CraftBlockEntityState implements super.applyTo(sign); if (this.lines != null) { @@ -2145,7 +2203,7 @@ index 9e68893b189ad05e4d2a5e8788e93e10670ac824..26f21754b5ec3d1cbd455c4d9d04af29 } } -@@ -100,6 +129,20 @@ public class CraftSign extends CraftBlockEntityState implements +@@ -99,6 +128,20 @@ public class CraftSign extends CraftBlockEntityState implements ((CraftPlayer) player).getHandle().openTextEdit(handle); } @@ -2167,10 +2225,10 @@ index 9e68893b189ad05e4d2a5e8788e93e10670ac824..26f21754b5ec3d1cbd455c4d9d04af29 Component[] components = new Component[4]; diff --git a/src/main/java/org/bukkit/craftbukkit/command/CraftBlockCommandSender.java b/src/main/java/org/bukkit/craftbukkit/command/CraftBlockCommandSender.java -index 83efca7144b4ce9cf7bd6bbbbf9c4426d2472315..bf4c5c83c3c6d710c9c40257087a2c744a7d00c6 100644 +index 3de88112bdb08d6bd0d28f20582c4090bfd8dbfe..11164a28018be3ba46f898e57a1eefbeb0360426 100644 --- a/src/main/java/org/bukkit/craftbukkit/command/CraftBlockCommandSender.java +++ b/src/main/java/org/bukkit/craftbukkit/command/CraftBlockCommandSender.java -@@ -46,6 +46,13 @@ public class CraftBlockCommandSender extends ServerCommandSender implements Bloc +@@ -45,6 +45,13 @@ public class CraftBlockCommandSender extends ServerCommandSender implements Bloc return this.block.getTextName(); } @@ -2215,10 +2273,10 @@ index f3cb4102ab223f379f60dac317df7da1fab812a8..324e6d1a4fadd3e557e4ba05f04e6a58 + // Paper end } diff --git a/src/main/java/org/bukkit/craftbukkit/command/CraftRemoteConsoleCommandSender.java b/src/main/java/org/bukkit/craftbukkit/command/CraftRemoteConsoleCommandSender.java -index 02a8c522a25f1c3c8eb0245560757772e627d31e..07f7effaa46afdd8766e3e6bfd8cb923e55f68cf 100644 +index 03027fe2b7ffe4c7ce7f1bb4f56051a4743c7f01..a6612cc0ea87aeb8e87521ff7b5fe58c7b06b9ef 100644 --- a/src/main/java/org/bukkit/craftbukkit/command/CraftRemoteConsoleCommandSender.java +++ b/src/main/java/org/bukkit/craftbukkit/command/CraftRemoteConsoleCommandSender.java -@@ -30,6 +30,13 @@ public class CraftRemoteConsoleCommandSender extends ServerCommandSender impleme +@@ -29,6 +29,13 @@ public class CraftRemoteConsoleCommandSender extends ServerCommandSender impleme return "Rcon"; } @@ -2282,10 +2340,10 @@ index 8107ed0d248ff2a1cf8e556b7610a68f6c197691..eaff8df6c8c12c64e005a68a02e2e35e + // Paper end } diff --git a/src/main/java/org/bukkit/craftbukkit/enchantments/CraftEnchantment.java b/src/main/java/org/bukkit/craftbukkit/enchantments/CraftEnchantment.java -index cf69a45f038c2b8336010f5fe277313fd0513b5b..eb99e0c2462a2d1ab4508a5c3f1580b6e31d7465 100644 +index b4c90f8f55afcf66cff97d11ab5d69d3a692633e..7d186c7595dbcd109cee2cc16d70d8302b4d6b8f 100644 --- a/src/main/java/org/bukkit/craftbukkit/enchantments/CraftEnchantment.java +++ b/src/main/java/org/bukkit/craftbukkit/enchantments/CraftEnchantment.java -@@ -187,6 +187,12 @@ public class CraftEnchantment extends Enchantment { +@@ -189,6 +189,12 @@ public class CraftEnchantment extends Enchantment { CraftEnchantment ench = (CraftEnchantment) other; return !this.target.isCompatibleWith(ench.target); } @@ -2299,10 +2357,10 @@ index cf69a45f038c2b8336010f5fe277313fd0513b5b..eb99e0c2462a2d1ab4508a5c3f1580b6 public net.minecraft.world.item.enchantment.Enchantment getHandle() { return this.target; diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java -index a4907dee676e9e9cc2725a3312831198a0db7b10..4b7ed15279bbdd116d993f190094f80c888aed69 100644 +index 7fa6212fca01af9efd787f2c74af986fbeef4a77..b403022201b34118adddf817b19a8bbdb6229df4 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java -@@ -191,6 +191,7 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { +@@ -196,6 +196,7 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { protected Entity entity; private EntityDamageEvent lastDamageEvent; private final CraftPersistentDataContainer persistentDataContainer = new CraftPersistentDataContainer(CraftEntity.DATA_TYPE_REGISTRY); @@ -2310,7 +2368,7 @@ index a4907dee676e9e9cc2725a3312831198a0db7b10..4b7ed15279bbdd116d993f190094f80c public CraftEntity(final CraftServer server, final Entity entity) { this.server = server; -@@ -818,6 +819,32 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { +@@ -830,6 +831,32 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { return this.getHandle().getVehicle().getBukkitEntity(); } @@ -2343,7 +2401,7 @@ index a4907dee676e9e9cc2725a3312831198a0db7b10..4b7ed15279bbdd116d993f190094f80c @Override public void setCustomName(String name) { // sane limit for name length -@@ -873,6 +900,17 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { +@@ -885,6 +912,17 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { public String getName() { return CraftChatMessage.fromComponent(this.getHandle().getName()); } @@ -2414,10 +2472,10 @@ index 446fdca49a5a6999626a7ee3a1d5c168b15a09dd..f9863e138994f6c7a7975a852f106faa public boolean isOp() { return true; diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 2577a135bb88adc9000ab67477846c6466d973e7..cd288194bee65fbf3b7fe8a5d36e09acb1931e57 100644 +index 765659b39d30e2e5c491c0808fe1808776ea767b..d8d634ea96a03a643f6743da8af23480824ced98 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -272,14 +272,39 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -270,14 +270,39 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @Override public String getDisplayName() { @@ -2457,7 +2515,7 @@ index 2577a135bb88adc9000ab67477846c6466d973e7..cd288194bee65fbf3b7fe8a5d36e09ac @Override public String getPlayerListName() { return this.getHandle().listName == null ? getName() : CraftChatMessage.fromComponent(this.getHandle().listName); -@@ -298,42 +323,42 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -296,42 +321,42 @@ public class CraftPlayer extends CraftHumanEntity implements Player { } } @@ -2504,12 +2562,12 @@ index 2577a135bb88adc9000ab67477846c6466d973e7..cd288194bee65fbf3b7fe8a5d36e09ac private void updatePlayerListHeaderFooter() { if (this.getHandle().connection == null) return; -- ClientboundTabListPacket packet = new ClientboundTabListPacket((this.playerListHeader == null) ? new TextComponent("") : this.playerListHeader, (this.playerListFooter == null) ? new TextComponent("") : this.playerListFooter); -+ ClientboundTabListPacket packet = new ClientboundTabListPacket((this.playerListHeader == null) ? new TextComponent("") : io.papermc.paper.adventure.PaperAdventure.asVanilla(this.playerListHeader), (this.playerListFooter == null) ? new TextComponent("") : io.papermc.paper.adventure.PaperAdventure.asVanilla(this.playerListFooter)); +- ClientboundTabListPacket packet = new ClientboundTabListPacket((this.playerListHeader == null) ? Component.empty() : this.playerListHeader, (this.playerListFooter == null) ? Component.empty() : this.playerListFooter); ++ ClientboundTabListPacket packet = new ClientboundTabListPacket((this.playerListHeader == null) ? Component.empty() : io.papermc.paper.adventure.PaperAdventure.asVanilla(this.playerListHeader), (this.playerListFooter == null) ? Component.empty() : io.papermc.paper.adventure.PaperAdventure.asVanilla(this.playerListFooter)); // Paper - adventure this.getHandle().connection.send(packet); } -@@ -365,6 +390,23 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -363,6 +388,23 @@ public class CraftPlayer extends CraftHumanEntity implements Player { this.getHandle().connection.disconnect(message == null ? "" : message); } @@ -2533,7 +2591,7 @@ index 2577a135bb88adc9000ab67477846c6466d973e7..cd288194bee65fbf3b7fe8a5d36e09ac @Override public void setCompassTarget(Location loc) { if (this.getHandle().connection == null) return; -@@ -620,6 +662,35 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -618,6 +660,35 @@ public class CraftPlayer extends CraftHumanEntity implements Player { this.getHandle().connection.send(packet); } @@ -2569,7 +2627,7 @@ index 2577a135bb88adc9000ab67477846c6466d973e7..cd288194bee65fbf3b7fe8a5d36e09ac @Override public void sendSignChange(Location loc, String[] lines) { this.sendSignChange(loc, lines, DyeColor.BLACK); -@@ -647,14 +718,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -645,14 +716,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player { } Component[] components = CraftSign.sanitizeLines(lines); @@ -2587,7 +2645,7 @@ index 2577a135bb88adc9000ab67477846c6466d973e7..cd288194bee65fbf3b7fe8a5d36e09ac } @Override -@@ -1425,7 +1497,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -1423,7 +1495,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @Override public void setResourcePack(String url) { @@ -2596,7 +2654,7 @@ index 2577a135bb88adc9000ab67477846c6466d973e7..cd288194bee65fbf3b7fe8a5d36e09ac } @Override -@@ -1440,7 +1512,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -1438,7 +1510,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @Override public void setResourcePack(String url, byte[] hash, boolean force) { @@ -2605,7 +2663,7 @@ index 2577a135bb88adc9000ab67477846c6466d973e7..cd288194bee65fbf3b7fe8a5d36e09ac } @Override -@@ -1456,6 +1528,21 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -1454,6 +1526,21 @@ public class CraftPlayer extends CraftHumanEntity implements Player { } } @@ -2627,7 +2685,7 @@ index 2577a135bb88adc9000ab67477846c6466d973e7..cd288194bee65fbf3b7fe8a5d36e09ac public void addChannel(String channel) { Preconditions.checkState(this.channels.size() < 128, "Cannot register channel '%s'. Too many channels registered!", channel); channel = StandardMessenger.validateAndCorrectChannel(channel); -@@ -1860,6 +1947,12 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -1858,6 +1945,12 @@ public class CraftPlayer extends CraftHumanEntity implements Player { return (this.getHandle().clientViewDistance == null) ? Bukkit.getViewDistance() : this.getHandle().clientViewDistance; } @@ -2640,7 +2698,7 @@ index 2577a135bb88adc9000ab67477846c6466d973e7..cd288194bee65fbf3b7fe8a5d36e09ac @Override public int getPing() { return this.getHandle().latency; -@@ -1905,6 +1998,194 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -1903,6 +1996,194 @@ public class CraftPlayer extends CraftHumanEntity implements Player { return this.getHandle().allowsListing(); } @@ -2861,7 +2919,7 @@ index e9349ebcaa86144eefdb053b9eacf7ff37f2c0ec..147368eb3003b6a081389ab81bd5016d return event; } diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftContainer.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftContainer.java -index af9facfaa8bba614e37bd604ca0656a852d0325b..60fa587ce17e138d2baf8959c26e25ed1db17a4a 100644 +index e2711a189bcaffc0f79d903f0696d87b0de116fe..9531a11e63b4c5beeebabc45e4a40d5d39f05c7a 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftContainer.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftContainer.java @@ -69,6 +69,13 @@ public class CraftContainer extends AbstractContainerMenu { @@ -2983,10 +3041,10 @@ index 6a64fbb8b4937f39d5fdc2e2cbec26c83c74c486..7d6b5fdb00a5c1614849735634262a36 public String getTitle() { return CraftChatMessage.fromComponent(this.container.getTitle()); diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java -index 2e1aff425b24e1cd2197305226119f9d84574154..f4e909ca1a8518d697acabca298c387b4bde7542 100644 +index c7503805bb2358996fb704288b8e4320aee6f425..a06f9775a43a245380edabde63e7999082e7958a 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java -@@ -368,4 +368,17 @@ public final class CraftItemFactory implements ItemFactory { +@@ -374,4 +374,17 @@ public final class CraftItemFactory implements ItemFactory { public Material updateMaterial(ItemMeta meta, Material material) throws IllegalArgumentException { return ((CraftMetaItem) meta).updateMaterial(material); } @@ -3005,10 +3063,10 @@ index 2e1aff425b24e1cd2197305226119f9d84574154..f4e909ca1a8518d697acabca298c387b + // Paper end } diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMerchantCustom.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMerchantCustom.java -index 059c84a4e50b043f2ac2a033d5d3cbf3cba3b3f9..552851cff3678d605428866999951fefd4375d7a 100644 +index 2669644228037f7447ddf98a48a58bbbf6129c37..eaec84147d3023c71865a6b2236879511e9f3685 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMerchantCustom.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMerchantCustom.java -@@ -14,10 +14,17 @@ import org.apache.commons.lang.Validate; +@@ -13,10 +13,17 @@ import org.apache.commons.lang.Validate; public class CraftMerchantCustom extends CraftMerchant { @@ -3026,14 +3084,14 @@ index 059c84a4e50b043f2ac2a033d5d3cbf3cba3b3f9..552851cff3678d605428866999951fef @Override public String toString() { -@@ -37,10 +44,17 @@ public class CraftMerchantCustom extends CraftMerchant { +@@ -36,10 +43,17 @@ public class CraftMerchantCustom extends CraftMerchant { private Level tradingWorld; protected CraftMerchant craftMerchant; + @Deprecated // Paper - Adventure public MinecraftMerchant(String title) { Validate.notNull(title, "Title cannot be null"); - this.title = new TextComponent(title); + this.title = Component.literal(title); } + // Paper start + public MinecraftMerchant(net.kyori.adventure.text.Component title) { @@ -3270,7 +3328,7 @@ index 00445fc7373c70f4cecc4114f9bcfb4b6f27c0e8..67a198fe1ba930836b82fcc22ab25eb1 + // Paper end } diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java -index 2ac6eb382ad22b9684d460745cecfa9333ccad53..b42527e0307811a3697f6e7b0afc9a10527acbaf 100644 +index f2737146ffb005dec43bd796043c53397a3b7485..0a5f063bc74e1dae67167537437ebd7e4ddf113a 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java @@ -746,6 +746,18 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { @@ -3590,10 +3648,10 @@ index 81f16dc1ed6e102af298600db75cab21a09bc00f..18d5a26c34c848241c306241b3ad9825 @Override public String getDisplayName() throws IllegalStateException { diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftChatMessage.java b/src/main/java/org/bukkit/craftbukkit/util/CraftChatMessage.java -index f9b7b8f7ccc95b73967a51420fd6ce88d80d75fe..0de5a46423ae0403dcbfca630dfd7c5ac1e1761d 100644 +index 78ea79b66cc9e90402ef5cdc2e5e04e0c74b1c26..4fede2161792ba3e7cdf0cc5a1f533188becc6f7 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftChatMessage.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftChatMessage.java -@@ -290,6 +290,7 @@ public final class CraftChatMessage { +@@ -291,6 +291,7 @@ public final class CraftChatMessage { public static String fromComponent(Component component) { if (component == null) return ""; @@ -3602,7 +3660,7 @@ index f9b7b8f7ccc95b73967a51420fd6ce88d80d75fe..0de5a46423ae0403dcbfca630dfd7c5a boolean hadFormat = false; diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index 6e990ab85b1510a952de931a0ae4f5b6356da13f..ec5946ce9061573ec7d2a2ec52b71e0228ae0b25 100644 +index 0d0a5b436ff68d49cf7a043127818bd474562b4b..43e31362a980a4f300864321224bdf3ca92110ff 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java @@ -69,6 +69,38 @@ public final class CraftMagicNumbers implements UnsafeValues { diff --git a/patches/unapplied/server/0005-MC-Dev-fixes.patch b/patches/unapplied/server/0005-MC-Dev-fixes.patch deleted file mode 100644 index 548bafdca2..0000000000 --- a/patches/unapplied/server/0005-MC-Dev-fixes.patch +++ /dev/null @@ -1,284 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Aikar -Date: Wed, 30 Mar 2016 19:36:20 -0400 -Subject: [PATCH] MC Dev fixes - - -diff --git a/src/main/java/net/minecraft/Util.java b/src/main/java/net/minecraft/Util.java -index 216431e94b25fd5a0fdfacf21e532f72d0efe2b9..c1af79f65a1a6ba970764983cf666cb4b7fe36de 100644 ---- a/src/main/java/net/minecraft/Util.java -+++ b/src/main/java/net/minecraft/Util.java -@@ -351,7 +351,7 @@ public class Util { - } - - public static Hash.Strategy identityStrategy() { -- return Util.IdentityStrategy.INSTANCE; -+ return (Hash.Strategy) Util.IdentityStrategy.INSTANCE; // Paper - decompile fix - } - - public static CompletableFuture> sequence(List> futures) { -diff --git a/src/main/java/net/minecraft/core/BlockPos.java b/src/main/java/net/minecraft/core/BlockPos.java -index 5311c40d9bf22b423a69bc722a6125493e616eac..79c7e30d510bdbd4def3b03474f72af0f355091c 100644 ---- a/src/main/java/net/minecraft/core/BlockPos.java -+++ b/src/main/java/net/minecraft/core/BlockPos.java -@@ -375,12 +375,12 @@ public class BlockPos extends Vec3i { - if (this.index == l) { - return this.endOfData(); - } else { -- int i = this.index % i; -- int j = this.index / i; -- int k = j % j; -- int l = j / j; -+ int offsetX = this.index % i; // Paper - decomp fix -+ int u = this.index / i; // Paper - decomp fix -+ int offsetY = u % j; // Paper - decomp fix -+ int offsetZ = u / j; // Paper - decomp fix - ++this.index; -- return this.cursor.set(startX + i, startY + k, startZ + l); -+ return this.cursor.set(startX + offsetX, startY + offsetY, startZ + offsetZ); // Paper - decomp fix - } - } - }; -diff --git a/src/main/java/net/minecraft/nbt/ListTag.java b/src/main/java/net/minecraft/nbt/ListTag.java -index f346306d61854bdc6b395f5d8f799909537a1b50..69423244a1b6658e2c6ad4a7c5329e140b7155a8 100644 ---- a/src/main/java/net/minecraft/nbt/ListTag.java -+++ b/src/main/java/net/minecraft/nbt/ListTag.java -@@ -2,9 +2,12 @@ package net.minecraft.nbt; - - import com.google.common.collect.Iterables; - import com.google.common.collect.Lists; -+import it.unimi.dsi.fastutil.bytes.ByteOpenHashSet; -+import it.unimi.dsi.fastutil.bytes.ByteSet; - import java.io.DataInput; - import java.io.DataOutput; - import java.io.IOException; -+import java.util.Arrays; - import java.util.List; - import java.util.Objects; - -@@ -102,6 +105,7 @@ public class ListTag extends CollectionTag { - return "TAG_List"; - } - }; -+ private static final ByteSet INLINE_ELEMENT_TYPES = new ByteOpenHashSet(Arrays.asList((byte) 1, (byte) 2, (byte) 3, (byte) 4, (byte) 5, (byte) 6)); // Paper - decompiler fix // todo: what is this - private final List list; - private byte type; - -diff --git a/src/main/java/net/minecraft/nbt/NbtUtils.java b/src/main/java/net/minecraft/nbt/NbtUtils.java -index 856a4d6f878ffa966a46b711458934ed5d5b5c37..d6a742066b2e5ebf3975c190cca5134abf3cf1a3 100644 ---- a/src/main/java/net/minecraft/nbt/NbtUtils.java -+++ b/src/main/java/net/minecraft/nbt/NbtUtils.java -@@ -39,14 +39,14 @@ import net.minecraft.world.level.material.FluidState; - import org.slf4j.Logger; - - public final class NbtUtils { -- private static final Comparator YXZ_LISTTAG_INT_COMPARATOR = Comparator.comparingInt((nbt) -> { -+ private static final Comparator YXZ_LISTTAG_INT_COMPARATOR = Comparator.comparingInt((nbt) -> { // Paper - decompile fix - return nbt.getInt(1); - }).thenComparingInt((nbt) -> { - return nbt.getInt(0); - }).thenComparingInt((nbt) -> { - return nbt.getInt(2); - }); -- private static final Comparator YXZ_LISTTAG_DOUBLE_COMPARATOR = Comparator.comparingDouble((nbt) -> { -+ private static final Comparator YXZ_LISTTAG_DOUBLE_COMPARATOR = Comparator.comparingDouble((nbt) -> { // Paper - decompile fix - return nbt.getDouble(1); - }).thenComparingDouble((nbt) -> { - return nbt.getDouble(0); -@@ -494,7 +494,7 @@ public final class NbtUtils { - } - - public static CompoundTag update(DataFixer fixer, DataFixTypes fixTypes, CompoundTag compound, int oldVersion, int targetVersion) { -- return fixer.update(fixTypes.getType(), new Dynamic<>(NbtOps.INSTANCE, compound), oldVersion, targetVersion).getValue(); -+ return (CompoundTag) fixer.update(fixTypes.getType(), new Dynamic<>(NbtOps.INSTANCE, compound), oldVersion, targetVersion).getValue(); // Paper - decompile fix - } - - public static Component toPrettyComponent(Tag element) { -diff --git a/src/main/java/net/minecraft/network/ConnectionProtocol.java b/src/main/java/net/minecraft/network/ConnectionProtocol.java -index f10ea89e64aac2c11ed442ac7f2ffd15b793ac76..5df72f16e6b954ecee23a6f8daa29de0d3d991fe 100644 ---- a/src/main/java/net/minecraft/network/ConnectionProtocol.java -+++ b/src/main/java/net/minecraft/network/ConnectionProtocol.java -@@ -16,6 +16,7 @@ import javax.annotation.Nullable; - import net.minecraft.Util; - import net.minecraft.network.protocol.Packet; - import net.minecraft.network.protocol.PacketFlow; -+import net.minecraft.network.protocol.game.ClientGamePacketListener; - import net.minecraft.network.protocol.game.ClientboundAddEntityPacket; - import net.minecraft.network.protocol.game.ClientboundAddExperienceOrbPacket; - import net.minecraft.network.protocol.game.ClientboundAddMobPacket; -@@ -118,6 +119,7 @@ import net.minecraft.network.protocol.game.ClientboundUpdateAttributesPacket; - import net.minecraft.network.protocol.game.ClientboundUpdateMobEffectPacket; - import net.minecraft.network.protocol.game.ClientboundUpdateRecipesPacket; - import net.minecraft.network.protocol.game.ClientboundUpdateTagsPacket; -+import net.minecraft.network.protocol.game.ServerGamePacketListener; - import net.minecraft.network.protocol.game.ServerboundAcceptTeleportationPacket; - import net.minecraft.network.protocol.game.ServerboundBlockEntityTagQuery; - import net.minecraft.network.protocol.game.ServerboundChangeDifficultyPacket; -@@ -164,26 +166,33 @@ import net.minecraft.network.protocol.game.ServerboundTeleportToEntityPacket; - import net.minecraft.network.protocol.game.ServerboundUseItemOnPacket; - import net.minecraft.network.protocol.game.ServerboundUseItemPacket; - import net.minecraft.network.protocol.handshake.ClientIntentionPacket; -+import net.minecraft.network.protocol.handshake.ServerHandshakePacketListener; -+import net.minecraft.network.protocol.login.ClientLoginPacketListener; - import net.minecraft.network.protocol.login.ClientboundCustomQueryPacket; - import net.minecraft.network.protocol.login.ClientboundGameProfilePacket; - import net.minecraft.network.protocol.login.ClientboundHelloPacket; - import net.minecraft.network.protocol.login.ClientboundLoginCompressionPacket; - import net.minecraft.network.protocol.login.ClientboundLoginDisconnectPacket; -+import net.minecraft.network.protocol.login.ServerLoginPacketListener; - import net.minecraft.network.protocol.login.ServerboundCustomQueryPacket; - import net.minecraft.network.protocol.login.ServerboundHelloPacket; - import net.minecraft.network.protocol.login.ServerboundKeyPacket; -+import net.minecraft.network.protocol.status.ClientStatusPacketListener; - import net.minecraft.network.protocol.status.ClientboundPongResponsePacket; - import net.minecraft.network.protocol.status.ClientboundStatusResponsePacket; -+import net.minecraft.network.protocol.status.ServerStatusPacketListener; - import net.minecraft.network.protocol.status.ServerboundPingRequestPacket; - import net.minecraft.network.protocol.status.ServerboundStatusRequestPacket; - import net.minecraft.util.VisibleForDebug; - import org.slf4j.Logger; - - public enum ConnectionProtocol { -- HANDSHAKING(-1, protocol().addFlow(PacketFlow.SERVERBOUND, (new ConnectionProtocol.PacketSet()).addPacket(ClientIntentionPacket.class, ClientIntentionPacket::new))), -- PLAY(0, protocol().addFlow(PacketFlow.CLIENTBOUND, (new ConnectionProtocol.PacketSet()).addPacket(ClientboundAddEntityPacket.class, ClientboundAddEntityPacket::new).addPacket(ClientboundAddExperienceOrbPacket.class, ClientboundAddExperienceOrbPacket::new).addPacket(ClientboundAddMobPacket.class, ClientboundAddMobPacket::new).addPacket(ClientboundAddPaintingPacket.class, ClientboundAddPaintingPacket::new).addPacket(ClientboundAddPlayerPacket.class, ClientboundAddPlayerPacket::new).addPacket(ClientboundAddVibrationSignalPacket.class, ClientboundAddVibrationSignalPacket::new).addPacket(ClientboundAnimatePacket.class, ClientboundAnimatePacket::new).addPacket(ClientboundAwardStatsPacket.class, ClientboundAwardStatsPacket::new).addPacket(ClientboundBlockBreakAckPacket.class, ClientboundBlockBreakAckPacket::new).addPacket(ClientboundBlockDestructionPacket.class, ClientboundBlockDestructionPacket::new).addPacket(ClientboundBlockEntityDataPacket.class, ClientboundBlockEntityDataPacket::new).addPacket(ClientboundBlockEventPacket.class, ClientboundBlockEventPacket::new).addPacket(ClientboundBlockUpdatePacket.class, ClientboundBlockUpdatePacket::new).addPacket(ClientboundBossEventPacket.class, ClientboundBossEventPacket::new).addPacket(ClientboundChangeDifficultyPacket.class, ClientboundChangeDifficultyPacket::new).addPacket(ClientboundChatPacket.class, ClientboundChatPacket::new).addPacket(ClientboundClearTitlesPacket.class, ClientboundClearTitlesPacket::new).addPacket(ClientboundCommandSuggestionsPacket.class, ClientboundCommandSuggestionsPacket::new).addPacket(ClientboundCommandsPacket.class, ClientboundCommandsPacket::new).addPacket(ClientboundContainerClosePacket.class, ClientboundContainerClosePacket::new).addPacket(ClientboundContainerSetContentPacket.class, ClientboundContainerSetContentPacket::new).addPacket(ClientboundContainerSetDataPacket.class, ClientboundContainerSetDataPacket::new).addPacket(ClientboundContainerSetSlotPacket.class, ClientboundContainerSetSlotPacket::new).addPacket(ClientboundCooldownPacket.class, ClientboundCooldownPacket::new).addPacket(ClientboundCustomPayloadPacket.class, ClientboundCustomPayloadPacket::new).addPacket(ClientboundCustomSoundPacket.class, ClientboundCustomSoundPacket::new).addPacket(ClientboundDisconnectPacket.class, ClientboundDisconnectPacket::new).addPacket(ClientboundEntityEventPacket.class, ClientboundEntityEventPacket::new).addPacket(ClientboundExplodePacket.class, ClientboundExplodePacket::new).addPacket(ClientboundForgetLevelChunkPacket.class, ClientboundForgetLevelChunkPacket::new).addPacket(ClientboundGameEventPacket.class, ClientboundGameEventPacket::new).addPacket(ClientboundHorseScreenOpenPacket.class, ClientboundHorseScreenOpenPacket::new).addPacket(ClientboundInitializeBorderPacket.class, ClientboundInitializeBorderPacket::new).addPacket(ClientboundKeepAlivePacket.class, ClientboundKeepAlivePacket::new).addPacket(ClientboundLevelChunkWithLightPacket.class, ClientboundLevelChunkWithLightPacket::new).addPacket(ClientboundLevelEventPacket.class, ClientboundLevelEventPacket::new).addPacket(ClientboundLevelParticlesPacket.class, ClientboundLevelParticlesPacket::new).addPacket(ClientboundLightUpdatePacket.class, ClientboundLightUpdatePacket::new).addPacket(ClientboundLoginPacket.class, ClientboundLoginPacket::new).addPacket(ClientboundMapItemDataPacket.class, ClientboundMapItemDataPacket::new).addPacket(ClientboundMerchantOffersPacket.class, ClientboundMerchantOffersPacket::new).addPacket(ClientboundMoveEntityPacket.Pos.class, ClientboundMoveEntityPacket.Pos::read).addPacket(ClientboundMoveEntityPacket.PosRot.class, ClientboundMoveEntityPacket.PosRot::read).addPacket(ClientboundMoveEntityPacket.Rot.class, ClientboundMoveEntityPacket.Rot::read).addPacket(ClientboundMoveVehiclePacket.class, ClientboundMoveVehiclePacket::new).addPacket(ClientboundOpenBookPacket.class, ClientboundOpenBookPacket::new).addPacket(ClientboundOpenScreenPacket.class, ClientboundOpenScreenPacket::new).addPacket(ClientboundOpenSignEditorPacket.class, ClientboundOpenSignEditorPacket::new).addPacket(ClientboundPingPacket.class, ClientboundPingPacket::new).addPacket(ClientboundPlaceGhostRecipePacket.class, ClientboundPlaceGhostRecipePacket::new).addPacket(ClientboundPlayerAbilitiesPacket.class, ClientboundPlayerAbilitiesPacket::new).addPacket(ClientboundPlayerCombatEndPacket.class, ClientboundPlayerCombatEndPacket::new).addPacket(ClientboundPlayerCombatEnterPacket.class, ClientboundPlayerCombatEnterPacket::new).addPacket(ClientboundPlayerCombatKillPacket.class, ClientboundPlayerCombatKillPacket::new).addPacket(ClientboundPlayerInfoPacket.class, ClientboundPlayerInfoPacket::new).addPacket(ClientboundPlayerLookAtPacket.class, ClientboundPlayerLookAtPacket::new).addPacket(ClientboundPlayerPositionPacket.class, ClientboundPlayerPositionPacket::new).addPacket(ClientboundRecipePacket.class, ClientboundRecipePacket::new).addPacket(ClientboundRemoveEntitiesPacket.class, ClientboundRemoveEntitiesPacket::new).addPacket(ClientboundRemoveMobEffectPacket.class, ClientboundRemoveMobEffectPacket::new).addPacket(ClientboundResourcePackPacket.class, ClientboundResourcePackPacket::new).addPacket(ClientboundRespawnPacket.class, ClientboundRespawnPacket::new).addPacket(ClientboundRotateHeadPacket.class, ClientboundRotateHeadPacket::new).addPacket(ClientboundSectionBlocksUpdatePacket.class, ClientboundSectionBlocksUpdatePacket::new).addPacket(ClientboundSelectAdvancementsTabPacket.class, ClientboundSelectAdvancementsTabPacket::new).addPacket(ClientboundSetActionBarTextPacket.class, ClientboundSetActionBarTextPacket::new).addPacket(ClientboundSetBorderCenterPacket.class, ClientboundSetBorderCenterPacket::new).addPacket(ClientboundSetBorderLerpSizePacket.class, ClientboundSetBorderLerpSizePacket::new).addPacket(ClientboundSetBorderSizePacket.class, ClientboundSetBorderSizePacket::new).addPacket(ClientboundSetBorderWarningDelayPacket.class, ClientboundSetBorderWarningDelayPacket::new).addPacket(ClientboundSetBorderWarningDistancePacket.class, ClientboundSetBorderWarningDistancePacket::new).addPacket(ClientboundSetCameraPacket.class, ClientboundSetCameraPacket::new).addPacket(ClientboundSetCarriedItemPacket.class, ClientboundSetCarriedItemPacket::new).addPacket(ClientboundSetChunkCacheCenterPacket.class, ClientboundSetChunkCacheCenterPacket::new).addPacket(ClientboundSetChunkCacheRadiusPacket.class, ClientboundSetChunkCacheRadiusPacket::new).addPacket(ClientboundSetDefaultSpawnPositionPacket.class, ClientboundSetDefaultSpawnPositionPacket::new).addPacket(ClientboundSetDisplayObjectivePacket.class, ClientboundSetDisplayObjectivePacket::new).addPacket(ClientboundSetEntityDataPacket.class, ClientboundSetEntityDataPacket::new).addPacket(ClientboundSetEntityLinkPacket.class, ClientboundSetEntityLinkPacket::new).addPacket(ClientboundSetEntityMotionPacket.class, ClientboundSetEntityMotionPacket::new).addPacket(ClientboundSetEquipmentPacket.class, ClientboundSetEquipmentPacket::new).addPacket(ClientboundSetExperiencePacket.class, ClientboundSetExperiencePacket::new).addPacket(ClientboundSetHealthPacket.class, ClientboundSetHealthPacket::new).addPacket(ClientboundSetObjectivePacket.class, ClientboundSetObjectivePacket::new).addPacket(ClientboundSetPassengersPacket.class, ClientboundSetPassengersPacket::new).addPacket(ClientboundSetPlayerTeamPacket.class, ClientboundSetPlayerTeamPacket::new).addPacket(ClientboundSetScorePacket.class, ClientboundSetScorePacket::new).addPacket(ClientboundSetSimulationDistancePacket.class, ClientboundSetSimulationDistancePacket::new).addPacket(ClientboundSetSubtitleTextPacket.class, ClientboundSetSubtitleTextPacket::new).addPacket(ClientboundSetTimePacket.class, ClientboundSetTimePacket::new).addPacket(ClientboundSetTitleTextPacket.class, ClientboundSetTitleTextPacket::new).addPacket(ClientboundSetTitlesAnimationPacket.class, ClientboundSetTitlesAnimationPacket::new).addPacket(ClientboundSoundEntityPacket.class, ClientboundSoundEntityPacket::new).addPacket(ClientboundSoundPacket.class, ClientboundSoundPacket::new).addPacket(ClientboundStopSoundPacket.class, ClientboundStopSoundPacket::new).addPacket(ClientboundTabListPacket.class, ClientboundTabListPacket::new).addPacket(ClientboundTagQueryPacket.class, ClientboundTagQueryPacket::new).addPacket(ClientboundTakeItemEntityPacket.class, ClientboundTakeItemEntityPacket::new).addPacket(ClientboundTeleportEntityPacket.class, ClientboundTeleportEntityPacket::new).addPacket(ClientboundUpdateAdvancementsPacket.class, ClientboundUpdateAdvancementsPacket::new).addPacket(ClientboundUpdateAttributesPacket.class, ClientboundUpdateAttributesPacket::new).addPacket(ClientboundUpdateMobEffectPacket.class, ClientboundUpdateMobEffectPacket::new).addPacket(ClientboundUpdateRecipesPacket.class, ClientboundUpdateRecipesPacket::new).addPacket(ClientboundUpdateTagsPacket.class, ClientboundUpdateTagsPacket::new)).addFlow(PacketFlow.SERVERBOUND, (new ConnectionProtocol.PacketSet()).addPacket(ServerboundAcceptTeleportationPacket.class, ServerboundAcceptTeleportationPacket::new).addPacket(ServerboundBlockEntityTagQuery.class, ServerboundBlockEntityTagQuery::new).addPacket(ServerboundChangeDifficultyPacket.class, ServerboundChangeDifficultyPacket::new).addPacket(ServerboundChatPacket.class, ServerboundChatPacket::new).addPacket(ServerboundClientCommandPacket.class, ServerboundClientCommandPacket::new).addPacket(ServerboundClientInformationPacket.class, ServerboundClientInformationPacket::new).addPacket(ServerboundCommandSuggestionPacket.class, ServerboundCommandSuggestionPacket::new).addPacket(ServerboundContainerButtonClickPacket.class, ServerboundContainerButtonClickPacket::new).addPacket(ServerboundContainerClickPacket.class, ServerboundContainerClickPacket::new).addPacket(ServerboundContainerClosePacket.class, ServerboundContainerClosePacket::new).addPacket(ServerboundCustomPayloadPacket.class, ServerboundCustomPayloadPacket::new).addPacket(ServerboundEditBookPacket.class, ServerboundEditBookPacket::new).addPacket(ServerboundEntityTagQuery.class, ServerboundEntityTagQuery::new).addPacket(ServerboundInteractPacket.class, ServerboundInteractPacket::new).addPacket(ServerboundJigsawGeneratePacket.class, ServerboundJigsawGeneratePacket::new).addPacket(ServerboundKeepAlivePacket.class, ServerboundKeepAlivePacket::new).addPacket(ServerboundLockDifficultyPacket.class, ServerboundLockDifficultyPacket::new).addPacket(ServerboundMovePlayerPacket.Pos.class, ServerboundMovePlayerPacket.Pos::read).addPacket(ServerboundMovePlayerPacket.PosRot.class, ServerboundMovePlayerPacket.PosRot::read).addPacket(ServerboundMovePlayerPacket.Rot.class, ServerboundMovePlayerPacket.Rot::read).addPacket(ServerboundMovePlayerPacket.StatusOnly.class, ServerboundMovePlayerPacket.StatusOnly::read).addPacket(ServerboundMoveVehiclePacket.class, ServerboundMoveVehiclePacket::new).addPacket(ServerboundPaddleBoatPacket.class, ServerboundPaddleBoatPacket::new).addPacket(ServerboundPickItemPacket.class, ServerboundPickItemPacket::new).addPacket(ServerboundPlaceRecipePacket.class, ServerboundPlaceRecipePacket::new).addPacket(ServerboundPlayerAbilitiesPacket.class, ServerboundPlayerAbilitiesPacket::new).addPacket(ServerboundPlayerActionPacket.class, ServerboundPlayerActionPacket::new).addPacket(ServerboundPlayerCommandPacket.class, ServerboundPlayerCommandPacket::new).addPacket(ServerboundPlayerInputPacket.class, ServerboundPlayerInputPacket::new).addPacket(ServerboundPongPacket.class, ServerboundPongPacket::new).addPacket(ServerboundRecipeBookChangeSettingsPacket.class, ServerboundRecipeBookChangeSettingsPacket::new).addPacket(ServerboundRecipeBookSeenRecipePacket.class, ServerboundRecipeBookSeenRecipePacket::new).addPacket(ServerboundRenameItemPacket.class, ServerboundRenameItemPacket::new).addPacket(ServerboundResourcePackPacket.class, ServerboundResourcePackPacket::new).addPacket(ServerboundSeenAdvancementsPacket.class, ServerboundSeenAdvancementsPacket::new).addPacket(ServerboundSelectTradePacket.class, ServerboundSelectTradePacket::new).addPacket(ServerboundSetBeaconPacket.class, ServerboundSetBeaconPacket::new).addPacket(ServerboundSetCarriedItemPacket.class, ServerboundSetCarriedItemPacket::new).addPacket(ServerboundSetCommandBlockPacket.class, ServerboundSetCommandBlockPacket::new).addPacket(ServerboundSetCommandMinecartPacket.class, ServerboundSetCommandMinecartPacket::new).addPacket(ServerboundSetCreativeModeSlotPacket.class, ServerboundSetCreativeModeSlotPacket::new).addPacket(ServerboundSetJigsawBlockPacket.class, ServerboundSetJigsawBlockPacket::new).addPacket(ServerboundSetStructureBlockPacket.class, ServerboundSetStructureBlockPacket::new).addPacket(ServerboundSignUpdatePacket.class, ServerboundSignUpdatePacket::new).addPacket(ServerboundSwingPacket.class, ServerboundSwingPacket::new).addPacket(ServerboundTeleportToEntityPacket.class, ServerboundTeleportToEntityPacket::new).addPacket(ServerboundUseItemOnPacket.class, ServerboundUseItemOnPacket::new).addPacket(ServerboundUseItemPacket.class, ServerboundUseItemPacket::new))), -- STATUS(1, protocol().addFlow(PacketFlow.SERVERBOUND, (new ConnectionProtocol.PacketSet()).addPacket(ServerboundStatusRequestPacket.class, ServerboundStatusRequestPacket::new).addPacket(ServerboundPingRequestPacket.class, ServerboundPingRequestPacket::new)).addFlow(PacketFlow.CLIENTBOUND, (new ConnectionProtocol.PacketSet()).addPacket(ClientboundStatusResponsePacket.class, ClientboundStatusResponsePacket::new).addPacket(ClientboundPongResponsePacket.class, ClientboundPongResponsePacket::new))), -- LOGIN(2, protocol().addFlow(PacketFlow.CLIENTBOUND, (new ConnectionProtocol.PacketSet()).addPacket(ClientboundLoginDisconnectPacket.class, ClientboundLoginDisconnectPacket::new).addPacket(ClientboundHelloPacket.class, ClientboundHelloPacket::new).addPacket(ClientboundGameProfilePacket.class, ClientboundGameProfilePacket::new).addPacket(ClientboundLoginCompressionPacket.class, ClientboundLoginCompressionPacket::new).addPacket(ClientboundCustomQueryPacket.class, ClientboundCustomQueryPacket::new)).addFlow(PacketFlow.SERVERBOUND, (new ConnectionProtocol.PacketSet()).addPacket(ServerboundHelloPacket.class, ServerboundHelloPacket::new).addPacket(ServerboundKeyPacket.class, ServerboundKeyPacket::new).addPacket(ServerboundCustomQueryPacket.class, ServerboundCustomQueryPacket::new))); -+ // Paper start - fix decompile error - add correct generic packet listeners (e.g. ServerHandshakePacketListener) to PacketSet's generic type, matching the packet flow direction -+ HANDSHAKING(-1, protocol().addFlow(PacketFlow.SERVERBOUND, (new ConnectionProtocol.PacketSet()).addPacket(ClientIntentionPacket.class, ClientIntentionPacket::new))), -+ PLAY(0, protocol().addFlow(PacketFlow.CLIENTBOUND, (new ConnectionProtocol.PacketSet()).addPacket(ClientboundAddEntityPacket.class, ClientboundAddEntityPacket::new).addPacket(ClientboundAddExperienceOrbPacket.class, ClientboundAddExperienceOrbPacket::new).addPacket(ClientboundAddMobPacket.class, ClientboundAddMobPacket::new).addPacket(ClientboundAddPaintingPacket.class, ClientboundAddPaintingPacket::new).addPacket(ClientboundAddPlayerPacket.class, ClientboundAddPlayerPacket::new).addPacket(ClientboundAddVibrationSignalPacket.class, ClientboundAddVibrationSignalPacket::new).addPacket(ClientboundAnimatePacket.class, ClientboundAnimatePacket::new).addPacket(ClientboundAwardStatsPacket.class, ClientboundAwardStatsPacket::new).addPacket(ClientboundBlockBreakAckPacket.class, ClientboundBlockBreakAckPacket::new).addPacket(ClientboundBlockDestructionPacket.class, ClientboundBlockDestructionPacket::new).addPacket(ClientboundBlockEntityDataPacket.class, ClientboundBlockEntityDataPacket::new).addPacket(ClientboundBlockEventPacket.class, ClientboundBlockEventPacket::new).addPacket(ClientboundBlockUpdatePacket.class, ClientboundBlockUpdatePacket::new).addPacket(ClientboundBossEventPacket.class, ClientboundBossEventPacket::new).addPacket(ClientboundChangeDifficultyPacket.class, ClientboundChangeDifficultyPacket::new).addPacket(ClientboundChatPacket.class, ClientboundChatPacket::new).addPacket(ClientboundClearTitlesPacket.class, ClientboundClearTitlesPacket::new).addPacket(ClientboundCommandSuggestionsPacket.class, ClientboundCommandSuggestionsPacket::new).addPacket(ClientboundCommandsPacket.class, ClientboundCommandsPacket::new).addPacket(ClientboundContainerClosePacket.class, ClientboundContainerClosePacket::new).addPacket(ClientboundContainerSetContentPacket.class, ClientboundContainerSetContentPacket::new).addPacket(ClientboundContainerSetDataPacket.class, ClientboundContainerSetDataPacket::new).addPacket(ClientboundContainerSetSlotPacket.class, ClientboundContainerSetSlotPacket::new).addPacket(ClientboundCooldownPacket.class, ClientboundCooldownPacket::new).addPacket(ClientboundCustomPayloadPacket.class, ClientboundCustomPayloadPacket::new).addPacket(ClientboundCustomSoundPacket.class, ClientboundCustomSoundPacket::new).addPacket(ClientboundDisconnectPacket.class, ClientboundDisconnectPacket::new).addPacket(ClientboundEntityEventPacket.class, ClientboundEntityEventPacket::new).addPacket(ClientboundExplodePacket.class, ClientboundExplodePacket::new).addPacket(ClientboundForgetLevelChunkPacket.class, ClientboundForgetLevelChunkPacket::new).addPacket(ClientboundGameEventPacket.class, ClientboundGameEventPacket::new).addPacket(ClientboundHorseScreenOpenPacket.class, ClientboundHorseScreenOpenPacket::new).addPacket(ClientboundInitializeBorderPacket.class, ClientboundInitializeBorderPacket::new).addPacket(ClientboundKeepAlivePacket.class, ClientboundKeepAlivePacket::new).addPacket(ClientboundLevelChunkWithLightPacket.class, ClientboundLevelChunkWithLightPacket::new).addPacket(ClientboundLevelEventPacket.class, ClientboundLevelEventPacket::new).addPacket(ClientboundLevelParticlesPacket.class, ClientboundLevelParticlesPacket::new).addPacket(ClientboundLightUpdatePacket.class, ClientboundLightUpdatePacket::new).addPacket(ClientboundLoginPacket.class, ClientboundLoginPacket::new).addPacket(ClientboundMapItemDataPacket.class, ClientboundMapItemDataPacket::new).addPacket(ClientboundMerchantOffersPacket.class, ClientboundMerchantOffersPacket::new).addPacket(ClientboundMoveEntityPacket.Pos.class, ClientboundMoveEntityPacket.Pos::read).addPacket(ClientboundMoveEntityPacket.PosRot.class, ClientboundMoveEntityPacket.PosRot::read).addPacket(ClientboundMoveEntityPacket.Rot.class, ClientboundMoveEntityPacket.Rot::read).addPacket(ClientboundMoveVehiclePacket.class, ClientboundMoveVehiclePacket::new).addPacket(ClientboundOpenBookPacket.class, ClientboundOpenBookPacket::new).addPacket(ClientboundOpenScreenPacket.class, ClientboundOpenScreenPacket::new).addPacket(ClientboundOpenSignEditorPacket.class, ClientboundOpenSignEditorPacket::new).addPacket(ClientboundPingPacket.class, ClientboundPingPacket::new).addPacket(ClientboundPlaceGhostRecipePacket.class, ClientboundPlaceGhostRecipePacket::new).addPacket(ClientboundPlayerAbilitiesPacket.class, ClientboundPlayerAbilitiesPacket::new).addPacket(ClientboundPlayerCombatEndPacket.class, ClientboundPlayerCombatEndPacket::new).addPacket(ClientboundPlayerCombatEnterPacket.class, ClientboundPlayerCombatEnterPacket::new).addPacket(ClientboundPlayerCombatKillPacket.class, ClientboundPlayerCombatKillPacket::new).addPacket(ClientboundPlayerInfoPacket.class, ClientboundPlayerInfoPacket::new).addPacket(ClientboundPlayerLookAtPacket.class, ClientboundPlayerLookAtPacket::new).addPacket(ClientboundPlayerPositionPacket.class, ClientboundPlayerPositionPacket::new).addPacket(ClientboundRecipePacket.class, ClientboundRecipePacket::new).addPacket(ClientboundRemoveEntitiesPacket.class, ClientboundRemoveEntitiesPacket::new).addPacket(ClientboundRemoveMobEffectPacket.class, ClientboundRemoveMobEffectPacket::new).addPacket(ClientboundResourcePackPacket.class, ClientboundResourcePackPacket::new).addPacket(ClientboundRespawnPacket.class, ClientboundRespawnPacket::new).addPacket(ClientboundRotateHeadPacket.class, ClientboundRotateHeadPacket::new).addPacket(ClientboundSectionBlocksUpdatePacket.class, ClientboundSectionBlocksUpdatePacket::new).addPacket(ClientboundSelectAdvancementsTabPacket.class, ClientboundSelectAdvancementsTabPacket::new).addPacket(ClientboundSetActionBarTextPacket.class, ClientboundSetActionBarTextPacket::new).addPacket(ClientboundSetBorderCenterPacket.class, ClientboundSetBorderCenterPacket::new).addPacket(ClientboundSetBorderLerpSizePacket.class, ClientboundSetBorderLerpSizePacket::new).addPacket(ClientboundSetBorderSizePacket.class, ClientboundSetBorderSizePacket::new).addPacket(ClientboundSetBorderWarningDelayPacket.class, ClientboundSetBorderWarningDelayPacket::new).addPacket(ClientboundSetBorderWarningDistancePacket.class, ClientboundSetBorderWarningDistancePacket::new).addPacket(ClientboundSetCameraPacket.class, ClientboundSetCameraPacket::new).addPacket(ClientboundSetCarriedItemPacket.class, ClientboundSetCarriedItemPacket::new).addPacket(ClientboundSetChunkCacheCenterPacket.class, ClientboundSetChunkCacheCenterPacket::new).addPacket(ClientboundSetChunkCacheRadiusPacket.class, ClientboundSetChunkCacheRadiusPacket::new).addPacket(ClientboundSetDefaultSpawnPositionPacket.class, ClientboundSetDefaultSpawnPositionPacket::new).addPacket(ClientboundSetDisplayObjectivePacket.class, ClientboundSetDisplayObjectivePacket::new).addPacket(ClientboundSetEntityDataPacket.class, ClientboundSetEntityDataPacket::new).addPacket(ClientboundSetEntityLinkPacket.class, ClientboundSetEntityLinkPacket::new).addPacket(ClientboundSetEntityMotionPacket.class, ClientboundSetEntityMotionPacket::new).addPacket(ClientboundSetEquipmentPacket.class, ClientboundSetEquipmentPacket::new).addPacket(ClientboundSetExperiencePacket.class, ClientboundSetExperiencePacket::new).addPacket(ClientboundSetHealthPacket.class, ClientboundSetHealthPacket::new).addPacket(ClientboundSetObjectivePacket.class, ClientboundSetObjectivePacket::new).addPacket(ClientboundSetPassengersPacket.class, ClientboundSetPassengersPacket::new).addPacket(ClientboundSetPlayerTeamPacket.class, ClientboundSetPlayerTeamPacket::new).addPacket(ClientboundSetScorePacket.class, ClientboundSetScorePacket::new).addPacket(ClientboundSetSimulationDistancePacket.class, ClientboundSetSimulationDistancePacket::new).addPacket(ClientboundSetSubtitleTextPacket.class, ClientboundSetSubtitleTextPacket::new).addPacket(ClientboundSetTimePacket.class, ClientboundSetTimePacket::new).addPacket(ClientboundSetTitleTextPacket.class, ClientboundSetTitleTextPacket::new).addPacket(ClientboundSetTitlesAnimationPacket.class, ClientboundSetTitlesAnimationPacket::new).addPacket(ClientboundSoundEntityPacket.class, ClientboundSoundEntityPacket::new).addPacket(ClientboundSoundPacket.class, ClientboundSoundPacket::new).addPacket(ClientboundStopSoundPacket.class, ClientboundStopSoundPacket::new).addPacket(ClientboundTabListPacket.class, ClientboundTabListPacket::new).addPacket(ClientboundTagQueryPacket.class, ClientboundTagQueryPacket::new).addPacket(ClientboundTakeItemEntityPacket.class, ClientboundTakeItemEntityPacket::new).addPacket(ClientboundTeleportEntityPacket.class, ClientboundTeleportEntityPacket::new).addPacket(ClientboundUpdateAdvancementsPacket.class, ClientboundUpdateAdvancementsPacket::new).addPacket(ClientboundUpdateAttributesPacket.class, ClientboundUpdateAttributesPacket::new).addPacket(ClientboundUpdateMobEffectPacket.class, ClientboundUpdateMobEffectPacket::new).addPacket(ClientboundUpdateRecipesPacket.class, ClientboundUpdateRecipesPacket::new).addPacket(ClientboundUpdateTagsPacket.class, ClientboundUpdateTagsPacket::new)).addFlow(PacketFlow.SERVERBOUND, (new ConnectionProtocol.PacketSet()).addPacket(ServerboundAcceptTeleportationPacket.class, ServerboundAcceptTeleportationPacket::new).addPacket(ServerboundBlockEntityTagQuery.class, ServerboundBlockEntityTagQuery::new).addPacket(ServerboundChangeDifficultyPacket.class, ServerboundChangeDifficultyPacket::new).addPacket(ServerboundChatPacket.class, ServerboundChatPacket::new).addPacket(ServerboundClientCommandPacket.class, ServerboundClientCommandPacket::new).addPacket(ServerboundClientInformationPacket.class, ServerboundClientInformationPacket::new).addPacket(ServerboundCommandSuggestionPacket.class, ServerboundCommandSuggestionPacket::new).addPacket(ServerboundContainerButtonClickPacket.class, ServerboundContainerButtonClickPacket::new).addPacket(ServerboundContainerClickPacket.class, ServerboundContainerClickPacket::new).addPacket(ServerboundContainerClosePacket.class, ServerboundContainerClosePacket::new).addPacket(ServerboundCustomPayloadPacket.class, ServerboundCustomPayloadPacket::new).addPacket(ServerboundEditBookPacket.class, ServerboundEditBookPacket::new).addPacket(ServerboundEntityTagQuery.class, ServerboundEntityTagQuery::new).addPacket(ServerboundInteractPacket.class, ServerboundInteractPacket::new).addPacket(ServerboundJigsawGeneratePacket.class, ServerboundJigsawGeneratePacket::new).addPacket(ServerboundKeepAlivePacket.class, ServerboundKeepAlivePacket::new).addPacket(ServerboundLockDifficultyPacket.class, ServerboundLockDifficultyPacket::new).addPacket(ServerboundMovePlayerPacket.Pos.class, ServerboundMovePlayerPacket.Pos::read).addPacket(ServerboundMovePlayerPacket.PosRot.class, ServerboundMovePlayerPacket.PosRot::read).addPacket(ServerboundMovePlayerPacket.Rot.class, ServerboundMovePlayerPacket.Rot::read).addPacket(ServerboundMovePlayerPacket.StatusOnly.class, ServerboundMovePlayerPacket.StatusOnly::read).addPacket(ServerboundMoveVehiclePacket.class, ServerboundMoveVehiclePacket::new).addPacket(ServerboundPaddleBoatPacket.class, ServerboundPaddleBoatPacket::new).addPacket(ServerboundPickItemPacket.class, ServerboundPickItemPacket::new).addPacket(ServerboundPlaceRecipePacket.class, ServerboundPlaceRecipePacket::new).addPacket(ServerboundPlayerAbilitiesPacket.class, ServerboundPlayerAbilitiesPacket::new).addPacket(ServerboundPlayerActionPacket.class, ServerboundPlayerActionPacket::new).addPacket(ServerboundPlayerCommandPacket.class, ServerboundPlayerCommandPacket::new).addPacket(ServerboundPlayerInputPacket.class, ServerboundPlayerInputPacket::new).addPacket(ServerboundPongPacket.class, ServerboundPongPacket::new).addPacket(ServerboundRecipeBookChangeSettingsPacket.class, ServerboundRecipeBookChangeSettingsPacket::new).addPacket(ServerboundRecipeBookSeenRecipePacket.class, ServerboundRecipeBookSeenRecipePacket::new).addPacket(ServerboundRenameItemPacket.class, ServerboundRenameItemPacket::new).addPacket(ServerboundResourcePackPacket.class, ServerboundResourcePackPacket::new).addPacket(ServerboundSeenAdvancementsPacket.class, ServerboundSeenAdvancementsPacket::new).addPacket(ServerboundSelectTradePacket.class, ServerboundSelectTradePacket::new).addPacket(ServerboundSetBeaconPacket.class, ServerboundSetBeaconPacket::new).addPacket(ServerboundSetCarriedItemPacket.class, ServerboundSetCarriedItemPacket::new).addPacket(ServerboundSetCommandBlockPacket.class, ServerboundSetCommandBlockPacket::new).addPacket(ServerboundSetCommandMinecartPacket.class, ServerboundSetCommandMinecartPacket::new).addPacket(ServerboundSetCreativeModeSlotPacket.class, ServerboundSetCreativeModeSlotPacket::new).addPacket(ServerboundSetJigsawBlockPacket.class, ServerboundSetJigsawBlockPacket::new).addPacket(ServerboundSetStructureBlockPacket.class, ServerboundSetStructureBlockPacket::new).addPacket(ServerboundSignUpdatePacket.class, ServerboundSignUpdatePacket::new).addPacket(ServerboundSwingPacket.class, ServerboundSwingPacket::new).addPacket(ServerboundTeleportToEntityPacket.class, ServerboundTeleportToEntityPacket::new).addPacket(ServerboundUseItemOnPacket.class, ServerboundUseItemOnPacket::new).addPacket(ServerboundUseItemPacket.class, ServerboundUseItemPacket::new))), -+ STATUS(1, protocol().addFlow(PacketFlow.SERVERBOUND, (new ConnectionProtocol.PacketSet()).addPacket(ServerboundStatusRequestPacket.class, ServerboundStatusRequestPacket::new).addPacket(ServerboundPingRequestPacket.class, ServerboundPingRequestPacket::new)).addFlow(PacketFlow.CLIENTBOUND, (new ConnectionProtocol.PacketSet()).addPacket(ClientboundStatusResponsePacket.class, ClientboundStatusResponsePacket::new).addPacket(ClientboundPongResponsePacket.class, ClientboundPongResponsePacket::new))), -+ LOGIN(2, protocol().addFlow(PacketFlow.CLIENTBOUND, (new ConnectionProtocol.PacketSet()).addPacket(ClientboundLoginDisconnectPacket.class, ClientboundLoginDisconnectPacket::new).addPacket(ClientboundHelloPacket.class, ClientboundHelloPacket::new).addPacket(ClientboundGameProfilePacket.class, ClientboundGameProfilePacket::new).addPacket(ClientboundLoginCompressionPacket.class, ClientboundLoginCompressionPacket::new).addPacket(ClientboundCustomQueryPacket.class, ClientboundCustomQueryPacket::new)).addFlow(PacketFlow.SERVERBOUND, (new ConnectionProtocol.PacketSet()).addPacket(ServerboundHelloPacket.class, ServerboundHelloPacket::new).addPacket(ServerboundKeyPacket.class, ServerboundKeyPacket::new).addPacket(ServerboundCustomQueryPacket.class, ServerboundCustomQueryPacket::new))); -+ // Paper end - - private static final int MIN_PROTOCOL_ID = -1; - private static final int MAX_PROTOCOL_ID = 2; -diff --git a/src/main/java/net/minecraft/resources/RegistryLoader.java b/src/main/java/net/minecraft/resources/RegistryLoader.java -index bb2f21e10bad59186f6408b5d6f49ee8375e6870..0d28a3a7f52174e70e044957b37361043b153e42 100644 ---- a/src/main/java/net/minecraft/resources/RegistryLoader.java -+++ b/src/main/java/net/minecraft/resources/RegistryLoader.java -@@ -73,7 +73,7 @@ public class RegistryLoader { - } - - private RegistryLoader.ReadCache readCache(ResourceKey> registryRef) { -- return this.readCache.computeIfAbsent(registryRef, (ref) -> { -+ return (RegistryLoader.ReadCache) this.readCache.computeIfAbsent(registryRef, (ref) -> { // Paper - decompile fix - return new RegistryLoader.ReadCache(); - }); - } -diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index ef128de5fe17231b39edb12a7014291d03cf79ec..868f6799a0e406401eecf18bc939fbdf88f534a2 100644 ---- a/src/main/java/net/minecraft/server/MinecraftServer.java -+++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -1770,7 +1770,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoopmap(resourcepackrepository::getPack).filter(Objects::nonNull).map(Pack::open).collect(ImmutableList.toImmutableList()); // CraftBukkit - decompile error // Paper - decompile error // todo: is this needed anymore? - }, this).thenCompose((immutablelist) -> { - MultiPackResourceManager resourcemanager = new MultiPackResourceManager(PackType.SERVER_DATA, immutablelist); - -diff --git a/src/main/java/net/minecraft/server/level/Ticket.java b/src/main/java/net/minecraft/server/level/Ticket.java -index 062da1bddd9704f5fbc46e974e13e60cd500bbe2..ffc43e5d3d0563c9e9c171064511b2c65ddf67e1 100644 ---- a/src/main/java/net/minecraft/server/level/Ticket.java -+++ b/src/main/java/net/minecraft/server/level/Ticket.java -@@ -21,7 +21,7 @@ public final class Ticket implements Comparable> { - return i; - } else { - int j = Integer.compare(System.identityHashCode(this.type), System.identityHashCode(ticket.type)); -- return j != 0 ? j : this.type.getComparator().compare(this.key, ticket.key); -+ return j != 0 ? j : this.type.getComparator().compare(this.key, (T)ticket.key); // Paper - decompile fix - } - } - -diff --git a/src/main/java/net/minecraft/util/SortedArraySet.java b/src/main/java/net/minecraft/util/SortedArraySet.java -index d0f6eb3981a171c0f34870cb0472599d6cca9642..d1b2ba24ef54e01c6249c3b2ca16e80f03c001a6 100644 ---- a/src/main/java/net/minecraft/util/SortedArraySet.java -+++ b/src/main/java/net/minecraft/util/SortedArraySet.java -@@ -28,7 +28,7 @@ public class SortedArraySet extends AbstractSet { - } - - public static > SortedArraySet create(int initialCapacity) { -- return new SortedArraySet<>(initialCapacity, Comparator.naturalOrder()); -+ return new SortedArraySet<>(initialCapacity, Comparator.naturalOrder()); // Paper - decompile fix - } - - public static SortedArraySet create(Comparator comparator) { -diff --git a/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiSection.java b/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiSection.java -index 3d0b05a9ac049cf751dad0b0df46b5152b0cc9a5..3959eeb9090e8e4c999d89ec32fac8c46d5cdc75 100644 ---- a/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiSection.java -+++ b/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiSection.java -@@ -30,7 +30,7 @@ public class PoiSection { - private boolean isValid; - - public static Codec codec(Runnable updateListener) { -- return RecordCodecBuilder.create((instance) -> { -+ return RecordCodecBuilder.create((instance) -> { // Paper - decompile fix - return instance.group(RecordCodecBuilder.point(updateListener), Codec.BOOL.optionalFieldOf("Valid", Boolean.valueOf(false)).forGetter((poiSet) -> { - return poiSet.isValid; - }), PoiRecord.codec(updateListener).listOf().fieldOf("Records").forGetter((poiSet) -> { -diff --git a/src/main/java/net/minecraft/world/entity/monster/hoglin/Hoglin.java b/src/main/java/net/minecraft/world/entity/monster/hoglin/Hoglin.java -index c5b9c0c650df5f4b7e3d2a431dc900e210104dea..49ca4f6a9e33fdb5295dae2b059d071551353c24 100644 ---- a/src/main/java/net/minecraft/world/entity/monster/hoglin/Hoglin.java -+++ b/src/main/java/net/minecraft/world/entity/monster/hoglin/Hoglin.java -@@ -123,7 +123,7 @@ public class Hoglin extends Animal implements Enemy, HoglinBase { - - @Override - public Brain getBrain() { -- return super.getBrain(); -+ return (Brain) super.getBrain(); // Paper - decompile fix - } - - @Override -diff --git a/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java b/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java -index 92650d816113a0f1c2b589691895ebba3424d661..7ef0075cc16613709e145714204a728d8d8dd82b 100644 ---- a/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java -+++ b/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java -@@ -76,7 +76,7 @@ public class RecipeManager extends SimpleJsonResourceReloadListener { - } - - this.recipes = (Map) map1.entrySet().stream().collect(ImmutableMap.toImmutableMap(Entry::getKey, (entry1) -> { -- return (entry1.getValue()); // CraftBukkit -+ return entry1.getValue(); // CraftBukkit // Paper - decompile fix - *shrugs internally* // todo: is this needed anymore? - })); - this.byName = Maps.newHashMap(builder.build()); // CraftBukkit - RecipeManager.LOGGER.info("Loaded {} recipes", map1.size()); -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 80a21d6f607473691c4ee3494bf5f49edf433e59..8bb59da19f2faabb980fbebc4d9825ae74a1b6c5 100644 ---- a/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java -+++ b/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java -@@ -42,7 +42,7 @@ public class PalettedContainer implements PaletteResize { - } - - public static Codec> codec(IdMap idList, Codec entryCodec, PalettedContainer.Strategy provider, T object) { -- return RecordCodecBuilder.create((instance) -> { -+ return RecordCodecBuilder.>create((instance) -> { // Paper - decompile fix - return instance.group(entryCodec.mapResult(ExtraCodecs.orElsePartial(object)).listOf().fieldOf("palette").forGetter(PalettedContainer.DiscData::paletteEntries), Codec.LONG_STREAM.optionalFieldOf("data").forGetter(PalettedContainer.DiscData::storage)).apply(instance, PalettedContainer.DiscData::new); - }).comapFlatMap((serialized) -> { - return read(idList, provider, serialized); -diff --git a/src/main/java/net/minecraft/world/level/entity/EntityLookup.java b/src/main/java/net/minecraft/world/level/entity/EntityLookup.java -index 3864da01056970ae05cc3ca094f923178b4ffc97..e6b9f812e521abd552e0c7dc0429d5a62f2bfc35 100644 ---- a/src/main/java/net/minecraft/world/level/entity/EntityLookup.java -+++ b/src/main/java/net/minecraft/world/level/entity/EntityLookup.java -@@ -20,7 +20,7 @@ public class EntityLookup { - for(T entityAccess : this.byId.values()) { - U entityAccess2 = (U)((EntityAccess)filter.tryCast(entityAccess)); - if (entityAccess2 != null) { -- action.accept((T)entityAccess2); -+ action.accept(entityAccess2); // Paper - decompile fix - } - } - -diff --git a/src/main/java/net/minecraft/world/level/entity/EntitySection.java b/src/main/java/net/minecraft/world/level/entity/EntitySection.java -index e6b1663d4ccdd3842f711ad7547df8ccf973e4b1..524f3c42964eb83c9109bcc548a1075f1e295411 100644 ---- a/src/main/java/net/minecraft/world/level/entity/EntitySection.java -+++ b/src/main/java/net/minecraft/world/level/entity/EntitySection.java -@@ -42,7 +42,7 @@ public class EntitySection { - for(T entityAccess : collection) { - U entityAccess2 = (U)((EntityAccess)type.tryCast(entityAccess)); - if (entityAccess2 != null && entityAccess.getBoundingBox().intersects(box)) { -- action.accept((T)entityAccess2); -+ action.accept(entityAccess2); // Paper - decompile fix - } - } -