Skip to content

Commit

Permalink
fix crash with additional laterns #64
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexthw46 committed Jul 29, 2024
1 parent cfe9177 commit 1cf989a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 10 deletions.
6 changes: 3 additions & 3 deletions src/main/java/elucent/eidolon/codex/CodexChapters.java
Original file line number Diff line number Diff line change
Expand Up @@ -566,9 +566,9 @@ public static void init() {
"eidolon.codex.chapter.altar_lights",
new TitlePage("eidolon.codex.page.altar_lights.0"),
new ListPage("eidolon.codex.page.altar_lights.1",
new ListEntry("torch", new ItemStack(Items.TORCH)),
new ListEntry("soultorch", new ItemStack(Items.SOUL_TORCH)),
new ListEntry("lantern", new ItemStack(Items.LANTERN)),
new ListEntry("torch", new ItemStack(Items.TORCH), Blocks.TORCH),
new ListEntry("soultorch", new ItemStack(Items.SOUL_TORCH), Blocks.SOUL_TORCH),
new ListEntry("lantern", new ItemStack(Items.LANTERN), Blocks.LANTERN),
new ListEntry("candle", new ItemStack(Registry.CANDLE.get())),
new ListEntry("candlestick", new ItemStack(Registry.CANDLESTICK.get())),
new ListEntry("magic_candle", new ItemStack(Registry.MAGIC_CANDLE.get())),
Expand Down
19 changes: 12 additions & 7 deletions src/main/java/elucent/eidolon/codex/ListPage.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,16 +57,21 @@ public void render(CodexGui gui, @NotNull GuiGraphics mStack, ResourceLocation b
AltarEntry entry = entries[i].entry;
drawItem(mStack, icon, x + 2, y + 8 + i * 20, mouseX, mouseY);
String text = "";
if (entry.getPower() > 0) {
text += (int) entry.getPower() + " " + I18n.get("eidolon.codex.altar_power");
}
if (entry.getCapacity() > 0) {
if (!text.isEmpty()) {
text += ", ";
try {
if (entry.getPower() > 0) {
text += (int) entry.getPower() + " " + I18n.get("eidolon.codex.altar_power");
}
if (entry.getCapacity() > 0) {
if (!text.isEmpty()) {
text += ", ";
}
text += (int) entry.getCapacity() + " " + I18n.get("eidolon.codex.altar_capacity");
}
text += (int) entry.getCapacity() + " " + I18n.get("eidolon.codex.altar_capacity");
} catch (Exception e) {
text = "Invalid Entry. Likely mod conflict.";
}
drawText(mStack, text, x + 24, y + 20 + i * 20 - Minecraft.getInstance().font.lineHeight);

}

}
Expand Down

0 comments on commit 1cf989a

Please sign in to comment.