From 833bce1d001f30bdfbb8017a25b989ff6b28e55f Mon Sep 17 00:00:00 2001 From: HoleFish <1594248739@qq.com> Date: Sun, 24 Nov 2024 23:34:35 +0800 Subject: [PATCH] Alignment --- .../implementations/MTEMultiBlockBase.java | 47 ++++++++++++------- .../MTELapotronicSuperCapacitor.java | 39 +++++++++++---- 2 files changed, 58 insertions(+), 28 deletions(-) diff --git a/src/main/java/gregtech/api/metatileentity/implementations/MTEMultiBlockBase.java b/src/main/java/gregtech/api/metatileentity/implementations/MTEMultiBlockBase.java index 1958b4aa3f2..3ab24255df9 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/MTEMultiBlockBase.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/MTEMultiBlockBase.java @@ -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)) @@ -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( @@ -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( @@ -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())) @@ -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) { diff --git a/src/main/java/kekztech/common/tileentities/MTELapotronicSuperCapacitor.java b/src/main/java/kekztech/common/tileentities/MTELapotronicSuperCapacitor.java index 45e6ed1e529..70d3c6d97a6 100644 --- a/src/main/java/kekztech/common/tileentities/MTELapotronicSuperCapacitor.java +++ b/src/main/java/kekztech/common/tileentities/MTELapotronicSuperCapacitor.java @@ -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( @@ -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())); @@ -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())) @@ -1196,6 +1208,7 @@ && 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)) @@ -1203,6 +1216,7 @@ && getBaseMetaTileEntity().wasShutdown())) 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)) @@ -1218,6 +1232,7 @@ && getBaseMetaTileEntity().wasShutdown())) + passiveDischargeAmountCache + EnumChatFormatting.WHITE + " EU/t") + .setTextAlignment(Alignment.CenterLeft) .setDefaultColor(COLOR_TEXT_WHITE.get()) .setEnabled(widget -> isActiveCache)) .widget( @@ -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)) @@ -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( @@ -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))