Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Align multiblock text to left #3553

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2453,9 +2453,9 @@ public void addUIWidgets(ModularWindow.Builder builder, UIBuildContext buildCont
drawTexts(screenElements, inventorySlot);
builder.widget(
new Scrollable().setVerticalScroll()
.widget(screenElements.setPos(10, 0))
.setPos(0, 7)
.setSize(190, 79));
.widget(screenElements)
.setPos(10, 7)
.setSize(182, 79));

setMachineModeIcons();
builder.widget(createPowerSwitchButton(builder))
Expand Down Expand Up @@ -2563,38 +2563,44 @@ protected String generateCurrentRecipeInfoString() {

protected void drawTexts(DynamicPositionedColumn screenElements, SlotWidget inventorySlot) {
screenElements.setSynced(false)
.setSpace(0)
.setPos(10, 7);
.setSpace(0);
if (supportsMachineModeSwitch()) {
screenElements.widget(
TextWidget.dynamicString(
() -> EnumChatFormatting.WHITE + GTUtility.trans("400", "Running mode: ")
+ EnumChatFormatting.GOLD
+ getMachineModeName()));
TextWidget
.dynamicString(
() -> EnumChatFormatting.WHITE + GTUtility.trans("400", "Running mode: ")
+ EnumChatFormatting.GOLD
+ getMachineModeName())
.setTextAlignment(Alignment.CenterLeft));
}
screenElements
.widget(
new TextWidget(GTUtility.trans("132", "Pipe is loose.")).setDefaultColor(COLOR_TEXT_WHITE.get())
new TextWidget(GTUtility.trans("132", "Pipe is loose.")).setTextAlignment(Alignment.CenterLeft)
.setDefaultColor(COLOR_TEXT_WHITE.get())
.setEnabled(widget -> !mWrench))
.widget(new FakeSyncWidget.BooleanSyncer(() -> mWrench, val -> mWrench = val));
screenElements
.widget(
new TextWidget(GTUtility.trans("133", "Screws are loose.")).setDefaultColor(COLOR_TEXT_WHITE.get())
new TextWidget(GTUtility.trans("133", "Screws are loose.")).setTextAlignment(Alignment.CenterLeft)
.setDefaultColor(COLOR_TEXT_WHITE.get())
.setEnabled(widget -> !mScrewdriver))
.widget(new FakeSyncWidget.BooleanSyncer(() -> mScrewdriver, val -> mScrewdriver = val));
screenElements
.widget(
new TextWidget(GTUtility.trans("134", "Something is stuck.")).setDefaultColor(COLOR_TEXT_WHITE.get())
new TextWidget(GTUtility.trans("134", "Something is stuck.")).setTextAlignment(Alignment.CenterLeft)
.setDefaultColor(COLOR_TEXT_WHITE.get())
.setEnabled(widget -> !mSoftHammer))
.widget(new FakeSyncWidget.BooleanSyncer(() -> mSoftHammer, val -> mSoftHammer = val));
screenElements
.widget(
new TextWidget(GTUtility.trans("135", "Platings are dented.")).setDefaultColor(COLOR_TEXT_WHITE.get())
new TextWidget(GTUtility.trans("135", "Platings are dented.")).setTextAlignment(Alignment.CenterLeft)
.setDefaultColor(COLOR_TEXT_WHITE.get())
.setEnabled(widget -> !mHardHammer))
.widget(new FakeSyncWidget.BooleanSyncer(() -> mHardHammer, val -> mHardHammer = val));
screenElements
.widget(
new TextWidget(GTUtility.trans("136", "Circuitry burned out.")).setDefaultColor(COLOR_TEXT_WHITE.get())
new TextWidget(GTUtility.trans("136", "Circuitry burned out.")).setTextAlignment(Alignment.CenterLeft)
.setDefaultColor(COLOR_TEXT_WHITE.get())
.setEnabled(widget -> !mSolderingTool))
.widget(new FakeSyncWidget.BooleanSyncer(() -> mSolderingTool, val -> mSolderingTool = val));
screenElements.widget(
Expand All @@ -2603,14 +2609,17 @@ protected void drawTexts(DynamicPositionedColumn screenElements, SlotWidget inve
.widget(new FakeSyncWidget.BooleanSyncer(() -> mCrowbar, val -> mCrowbar = val));
screenElements
.widget(
new TextWidget(GTUtility.trans("138", "Incomplete Structure.")).setDefaultColor(COLOR_TEXT_WHITE.get())
new TextWidget(GTUtility.trans("138", "Incomplete Structure.")).setTextAlignment(Alignment.CenterLeft)
.setDefaultColor(COLOR_TEXT_WHITE.get())
.setEnabled(widget -> !mMachine))
.widget(new FakeSyncWidget.BooleanSyncer(() -> mMachine, val -> mMachine = val));
screenElements.widget(
new TextWidget("Too Uncertain.").setDefaultColor(COLOR_TEXT_WHITE.get())
new TextWidget("Too Uncertain.").setTextAlignment(Alignment.CenterLeft)
.setDefaultColor(COLOR_TEXT_WHITE.get())
.setEnabled(widget -> (getBaseMetaTileEntity().getErrorDisplayID() & 128) != 0));
screenElements.widget(
new TextWidget("Invalid Parameters.").setDefaultColor(COLOR_TEXT_WHITE.get())
new TextWidget("Invalid Parameters.").setTextAlignment(Alignment.CenterLeft)
.setDefaultColor(COLOR_TEXT_WHITE.get())
.setEnabled(widget -> (getBaseMetaTileEntity().getErrorDisplayID() & 256) != 0));

screenElements.widget(
Expand Down Expand Up @@ -2647,6 +2656,7 @@ protected void drawTexts(DynamicPositionedColumn screenElements, SlotWidget inve
time.getSeconds() % 60);
})
.setSynced(false)
.setTextAlignment(Alignment.CenterLeft)
.setEnabled(
widget -> shouldDisplayShutDownReason() && !getBaseMetaTileEntity().isActive()
&& getBaseMetaTileEntity().wasShutdown()))
Expand Down Expand Up @@ -2710,7 +2720,8 @@ && getBaseMetaTileEntity().wasShutdown()))
}

