diff options
author | Jake Potrebic <[email protected]> | 2024-05-29 11:27:29 -0700 |
---|---|---|
committer | GitHub <[email protected]> | 2024-05-29 20:27:29 +0200 |
commit | 716b868b085a384ec514e978c3f0a367659ced78 (patch) | |
tree | 0afe73a491998b3f7418e2efdf2bbc1a52e470c7 | |
parent | 672c07728f6f247df34e866a77a47b457c7d1ed9 (diff) | |
download | Paper-716b868b085a384ec514e978c3f0a367659ced78.tar.gz Paper-716b868b085a384ec514e978c3f0a367659ced78.zip |
Use RegistryOps for loadAdvancement (#10799)
5 files changed, 16 insertions, 12 deletions
diff --git a/patches/server/0914-Fix-UnsafeValues-loadAdvancement.patch b/patches/server/0914-Fix-UnsafeValues-loadAdvancement.patch index 4bf2224704..5c6b4fb26d 100644 --- a/patches/server/0914-Fix-UnsafeValues-loadAdvancement.patch +++ b/patches/server/0914-Fix-UnsafeValues-loadAdvancement.patch @@ -5,12 +5,16 @@ Subject: [PATCH] Fix UnsafeValues#loadAdvancement diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index 2d51418612e4df40b9536ac72ba0a070d59f32d1..34208c749621003ba3ad74894ca25e01469b66f2 100644 +index ac42442b64b1b2ba29997d0720970e7f677a2702..cb72cc3e2b86b447e51236a70a4dd04a611ac81c 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -@@ -323,7 +323,27 @@ public final class CraftMagicNumbers implements UnsafeValues { +@@ -321,9 +321,30 @@ public final class CraftMagicNumbers implements UnsafeValues { + ResourceLocation minecraftkey = CraftNamespacedKey.toMinecraft(key); + JsonElement jsonelement = ServerAdvancementManager.GSON.fromJson(advancement, JsonElement.class); - net.minecraft.advancements.Advancement nms = net.minecraft.advancements.Advancement.CODEC.parse(JsonOps.INSTANCE, jsonelement).getOrThrow(JsonParseException::new); +- net.minecraft.advancements.Advancement nms = net.minecraft.advancements.Advancement.CODEC.parse(JsonOps.INSTANCE, jsonelement).getOrThrow(JsonParseException::new); ++ final net.minecraft.resources.RegistryOps<JsonElement> ops = CraftRegistry.getMinecraftRegistry().createSerializationContext(JsonOps.INSTANCE); // Paper - use RegistryOps ++ final net.minecraft.advancements.Advancement nms = net.minecraft.advancements.Advancement.CODEC.parse(ops, jsonelement).getOrThrow(JsonParseException::new); // Paper - use RegistryOps if (nms != null) { - MinecraftServer.getServer().getAdvancements().advancements.put(minecraftkey, new AdvancementHolder(minecraftkey, nms)); + // Paper start - Fix throw UnsupportedOperationException diff --git a/patches/server/0948-Add-api-for-spawn-egg-texture-colors.patch b/patches/server/0948-Add-api-for-spawn-egg-texture-colors.patch index 876067fe4a..007f7ada26 100644 --- a/patches/server/0948-Add-api-for-spawn-egg-texture-colors.patch +++ b/patches/server/0948-Add-api-for-spawn-egg-texture-colors.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add api for spawn egg texture colors diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index ddf184592488c6664442f113321954fff109a466..96d8576caf8c8698a77f3321e5918f0768e13655 100644 +index cb72cc3e2b86b447e51236a70a4dd04a611ac81c..00cf4a0daa227e6b24ed052873290ff3fdae3119 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -@@ -652,6 +652,15 @@ public final class CraftMagicNumbers implements UnsafeValues { +@@ -653,6 +653,15 @@ public final class CraftMagicNumbers implements UnsafeValues { return CraftRegistry.get(registry, namespacedKey, ApiVersion.CURRENT); } diff --git a/patches/server/0949-Add-Lifecycle-Event-system.patch b/patches/server/0949-Add-Lifecycle-Event-system.patch index 6927718c47..61aced9c2d 100644 --- a/patches/server/0949-Add-Lifecycle-Event-system.patch +++ b/patches/server/0949-Add-Lifecycle-Event-system.patch @@ -739,10 +739,10 @@ index d96399e9bf1a58db5a4a22e58abb99e7660e0694..66bdac50130f523f9dc4379b103b7a46 + // Paper end - lifecycle events } diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index 96d8576caf8c8698a77f3321e5918f0768e13655..873cfc2615e79ea2cc74b0da2544c923206d8f8b 100644 +index 00cf4a0daa227e6b24ed052873290ff3fdae3119..6fc7b20c0f8f14c1d6a47177f9ccf402e88153e6 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -@@ -661,6 +661,13 @@ public final class CraftMagicNumbers implements UnsafeValues { +@@ -662,6 +662,13 @@ public final class CraftMagicNumbers implements UnsafeValues { } // Paper end - spawn egg color visibility diff --git a/patches/server/0950-ItemStack-Tooltip-API.patch b/patches/server/0950-ItemStack-Tooltip-API.patch index fc2f735d6c..ddeb751677 100644 --- a/patches/server/0950-ItemStack-Tooltip-API.patch +++ b/patches/server/0950-ItemStack-Tooltip-API.patch @@ -5,10 +5,10 @@ Subject: [PATCH] ItemStack Tooltip API diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index 873cfc2615e79ea2cc74b0da2544c923206d8f8b..4c199dd62982eaedf7adba49444af7bf8f3d04bc 100644 +index 6fc7b20c0f8f14c1d6a47177f9ccf402e88153e6..1fabc9cf3bf7a05a2593f64eb3e41c21b5f4ee84 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -@@ -637,6 +637,21 @@ public final class CraftMagicNumbers implements UnsafeValues { +@@ -638,6 +638,21 @@ public final class CraftMagicNumbers implements UnsafeValues { } // Paper end - fix custom stats criteria creation diff --git a/patches/server/0972-Rewrite-dataconverter-system.patch b/patches/server/0972-Rewrite-dataconverter-system.patch index 0fe907801b..8c6cdaf4bf 100644 --- a/patches/server/0972-Rewrite-dataconverter-system.patch +++ b/patches/server/0972-Rewrite-dataconverter-system.patch @@ -28981,10 +28981,10 @@ index 1d287dd7379e56f7fd4b425880b850cd843f5789..8ab7ca373a885fbe658013c9c6a2e38d return nbttagcompound; }); diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index 4c199dd62982eaedf7adba49444af7bf8f3d04bc..e46714f38df931350d81c30907560c381c8d2725 100644 +index 1fabc9cf3bf7a05a2593f64eb3e41c21b5f4ee84..4788a591f40f506d81b10fd9f6ab68f308a68e23 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -@@ -520,7 +520,7 @@ public final class CraftMagicNumbers implements UnsafeValues { +@@ -521,7 +521,7 @@ public final class CraftMagicNumbers implements UnsafeValues { net.minecraft.nbt.CompoundTag compound = deserializeNbtFromBytes(data); final int dataVersion = compound.getInt("DataVersion"); @@ -28993,7 +28993,7 @@ index 4c199dd62982eaedf7adba49444af7bf8f3d04bc..e46714f38df931350d81c30907560c38 return CraftItemStack.asCraftMirror(net.minecraft.world.item.ItemStack.parse(MinecraftServer.getServer().registryAccess(), compound).orElseThrow()); } -@@ -541,7 +541,7 @@ public final class CraftMagicNumbers implements UnsafeValues { +@@ -542,7 +542,7 @@ public final class CraftMagicNumbers implements UnsafeValues { net.minecraft.nbt.CompoundTag compound = deserializeNbtFromBytes(data); int dataVersion = compound.getInt("DataVersion"); |