From ef2b81220a4df0ae33cd81c57e3a11ea7b48e963 Mon Sep 17 00:00:00 2001 From: Zorbatron <46525467+Zorbatron@users.noreply.github.com> Date: Wed, 29 Oct 2025 17:54:57 -0400 Subject: [PATCH 1/8] Separate out each coordinate axis into its own line. --- .gitignore | 1 + .../multi/electric/MetaTileEntityLargeMiner.java | 8 +++++--- src/main/resources/assets/gregtech/lang/en_us.lang | 4 +++- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index c2fb66e1e33..3b2f04a46c0 100644 --- a/.gitignore +++ b/.gitignore @@ -74,6 +74,7 @@ local.properties /classes/ /out/ /build/ +.run/ # Linux *~ diff --git a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityLargeMiner.java b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityLargeMiner.java index 8128e1fa525..7436c7eafd2 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityLargeMiner.java +++ b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityLargeMiner.java @@ -270,9 +270,11 @@ protected void configureDisplayText(MultiblockUIBuilder builder) { int workingArea = syncer.syncInt(getWorkingArea(minerLogic.getCurrentRadius())); list.add(KeyUtil.lang(TextFormatting.GRAY, "gregtech.machine.miner.mining_at")); - list.add(KeyUtil.lang(TextFormatting.GRAY, "gregtech.machine.miner.mining_pos", - syncer.syncInt(minerLogic.getMineX().get()), - syncer.syncInt(minerLogic.getMineY().get()), + list.add(KeyUtil.lang(TextFormatting.GRAY, "gregtech.machine.miner.mining_pos_x", + syncer.syncInt(minerLogic.getMineX().get()))); + list.add(KeyUtil.lang(TextFormatting.GRAY, "gregtech.machine.miner.mining_pos_y", + syncer.syncInt(minerLogic.getMineY().get()))); + list.add(KeyUtil.lang(TextFormatting.GRAY, "gregtech.machine.miner.mining_pos_z", syncer.syncInt(minerLogic.getMineZ().get()))); if (syncer.syncBoolean(minerLogic.isChunkMode())) { diff --git a/src/main/resources/assets/gregtech/lang/en_us.lang b/src/main/resources/assets/gregtech/lang/en_us.lang index ea6df5b60b1..195504dcf43 100644 --- a/src/main/resources/assets/gregtech/lang/en_us.lang +++ b/src/main/resources/assets/gregtech/lang/en_us.lang @@ -4892,7 +4892,9 @@ gregtech.machine.miner.fluid_usage=Uses §f%,d L/t §7of §f%s§7, doubled per o gregtech.machine.miner.multi.description=A multiblock mining machine that covers a large area and produces huge quantity of ore. gregtech.machine.miner.multi.needsfluid=No Drilling Fluid! gregtech.machine.miner.mining_at=Currently mining at: -gregtech.machine.miner.mining_pos=X: %s Y: %s Z: %s +gregtech.machine.miner.mining_pos_x=X: %s +gregtech.machine.miner.mining_pos_y=Y: %s +gregtech.machine.miner.mining_pos_z=Z: %s gregtech.machine.miner.radius=Radius: %d gregtech.machine.miner.working_area=Working Area: %dx%d blocks gregtech.machine.miner.working_area_chunks=Working Area: %dx%d chunks From 454517d9fd821bfeebdff8454764b96baeabdbc9 Mon Sep 17 00:00:00 2001 From: Zorbatron <46525467+Zorbatron@users.noreply.github.com> Date: Wed, 29 Oct 2025 18:53:13 -0400 Subject: [PATCH 2/8] Port LV-HV miners to MUI2 --- .../electric/MetaTileEntityMiner.java | 164 +++++++++++------- 1 file changed, 98 insertions(+), 66 deletions(-) diff --git a/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityMiner.java b/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityMiner.java index 78603f145d1..80b36be512b 100644 --- a/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityMiner.java +++ b/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityMiner.java @@ -7,16 +7,16 @@ import gregtech.api.capability.impl.EnergyContainerHandler; import gregtech.api.capability.impl.NotifiableItemStackHandler; import gregtech.api.capability.impl.miner.MinerLogic; -import gregtech.api.gui.GuiTextures; -import gregtech.api.gui.ModularUI; -import gregtech.api.gui.widgets.AdvancedTextWidget; -import gregtech.api.gui.widgets.SlotWidget; import gregtech.api.items.itemhandlers.GTItemStackHandler; import gregtech.api.metatileentity.IDataInfoProvider; import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.metatileentity.TieredMetaTileEntity; import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; +import gregtech.api.mui.GTGuiTextures; +import gregtech.api.mui.GTGuis; +import gregtech.api.util.KeyUtil; import gregtech.client.renderer.texture.Textures; +import gregtech.common.mui.widget.ScrollableTextWidget; import gregtech.core.sound.GTSoundEvents; import net.minecraft.client.resources.I18n; @@ -26,7 +26,6 @@ import net.minecraft.network.PacketBuffer; import net.minecraft.util.*; import net.minecraft.util.text.ITextComponent; -import net.minecraft.util.text.Style; import net.minecraft.util.text.TextComponentTranslation; import net.minecraft.util.text.TextFormatting; import net.minecraft.world.World; @@ -40,6 +39,17 @@ import codechicken.lib.render.CCRenderState; import codechicken.lib.render.pipeline.IVertexOperation; import codechicken.lib.vec.Matrix4; +import com.cleanroommc.modularui.api.drawable.IKey; +import com.cleanroommc.modularui.factory.PosGuiData; +import com.cleanroommc.modularui.screen.ModularPanel; +import com.cleanroommc.modularui.utils.Alignment; +import com.cleanroommc.modularui.value.sync.BooleanSyncValue; +import com.cleanroommc.modularui.value.sync.IntSyncValue; +import com.cleanroommc.modularui.value.sync.PanelSyncManager; +import com.cleanroommc.modularui.value.sync.SyncHandlers; +import com.cleanroommc.modularui.widgets.ItemSlot; +import com.cleanroommc.modularui.widgets.SlotGroupWidget; +import com.cleanroommc.modularui.widgets.layout.Grid; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -96,69 +106,91 @@ public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, } @Override - protected ModularUI createUI(@NotNull EntityPlayer entityPlayer) { - int rowSize = (int) Math.sqrt(inventorySize); - ModularUI.Builder builder = new ModularUI.Builder(GuiTextures.BACKGROUND, 195, 176); - builder.bindPlayerInventory(entityPlayer.inventory, 94); - - if (getTier() == GTValues.HV) { - for (int y = 0; y < rowSize; y++) { - for (int x = 0; x < rowSize; x++) { - int index = y * rowSize + x; - builder.widget( - new SlotWidget(exportItems, index, 151 - rowSize * 9 + x * 18, 18 + y * 18, true, false) - .setBackgroundTexture(GuiTextures.SLOT)); - } - } - } else { - for (int y = 0; y < rowSize; y++) { - for (int x = 0; x < rowSize; x++) { - int index = y * rowSize + x; - builder.widget( - new SlotWidget(exportItems, index, 142 - rowSize * 9 + x * 18, 18 + y * 18, true, false) - .setBackgroundTexture(GuiTextures.SLOT)); - } - } - } - - builder.image(7, 16, 105, 75, GuiTextures.DISPLAY) - .label(6, 6, getMetaFullName()); - builder.widget(new AdvancedTextWidget(10, 19, this::addDisplayText, 0xFFFFFF) - .setMaxWidthLimit(84)); - builder.widget(new AdvancedTextWidget(70, 19, this::addDisplayText2, 0xFFFFFF) - .setMaxWidthLimit(84)); - builder.widget(new SlotWidget(chargerInventory, 0, 171, 152) - .setBackgroundTexture(GuiTextures.SLOT, GuiTextures.CHARGER_OVERLAY)); - - return builder.build(getHolder(), entityPlayer); - } - - private void addDisplayText(@NotNull List textList) { - int workingArea = getWorkingArea(minerLogic.getCurrentRadius()); - textList.add(new TextComponentTranslation("gregtech.machine.miner.startx", this.minerLogic.getX().get())); - textList.add(new TextComponentTranslation("gregtech.machine.miner.starty", this.minerLogic.getY().get())); - textList.add(new TextComponentTranslation("gregtech.machine.miner.startz", this.minerLogic.getZ().get())); - textList.add(new TextComponentTranslation("gregtech.machine.miner.working_area", workingArea, workingArea)); - if (this.minerLogic.isDone()) - textList.add(new TextComponentTranslation("gregtech.machine.miner.done") - .setStyle(new Style().setColor(TextFormatting.GREEN))); - else if (this.minerLogic.isWorking()) - textList.add(new TextComponentTranslation("gregtech.machine.miner.working") - .setStyle(new Style().setColor(TextFormatting.GOLD))); - else if (!this.isWorkingEnabled()) - textList.add(new TextComponentTranslation("gregtech.multiblock.work_paused")); - if (isInventoryFull) - textList.add(new TextComponentTranslation("gregtech.machine.miner.invfull") - .setStyle(new Style().setColor(TextFormatting.RED))); - if (!drainEnergy(true)) - textList.add(new TextComponentTranslation("gregtech.machine.miner.needspower") - .setStyle(new Style().setColor(TextFormatting.RED))); + public boolean usesMui2() { + return true; } - private void addDisplayText2(@NotNull List textList) { - textList.add(new TextComponentTranslation("gregtech.machine.miner.minex", this.minerLogic.getMineX().get())); - textList.add(new TextComponentTranslation("gregtech.machine.miner.miney", this.minerLogic.getMineY().get())); - textList.add(new TextComponentTranslation("gregtech.machine.miner.minez", this.minerLogic.getMineZ().get())); + @Override + public ModularPanel buildUI(PosGuiData guiData, PanelSyncManager panelSyncManager) { + int rowSize = (int) Math.sqrt(inventorySize); + panelSyncManager.registerSlotGroup("export_items", rowSize); + + IntSyncValue radiusSync = new IntSyncValue(() -> getWorkingArea(minerLogic.getCurrentRadius())); + BooleanSyncValue isDoneSync = new BooleanSyncValue(minerLogic::isDone); + BooleanSyncValue isWorkingSync = new BooleanSyncValue(minerLogic::isWorking); + BooleanSyncValue isWorkingEnabledSync = new BooleanSyncValue(minerLogic::isWorkingEnabled); + BooleanSyncValue isInventoryFullSync = new BooleanSyncValue(() -> isInventoryFull); + BooleanSyncValue hasEnoughEnergySync = new BooleanSyncValue(() -> drainEnergy(true)); + panelSyncManager.syncValue("radius", 0, radiusSync); + panelSyncManager.syncValue("isDone", 0, isDoneSync); + panelSyncManager.syncValue("isWorking", 0, isWorkingSync); + panelSyncManager.syncValue("isWorkingEnabled", 0, isWorkingEnabledSync); + panelSyncManager.syncValue("isInventoryFull", 0, isInventoryFullSync); + panelSyncManager.syncValue("hasEnoughEnergy", 0, hasEnoughEnergySync); + + IntSyncValue xPosSync = new IntSyncValue(() -> minerLogic.getMineX().get()); + IntSyncValue yPosSync = new IntSyncValue(() -> minerLogic.getMineY().get()); + IntSyncValue zPosSync = new IntSyncValue(() -> minerLogic.getMineZ().get()); + panelSyncManager.syncValue("xPos", 0, xPosSync); + panelSyncManager.syncValue("yPos", 0, yPosSync); + panelSyncManager.syncValue("zPos", 0, zPosSync); + + return GTGuis.createPanel(this, 197, 176) + .child(IKey.lang(getMetaFullName()) + .asWidget() + .pos(5, 5)) + .child(new ScrollableTextWidget() + .pos(7 + 3, 15 + 3) + .size(105 - 3 * 2, 75 - 3 * 2) + .autoUpdate(true) + .alignment(Alignment.TopLeft) + .textBuilder(text -> { + text.addLine(KeyUtil.lang(TextFormatting.WHITE, "gregtech.machine.miner.mining_at")); + text.addLine(KeyUtil.lang(TextFormatting.WHITE, "gregtech.machine.miner.mining_pos_x", + xPosSync.getIntValue())); + text.addLine(KeyUtil.lang(TextFormatting.WHITE, "gregtech.machine.miner.mining_pos_y", + yPosSync.getIntValue())); + text.addLine(KeyUtil.lang(TextFormatting.WHITE, "gregtech.machine.miner.mining_pos_z", + zPosSync.getIntValue())); + + text.addLine(KeyUtil.lang(TextFormatting.WHITE, "gregtech.machine.miner.working_area", + radiusSync.getIntValue(), radiusSync.getIntValue())); + + if (isDoneSync.getBoolValue()) { + text.addLine(KeyUtil.lang(TextFormatting.GREEN, "gregtech.machine.miner.done")); + } else if (isWorkingSync.getBoolValue()) { + text.addLine(KeyUtil.lang(TextFormatting.GOLD, "gregtech.machine.miner.working")); + } else if (!isWorkingEnabledSync.getBoolValue()) { + text.addLine(KeyUtil.lang("gregtech.multiblock.work_paused")); + } + + if (isInventoryFullSync.getBoolValue()) { + text.addLine(KeyUtil.lang(TextFormatting.RED, "gregtech.machine.miner.invfull")); + } + + if (!hasEnoughEnergySync.getBoolValue()) { + text.addLine(KeyUtil.lang(TextFormatting.RED, "gregtech.machine.miner.needspower")); + } + }) + .background(GTGuiTextures.DISPLAY.asIcon() + .margin(-3))) + .child(new Grid() + .pos(151 - 18 * 2, 15) + .minElementMargin(0) + .minColWidth(18) + .minRowHeight(18) + .mapTo(rowSize, inventorySize, index -> new ItemSlot() + .slot(SyncHandlers.itemSlot(exportItems, index) + .slotGroup("export_items") + .accessibility(false, true)))) + .child(SlotGroupWidget.playerInventory() + .left(7) + .bottom(7)) + .child(new ItemSlot() + .right(7) + .bottom(7) + .slot(chargerInventory, 0) + .background(GTGuiTextures.SLOT, GTGuiTextures.CHARGER_OVERLAY)); } @Override From ac8b10a743f0a0e152951beb58749eb79b90fcde Mon Sep 17 00:00:00 2001 From: Zorbatron <46525467+Zorbatron@users.noreply.github.com> Date: Wed, 29 Oct 2025 19:11:20 -0400 Subject: [PATCH 3/8] Steam miner --- .../electric/MetaTileEntityMiner.java | 11 +- .../metatileentities/steam/SteamMiner.java | 160 ++++++++++++------ 2 files changed, 110 insertions(+), 61 deletions(-) diff --git a/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityMiner.java b/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityMiner.java index 80b36be512b..dde3d056378 100644 --- a/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityMiner.java +++ b/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityMiner.java @@ -110,6 +110,7 @@ public boolean usesMui2() { return true; } + @SuppressWarnings("DuplicatedCode") @Override public ModularPanel buildUI(PosGuiData guiData, PanelSyncManager panelSyncManager) { int rowSize = (int) Math.sqrt(inventorySize); @@ -122,11 +123,11 @@ public ModularPanel buildUI(PosGuiData guiData, PanelSyncManager panelSyncManage BooleanSyncValue isInventoryFullSync = new BooleanSyncValue(() -> isInventoryFull); BooleanSyncValue hasEnoughEnergySync = new BooleanSyncValue(() -> drainEnergy(true)); panelSyncManager.syncValue("radius", 0, radiusSync); - panelSyncManager.syncValue("isDone", 0, isDoneSync); - panelSyncManager.syncValue("isWorking", 0, isWorkingSync); - panelSyncManager.syncValue("isWorkingEnabled", 0, isWorkingEnabledSync); - panelSyncManager.syncValue("isInventoryFull", 0, isInventoryFullSync); - panelSyncManager.syncValue("hasEnoughEnergy", 0, hasEnoughEnergySync); + panelSyncManager.syncValue("done", 0, isDoneSync); + panelSyncManager.syncValue("working", 0, isWorkingSync); + panelSyncManager.syncValue("workingEnabled", 0, isWorkingEnabledSync); + panelSyncManager.syncValue("inventoryFull", 0, isInventoryFullSync); + panelSyncManager.syncValue("enoughEnergy", 0, hasEnoughEnergySync); IntSyncValue xPosSync = new IntSyncValue(() -> minerLogic.getMineX().get()); IntSyncValue yPosSync = new IntSyncValue(() -> minerLogic.getMineY().get()); diff --git a/src/main/java/gregtech/common/metatileentities/steam/SteamMiner.java b/src/main/java/gregtech/common/metatileentities/steam/SteamMiner.java index 3f70bf75aaf..0d39cdd18a2 100644 --- a/src/main/java/gregtech/common/metatileentities/steam/SteamMiner.java +++ b/src/main/java/gregtech/common/metatileentities/steam/SteamMiner.java @@ -8,24 +8,24 @@ import gregtech.api.capability.impl.miner.MinerLogic; import gregtech.api.capability.impl.miner.SteamMinerLogic; import gregtech.api.damagesources.DamageSources; -import gregtech.api.gui.GuiTextures; -import gregtech.api.gui.ModularUI; -import gregtech.api.gui.widgets.AdvancedTextWidget; -import gregtech.api.gui.widgets.SlotWidget; import gregtech.api.metatileentity.IDataInfoProvider; import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; +import gregtech.api.mui.GTGuiTextures; +import gregtech.api.mui.GTGuiTheme; +import gregtech.api.mui.GTGuis; import gregtech.api.util.GTUtility; +import gregtech.api.util.KeyUtil; import gregtech.client.renderer.texture.Textures; import gregtech.client.renderer.texture.cube.SimpleSidedCubeRenderer; import gregtech.common.ConfigHolder; +import gregtech.common.mui.widget.ScrollableTextWidget; import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.resources.I18n; import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.SoundEvents; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; @@ -34,7 +34,6 @@ import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.util.text.ITextComponent; -import net.minecraft.util.text.Style; import net.minecraft.util.text.TextComponentTranslation; import net.minecraft.util.text.TextFormatting; import net.minecraft.world.World; @@ -48,6 +47,17 @@ import codechicken.lib.render.pipeline.ColourMultiplier; import codechicken.lib.render.pipeline.IVertexOperation; import codechicken.lib.vec.Matrix4; +import com.cleanroommc.modularui.api.drawable.IKey; +import com.cleanroommc.modularui.factory.PosGuiData; +import com.cleanroommc.modularui.screen.ModularPanel; +import com.cleanroommc.modularui.utils.Alignment; +import com.cleanroommc.modularui.value.sync.BooleanSyncValue; +import com.cleanroommc.modularui.value.sync.IntSyncValue; +import com.cleanroommc.modularui.value.sync.PanelSyncManager; +import com.cleanroommc.modularui.value.sync.SyncHandlers; +import com.cleanroommc.modularui.widgets.ItemSlot; +import com.cleanroommc.modularui.widgets.SlotGroupWidget; +import com.cleanroommc.modularui.widgets.layout.Grid; import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.tuple.Pair; import org.jetbrains.annotations.NotNull; @@ -114,60 +124,98 @@ public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, } @Override - protected ModularUI createUI(EntityPlayer entityPlayer) { - int rowSize = (int) Math.sqrt(inventorySize); - - ModularUI.Builder builder = ModularUI.builder(GuiTextures.BACKGROUND_STEAM.get(false), 175, 176); - builder.bindPlayerInventory(entityPlayer.inventory, 94); - - for (int y = 0; y < rowSize; y++) { - for (int x = 0; x < rowSize; x++) { - int index = y * rowSize + x; - builder.widget(new SlotWidget(exportItems, index, 142 - rowSize * 9 + x * 18, 18 + y * 18, true, false) - .setBackgroundTexture(GuiTextures.SLOT_STEAM.get(false))); - } - } - builder.bindPlayerInventory(entityPlayer.inventory, GuiTextures.SLOT_STEAM.get(false), 10); - - builder.image(7, 16, 105, 75, GuiTextures.DISPLAY_STEAM.get(false)) - .label(6, 6, getMetaFullName()); - builder.widget(new AdvancedTextWidget(10, 19, this::addDisplayText, 0xFFFFFF) - .setMaxWidthLimit(84)); - builder.widget(new AdvancedTextWidget(70, 19, this::addDisplayText2, 0xFFFFFF) - .setMaxWidthLimit(84)); - - return builder.build(getHolder(), entityPlayer); + public boolean usesMui2() { + return true; } - void addDisplayText(List textList) { - int workingArea = getWorkingArea(minerLogic.getCurrentRadius()); - textList.add(new TextComponentTranslation("gregtech.machine.miner.startx", this.minerLogic.getX().get())); - textList.add(new TextComponentTranslation("gregtech.machine.miner.starty", this.minerLogic.getY().get())); - textList.add(new TextComponentTranslation("gregtech.machine.miner.startz", this.minerLogic.getZ().get())); - textList.add(new TextComponentTranslation("gregtech.machine.miner.working_area", workingArea, workingArea)); - if (this.minerLogic.isDone()) - textList.add(new TextComponentTranslation("gregtech.machine.miner.done") - .setStyle(new Style().setColor(TextFormatting.GREEN))); - else if (this.minerLogic.isWorking()) - textList.add(new TextComponentTranslation("gregtech.machine.miner.working") - .setStyle(new Style().setColor(TextFormatting.GOLD))); - else if (!this.isWorkingEnabled()) - textList.add(new TextComponentTranslation("gregtech.multiblock.work_paused")); - if (this.isInventoryFull) - textList.add(new TextComponentTranslation("gregtech.machine.miner.invfull") - .setStyle(new Style().setColor(TextFormatting.RED))); - if (ventingStuck) - textList.add(new TextComponentTranslation("gregtech.machine.steam_miner.vent") - .setStyle(new Style().setColor(TextFormatting.RED))); - else if (!drainEnergy(true)) - textList.add(new TextComponentTranslation("gregtech.machine.steam_miner.steam") - .setStyle(new Style().setColor(TextFormatting.RED))); + @Override + public GTGuiTheme getUITheme() { + return GTGuiTheme.BRONZE; } - void addDisplayText2(List textList) { - textList.add(new TextComponentTranslation("gregtech.machine.miner.minex", this.minerLogic.getMineX().get())); - textList.add(new TextComponentTranslation("gregtech.machine.miner.miney", this.minerLogic.getMineY().get())); - textList.add(new TextComponentTranslation("gregtech.machine.miner.minez", this.minerLogic.getMineZ().get())); + @SuppressWarnings("DuplicatedCode") + @Override + public ModularPanel buildUI(PosGuiData guiData, PanelSyncManager panelSyncManager) { + int rowSize = (int) Math.sqrt(inventorySize); + panelSyncManager.registerSlotGroup("export_items", rowSize); + + IntSyncValue radiusSync = new IntSyncValue(() -> getWorkingArea(minerLogic.getCurrentRadius())); + BooleanSyncValue isDoneSync = new BooleanSyncValue(minerLogic::isDone); + BooleanSyncValue isWorkingSync = new BooleanSyncValue(minerLogic::isWorking); + BooleanSyncValue isWorkingEnabledSync = new BooleanSyncValue(minerLogic::isWorkingEnabled); + BooleanSyncValue isInventoryFullSync = new BooleanSyncValue(() -> isInventoryFull); + BooleanSyncValue isVentBlockedSync = new BooleanSyncValue(this::isVentingStuck); + BooleanSyncValue hasEnoughEnergySync = new BooleanSyncValue(() -> drainEnergy(true)); + panelSyncManager.syncValue("radius", 0, radiusSync); + panelSyncManager.syncValue("done", 0, isDoneSync); + panelSyncManager.syncValue("working", 0, isWorkingSync); + panelSyncManager.syncValue("workingEnabled", 0, isWorkingEnabledSync); + panelSyncManager.syncValue("inventoryFull", 0, isInventoryFullSync); + panelSyncManager.syncValue("ventBlocked", 0, isVentBlockedSync); + panelSyncManager.syncValue("enoughEnergy", 0, hasEnoughEnergySync); + + IntSyncValue xPosSync = new IntSyncValue(() -> minerLogic.getMineX().get()); + IntSyncValue yPosSync = new IntSyncValue(() -> minerLogic.getMineY().get()); + IntSyncValue zPosSync = new IntSyncValue(() -> minerLogic.getMineZ().get()); + panelSyncManager.syncValue("xPos", 0, xPosSync); + panelSyncManager.syncValue("yPos", 0, yPosSync); + panelSyncManager.syncValue("zPos", 0, zPosSync); + + return GTGuis.createPanel(this, 175, 176) + .child(IKey.lang(getMetaFullName()) + .asWidget() + .pos(5, 5)) + .child(new ScrollableTextWidget() + .pos(7 + 3, 15 + 3) + .size(105 - 3 * 2, 75 - 3 * 2) + .autoUpdate(true) + .alignment(Alignment.TopLeft) + .textBuilder(text -> { + text.addLine(KeyUtil.lang(TextFormatting.WHITE, "gregtech.machine.miner.mining_at")); + text.addLine(KeyUtil.lang(TextFormatting.WHITE, "gregtech.machine.miner.mining_pos_x", + xPosSync.getIntValue())); + text.addLine(KeyUtil.lang(TextFormatting.WHITE, "gregtech.machine.miner.mining_pos_y", + yPosSync.getIntValue())); + text.addLine(KeyUtil.lang(TextFormatting.WHITE, "gregtech.machine.miner.mining_pos_z", + zPosSync.getIntValue())); + + text.addLine(KeyUtil.lang(TextFormatting.WHITE, "gregtech.machine.miner.working_area", + radiusSync.getIntValue(), radiusSync.getIntValue())); + + if (isDoneSync.getBoolValue()) { + text.addLine(KeyUtil.lang(TextFormatting.GREEN, "gregtech.machine.miner.done")); + } else if (isWorkingSync.getBoolValue()) { + text.addLine(KeyUtil.lang(TextFormatting.GOLD, "gregtech.machine.miner.working")); + } else if (!isWorkingEnabledSync.getBoolValue()) { + text.addLine(KeyUtil.lang("gregtech.multiblock.work_paused")); + } + + if (isInventoryFullSync.getBoolValue()) { + text.addLine(KeyUtil.lang(TextFormatting.RED, "gregtech.machine.miner.invfull")); + } + + if (isVentBlockedSync.getBoolValue()) { + text.addLine(KeyUtil.lang(TextFormatting.RED, "gregtech.machine.steam_miner.vent")); + } + + if (!hasEnoughEnergySync.getBoolValue()) { + text.addLine(KeyUtil.lang(TextFormatting.RED, "gregtech.machine.steam_miner.steam")); + } + }) + .background(GTGuiTextures.DISPLAY_BRONZE.asIcon() + .margin(-3))) + .child(new Grid() + .pos(151 - 18 * 2, 15) + .minElementMargin(0) + .minColWidth(18) + .minRowHeight(18) + .mapTo(rowSize, inventorySize, index -> new ItemSlot() + .slot(SyncHandlers.itemSlot(exportItems, index) + .slotGroup("export_items") + .accessibility(false, true)))) + .child(SlotGroupWidget.playerInventory() + .left(7) + .bottom(7)); } @Override From 60dfb046f865e70d3c3c47f98dc1181894bb751c Mon Sep 17 00:00:00 2001 From: Zorbatron <46525467+Zorbatron@users.noreply.github.com> Date: Wed, 29 Oct 2025 19:22:15 -0400 Subject: [PATCH 4/8] Don't say "no steam" when vent is blocked --- .../gregtech/common/metatileentities/steam/SteamMiner.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/java/gregtech/common/metatileentities/steam/SteamMiner.java b/src/main/java/gregtech/common/metatileentities/steam/SteamMiner.java index 0d39cdd18a2..5d036790af8 100644 --- a/src/main/java/gregtech/common/metatileentities/steam/SteamMiner.java +++ b/src/main/java/gregtech/common/metatileentities/steam/SteamMiner.java @@ -198,7 +198,11 @@ public ModularPanel buildUI(PosGuiData guiData, PanelSyncManager panelSyncManage text.addLine(KeyUtil.lang(TextFormatting.RED, "gregtech.machine.steam_miner.vent")); } - if (!hasEnoughEnergySync.getBoolValue()) { + // Drain energy always returns false when the vent is blocked, so check that it isn't + // blocked. + // It should be fine since I don't think it can even enter the vent blocked state without + // having steam. + if (!hasEnoughEnergySync.getBoolValue() && !isVentBlockedSync.getBoolValue()) { text.addLine(KeyUtil.lang(TextFormatting.RED, "gregtech.machine.steam_miner.steam")); } }) From 38af9e49c679d934e91bce5b72850002301e0fe7 Mon Sep 17 00:00:00 2001 From: Zorbatron <46525467+Zorbatron@users.noreply.github.com> Date: Thu, 13 Nov 2025 01:40:09 -0500 Subject: [PATCH 5/8] Fix master merge-in --- .../java/gregtech/api/capability/IMiner.java | 43 +++++++++ .../electric/MetaTileEntityMiner.java | 88 +++++++------------ .../metatileentities/steam/SteamMiner.java | 34 ++----- 3 files changed, 84 insertions(+), 81 deletions(-) diff --git a/src/main/java/gregtech/api/capability/IMiner.java b/src/main/java/gregtech/api/capability/IMiner.java index 4b82046f399..837ee9fd161 100644 --- a/src/main/java/gregtech/api/capability/IMiner.java +++ b/src/main/java/gregtech/api/capability/IMiner.java @@ -1,6 +1,22 @@ package gregtech.api.capability; +import gregtech.common.mui.widget.ScrollableTextWidget; + +import net.minecraftforge.items.IItemHandlerModifiable; + import codechicken.lib.vec.Cuboid6; +import com.cleanroommc.modularui.drawable.UITexture; +import com.cleanroommc.modularui.drawable.text.RichText; +import com.cleanroommc.modularui.utils.Alignment; +import com.cleanroommc.modularui.value.sync.PanelSyncManager; +import com.cleanroommc.modularui.value.sync.SyncHandlers; +import com.cleanroommc.modularui.widget.Widget; +import com.cleanroommc.modularui.widgets.layout.Flow; +import com.cleanroommc.modularui.widgets.layout.Grid; +import com.cleanroommc.modularui.widgets.slot.ItemSlot; +import org.jetbrains.annotations.NotNull; + +import java.util.function.Consumer; public interface IMiner { @@ -19,4 +35,31 @@ default boolean drainFluid(boolean simulate) { default int getWorkingArea(int maximumRadius) { return maximumRadius * 2 + 1; } + + default Widget createMinerWidgets(@NotNull PanelSyncManager panelSyncManager, + @NotNull IItemHandlerModifiable inventory, int inventorySize, + @NotNull UITexture textDisplayBackground, + @NotNull Consumer textBuilder) { + int rowSize = (int) Math.sqrt(inventorySize); + panelSyncManager.registerSlotGroup("export_items", rowSize); + + return Flow.row() + .coverChildren() + .child(new ScrollableTextWidget() + .size(105 - 3 * 2, 75 - 3 * 2) + .autoUpdate(true) + .alignment(Alignment.TopLeft) + .textBuilder(textBuilder) + .background(textDisplayBackground.asIcon() + .margin(-3))) + .child(new Grid() + .marginLeft(6) + .minElementMargin(0) + .minColWidth(18) + .minRowHeight(18) + .mapTo(rowSize, inventorySize, index -> new ItemSlot() + .slot(SyncHandlers.itemSlot(inventory, index) + .slotGroup("export_items") + .accessibility(false, true)))); + } } diff --git a/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityMiner.java b/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityMiner.java index dde3d056378..e08db497a28 100644 --- a/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityMiner.java +++ b/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityMiner.java @@ -16,7 +16,6 @@ import gregtech.api.mui.GTGuis; import gregtech.api.util.KeyUtil; import gregtech.client.renderer.texture.Textures; -import gregtech.common.mui.widget.ScrollableTextWidget; import gregtech.core.sound.GTSoundEvents; import net.minecraft.client.resources.I18n; @@ -42,14 +41,12 @@ import com.cleanroommc.modularui.api.drawable.IKey; import com.cleanroommc.modularui.factory.PosGuiData; import com.cleanroommc.modularui.screen.ModularPanel; -import com.cleanroommc.modularui.utils.Alignment; +import com.cleanroommc.modularui.screen.UISettings; import com.cleanroommc.modularui.value.sync.BooleanSyncValue; import com.cleanroommc.modularui.value.sync.IntSyncValue; import com.cleanroommc.modularui.value.sync.PanelSyncManager; -import com.cleanroommc.modularui.value.sync.SyncHandlers; -import com.cleanroommc.modularui.widgets.ItemSlot; import com.cleanroommc.modularui.widgets.SlotGroupWidget; -import com.cleanroommc.modularui.widgets.layout.Grid; +import com.cleanroommc.modularui.widgets.slot.ItemSlot; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -112,10 +109,7 @@ public boolean usesMui2() { @SuppressWarnings("DuplicatedCode") @Override - public ModularPanel buildUI(PosGuiData guiData, PanelSyncManager panelSyncManager) { - int rowSize = (int) Math.sqrt(inventorySize); - panelSyncManager.registerSlotGroup("export_items", rowSize); - + public ModularPanel buildUI(PosGuiData guiData, PanelSyncManager panelSyncManager, UISettings settings) { IntSyncValue radiusSync = new IntSyncValue(() -> getWorkingArea(minerLogic.getCurrentRadius())); BooleanSyncValue isDoneSync = new BooleanSyncValue(minerLogic::isDone); BooleanSyncValue isWorkingSync = new BooleanSyncValue(minerLogic::isWorking); @@ -140,51 +134,37 @@ public ModularPanel buildUI(PosGuiData guiData, PanelSyncManager panelSyncManage .child(IKey.lang(getMetaFullName()) .asWidget() .pos(5, 5)) - .child(new ScrollableTextWidget() - .pos(7 + 3, 15 + 3) - .size(105 - 3 * 2, 75 - 3 * 2) - .autoUpdate(true) - .alignment(Alignment.TopLeft) - .textBuilder(text -> { - text.addLine(KeyUtil.lang(TextFormatting.WHITE, "gregtech.machine.miner.mining_at")); - text.addLine(KeyUtil.lang(TextFormatting.WHITE, "gregtech.machine.miner.mining_pos_x", - xPosSync.getIntValue())); - text.addLine(KeyUtil.lang(TextFormatting.WHITE, "gregtech.machine.miner.mining_pos_y", - yPosSync.getIntValue())); - text.addLine(KeyUtil.lang(TextFormatting.WHITE, "gregtech.machine.miner.mining_pos_z", - zPosSync.getIntValue())); - - text.addLine(KeyUtil.lang(TextFormatting.WHITE, "gregtech.machine.miner.working_area", - radiusSync.getIntValue(), radiusSync.getIntValue())); - - if (isDoneSync.getBoolValue()) { - text.addLine(KeyUtil.lang(TextFormatting.GREEN, "gregtech.machine.miner.done")); - } else if (isWorkingSync.getBoolValue()) { - text.addLine(KeyUtil.lang(TextFormatting.GOLD, "gregtech.machine.miner.working")); - } else if (!isWorkingEnabledSync.getBoolValue()) { - text.addLine(KeyUtil.lang("gregtech.multiblock.work_paused")); - } - - if (isInventoryFullSync.getBoolValue()) { - text.addLine(KeyUtil.lang(TextFormatting.RED, "gregtech.machine.miner.invfull")); - } - - if (!hasEnoughEnergySync.getBoolValue()) { - text.addLine(KeyUtil.lang(TextFormatting.RED, "gregtech.machine.miner.needspower")); - } - }) - .background(GTGuiTextures.DISPLAY.asIcon() - .margin(-3))) - .child(new Grid() - .pos(151 - 18 * 2, 15) - .minElementMargin(0) - .minColWidth(18) - .minRowHeight(18) - .mapTo(rowSize, inventorySize, index -> new ItemSlot() - .slot(SyncHandlers.itemSlot(exportItems, index) - .slotGroup("export_items") - .accessibility(false, true)))) - .child(SlotGroupWidget.playerInventory() + .child(createMinerWidgets(panelSyncManager, exportItems, inventorySize, GTGuiTextures.DISPLAY, text -> { + text.addLine(KeyUtil.lang(TextFormatting.WHITE, "gregtech.machine.miner.mining_at")); + text.addLine(KeyUtil.lang(TextFormatting.WHITE, "gregtech.machine.miner.mining_pos_x", + xPosSync.getIntValue())); + text.addLine(KeyUtil.lang(TextFormatting.WHITE, "gregtech.machine.miner.mining_pos_y", + yPosSync.getIntValue())); + text.addLine(KeyUtil.lang(TextFormatting.WHITE, "gregtech.machine.miner.mining_pos_z", + zPosSync.getIntValue())); + + text.addLine(KeyUtil.lang(TextFormatting.WHITE, "gregtech.machine.miner.working_area", + radiusSync.getIntValue(), radiusSync.getIntValue())); + + if (isDoneSync.getBoolValue()) { + text.addLine(KeyUtil.lang(TextFormatting.GREEN, "gregtech.machine.miner.done")); + } else if (isWorkingSync.getBoolValue()) { + text.addLine(KeyUtil.lang(TextFormatting.GOLD, "gregtech.machine.miner.working")); + } else if (!isWorkingEnabledSync.getBoolValue()) { + text.addLine(KeyUtil.lang("gregtech.multiblock.work_paused")); + } + + if (isInventoryFullSync.getBoolValue()) { + text.addLine(KeyUtil.lang(TextFormatting.RED, "gregtech.machine.miner.invfull")); + } + + if (!hasEnoughEnergySync.getBoolValue()) { + text.addLine(KeyUtil.lang(TextFormatting.RED, "gregtech.machine.miner.needspower")); + } + }) + .left(10) + .top(18)) + .child(SlotGroupWidget.playerInventory(false) .left(7) .bottom(7)) .child(new ItemSlot() diff --git a/src/main/java/gregtech/common/metatileentities/steam/SteamMiner.java b/src/main/java/gregtech/common/metatileentities/steam/SteamMiner.java index 5d036790af8..de781d466b6 100644 --- a/src/main/java/gregtech/common/metatileentities/steam/SteamMiner.java +++ b/src/main/java/gregtech/common/metatileentities/steam/SteamMiner.java @@ -19,7 +19,6 @@ import gregtech.client.renderer.texture.Textures; import gregtech.client.renderer.texture.cube.SimpleSidedCubeRenderer; import gregtech.common.ConfigHolder; -import gregtech.common.mui.widget.ScrollableTextWidget; import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; @@ -50,14 +49,11 @@ import com.cleanroommc.modularui.api.drawable.IKey; import com.cleanroommc.modularui.factory.PosGuiData; import com.cleanroommc.modularui.screen.ModularPanel; -import com.cleanroommc.modularui.utils.Alignment; +import com.cleanroommc.modularui.screen.UISettings; import com.cleanroommc.modularui.value.sync.BooleanSyncValue; import com.cleanroommc.modularui.value.sync.IntSyncValue; import com.cleanroommc.modularui.value.sync.PanelSyncManager; -import com.cleanroommc.modularui.value.sync.SyncHandlers; -import com.cleanroommc.modularui.widgets.ItemSlot; import com.cleanroommc.modularui.widgets.SlotGroupWidget; -import com.cleanroommc.modularui.widgets.layout.Grid; import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.tuple.Pair; import org.jetbrains.annotations.NotNull; @@ -135,10 +131,7 @@ public GTGuiTheme getUITheme() { @SuppressWarnings("DuplicatedCode") @Override - public ModularPanel buildUI(PosGuiData guiData, PanelSyncManager panelSyncManager) { - int rowSize = (int) Math.sqrt(inventorySize); - panelSyncManager.registerSlotGroup("export_items", rowSize); - + public ModularPanel buildUI(PosGuiData guiData, PanelSyncManager panelSyncManager, UISettings settings) { IntSyncValue radiusSync = new IntSyncValue(() -> getWorkingArea(minerLogic.getCurrentRadius())); BooleanSyncValue isDoneSync = new BooleanSyncValue(minerLogic::isDone); BooleanSyncValue isWorkingSync = new BooleanSyncValue(minerLogic::isWorking); @@ -165,12 +158,8 @@ public ModularPanel buildUI(PosGuiData guiData, PanelSyncManager panelSyncManage .child(IKey.lang(getMetaFullName()) .asWidget() .pos(5, 5)) - .child(new ScrollableTextWidget() - .pos(7 + 3, 15 + 3) - .size(105 - 3 * 2, 75 - 3 * 2) - .autoUpdate(true) - .alignment(Alignment.TopLeft) - .textBuilder(text -> { + .child(createMinerWidgets(panelSyncManager, exportItems, inventorySize, GTGuiTextures.DISPLAY_BRONZE, + text -> { text.addLine(KeyUtil.lang(TextFormatting.WHITE, "gregtech.machine.miner.mining_at")); text.addLine(KeyUtil.lang(TextFormatting.WHITE, "gregtech.machine.miner.mining_pos_x", xPosSync.getIntValue())); @@ -206,18 +195,9 @@ public ModularPanel buildUI(PosGuiData guiData, PanelSyncManager panelSyncManage text.addLine(KeyUtil.lang(TextFormatting.RED, "gregtech.machine.steam_miner.steam")); } }) - .background(GTGuiTextures.DISPLAY_BRONZE.asIcon() - .margin(-3))) - .child(new Grid() - .pos(151 - 18 * 2, 15) - .minElementMargin(0) - .minColWidth(18) - .minRowHeight(18) - .mapTo(rowSize, inventorySize, index -> new ItemSlot() - .slot(SyncHandlers.itemSlot(exportItems, index) - .slotGroup("export_items") - .accessibility(false, true)))) - .child(SlotGroupWidget.playerInventory() + .left(10) + .top(18)) + .child(SlotGroupWidget.playerInventory(false) .left(7) .bottom(7)); } From 4884f946d03c04d6a7647d357674deb3546415a9 Mon Sep 17 00:00:00 2001 From: Zorbatron <46525467+Zorbatron@users.noreply.github.com> Date: Fri, 14 Nov 2025 21:38:51 -0500 Subject: [PATCH 6/8] Re-enable slot textures for alternate themes --- src/main/java/gregtech/api/mui/GTGuiTheme.java | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/main/java/gregtech/api/mui/GTGuiTheme.java b/src/main/java/gregtech/api/mui/GTGuiTheme.java index aa7b579797f..01b5084ec2c 100644 --- a/src/main/java/gregtech/api/mui/GTGuiTheme.java +++ b/src/main/java/gregtech/api/mui/GTGuiTheme.java @@ -71,8 +71,7 @@ private static String gregtech(String s) { public static final GTGuiTheme BRONZE = templateBuilder(Names.BRONZE) .parent(Names.STANDARD) .panel(IDs.BRONZE_BACKGROUND) - // .itemSlot(GTGuiTextures.IDs.BRONZE_SLOT) - // .fluidSlot(GTGuiTextures.IDs.BRONZE_SLOT) + .itemSlot(GTGuiTextures.IDs.BRONZE_SLOT) .displayBackground(IDs.DISPLAY_BRONZE) .button(IDs.BRONZE_BUTTON) .color(Colors.BRONZE) @@ -84,8 +83,7 @@ private static String gregtech(String s) { .parent(Names.STANDARD) .panel(IDs.STEEL_BACKGROUND) .textColor(Color.WHITE.darker(1)) - // .itemSlot(GTGuiTextures.IDs.STEEL_SLOT) - // .fluidSlot(GTGuiTextures.IDs.STEEL_SLOT) + .itemSlot(GTGuiTextures.IDs.STEEL_SLOT) .displayBackground(IDs.DISPLAY_STEEL) .button(IDs.STEEL_BUTTON) .simpleToggleButton(IDs.STEEL_BUTTON, IDs.STEEL_BUTTON_SELECTED, @@ -98,8 +96,7 @@ private static String gregtech(String s) { .panel(IDs.PRIMITIVE_BACKGROUND) .textColor(Color.WHITE.darker(1)) .color(Colors.PRIMITIVE) - // .itemSlot(GTGuiTextures.IDs.PRIMITIVE_SLOT) - // .fluidSlot(GTGuiTextures.IDs.PRIMITIVE_SLOT) + .itemSlot(GTGuiTextures.IDs.PRIMITIVE_SLOT) .build(); protected final String themeId; From 92835d875398d9f71b8e1cbb7fc4b9c2197da0bd Mon Sep 17 00:00:00 2001 From: Zorbatron <46525467+Zorbatron@users.noreply.github.com> Date: Sat, 15 Nov 2025 00:04:25 -0500 Subject: [PATCH 7/8] Only show the mining position when the miner is actually working --- .../electric/MetaTileEntityMiner.java | 32 ++++++++------ .../metatileentities/steam/SteamMiner.java | 42 ++++++++++++------- 2 files changed, 48 insertions(+), 26 deletions(-) diff --git a/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityMiner.java b/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityMiner.java index e08db497a28..33872c14e6c 100644 --- a/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityMiner.java +++ b/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityMiner.java @@ -135,30 +135,38 @@ public ModularPanel buildUI(PosGuiData guiData, PanelSyncManager panelSyncManage .asWidget() .pos(5, 5)) .child(createMinerWidgets(panelSyncManager, exportItems, inventorySize, GTGuiTextures.DISPLAY, text -> { - text.addLine(KeyUtil.lang(TextFormatting.WHITE, "gregtech.machine.miner.mining_at")); - text.addLine(KeyUtil.lang(TextFormatting.WHITE, "gregtech.machine.miner.mining_pos_x", - xPosSync.getIntValue())); - text.addLine(KeyUtil.lang(TextFormatting.WHITE, "gregtech.machine.miner.mining_pos_y", - yPosSync.getIntValue())); - text.addLine(KeyUtil.lang(TextFormatting.WHITE, "gregtech.machine.miner.mining_pos_z", - zPosSync.getIntValue())); + boolean isDone = isDoneSync.getBoolValue(); + boolean isWorking = isWorkingSync.getBoolValue(); + boolean isWorkingEnabled = isWorkingEnabledSync.getBoolValue(); + boolean isInventoryFull = isInventoryFullSync.getBoolValue(); + boolean hasEnoughEnergy = hasEnoughEnergySync.getBoolValue(); + + if (isWorking) { + text.addLine(KeyUtil.lang(TextFormatting.WHITE, "gregtech.machine.miner.mining_at")); + text.addLine(KeyUtil.lang(TextFormatting.WHITE, "gregtech.machine.miner.mining_pos_x", + xPosSync.getIntValue())); + text.addLine(KeyUtil.lang(TextFormatting.WHITE, "gregtech.machine.miner.mining_pos_y", + yPosSync.getIntValue())); + text.addLine(KeyUtil.lang(TextFormatting.WHITE, "gregtech.machine.miner.mining_pos_z", + zPosSync.getIntValue())); + } text.addLine(KeyUtil.lang(TextFormatting.WHITE, "gregtech.machine.miner.working_area", radiusSync.getIntValue(), radiusSync.getIntValue())); - if (isDoneSync.getBoolValue()) { + if (isDone) { text.addLine(KeyUtil.lang(TextFormatting.GREEN, "gregtech.machine.miner.done")); - } else if (isWorkingSync.getBoolValue()) { + } else if (isWorking) { text.addLine(KeyUtil.lang(TextFormatting.GOLD, "gregtech.machine.miner.working")); - } else if (!isWorkingEnabledSync.getBoolValue()) { + } else if (!isWorkingEnabled) { text.addLine(KeyUtil.lang("gregtech.multiblock.work_paused")); } - if (isInventoryFullSync.getBoolValue()) { + if (isInventoryFull) { text.addLine(KeyUtil.lang(TextFormatting.RED, "gregtech.machine.miner.invfull")); } - if (!hasEnoughEnergySync.getBoolValue()) { + if (!hasEnoughEnergy) { text.addLine(KeyUtil.lang(TextFormatting.RED, "gregtech.machine.miner.needspower")); } }) diff --git a/src/main/java/gregtech/common/metatileentities/steam/SteamMiner.java b/src/main/java/gregtech/common/metatileentities/steam/SteamMiner.java index de781d466b6..af16eceb87c 100644 --- a/src/main/java/gregtech/common/metatileentities/steam/SteamMiner.java +++ b/src/main/java/gregtech/common/metatileentities/steam/SteamMiner.java @@ -160,30 +160,44 @@ public ModularPanel buildUI(PosGuiData guiData, PanelSyncManager panelSyncManage .pos(5, 5)) .child(createMinerWidgets(panelSyncManager, exportItems, inventorySize, GTGuiTextures.DISPLAY_BRONZE, text -> { - text.addLine(KeyUtil.lang(TextFormatting.WHITE, "gregtech.machine.miner.mining_at")); - text.addLine(KeyUtil.lang(TextFormatting.WHITE, "gregtech.machine.miner.mining_pos_x", - xPosSync.getIntValue())); - text.addLine(KeyUtil.lang(TextFormatting.WHITE, "gregtech.machine.miner.mining_pos_y", - yPosSync.getIntValue())); - text.addLine(KeyUtil.lang(TextFormatting.WHITE, "gregtech.machine.miner.mining_pos_z", - zPosSync.getIntValue())); + boolean isDone = isDoneSync.getBoolValue(); + boolean isWorking = isWorkingSync.getBoolValue(); + boolean isWorkingEnabled = isWorkingEnabledSync.getBoolValue(); + boolean isInventoryFull = isInventoryFullSync.getBoolValue(); + boolean hasEnoughEnergy = hasEnoughEnergySync.getBoolValue(); + boolean isVentBlocked = isVentBlockedSync.getBoolValue(); + + int xPos = xPosSync.getIntValue(); + int yPos = yPosSync.getIntValue(); + int zPos = zPosSync.getIntValue(); + int radius = radiusSync.getIntValue(); + + if (isWorking) { + text.addLine(KeyUtil.lang(TextFormatting.WHITE, "gregtech.machine.miner.mining_at")); + text.addLine(KeyUtil.lang(TextFormatting.WHITE, "gregtech.machine.miner.mining_pos_x", + xPos)); + text.addLine(KeyUtil.lang(TextFormatting.WHITE, "gregtech.machine.miner.mining_pos_y", + yPos)); + text.addLine(KeyUtil.lang(TextFormatting.WHITE, "gregtech.machine.miner.mining_pos_z", + zPos)); + } text.addLine(KeyUtil.lang(TextFormatting.WHITE, "gregtech.machine.miner.working_area", - radiusSync.getIntValue(), radiusSync.getIntValue())); + radius, radius)); - if (isDoneSync.getBoolValue()) { + if (isDone) { text.addLine(KeyUtil.lang(TextFormatting.GREEN, "gregtech.machine.miner.done")); - } else if (isWorkingSync.getBoolValue()) { + } else if (isWorking) { text.addLine(KeyUtil.lang(TextFormatting.GOLD, "gregtech.machine.miner.working")); - } else if (!isWorkingEnabledSync.getBoolValue()) { + } else if (!isWorkingEnabled) { text.addLine(KeyUtil.lang("gregtech.multiblock.work_paused")); } - if (isInventoryFullSync.getBoolValue()) { + if (isInventoryFull) { text.addLine(KeyUtil.lang(TextFormatting.RED, "gregtech.machine.miner.invfull")); } - if (isVentBlockedSync.getBoolValue()) { + if (isVentBlocked) { text.addLine(KeyUtil.lang(TextFormatting.RED, "gregtech.machine.steam_miner.vent")); } @@ -191,7 +205,7 @@ public ModularPanel buildUI(PosGuiData guiData, PanelSyncManager panelSyncManage // blocked. // It should be fine since I don't think it can even enter the vent blocked state without // having steam. - if (!hasEnoughEnergySync.getBoolValue() && !isVentBlockedSync.getBoolValue()) { + if (!hasEnoughEnergy && !isVentBlocked) { text.addLine(KeyUtil.lang(TextFormatting.RED, "gregtech.machine.steam_miner.steam")); } }) From 80338e0e7d1c42956c0eea2eaf0cae06c1b3c783 Mon Sep 17 00:00:00 2001 From: Zorbatron <46525467+Zorbatron@users.noreply.github.com> Date: Sat, 15 Nov 2025 00:59:45 -0500 Subject: [PATCH 8/8] Have a more colorful text display --- .../java/gregtech/api/mui/TextStandards.java | 26 +++++++++++++++++++ .../electric/MetaTileEntityMiner.java | 13 ++++++---- .../metatileentities/steam/SteamMiner.java | 18 ++++++++----- .../resources/assets/gregtech/lang/en_us.lang | 22 ++++++++-------- 4 files changed, 57 insertions(+), 22 deletions(-) create mode 100644 src/main/java/gregtech/api/mui/TextStandards.java diff --git a/src/main/java/gregtech/api/mui/TextStandards.java b/src/main/java/gregtech/api/mui/TextStandards.java new file mode 100644 index 00000000000..02aef97140d --- /dev/null +++ b/src/main/java/gregtech/api/mui/TextStandards.java @@ -0,0 +1,26 @@ +package gregtech.api.mui; + +import gregtech.api.util.KeyUtil; + +import net.minecraft.util.text.TextFormatting; + +import com.cleanroommc.modularui.api.drawable.IKey; + +public final class TextStandards { + + public static class Colors { + + public static final TextFormatting MACHINE_WORKING = TextFormatting.GREEN; + public static final TextFormatting MACHINE_DONE = TextFormatting.GREEN; + public static final TextFormatting MACHINE_PAUSED = TextFormatting.GOLD; + public static final TextFormatting NO_OUTPUT_SPACE = TextFormatting.RED; + public static final TextFormatting STEAM_VENT_BLOCKED = TextFormatting.RED; + public static final TextFormatting NO_POWER = TextFormatting.RED; + } + + public static class Keys { + + public static final IKey MACHINE_PAUSED = KeyUtil.lang(Colors.MACHINE_PAUSED, + "gregtech.multiblock.work_paused"); + } +} diff --git a/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityMiner.java b/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityMiner.java index 33872c14e6c..53656efac23 100644 --- a/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityMiner.java +++ b/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityMiner.java @@ -14,6 +14,7 @@ import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; import gregtech.api.mui.GTGuiTextures; import gregtech.api.mui.GTGuis; +import gregtech.api.mui.TextStandards; import gregtech.api.util.KeyUtil; import gregtech.client.renderer.texture.Textures; import gregtech.core.sound.GTSoundEvents; @@ -155,19 +156,21 @@ public ModularPanel buildUI(PosGuiData guiData, PanelSyncManager panelSyncManage radiusSync.getIntValue(), radiusSync.getIntValue())); if (isDone) { - text.addLine(KeyUtil.lang(TextFormatting.GREEN, "gregtech.machine.miner.done")); + text.addLine(KeyUtil.lang(TextStandards.Colors.MACHINE_DONE, "gregtech.machine.miner.done")); } else if (isWorking) { - text.addLine(KeyUtil.lang(TextFormatting.GOLD, "gregtech.machine.miner.working")); + text.addLine(KeyUtil.lang(TextStandards.Colors.MACHINE_WORKING, + "gregtech.machine.miner.working")); } else if (!isWorkingEnabled) { - text.addLine(KeyUtil.lang("gregtech.multiblock.work_paused")); + text.addLine(TextStandards.Keys.MACHINE_PAUSED); } if (isInventoryFull) { - text.addLine(KeyUtil.lang(TextFormatting.RED, "gregtech.machine.miner.invfull")); + text.addLine(KeyUtil.lang(TextStandards.Colors.NO_OUTPUT_SPACE, + "gregtech.machine.miner.invfull")); } if (!hasEnoughEnergy) { - text.addLine(KeyUtil.lang(TextFormatting.RED, "gregtech.machine.miner.needspower")); + text.addLine(KeyUtil.lang(TextStandards.Colors.NO_POWER, "gregtech.machine.miner.needspower")); } }) .left(10) diff --git a/src/main/java/gregtech/common/metatileentities/steam/SteamMiner.java b/src/main/java/gregtech/common/metatileentities/steam/SteamMiner.java index af16eceb87c..cbe9ae2aa7a 100644 --- a/src/main/java/gregtech/common/metatileentities/steam/SteamMiner.java +++ b/src/main/java/gregtech/common/metatileentities/steam/SteamMiner.java @@ -14,6 +14,7 @@ import gregtech.api.mui.GTGuiTextures; import gregtech.api.mui.GTGuiTheme; import gregtech.api.mui.GTGuis; +import gregtech.api.mui.TextStandards; import gregtech.api.util.GTUtility; import gregtech.api.util.KeyUtil; import gregtech.client.renderer.texture.Textures; @@ -186,19 +187,23 @@ public ModularPanel buildUI(PosGuiData guiData, PanelSyncManager panelSyncManage radius, radius)); if (isDone) { - text.addLine(KeyUtil.lang(TextFormatting.GREEN, "gregtech.machine.miner.done")); + text.addLine(KeyUtil.lang(TextStandards.Colors.MACHINE_DONE, + "gregtech.machine.miner.done")); } else if (isWorking) { - text.addLine(KeyUtil.lang(TextFormatting.GOLD, "gregtech.machine.miner.working")); + text.addLine(KeyUtil.lang(TextStandards.Colors.MACHINE_WORKING, + "gregtech.machine.miner.working")); } else if (!isWorkingEnabled) { - text.addLine(KeyUtil.lang("gregtech.multiblock.work_paused")); + text.addLine(TextStandards.Keys.MACHINE_PAUSED); } if (isInventoryFull) { - text.addLine(KeyUtil.lang(TextFormatting.RED, "gregtech.machine.miner.invfull")); + text.addLine(KeyUtil.lang(TextStandards.Colors.NO_OUTPUT_SPACE, + "gregtech.machine.miner.invfull")); } if (isVentBlocked) { - text.addLine(KeyUtil.lang(TextFormatting.RED, "gregtech.machine.steam_miner.vent")); + text.addLine(KeyUtil.lang(TextStandards.Colors.STEAM_VENT_BLOCKED, + "gregtech.machine.steam_miner.vent")); } // Drain energy always returns false when the vent is blocked, so check that it isn't @@ -206,7 +211,8 @@ public ModularPanel buildUI(PosGuiData guiData, PanelSyncManager panelSyncManage // It should be fine since I don't think it can even enter the vent blocked state without // having steam. if (!hasEnoughEnergy && !isVentBlocked) { - text.addLine(KeyUtil.lang(TextFormatting.RED, "gregtech.machine.steam_miner.steam")); + text.addLine(KeyUtil.lang(TextStandards.Colors.NO_POWER, + "gregtech.machine.steam_miner.steam")); } }) .left(10) diff --git a/src/main/resources/assets/gregtech/lang/en_us.lang b/src/main/resources/assets/gregtech/lang/en_us.lang index 195504dcf43..d9a27bc991f 100644 --- a/src/main/resources/assets/gregtech/lang/en_us.lang +++ b/src/main/resources/assets/gregtech/lang/en_us.lang @@ -4883,6 +4883,7 @@ gregtech.machine.miner.hv.name=Advanced Miner II gregtech.machine.miner.tooltip=Mines ores below the Miner! Starts as §f%sx%s §7area gregtech.machine.miner.per_block=§7takes §f%,ds §7per Block + gregtech.machine.large_miner.ev.name=Basic Ore Drilling Plant gregtech.machine.large_miner.iv.name=Advanced Ore Drilling Plant 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 gregtech.machine.miner.fluid_usage=Uses §f%,d L/t §7of §f%s§7, doubled per overclock. gregtech.machine.miner.multi.description=A multiblock mining machine that covers a large area and produces huge quantity of ore. gregtech.machine.miner.multi.needsfluid=No Drilling Fluid! +gregtech.machine.miner.done=Done! +gregtech.machine.miner.working=Mining... +gregtech.machine.miner.invfull=Inventory Full! +gregtech.machine.miner.needspower=Needs Power! +gregtech.machine.steam_miner.vent=Venting Blocked! +gregtech.machine.steam_miner.steam=Needs Steam! +gregtech.machine.miner.errorradius=§cCannot change radius while working! gregtech.machine.miner.mining_at=Currently mining at: -gregtech.machine.miner.mining_pos_x=X: %s -gregtech.machine.miner.mining_pos_y=Y: %s -gregtech.machine.miner.mining_pos_z=Z: %s +gregtech.machine.miner.mining_pos_x=§bX§r: §a%s§r +gregtech.machine.miner.mining_pos_y=§bY§r: §a%s§r +gregtech.machine.miner.mining_pos_z=§bZ§r: §a%s§r gregtech.machine.miner.radius=Radius: %d gregtech.machine.miner.working_area=Working Area: %dx%d blocks 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 gregtech.multiblock.large_boiler.water_bar_hover=§7Water: §9%,d / %,d L gregtech.multiblock.large_boiler.no_water=§eNo Water! -gregtech.machine.miner.done=Done! -gregtech.machine.miner.working=Working... -gregtech.machine.miner.invfull=Inventory Full! -gregtech.machine.miner.needspower=Needs Power! -gregtech.machine.steam_miner.vent=Venting Blocked! -gregtech.machine.steam_miner.steam=Needs Steam! -gregtech.machine.miner.errorradius=§cCannot change radius while working! - gregtech.multiblock.miner.neither_mode=Chunk Mode: §cDisabled§r/nSilk Touch Mode: §cDisabled§r/n§7Switching requires an idle machine. gregtech.multiblock.miner.chunk_mode=Chunk Mode: §aEnabled§r/nSilk Touch Mode: §cDisabled§r/n§7Switching requires an idle machine. gregtech.multiblock.miner.silk_touch_mode=Chunk Mode: §cDisabled§r/nSilk Touch Mode: §aEnabled§r/n§7Switching requires an idle machine.