Skip to content

Commit 2f7f582

Browse files
committed
Refactor UI color constants for Mechanical Furnace and related widgets
1 parent 7acad4e commit 2f7f582

File tree

5 files changed

+30
-12
lines changed

5 files changed

+30
-12
lines changed

src/main/java/net/roboxgamer/modernutils/client/screen/MechanicalFurnaceScreen.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -317,11 +317,11 @@ protected void renderBg(@NotNull GuiGraphics guiGraphics, float partialTick, int
317317
int y = this.topPos;
318318

319319
// Draw main background
320-
guiGraphics.fill(x, y, x + imageWidth, y + imageHeight, 0xFF1F1F1F);
320+
guiGraphics.fill(x, y, x + imageWidth, y + imageHeight, Constants.Colors.BACKGROUND_MAIN);
321321

322322
// Draw furnace area background
323323
guiGraphics.fill(x + CONTAINER_PADDING, y + TITLE_HEIGHT, x + imageWidth - CONTAINER_PADDING,
324-
y + imageHeight - CONTAINER_PADDING, 0xFF2F2F2F);
324+
y + imageHeight - CONTAINER_PADDING, Constants.Colors.BACKGROUND_SECONDARY);
325325
}
326326

327327
@Override

src/main/java/net/roboxgamer/modernutils/client/screen/widgets/FuelGaugeWidget.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package net.roboxgamer.modernutils.client.screen.widgets;
22