screenElements.widget(
new TextWidget(GTUtility.trans("144", "Missing Turbine Rotor")).setDefaultColor(COLOR_TEXT_WHITE.get())
new TextWidget(GTUtility.trans("144", "Missing Turbine Rotor")).setTextAlignment(Alignment.CenterLeft)
.setDefaultColor(COLOR_TEXT_WHITE.get())
.setEnabled(widget -> {
if (getBaseMetaTileEntity().isAllowedToWork()) return false;
if (getBaseMetaTileEntity().getErrorDisplayID() == 0 && this instanceof MTELargeTurbine) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1106,41 +1106,49 @@ protected void drawTexts(DynamicPositionedColumn screenElements, SlotWidget inve
.setPos(10, 7);
screenElements
.widget(
new TextWidget(GTUtility.trans("132", "Pipe is loose.")).setDefaultColor(COLOR_TEXT_WHITE.get())
new TextWidget(GTUtility.trans("132", "Pipe is loose.")).setTextAlignment(Alignment.CenterLeft)
.setDefaultColor(COLOR_TEXT_WHITE.get())
.setEnabled(widget -> !mWrench))
.widget(new FakeSyncWidget.BooleanSyncer(() -> mWrench, val -> mWrench = val));
screenElements
.widget(
new TextWidget(GTUtility.trans("133", "Screws are loose.")).setDefaultColor(COLOR_TEXT_WHITE.get())
new TextWidget(GTUtility.trans("133", "Screws are loose.")).setTextAlignment(Alignment.CenterLeft)
.setDefaultColor(COLOR_TEXT_WHITE.get())
.setEnabled(widget -> !mScrewdriver))
.widget(new FakeSyncWidget.BooleanSyncer(() -> mScrewdriver, val -> mScrewdriver = val));
screenElements
.widget(
new TextWidget(GTUtility.trans("134", "Something is stuck.")).setDefaultColor(COLOR_TEXT_WHITE.get())
new TextWidget(GTUtility.trans("134", "Something is stuck.")).setTextAlignment(Alignment.CenterLeft)
.setDefaultColor(COLOR_TEXT_WHITE.get())
.setEnabled(widget -> !mSoftHammer))
.widget(new FakeSyncWidget.BooleanSyncer(() -> mSoftHammer, val -> mSoftHammer = val));
screenElements
.widget(
new TextWidget(GTUtility.trans("135", "Platings are dented.")).setDefaultColor(COLOR_TEXT_WHITE.get())
new TextWidget(GTUtility.trans("135", "Platings are dented.")).setTextAlignment(Alignment.CenterLeft)
.setDefaultColor(COLOR_TEXT_WHITE.get())
.setEnabled(widget -> !mHardHammer))
.widget(new FakeSyncWidget.BooleanSyncer(() -> mHardHammer, val -> mHardHammer = val));
screenElements
.widget(
new TextWidget(GTUtility.trans("136", "Circuitry burned out.")).setDefaultColor(COLOR_TEXT_WHITE.get())
new TextWidget(GTUtility.trans("136", "Circuitry burned out.")).setTextAlignment(Alignment.CenterLeft)
.setDefaultColor(COLOR_TEXT_WHITE.get())
.setEnabled(widget -> !mSolderingTool))
.widget(new FakeSyncWidget.BooleanSyncer(() -> mSolderingTool, val -> mSolderingTool = val));
screenElements.widget(
new TextWidget(GTUtility.trans("137", "That doesn't belong there.")).setDefaultColor(COLOR_TEXT_WHITE.get())
new TextWidget(GTUtility.trans("137", "That doesn't belong there.")).setTextAlignment(Alignment.CenterLeft)
.setDefaultColor(COLOR_TEXT_WHITE.get())
.setEnabled(widget -> !mCrowbar))
.widget(new FakeSyncWidget.BooleanSyncer(() -> mCrowbar, val -> mCrowbar = val));
screenElements
.widget(
new TextWidget(GTUtility.trans("138", "Incomplete Structure.")).setDefaultColor(COLOR_TEXT_WHITE.get())
new TextWidget(GTUtility.trans("138", "Incomplete Structure.")).setTextAlignment(Alignment.CenterLeft)
.setDefaultColor(COLOR_TEXT_WHITE.get())
.setEnabled(widget -> !mMachine))
.widget(new FakeSyncWidget.BooleanSyncer(() -> mMachine, val -> mMachine = val));

screenElements.widget(
new TextWidget(GTUtility.trans("139", "Hit with Soft Mallet")).setDefaultColor(COLOR_TEXT_WHITE.get())
new TextWidget(GTUtility.trans("139", "Hit with Soft Mallet")).setTextAlignment(Alignment.CenterLeft)
.setDefaultColor(COLOR_TEXT_WHITE.get())
.setEnabled(
widget -> getBaseMetaTileEntity().getErrorDisplayID() == 0 && !getBaseMetaTileEntity().isActive()))
.widget(
Expand All @@ -1152,11 +1160,13 @@ protected void drawTexts(DynamicPositionedColumn screenElements, SlotWidget inve
() -> getBaseMetaTileEntity().isActive(),
val -> getBaseMetaTileEntity().setActive(val)));
screenElements.widget(
new TextWidget(GTUtility.trans("140", "to (re-)start the Machine")).setDefaultColor(COLOR_TEXT_WHITE.get())
new TextWidget(GTUtility.trans("140", "to (re-)start the Machine")).setTextAlignment(Alignment.CenterLeft)
.setDefaultColor(COLOR_TEXT_WHITE.get())
.setEnabled(
widget -> getBaseMetaTileEntity().getErrorDisplayID() == 0 && !getBaseMetaTileEntity().isActive()));
screenElements.widget(
new TextWidget(GTUtility.trans("141", "if it doesn't start.")).setDefaultColor(COLOR_TEXT_WHITE.get())
new TextWidget(GTUtility.trans("141", "if it doesn't start.")).setTextAlignment(Alignment.CenterLeft)
.setDefaultColor(COLOR_TEXT_WHITE.get())
.setEnabled(
widget -> getBaseMetaTileEntity().getErrorDisplayID() == 0 && !getBaseMetaTileEntity().isActive()));

Expand All @@ -1168,6 +1178,8 @@ protected void drawTexts(DynamicPositionedColumn screenElements, SlotWidget inve
time.toMinutes() % 60,
time.getSeconds() % 60);
})
.setSynced(false)
.setTextAlignment(Alignment.CenterLeft)
.setEnabled(
widget -> shouldDisplayShutDownReason() && !getBaseMetaTileEntity().isActive()
&& getBaseMetaTileEntity().wasShutdown()))
Expand Down Expand Up @@ -1196,13 +1208,15 @@ && getBaseMetaTileEntity().wasShutdown()))
screenElements.widget(
new TextWidget().setStringSupplier(
() -> "Total Capacity: " + EnumChatFormatting.BLUE + capacityCache + EnumChatFormatting.WHITE + " EU")
.setTextAlignment(Alignment.CenterLeft)
.setDefaultColor(COLOR_TEXT_WHITE.get())
.setEnabled(widget -> isActiveCache))
.widget(new FakeSyncWidget.StringSyncer(this::getCapacityCache, val -> capacityCache = val))
.widget(
new TextWidget()
.setStringSupplier(
() -> "Stored: " + EnumChatFormatting.RED + storedEUCache + EnumChatFormatting.WHITE + " EU")
.setTextAlignment(Alignment.CenterLeft)
.setDefaultColor(COLOR_TEXT_WHITE.get())
.setEnabled(widget -> isActiveCache))
.widget(new FakeSyncWidget.StringSyncer(this::getStoredCache, val -> storedEUCache = val))
Expand All @@ -1218,6 +1232,7 @@ && getBaseMetaTileEntity().wasShutdown()))
+ passiveDischargeAmountCache
+ EnumChatFormatting.WHITE
+ " EU/t")
.setTextAlignment(Alignment.CenterLeft)
.setDefaultColor(COLOR_TEXT_WHITE.get())
.setEnabled(widget -> isActiveCache))
.widget(
Expand All @@ -1232,6 +1247,7 @@ && getBaseMetaTileEntity().wasShutdown()))
: numberFormat.format(avgInCache))
+ EnumChatFormatting.WHITE
+ " last 5s")
.setTextAlignment(Alignment.CenterLeft)
.setDefaultColor(COLOR_TEXT_WHITE.get())
.setEnabled(widget -> isActiveCache))
.widget(new FakeSyncWidget.LongSyncer(this::getAvgIn, val -> avgInCache = val))
Expand All @@ -1243,11 +1259,13 @@ && getBaseMetaTileEntity().wasShutdown()))
: numberFormat.format(avgOutCache))
+ EnumChatFormatting.WHITE
+ " last 5s")
.setTextAlignment(Alignment.CenterLeft)
.setDefaultColor(COLOR_TEXT_WHITE.get())
.setEnabled(widget -> isActiveCache))
.widget(new FakeSyncWidget.LongSyncer(this::getAvgOut, val -> avgOutCache = val))
.widget(
new TextWidget().setStringSupplier(() -> EnumChatFormatting.WHITE + timeToCache)
.setTextAlignment(Alignment.CenterLeft)
.setEnabled(widget -> isActiveCache))
.widget(new FakeSyncWidget.StringSyncer(this::getTimeTo, val -> timeToCache = val))
.widget(
Expand All @@ -1257,6 +1275,7 @@ && getBaseMetaTileEntity().wasShutdown()))
+ wirelessStoreCache
+ EnumChatFormatting.WHITE
+ " EU")
.setTextAlignment(Alignment.CenterLeft)
.setDefaultColor(COLOR_TEXT_WHITE.get())
.setEnabled(widget -> isActiveCache))
.widget(new FakeSyncWidget.StringSyncer(this::getWirelessStoredCache, val -> wirelessStoreCache = val))
Expand Down
Loading