Skip to content

Commit

Permalink
Fix the textures for mod icon error overlays being missing (#680)
Browse files Browse the repository at this point in the history
- Fix missing error icon on mod icons
  • Loading branch information
haykam821 authored and Prospector committed Dec 18, 2023
1 parent 3f22e43 commit b597c87
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
public class ModListEntry extends AlwaysSelectedEntryListWidget.Entry<ModListEntry> {
public static final Identifier UNKNOWN_ICON = new Identifier("textures/misc/unknown_pack.png");
private static final Identifier MOD_CONFIGURATION_ICON = new Identifier("modmenu", "textures/gui/mod_configuration.png");
private static final Identifier ERROR_ICON = new Identifier("minecraft", "textures/gui/world_selection.png");
private static final Identifier ERROR_ICON = new Identifier("minecraft", "world_list/error");
private static final Identifier ERROR_HIGHLIGHTED_ICON = new Identifier("minecraft", "world_list/error_highlighted");

protected final MinecraftClient client;
public final Mod mod;
Expand Down Expand Up @@ -87,14 +88,14 @@ public void render(DrawContext DrawContext, int index, int y, int x, int rowWidt
if (this.client.options.getTouchscreen().getValue() || hovered) {
DrawContext.fill(x, y, x + iconSize, y + iconSize, -1601138544);
boolean hoveringIcon = mouseX - x < iconSize;
int v = hoveringIcon ? iconSize : 0;
if (this.list.getParent().modScreenErrors.containsKey(modId)) {
DrawContext.drawTexture(ERROR_ICON, x, y, 96.0F, (float) v, iconSize, iconSize, textureSize, textureSize);
DrawContext.drawGuiTexture(hoveringIcon ? ERROR_HIGHLIGHTED_ICON : ERROR_ICON, x, y, iconSize, iconSize);
if (hoveringIcon) {
Throwable e = this.list.getParent().modScreenErrors.get(modId);
this.list.getParent().setTooltip(this.client.textRenderer.wrapLines(Text.translatable("modmenu.configure.error", modId, modId).copy().append("\n\n").append(e.toString()).formatted(Formatting.RED), 175));
}
} else {
int v = hoveringIcon ? iconSize : 0;
DrawContext.drawTexture(MOD_CONFIGURATION_ICON, x, y, 0.0F, (float) v, iconSize, iconSize, textureSize, textureSize);
}
}
Expand Down

0 comments on commit b597c87

Please sign in to comment.