Skip to content

Commit

Permalink
Only register ring recipes if a RecipeManager is available
Browse files Browse the repository at this point in the history
Closes #159
  • Loading branch information
zabi94 committed Jul 30, 2023
1 parent d676d97 commit b46821c
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions src/main/java/zabi/minecraft/extraalchemy/items/ItemSettings.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,23 +40,23 @@ private static void getDefaultGroupItems(DisplayContext ctx, ItemGroup.Entries e
entries.add(ModItems.POTION_BAG);

//Adding filled ring recipes
try{
if (ModConfig.INSTANCE.enableRings) {
RecipeManager rm = SidedProxy.getProxy().getRecipeManager().orElseThrow();

for (Recipe<?> r:rm.values()) {
if (r instanceof PotionRingRecipe) {
if (r.getOutput(null) != null && r.getOutput(null).getItem() != null && PotionUtil.getPotionEffects(r.getOutput(null)).size() == 1) {
entries.add(r.getOutput(null));
} else {
Log.w("Ring recipe has an invalid output: "+r.getId().toString());
if (ModConfig.INSTANCE.enableRings) {

SidedProxy.getProxy().getRecipeManager().ifPresent(rm -> {
try{
for (Recipe<?> r:rm.values()) {
if (r instanceof PotionRingRecipe) {
if (r.getOutput(null) != null && r.getOutput(null).getItem() != null && PotionUtil.getPotionEffects(r.getOutput(null)).size() == 1) {
entries.add(r.getOutput(null));
} else {
Log.w("Ring recipe has an invalid output: "+r.getId().toString());
}
}
}
} catch (Throwable e) {
e.printStackTrace();
}
}
} catch (Throwable e) {
e.printStackTrace();
});
}


Expand Down

0 comments on commit b46821c

Please sign in to comment.