From 10d04661aa8c92de4a2f00546837273228d85fbb Mon Sep 17 00:00:00 2001 From: Jon Gilkison Date: Sun, 6 Sep 2026 14:45:33 +0700 Subject: [PATCH] Add configuration to manually offset the rendering of the health/toughness/armor. --- .../client/gui/BarOverlayRenderer.java | 13 +++++++------ .../fuzs/overflowingbars/config/ClientConfig.java | 6 ++++++ 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/Common/src/main/java/fuzs/overflowingbars/client/gui/BarOverlayRenderer.java b/Common/src/main/java/fuzs/overflowingbars/client/gui/BarOverlayRenderer.java index 0c1b961..793460f 100644 --- a/Common/src/main/java/fuzs/overflowingbars/client/gui/BarOverlayRenderer.java +++ b/Common/src/main/java/fuzs/overflowingbars/client/gui/BarOverlayRenderer.java @@ -2,6 +2,7 @@ import com.mojang.blaze3d.systems.RenderSystem; import fuzs.overflowingbars.OverflowingBars; +import fuzs.overflowingbars.config.ClientConfig; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiGraphics; import net.minecraft.resources.ResourceLocation; @@ -14,8 +15,8 @@ public class BarOverlayRenderer { public static void renderHealthLevelBars(Minecraft minecraft, GuiGraphics guiGraphics, int leftHeight, boolean rowCount) { if (minecraft.getCameraEntity() instanceof Player player) { - int posX = guiGraphics.guiWidth() / 2 - 91; - int posY = guiGraphics.guiHeight() - leftHeight; + int posX = guiGraphics.guiWidth() / 2 - 91 + OverflowingBars.CONFIG.get(ClientConfig.class).health.manualRowShiftX; + int posY = guiGraphics.guiHeight() - leftHeight + OverflowingBars.CONFIG.get(ClientConfig.class).health.manualRowShiftY; HealthBarRenderer.INSTANCE.renderPlayerHealth(guiGraphics, posX, posY, player, minecraft.getProfiler()); if (rowCount) { int allHearts = Mth.ceil(player.getHealth()); @@ -28,8 +29,8 @@ public static void renderHealthLevelBars(Minecraft minecraft, GuiGraphics guiGra public static void renderArmorLevelBar(Minecraft minecraft, GuiGraphics guiGraphics, int leftHeight, boolean rowCount, boolean unmodified) { if (minecraft.getCameraEntity() instanceof Player player) { - int posX = guiGraphics.guiWidth() / 2 - 91; - int posY = guiGraphics.guiHeight() - leftHeight; + int posX = guiGraphics.guiWidth() / 2 - 91 + OverflowingBars.CONFIG.get(ClientConfig.class).armor.manualRowShiftX; + int posY = guiGraphics.guiHeight() - leftHeight + OverflowingBars.CONFIG.get(ClientConfig.class).armor.manualRowShiftY; ArmorBarRenderer.renderArmorBar(guiGraphics, posX, posY, player, minecraft.getProfiler(), unmodified); if (rowCount && !unmodified) { RowCountRenderer.drawBarRowCount(guiGraphics, posX - 2, posY, player.getArmorValue(), true, @@ -41,8 +42,8 @@ public static void renderArmorLevelBar(Minecraft minecraft, GuiGraphics guiGraph public static void renderToughnessLevelBar(Minecraft minecraft, GuiGraphics guiGraphics, int guiHeight, boolean rowCount, boolean leftSide, boolean unmodified) { if (minecraft.getCameraEntity() instanceof Player player) { - int posX = guiGraphics.guiWidth() / 2 + (leftSide ? -91 : 91); - int posY = guiGraphics.guiHeight() - guiHeight; + int posX = guiGraphics.guiWidth() / 2 + (leftSide ? -91 : 91) + OverflowingBars.CONFIG.get(ClientConfig.class).toughness.manualRowShiftX; + int posY = guiGraphics.guiHeight() - guiHeight + OverflowingBars.CONFIG.get(ClientConfig.class).toughness.manualRowShiftY; ArmorBarRenderer.renderToughnessBar(guiGraphics, posX, posY, player, minecraft.getProfiler(), leftSide, unmodified ); diff --git a/Common/src/main/java/fuzs/overflowingbars/config/ClientConfig.java b/Common/src/main/java/fuzs/overflowingbars/config/ClientConfig.java index 191feb3..90516aa 100644 --- a/Common/src/main/java/fuzs/overflowingbars/config/ClientConfig.java +++ b/Common/src/main/java/fuzs/overflowingbars/config/ClientConfig.java @@ -26,6 +26,12 @@ public static class IconRowConfig implements ConfigCore { @Config(description = "Shift the bar up or down by specified number of icon rows. Allows for better mod compatibility.") @Config.IntRange(min = -5, max = 5) public int manualRowShift = 0; + @Config(description = "Shift the bar up or down by specified number of pixels. Allows for better mod compatibility.") + @Config.IntRange(min = -60, max = 60) + public int manualRowShiftY = 0; + @Config(description = "Shift the bar left or right by specified number of pixels. Allows for better mod compatibility.") + @Config.IntRange(min = -60, max = 60) + public int manualRowShiftX = 0; public int manualRowShift() { return this.manualRowShift * 10;