From df9c1b29f0ca35f97e1c74910f6d0e01c2ca6ccb Mon Sep 17 00:00:00 2001 From: Aaron <51387595+AzureAaron@users.noreply.github.com> Date: Tue, 23 Apr 2024 20:18:43 -0400 Subject: 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. --- .../skyblocker/utils/datafixer/ItemStackComponentizationFixer.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/main/java/de/hysky/skyblocker/utils/datafixer/ItemStackComponentizationFixer.java') diff --git a/src/main/java/de/hysky/skyblocker/utils/datafixer/ItemStackComponentizationFixer.java b/src/main/java/de/hysky/skyblocker/utils/datafixer/ItemStackComponentizationFixer.java index 0fa909bf..e77954b0 100644 --- a/src/main/java/de/hysky/skyblocker/utils/datafixer/ItemStackComponentizationFixer.java +++ b/src/main/java/de/hysky/skyblocker/utils/datafixer/ItemStackComponentizationFixer.java @@ -35,7 +35,7 @@ public class ItemStackComponentizationFixer { public static ItemStack fixUpItem(NbtCompound nbt) { Dynamic dynamic = Schemas.getFixer().update(TypeReferences.ITEM_STACK, new Dynamic(NbtOps.INSTANCE, nbt), ITEM_NBT_DATA_VERSION, ITEM_COMPONENTS_DATA_VERSION); - return ItemStack.CODEC.parse(dynamic).result().orElseThrow(); + return ItemStack.CODEC.parse(dynamic).getOrThrow(); } /** -- cgit