diff options
author | Bjarne Koll <[email protected]> | 2024-12-08 17:47:05 +0100 |
---|---|---|
committer | Bjarne Koll <[email protected]> | 2024-12-08 17:47:05 +0100 |
commit | 67fee6437e8d8346abf9bec07f5242028f9b85b6 (patch) | |
tree | 2249bd03b9201670b9e155fa7b942e2b19d1836f | |
parent | 0f7075fec430539908b64b41e78eee1b380dab79 (diff) | |
download | Paper-67fee6437e8d8346abf9bec07f5242028f9b85b6.tar.gz Paper-67fee6437e8d8346abf9bec07f5242028f9b85b6.zip |
Fix compile issues
-rw-r--r-- | patches/server/1073-Switch-Impl-types-to-Holderable.patch | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/patches/server/1073-Switch-Impl-types-to-Holderable.patch b/patches/server/1073-Switch-Impl-types-to-Holderable.patch index b0f0306fc0..ff5cf39229 100644 --- a/patches/server/1073-Switch-Impl-types-to-Holderable.patch +++ b/patches/server/1073-Switch-Impl-types-to-Holderable.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Switch Impl types to Holderable diff --git a/src/main/java/io/papermc/paper/util/Holderable.java b/src/main/java/io/papermc/paper/util/Holderable.java -index 404ab0df12bc8182520c77328017c128d22993eb..0d2496168efe69bd82d3b73b41f798e9ac03ffa4 100644 +index 404ab0df12bc8182520c77328017c128d22993eb..1aabc85bcba3f486645d5bd7011f3f398b120d18 100644 --- a/src/main/java/io/papermc/paper/util/Holderable.java +++ b/src/main/java/io/papermc/paper/util/Holderable.java @@ -1,8 +1,22 @@ @@ -31,18 +31,19 @@ index 404ab0df12bc8182520c77328017c128d22993eb..0d2496168efe69bd82d3b73b41f798e9 public interface Holderable<M> extends Handleable<M> { Holder<M> getHolder(); -@@ -11,4 +25,42 @@ public interface Holderable<M> extends Handleable<M> { +@@ -11,4 +25,43 @@ public interface Holderable<M> extends Handleable<M> { default M getHandle() { return this.getHolder().value(); } + ++ @SuppressWarnings({"unchecked", "rawtypes"}) + static <T extends Keyed, M> @Nullable T fromBukkitSerializationString(@Subst("test:key") String string, Codec<? extends Holder<M>> codec, Registry<T> registry) { -+ if (registry instanceof CraftRegistry<T, M> craftRegistry && craftRegistry.supportsDirectHolders()) { ++ if (registry instanceof final CraftRegistry craftRegistryRaw && craftRegistryRaw.supportsDirectHolders()) { + try { + JsonElement element = JsonParser.parseString(string); + final RegistryOps<JsonElement> ops = CraftRegistry.getMinecraftRegistry().createSerializationContext(JsonOps.INSTANCE); + Holder<M> holder = codec.decode(ops, element).getOrThrow().getFirst(); -+ return craftRegistry.convertDirectHolder(holder); ++ return ((CraftRegistry<T, M>) craftRegistryRaw).convertDirectHolder(holder); + } catch (JsonSyntaxException ex) { + // ignore, try to parse as a key + } |