Skip to content

Commit 80338e0

Browse files
committed
Have a more colorful text display
1 parent 92835d8 commit 80338e0

File tree

4 files changed

+57
-22
lines changed

4 files changed

+57
-22
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package gregtech.api.mui;
2+
3+
import gregtech.api.util.KeyUtil;
4+
5+
import net.minecraft.util.text.TextFormatting;
6+
7+
import com.cleanroommc.modularui.api.drawable.IKey;
8+
9+
public final class TextStandards {
10+
11+
public static class Colors {
12+
13+
public static final TextFormatting MACHINE_WORKING = TextFormatting.GREEN;
14+
public static final TextFormatting MACHINE_DONE = TextFormatting.GREEN;
15+
public static final TextFormatting MACHINE_PAUSED = TextFormatting.GOLD;
16+
public static final TextFormatting NO_OUTPUT_SPACE = TextFormatting.RED;
17+
public static final TextFormatting STEAM_VENT_BLOCKED = TextFormatting.RED;
18+
public static final TextFormatting NO_POWER = TextFormatting.RED;
19+
}
20+
21+
public static class Keys {
22+
23+
public static final IKey MACHINE_PAUSED = KeyUtil.lang(Colors.MACHINE_PAUSED,
24+
"gregtech.multiblock.work_paused");
25+
}
26+
}

src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityMiner.java

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
import gregtech.api.metatileentity.interfaces.IGregTechTileEntity;
1515
import gregtech.api.mui.GTGuiTextures;
1616
import gregtech.api.mui.GTGuis;
17+
import gregtech.api.mui.TextStandards;
1718
import gregtech.api.util.KeyUtil;
1819
import gregtech.client.renderer.texture.Textures;
1920
import gregtech.core.sound.GTSoundEvents;
@@ -155,19 +156,21 @@ public ModularPanel buildUI(PosGuiData guiData, PanelSyncManager panelSyncManage
155156
radiusSync.getIntValue(), radiusSync.getIntValue()));
156157

157158
if (isDone) {
158-
text.addLine(KeyUtil.lang(TextFormatting.GREEN, "gregtech.machine.miner.done"));
159+
text.addLine(KeyUtil.lang(TextStandards.Colors.MACHINE_DONE, "gregtech.machine.miner.done"));
159160
} else if (isWorking) {
160-
text.addLine(KeyUtil.lang(TextFormatting.GOLD, "gregtech.machine.miner.working"));
161+
text.addLine(KeyUtil.lang(TextStandards.Colors.MACHINE_WORKING,
162+
"gregtech.machine.miner.working"));
161163
} else if (!isWorkingEnabled) {
162-
text.addLine(KeyUtil.lang("gregtech.multiblock.work_paused"));
164+
text.addLine(TextStandards.Keys.MACHINE_PAUSED);
163165
}
164166

165167
if (isInventoryFull) {
166-
text.addLine(KeyUtil.lang(TextFormatting.RED, "gregtech.machine.miner.invfull"));
168+
text.addLine(KeyUtil.lang(TextStandards.Colors.NO_OUTPUT_SPACE,
169+
"gregtech.machine.miner.invfull"));
167170
}
168171

169172
if (!hasEnoughEnergy) {
170-
text.addLine(KeyUtil.lang(TextFormatting.RED, "gregtech.machine.miner.needspower"));
173+
text.addLine(KeyUtil.lang(TextStandards.Colors.NO_POWER, "gregtech.machine.miner.needspower"));
171174
}
172175
})
173176
.left(10)

src/main/java/gregtech/common/metatileentities/steam/SteamMiner.java

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
import gregtech.api.mui.GTGuiTextures;
1515
import gregtech.api.mui.GTGuiTheme;
1616
import gregtech.api.mui.GTGuis;
17+
import gregtech.api.mui.TextStandards;
1718
import gregtech.api.util.GTUtility;
1819
import gregtech.api.util.KeyUtil;
1920
import gregtech.client.renderer.texture.Textures;
@@ -186,27 +187,32 @@ public ModularPanel buildUI(PosGuiData guiData, PanelSyncManager panelSyncManage
186187
radius, radius));
187188

188189
if (isDone) {
189-
text.addLine(KeyUtil.lang(TextFormatting.GREEN, "gregtech.machine.miner.done"));
190+
text.addLine(KeyUtil.lang(TextStandards.Colors.MACHINE_DONE,
191+
"gregtech.machine.miner.done"));
190192
} else if (isWorking) {
191-
text.addLine(KeyUtil.lang(TextFormatting.GOLD, "gregtech.machine.miner.working"));
193+
text.addLine(KeyUtil.lang(TextStandards.Colors.MACHINE_WORKING,
194+
"gregtech.machine.miner.working"));
192195
} else if (!isWorkingEnabled) {
193-
text.addLine(KeyUtil.lang("gregtech.multiblock.work_paused"));
196+
text.addLine(TextStandards.Keys.MACHINE_PAUSED);
194197
}
195198

