mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-31 04:13:51 -07:00
more adventure codec stuff
and fix tests
This commit is contained in:
@@ -197,7 +197,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+
|
||||
+import io.papermc.paper.adventure.PaperAdventure;
|
||||
+import net.kyori.adventure.text.format.TextColor;
|
||||
+import net.minecraft.advancements.FrameType;
|
||||
+import net.minecraft.advancements.AdvancementType;
|
||||
+import net.minecraft.network.chat.contents.TranslatableContents;
|
||||
+import org.junit.jupiter.api.Test;
|
||||
+
|
||||
@@ -207,13 +207,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+
|
||||
+ @Test
|
||||
+ public void test() {
|
||||
+ for (FrameType nmsFrameType : FrameType.values()) {
|
||||
+ final TextColor expectedColor = PaperAdventure.asAdventure(nmsFrameType.getChatColor());
|
||||
+ final String expectedTranslationKey = ((TranslatableContents) nmsFrameType.getDisplayName().getContents()).getKey();
|
||||
+ final var frame = PaperAdvancementDisplay.asPaperFrame(nmsFrameType);
|
||||
+ for (final AdvancementType advancementType : AdvancementType.values()) {
|
||||
+ final TextColor expectedColor = PaperAdventure.asAdventure(advancementType.getChatColor());
|
||||
+ final String expectedTranslationKey = ((TranslatableContents) advancementType.getDisplayName().getContents()).getKey();
|
||||
+ final var frame = PaperAdvancementDisplay.asPaperFrame(advancementType);
|
||||
+ assertEquals(expectedTranslationKey, frame.translationKey(), "The translation keys should be the same");
|
||||
+ assertEquals(expectedColor, frame.color(), "The frame colors should be the same");
|
||||
+ assertEquals(nmsFrameType.getName(), AdvancementDisplay.Frame.NAMES.key(frame));
|
||||
+ assertEquals(advancementType.name(), AdvancementDisplay.Frame.NAMES.key(frame));
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
|
Reference in New Issue
Block a user