Skip to content

Commit 08b8c45

Browse files
committed
simplify status keys
remove unneeded method spotless
1 parent b9fb922 commit 08b8c45

File tree

3 files changed

+11
-16
lines changed

3 files changed

+11
-16
lines changed

src/main/java/gregtech/api/metatileentity/multiblock/ui/MultiblockUIFactory.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -474,9 +474,9 @@ public static class Builder {
474474
private boolean isStructureFormed;
475475

476476
// Keys for the three-state working system, can be set custom by multiblocks.
477-
private IKey idlingKey = IKey.lang("gregtech.multiblock.idling");
478-
private IKey pausedKey = IKey.lang("gregtech.multiblock.work_paused");
479-
private IKey runningKey = IKey.lang("gregtech.multiblock.running");
477+
private IKey idlingKey = IKey.lang("gregtech.multiblock.idling").format(TextFormatting.GRAY);
478+
private IKey pausedKey = IKey.lang("gregtech.multiblock.work_paused").format(TextFormatting.GOLD);
479+
private IKey runningKey = IKey.lang("gregtech.multiblock.running").format(TextFormatting.GREEN);
480480
private boolean dirty;
481481

482482
protected static Widget<?> keyMapper(IDrawable key) {
@@ -691,7 +691,7 @@ public Builder addWorkingStatusLine() {
691691
public Builder addWorkPausedLine(boolean checkState) {
692692
if (!isStructureFormed) return this;
693693
if (!checkState || !isWorkingEnabled.getAsBoolean()) {
694-
addKey(KeyUtil.colored(TextFormatting.GOLD, pausedKey));
694+
addKey(pausedKey);
695695
}
696696
return this;
697697
}
@@ -705,7 +705,7 @@ public Builder addWorkPausedLine(boolean checkState) {
705705
public Builder addRunningPerfectlyLine(boolean checkState) {
706706
if (!isStructureFormed) return this;
707707
if (!checkState || isActive.getAsBoolean()) {
708-
addKey(KeyUtil.colored(TextFormatting.GREEN, runningKey));
708+
addKey(runningKey);
709709
}
710710
return this;
711711
}
@@ -719,7 +719,7 @@ public Builder addRunningPerfectlyLine(boolean checkState) {
719719
public Builder addIdlingLine(boolean checkState) {
720720
if (!isStructureFormed) return this;
721721
if (!checkState || (isWorkingEnabled.getAsBoolean() && !isActive.getAsBoolean())) {
722-
addKey(KeyUtil.colored(TextFormatting.GRAY, idlingKey));
722+
addKey(idlingKey);
723723
}
724724
return this;
725725
}

src/main/java/gregtech/api/util/KeyUtil.java

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,6 @@ public class KeyUtil {
1313

1414
public static final String SECTION = "§";
1515

16-
public static IKey colored(TextFormatting formatting, IKey... keys) {
17-
if (ArrayUtils.isEmpty(keys)) return wrap(formatting);
18-
if (keys.length == 1) return IKey.comp(wrap(formatting), keys[0]);
19-
return IKey.comp(keys).format(formatting);
20-
}
21-
2216
public static IKey string(String s) {
2317
return IKey.str(s);
2418
}
@@ -55,7 +49,8 @@ public static IKey lang(TextFormatting formatting, String lang, Object... args)
5549
public static IKey lang(TextFormatting formatting, String lang, Supplier<?>... argSuppliers) {
5650
if (ArrayUtils.isEmpty(argSuppliers)) return IKey.lang(lang).format(formatting);
5751
if (argSuppliers.length == 1)
58-
return IKey.dynamic(() -> IKey.lang(lang, fixArg(formatting, argSuppliers[0].get())).format(formatting).getFormatted());
52+
return IKey.dynamic(
53+
() -> IKey.lang(lang, fixArg(formatting, argSuppliers[0].get())).format(formatting).getFormatted());
5954
final Object[] args = new Object[argSuppliers.length];
6055
return IKey.dynamic(() -> {
6156
Arrays.setAll(args, value -> fixArg(formatting, argSuppliers[value].get()));

src/main/java/gregtech/mixins/mui2/KeyCompMixin.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,17 @@
22

33
import com.cleanroommc.modularui.api.drawable.IKey;
44
import com.cleanroommc.modularui.drawable.text.BaseKey;
5-
65
import com.cleanroommc.modularui.drawable.text.CompoundKey;
7-
86
import org.spongepowered.asm.mixin.Mixin;
97
import org.spongepowered.asm.mixin.injection.At;
108
import org.spongepowered.asm.mixin.injection.Redirect;
119

1210
@Mixin(value = CompoundKey.class, remap = false)
1311
public abstract class KeyCompMixin extends BaseKey {
1412

15-
@Redirect(method = "get", at = @At(value = "INVOKE", target = "Lcom/cleanroommc/modularui/api/drawable/IKey;get()Ljava/lang/String;"))
13+
@Redirect(method = "get",
14+
at = @At(value = "INVOKE",
15+
target = "Lcom/cleanroommc/modularui/api/drawable/IKey;get()Ljava/lang/String;"))
1616
public String formatTheKeys(IKey key) {
1717
return key.getFormatted();
1818
}

0 commit comments

Comments
 (0)