Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/architectury/1.21' into architec…
Browse files Browse the repository at this point in the history
…tury/1.21
  • Loading branch information
fzzyhmstrs committed Feb 2, 2025
2 parents f388197 + 7b003e6 commit e8de789
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions xplat/src/main/java/fzzyhmstrs/emi_loot/emi/MobLootRecipe.java
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,12 @@ public MobLootRecipe(ClientMobLootTable loot) {
builtPool.stacks().forEach(cs -> {
list.addAll(cs.ingredient());
});
addWidgetBuilders(builtPool, false);
try {
addWidgetBuilders(builtPool, false);
} catch (Throwable e) {
EmiLoot.LOGGER.error("Error encountered while preparing layout for mob recipe {}, display may be incomplete.", loot.id);
e.printStackTrace();
}
}
);
outputStacks = list;
Expand All @@ -109,26 +114,21 @@ public MobLootRecipe(ClientMobLootTable loot) {
private final EntityType<?> type;
@Nullable
private final EmiStack egg;
private final List<WidgetRowBuilder> rowBuilderList = new LinkedList<>();
private final List<WidgetRowBuilder> rowBuilderList = new ArrayList<>();

private void addWidgetBuilders(ClientBuiltPool newPool, boolean recursive) {
if (recursive || rowBuilderList.isEmpty()) {
rowBuilderList.add(new WidgetRowBuilder(154));
}
boolean added = false;
for (WidgetRowBuilder builder : rowBuilderList) {
if (builder.canAddPool(newPool)) {
builder.addAndTrim(newPool);
added = true;
break;
return;
}
}
if (!added) {
Optional<ClientBuiltPool> opt = rowBuilderList.get(rowBuilderList.size() - 1).addAndTrim(newPool);
opt.ifPresent(clientMobBuiltPool -> addWidgetBuilders(clientMobBuiltPool, true));
}


Optional<ClientBuiltPool> opt = rowBuilderList.get(rowBuilderList.size() - 1).addAndTrim(newPool);
if (opt.isEmpty()) return;
addWidgetBuilders(opt.get(), true);
}

@Override
Expand Down Expand Up @@ -294,4 +294,4 @@ public boolean supportsRecipeTree() {
public boolean hideCraftable() {
return EmiRecipe.super.hideCraftable();
}
}
}

0 comments on commit e8de789

Please sign in to comment.