mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-22 07:08:47 +01:00
Use RegistryOps for loadAdvancement (#10799)
This commit is contained in:
parent
672c07728f
commit
716b868b08
5 changed files with 16 additions and 12 deletions
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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");
|
||||
|
|
Loading…
Reference in a new issue