Skip to content

Commit

Permalink
Fix GUI textures not being rendered anymore from snapshot changes
Browse files Browse the repository at this point in the history
  • Loading branch information
LostLuma committed Oct 18, 2024
1 parent 6ea1320 commit a1182f2
Show file tree
Hide file tree
Showing 31 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ private static void showNotification(String titleTranslationKey, String iconPath
}

Component title = localized("toast", titleTranslationKey);
ResourceLocation icon = ResourceLocations.of("dynamic_fps", "textures/battery/toast/" + iconPath + ".png");
ResourceLocation icon = ResourceLocations.of("dynamic_fps", "battery/toast/" + iconPath);

BatteryToast.queueToast(title, icon);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ public class BatteryToast implements Toast {

private static BatteryToast queuedToast;

private static final ResourceLocation MOD_ICON = ResourceLocations.of("dynamic_fps", "textures/battery/toast/background_icon.png");
private static final ResourceLocation BACKGROUND_IMAGE = ResourceLocations.of("dynamic_fps", "textures/battery/toast/background.png");
private static final ResourceLocation MOD_ICON = ResourceLocations.of("dynamic_fps", "battery/toast/background_icon");
private static final ResourceLocation BACKGROUND_IMAGE = ResourceLocations.of("dynamic_fps", "battery/toast/background");

private BatteryToast(Component title, ResourceLocation icon) {
this.title = title;
Expand Down Expand Up @@ -74,11 +74,11 @@ public void render(GuiGraphics graphics, Font font, long currentTime) {
this.description = localized("toast", "battery_charge", BatteryTracker.charge());
}

// resource, x, y, z, ?, ?, width, height, width, height
graphics.blit(RenderType::guiTextured, BACKGROUND_IMAGE, 0, 0, 0, 0.0f, 0, this.width(), this.height(), this.width(), this.height());
// type, resource, x, y, width, height
graphics.blitSprite(RenderType::guiTextured, BACKGROUND_IMAGE, 0, 0, this.width(), this.height());

graphics.blit(RenderType::guiTextured, MOD_ICON, 2, 2, 0, 0.0f, 0, 8, 8, 8, 8);
graphics.blit(RenderType::guiTextured, this.icon, 8, 8, 0, 0.0f, 0, 16, 16, 16, 16);
graphics.blitSprite(RenderType::guiTextured, MOD_ICON, 2, 2, 8, 8);
graphics.blitSprite(RenderType::guiTextured, this.icon, 8, 8, 16, 16);

graphics.drawString(Minecraft.getInstance().font, this.title, 30, 7, 0x5f3315, false);
graphics.drawString(Minecraft.getInstance().font, this.description, 30, 18, -16777216, false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,13 @@ private static void drawBatteryOverlay(GuiGraphics graphics) {

int index = BatteryTracker.charge() / 10;
String type = BatteryUtil.isCharging(BatteryTracker.status()) ? "charging" : "draining";
ResourceLocation icon = ResourceLocations.of("dynamic_fps", "textures/battery/icon/" + type + "_" + index + ".png");
ResourceLocation icon = ResourceLocations.of("dynamic_fps", "battery/icon/" + type + "_" + index);

// pair of coordinates
int[] position = config.placement().get(graphics);

// resource, x, y, z, ?, ?, width, height, width, height
graphics.blit(RenderType::guiTextured, icon, position[0], position[1], 0, 0.0f, 0, 16, 16, 16, 16);
// type, resource, x, y, width, height
graphics.blitSprite(RenderType::guiTextured, icon, position[0], position[1], 16, 16);
// font, text, x, y, text color
graphics.drawString(minecraft.font, BatteryTracker.charge() + "%", position[0] + 20, position[1] + 4, 0xFFFFFF);
}
Expand Down

0 comments on commit a1182f2

Please sign in to comment.