Skip to content

Commit

Permalink
Fix the incorrect codec usage in the Style convert
Browse files Browse the repository at this point in the history
  • Loading branch information
LemonCaramel committed Apr 28, 2024
1 parent f187fd6 commit 66b6341
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions patches/server/0010-Adventure.patch
Original file line number Diff line number Diff line change
Expand Up @@ -1157,7 +1157,7 @@ index 0000000000000000000000000000000000000000..2fd6c3e65354071af71c7d8ebb97b559
+}
diff --git a/src/main/java/io/papermc/paper/adventure/PaperAdventure.java b/src/main/java/io/papermc/paper/adventure/PaperAdventure.java
new file mode 100644
index 0000000000000000000000000000000000000000..cb9f8567ba6aae41a6cde519ac0cff0169a7cea7
index 0000000000000000000000000000000000000000..fc6e13e4f2408ccbfa645eae2d7ebf4dcfc21908
--- /dev/null
+++ b/src/main/java/io/papermc/paper/adventure/PaperAdventure.java
@@ -0,0 +1,478 @@
Expand Down Expand Up @@ -1624,7 +1624,7 @@ index 0000000000000000000000000000000000000000..cb9f8567ba6aae41a6cde519ac0cff01
+ public static net.minecraft.network.chat.Style asVanilla(final Style style) {
+ final RegistryOps<Object> ops = RegistryOps.create(JavaOps.INSTANCE, CraftRegistry.getMinecraftRegistry());
+ final Object encoded = AdventureCodecs.STYLE_MAP_CODEC.codec()
+ .parse(ops, style).getOrThrow(IllegalStateException::new);
+ .encodeStart(ops, style).getOrThrow(IllegalStateException::new);
+
+ return net.minecraft.network.chat.Style.Serializer.CODEC
+ .parse(ops, encoded).getOrThrow(IllegalStateException::new);
Expand All @@ -1633,7 +1633,7 @@ index 0000000000000000000000000000000000000000..cb9f8567ba6aae41a6cde519ac0cff01
+ public static Style asAdventure(final net.minecraft.network.chat.Style style) {
+ final RegistryOps<Object> ops = RegistryOps.create(JavaOps.INSTANCE, CraftRegistry.getMinecraftRegistry());
+ final Object encoded = net.minecraft.network.chat.Style.Serializer.CODEC
+ .parse(ops, style).getOrThrow(IllegalStateException::new);
+ .encodeStart(ops, style).getOrThrow(IllegalStateException::new);
+
+ return AdventureCodecs.STYLE_MAP_CODEC.codec()
+ .parse(ops, encoded).getOrThrow(IllegalStateException::new);
Expand Down

0 comments on commit 66b6341

Please sign in to comment.