33
import net.minecraft.client.gui.GuiGraphics;
4+
import net.roboxgamer.modernutils.util.Constants;
45
import net.minecraft.client.gui.components.AbstractWidget;
56
import net.minecraft.client.gui.narration.NarrationElementOutput;
67
import net.minecraft.client.gui.narration.NarratedElementType;
@@ -28,18 +29,18 @@ public void renderWidget(GuiGraphics guiGraphics, int mouseX, int mouseY, float
2829
if (!fuelSupplier.hasFuel()) return;
2930

3031
// Draw fuel background
31-
guiGraphics.fill(getX(), getY(), getX() + width, getY() + height, 0xFF3F3F3F);
32+
guiGraphics.fill(getX(), getY(), getX() + width, getY() + height, Constants.Colors.FUEL_BACKGROUND);
3233

3334
// Draw fuel level
3435
int fuelLevel = fuelSupplier.getFuelLevel();
3536
if (fuelLevel > 0) {
3637
int fuelHeight = Mth.ceil((fuelLevel / 100f) * height);
37-
guiGraphics.fill(getX(), getY() + height - fuelHeight,
38-
getX() + width, getY() + height, 0xFFFF8000);
38+
guiGraphics.fill(getX(), getY() + height - fuelHeight,
39+
getX() + width, getY() + height, Constants.Colors.FUEL_FILL);
3940
}
4041

4142
// Draw border
42-
drawBorder(guiGraphics, getX(), getY(), width, height, 0xFF4F4F4F, 0xFF1F1F1F);
43+
drawBorder(guiGraphics, getX(), getY(), width, height, Constants.Colors.BORDER_LIGHT, Constants.Colors.BORDER_DARK);
4344

4445
// Render tooltip if hovered
4546
if (isHovered() && fuelSupplier.hasFuel()) {

src/main/java/net/roboxgamer/modernutils/client/screen/widgets/ProgressArrowWidget.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package net.roboxgamer.modernutils.client.screen.widgets;
22

33
import net.minecraft.client.gui.GuiGraphics;
4+
import net.roboxgamer.modernutils.util.Constants;
45
import net.minecraft.client.gui.components.AbstractWidget;
56
import net.minecraft.client.gui.narration.NarrationElementOutput;
67
import net.minecraft.client.gui.narration.NarratedElementType;
@@ -26,18 +27,18 @@ public ProgressArrowWidget(int x, int y, ProgressSupplier progressSupplier) {
2627
@Override
2728
public void renderWidget(GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTick) {
2829
// Draw progress background
29-
guiGraphics.fill(getX(), getY(), getX() + width, getY() + height, 0xFF3F3F3F);
30+
guiGraphics.fill(getX(), getY(), getX() + width, getY() + height, Constants.Colors.PROGRESS_BACKGROUND);
3031

3132
// Draw progress bar from top to bottom
3233
int progress = progressSupplier.getProgress();
3334
if (progress > 0) {
3435
int progressHeight = Mth.ceil((progress / 100f) * height);
35-
guiGraphics.fill(getX(), getY(),
36-
getX() + width, getY() + progressHeight, 0xFF00FF00);
36+
guiGraphics.fill(getX(), getY(),
37+
getX() + width, getY() + progressHeight, Constants.Colors.PROGRESS_FILL);
3738
}
3839

3940
// Draw border
40-
drawBorder(guiGraphics, getX(), getY(), width, height, 0xFF4F4F4F, 0xFF1F1F1F);
41+
drawBorder(guiGraphics, getX(), getY(), width, height, Constants.Colors.BORDER_LIGHT, Constants.Colors.BORDER_DARK);
4142

4243
// Render tooltip if hovered
4344
if (isHovered()) {

src/main/java/net/roboxgamer/modernutils/client/screen/widgets/SlotWidget.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package net.roboxgamer.modernutils.client.screen.widgets;
22

33
import net.minecraft.client.gui.GuiGraphics;
4+
import net.roboxgamer.modernutils.util.Constants;
45
import net.minecraft.client.gui.components.AbstractWidget;
56
import net.minecraft.client.gui.narration.NarrationElementOutput;
67
import net.minecraft.client.gui.narration.NarratedElementType;
@@ -28,10 +29,10 @@ public void onClick(double mouseX, double mouseY) {
2829
@Override
2930
public void renderWidget(GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTick) {
3031
// Draw slot background
31-
guiGraphics.fill(getX(), getY(), getX() + width, getY() + height, 0xFF2F2F2F);
32+
guiGraphics.fill(getX(), getY(), getX() + width, getY() + height, Constants.Colors.SLOT_BACKGROUND);
3233

3334
// Draw 3D border effect
34-
drawBorder(guiGraphics, getX(), getY(), width, height, 0xFF4F4F4F, 0xFF1F1F1F);
35+
drawBorder(guiGraphics, getX(), getY(), width, height, Constants.Colors.BORDER_LIGHT, Constants.Colors.BORDER_DARK);
3536
}
3637

3738
private void drawBorder(GuiGraphics guiGraphics, int x, int y, int width, int height, int lightColor, int darkColor) {

src/main/java/net/roboxgamer/modernutils/util/Constants.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,21 @@
88
import net.minecraft.world.item.crafting.*;
99

1010
public class Constants {
11+
public static final class Colors {
12+
public static final int BACKGROUND_SECONDARY = 0xFFDDE5EB; // Light grayish-blue (main container)
13+
public static final int BACKGROUND_MAIN = 0xFFECEFF1; // Lighter grayish-blue (inner area)
14+
public static final int SLOT_BACKGROUND = 0xFFCED8E0; // Slightly darker grayish-blue (slot background)
15+
16+
public static final int PROGRESS_BACKGROUND = 0xFFCED8E0; // Slightly darker grayish-blue for progress background
17+
public static final int PROGRESS_FILL = 0xFF66BB6A; // Muted Green for progress bar
18+
19+
public static final int FUEL_BACKGROUND = 0xFFCED8E0; // Slightly darker grayish-blue for fuel background
20+
public static final int FUEL_FILL = 0xFFFF7043; // Muted Orange for fuel gauge
21+
22+
public static final int BORDER_LIGHT = 0xFFB0BEC5; // Lighter grayish-blue border
23+
public static final int BORDER_DARK = 0xFFA1ACB3; // Darker grayish-blue border
24+
}
25+
1126
public static final Class<?>[] MECHANICAL_CRAFTER_SPECIAL_RECIPES = new Class<?>[]{
1227
TippedArrowRecipe.class,
1328
FireworkRocketRecipe.class,

0 commit comments

Comments
 (0)