Skip to content

Commit

Permalink
Fix potion brewing crash
Browse files Browse the repository at this point in the history
  • Loading branch information
BluSpring committed Oct 28, 2024
1 parent 80ffc3e commit 58032a4
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,11 @@ public static abstract class MixInject<T> implements PotionBrewingMixInjection<T
@Inject(method = "<init>", at = @At("TAIL"))
private void kilt$getHolderValuesFromRegistry(T from, Ingredient ingredient, T to, CallbackInfo ci) {
if (from instanceof Potion fromPotion && to instanceof Potion toPotion) {
this.kilt$from = (Holder.Reference<T>) ForgeRegistries.POTIONS.getDelegateOrThrow(fromPotion);
this.kilt$to = (Holder.Reference<T>) ForgeRegistries.POTIONS.getDelegateOrThrow(toPotion);
ForgeRegistries.POTIONS.getDelegate(fromPotion).ifPresent(potion -> this.kilt$from = (Holder.Reference<T>) potion);
ForgeRegistries.POTIONS.getDelegate(toPotion).ifPresent(potion -> this.kilt$to = (Holder.Reference<T>) potion);
} else if (from instanceof Item fromItem && to instanceof Item toItem) {
this.kilt$from = (Holder.Reference<T>) ForgeRegistries.ITEMS.getDelegateOrThrow(fromItem);
this.kilt$to = (Holder.Reference<T>) ForgeRegistries.ITEMS.getDelegateOrThrow(toItem);
ForgeRegistries.ITEMS.getDelegate(fromItem).ifPresent(item -> this.kilt$from = (Holder.Reference<T>) item);
ForgeRegistries.ITEMS.getDelegate(toItem).ifPresent(item -> this.kilt$to = (Holder.Reference<T>) item);
}
}

Expand Down

0 comments on commit 58032a4

Please sign in to comment.