196199
if (isInventoryFull) {
197-
text.addLine(KeyUtil.lang(TextFormatting.RED, "gregtech.machine.miner.invfull"));
200+
text.addLine(KeyUtil.lang(TextStandards.Colors.NO_OUTPUT_SPACE,
201+
"gregtech.machine.miner.invfull"));
198202
}
199203

200204
if (isVentBlocked) {
201-
text.addLine(KeyUtil.lang(TextFormatting.RED, "gregtech.machine.steam_miner.vent"));
205+
text.addLine(KeyUtil.lang(TextStandards.Colors.STEAM_VENT_BLOCKED,
206+
"gregtech.machine.steam_miner.vent"));
202207
}
203208

204209
// Drain energy always returns false when the vent is blocked, so check that it isn't
205210
// blocked.
206211
// It should be fine since I don't think it can even enter the vent blocked state without
207212
// having steam.
208213
if (!hasEnoughEnergy && !isVentBlocked) {
209-
text.addLine(KeyUtil.lang(TextFormatting.RED, "gregtech.machine.steam_miner.steam"));
214+
text.addLine(KeyUtil.lang(TextStandards.Colors.NO_POWER,
215+
"gregtech.machine.steam_miner.steam"));
210216
}
211217
})
212218
.left(10)

src/main/resources/assets/gregtech/lang/en_us.lang

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4883,6 +4883,7 @@ gregtech.machine.miner.hv.name=Advanced Miner II
48834883
gregtech.machine.miner.tooltip=Mines ores below the Miner! Starts as §f%sx%s §7area
48844884
gregtech.machine.miner.per_block=§7takes §f%,ds §7per Block
48854885

4886+
48864887
gregtech.machine.large_miner.ev.name=Basic Ore Drilling Plant
48874888
gregtech.machine.large_miner.iv.name=Advanced Ore Drilling Plant
48884889
gregtech.machine.large_miner.luv.name=Advanced Ore Drilling Plant II
@@ -4891,10 +4892,17 @@ gregtech.machine.miner.multi.production=Produces §f3x§7 more crushed ore than
48914892
gregtech.machine.miner.fluid_usage=Uses §f%,d L/t §7of §f%s§7, doubled per overclock.
48924893
gregtech.machine.miner.multi.description=A multiblock mining machine that covers a large area and produces huge quantity of ore.
48934894
gregtech.machine.miner.multi.needsfluid=No Drilling Fluid!
4895+
gregtech.machine.miner.done=Done!
4896+
gregtech.machine.miner.working=Mining...
4897+
gregtech.machine.miner.invfull=Inventory Full!
4898+
gregtech.machine.miner.needspower=Needs Power!
4899+
gregtech.machine.steam_miner.vent=Venting Blocked!
4900+
gregtech.machine.steam_miner.steam=Needs Steam!
4901+
gregtech.machine.miner.errorradius=§cCannot change radius while working!
48944902
gregtech.machine.miner.mining_at=Currently mining at:
4895-
gregtech.machine.miner.mining_pos_x=X: %s
4896-
gregtech.machine.miner.mining_pos_y=Y: %s
4897-
gregtech.machine.miner.mining_pos_z=Z: %s
4903+
gregtech.machine.miner.mining_pos_x=§bX§r: §a%s§r
4904+
gregtech.machine.miner.mining_pos_y=§bY§r: §a%s§r
4905+
gregtech.machine.miner.mining_pos_z=§bZ§r: §a%s§r
48984906
gregtech.machine.miner.radius=Radius: %d
48994907
gregtech.machine.miner.working_area=Working Area: %dx%d blocks
49004908
gregtech.machine.miner.working_area_chunks=Working Area: %dx%d chunks
@@ -5910,14 +5918,6 @@ gregtech.multiblock.large_boiler.explosion_tooltip=Will explode if provided Fuel
59105918
gregtech.multiblock.large_boiler.water_bar_hover=§7Water: §9%,d / %,d L
59115919
gregtech.multiblock.large_boiler.no_water=§eNo Water!
59125920

5913-
gregtech.machine.miner.done=Done!
5914-
gregtech.machine.miner.working=Working...
5915-
gregtech.machine.miner.invfull=Inventory Full!
5916-
gregtech.machine.miner.needspower=Needs Power!
5917-
gregtech.machine.steam_miner.vent=Venting Blocked!
5918-
gregtech.machine.steam_miner.steam=Needs Steam!
5919-
gregtech.machine.miner.errorradius=§cCannot change radius while working!
5920-
59215921
gregtech.multiblock.miner.neither_mode=Chunk Mode: §cDisabled§r/nSilk Touch Mode: §cDisabled§r/n§7Switching requires an idle machine.
59225922
gregtech.multiblock.miner.chunk_mode=Chunk Mode: §aEnabled§r/nSilk Touch Mode: §cDisabled§r/n§7Switching requires an idle machine.
59235923
gregtech.multiblock.miner.silk_touch_mode=Chunk Mode: §cDisabled§r/nSilk Touch Mode: §aEnabled§r/n§7Switching requires an idle machine.

0 commit comments

Comments
 (0)