diff options
author | Aaron <51387595+AzureAaron@users.noreply.github.com> | 2024-04-23 20:18:43 -0400 |
---|---|---|
committer | Aaron <51387595+AzureAaron@users.noreply.github.com> | 2024-04-26 16:23:22 -0400 |
commit | df9c1b29f0ca35f97e1c74910f6d0e01c2ca6ccb (patch) | |
tree | 974fb1b8d041ee706c69027d858d8c2431a97031 /src/test/java/de/hysky/skyblocker/utils/datafixer/ItemStackComponentizationFixerTest.java | |
parent | 312fdb645de6965a45692b65ceeb4ca80be4d88a (diff) | |
download | Skyblocker-df9c1b29f0ca35f97e1c74910f6d0e01c2ca6ccb.tar.gz Skyblocker-df9c1b29f0ca35f97e1c74910f6d0e01c2ca6ccb.tar.bz2 Skyblocker-df9c1b29f0ca35f97e1c74910f6d0e01c2ca6ccb.zip |
Refactor usages of Optional's orElseThrow to getOrThrow
Mojang's method is more concise and provides far superior error messages
incase the value isn't present (like why it happened) whereas with
Optionals its just the standard value not present message.
Diffstat (limited to 'src/test/java/de/hysky/skyblocker/utils/datafixer/ItemStackComponentizationFixerTest.java')
-rw-r--r-- | src/test/java/de/hysky/skyblocker/utils/datafixer/ItemStackComponentizationFixerTest.java | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/test/java/de/hysky/skyblocker/utils/datafixer/ItemStackComponentizationFixerTest.java b/src/test/java/de/hysky/skyblocker/utils/datafixer/ItemStackComponentizationFixerTest.java index 774f1735..99c6a744 100644 --- a/src/test/java/de/hysky/skyblocker/utils/datafixer/ItemStackComponentizationFixerTest.java +++ b/src/test/java/de/hysky/skyblocker/utils/datafixer/ItemStackComponentizationFixerTest.java @@ -43,7 +43,7 @@ public class ItemStackComponentizationFixerTest { @Test void testDataFixer() { ItemStack fixedStack = ItemStackComponentizationFixer.fixUpItem(NBT); - JsonElement stackJson = ItemStack.CODEC.encodeStart(JsonOps.INSTANCE, fixedStack).result().orElseThrow(); + JsonElement stackJson = ItemStack.CODEC.encodeStart(JsonOps.INSTANCE, fixedStack).getOrThrow(); Assertions.assertEquals("{\"id\":\"minecraft:diamond_sword\",\"count\":1,\"components\":{\"minecraft:custom_data\":{\"ExtraAttributes\":{\"id\":\"TEST\"}}}}", GSON.toJson(stackJson)); } |