Skip to content

Commit

Permalink
add config for oxygen bar position
Browse files Browse the repository at this point in the history
  • Loading branch information
screret committed Apr 1, 2024
1 parent 2c6a85f commit cd3d951
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import argent_matter.gcyr.GCyR;
import argent_matter.gcyr.common.item.armor.SpaceSuitArmorItem;
import argent_matter.gcyr.config.GCyRConfig;
import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.resources.ResourceLocation;
import net.minecraftforge.client.gui.overlay.ForgeGui;
Expand All @@ -15,17 +16,17 @@ public void render(ForgeGui gui, GuiGraphics graphics, float partialTick, int sc
if (!gui.getMinecraft().options.hideGui) {
if (SpaceSuitArmorItem.hasFullSet(gui.getMinecraft().player)) {
gui.setupOverlayRenderState(true, false);
int minX = 32;
int minY = screenHeight - 32;
graphics.blit(GUI_TEXTURE, minX, minY, 0, 0, 64, 16, 64, 32);
int x = GCyRConfig.INSTANCE.client.oxygenBarX;
int y = screenHeight - GCyRConfig.INSTANCE.client.oxygenBarY;
graphics.blit(GUI_TEXTURE, x, y, 0, 0, 64, 16, 64, 32);

long oxygenAmount = SpaceSuitArmorItem.oxygenAmount(gui.getMinecraft().player);
long maxOxygen = SpaceSuitArmorItem.oxygenMax(gui.getMinecraft().player);
if (maxOxygen == 0) {
return;
}
int width = (int) (oxygenAmount * 64.0 / maxOxygen);
graphics.blit(GUI_TEXTURE, minX, minY, 0, 16, width, 16, 64, 32);
graphics.blit(GUI_TEXTURE, x, y, 0, 16, width, 16, 64, 32);
}
}
}
Expand Down
11 changes: 11 additions & 0 deletions src/main/java/argent_matter/gcyr/config/GCyRConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ public static void init() {
public MachineConfigs machine = new MachineConfigs();
@Configurable
public RocketConfigs rocket = new RocketConfigs();
@Configurable
public ClientConfigs client = new ClientConfigs();

public static class SatelliteConfigs {
@Configurable
Expand Down Expand Up @@ -75,4 +77,13 @@ public static class RocketConfigs {
@Configurable.Comment({"How much fuel is required to travel to a planet anywhere?", "note: this is platform-specific.", "Default: 48 buckets."})
public long anywhereFuelAmount = 48 * FluidHelper.getBucket();
}

public static class ClientConfigs {
@Configurable
@Configurable.Comment({"Offset of the oxygen bar from the left side of the screen.", "Default: 32"})
public int oxygenBarX = 32;
@Configurable
@Configurable.Comment({"Offset of the oxygen bar from the bottom of the screen.", "Default: 32"})
public int oxygenBarY = 32;
}
}

0 comments on commit cd3d951

Please sign in to comment.