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 /patches/server/0914-Fix-UnsafeValues-loadAdvancement.patch | |
parent | 672c07728f6f247df34e866a77a47b457c7d1ed9 (diff) | |
download | Paper-716b868b085a384ec514e978c3f0a367659ced78.tar.gz Paper-716b868b085a384ec514e978c3f0a367659ced78.zip |
Use RegistryOps for loadAdvancement (#10799)
Diffstat (limited to 'patches/server/0914-Fix-UnsafeValues-loadAdvancement.patch')
-rw-r--r-- | patches/server/0914-Fix-UnsafeValues-loadAdvancement.patch | 10 |
1 files changed, 7 insertions, 3 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 |