From 58032a42201f627a2a9264b916ac7ff030ad0bf1 Mon Sep 17 00:00:00 2001 From: Naz Date: Mon, 28 Oct 2024 08:06:43 +0800 Subject: [PATCH] Fix potion brewing crash --- .../world/item/alchemy/PotionBrewingInject.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/xyz/bluspring/kilt/forgeinjects/world/item/alchemy/PotionBrewingInject.java b/src/main/java/xyz/bluspring/kilt/forgeinjects/world/item/alchemy/PotionBrewingInject.java index da57c1e0..7d58b141 100644 --- a/src/main/java/xyz/bluspring/kilt/forgeinjects/world/item/alchemy/PotionBrewingInject.java +++ b/src/main/java/xyz/bluspring/kilt/forgeinjects/world/item/alchemy/PotionBrewingInject.java @@ -72,11 +72,11 @@ public static abstract class MixInject implements PotionBrewingMixInjection) ForgeRegistries.POTIONS.getDelegateOrThrow(fromPotion); - this.kilt$to = (Holder.Reference) ForgeRegistries.POTIONS.getDelegateOrThrow(toPotion); + ForgeRegistries.POTIONS.getDelegate(fromPotion).ifPresent(potion -> this.kilt$from = (Holder.Reference) potion); + ForgeRegistries.POTIONS.getDelegate(toPotion).ifPresent(potion -> this.kilt$to = (Holder.Reference) potion); } else if (from instanceof Item fromItem && to instanceof Item toItem) { - this.kilt$from = (Holder.Reference) ForgeRegistries.ITEMS.getDelegateOrThrow(fromItem); - this.kilt$to = (Holder.Reference) ForgeRegistries.ITEMS.getDelegateOrThrow(toItem); + ForgeRegistries.ITEMS.getDelegate(fromItem).ifPresent(item -> this.kilt$from = (Holder.Reference) item); + ForgeRegistries.ITEMS.getDelegate(toItem).ifPresent(item -> this.kilt$to = (Holder.Reference) item); } }