Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
1162a54
stuff
serenibyss Dec 10, 2023
20d86d2
group slots, fix shift clicking
serenibyss Dec 10, 2023
924ad03
clean up toggle buttons
serenibyss Dec 10, 2023
e0d7e45
cleanups
serenibyss Dec 10, 2023
60908b7
2.4 fix
serenibyss Dec 17, 2023
8a3cec9
Logo as part of GTGuiTheme
serenibyss Dec 17, 2023
611f60a
clickable progress bar (partial)
serenibyss Dec 17, 2023
c23d811
finish previous commit
serenibyss Dec 17, 2023
8b6a9a7
fix progress bar sync
serenibyss Dec 17, 2023
bf3a6e8
fix button/toggle button theme builder calls
serenibyss Dec 17, 2023
6559713
fix rebase
ghzdude Feb 28, 2025
fad6202
move mui2 related methods into builder
ghzdude Feb 28, 2025
4ee048a
use unary operator instead
ghzdude Feb 28, 2025
3d69058
port arc, assembler, autoclave
ghzdude Feb 28, 2025
fb2a238
spotless
ghzdude Feb 28, 2025
d3ca2d7
simplify builder to modify map ui directly
ghzdude Feb 28, 2025
baed011
move back to consumer
ghzdude Feb 28, 2025
6932f36
add comment clarifying null supression
ghzdude May 17, 2025
3d62c7e
set mui2 for map ui
ghzdude May 17, 2025
3f6aceb
use progress value directly in widget
ghzdude May 17, 2025
a7be9bf
rework slot overlay methods
ghzdude May 19, 2025
cd61706
port steam machines to mui2
ghzdude May 19, 2025
c55c703
actually port steam machines to mui2
ghzdude May 19, 2025
365714a
port singleblock generators to mui2
ghzdude May 19, 2025
f1a54ca
spotless
ghzdude May 19, 2025
4facb0f
improve/cleanup existing mui2 code
ghzdude May 19, 2025
67bf06a
spotless
ghzdude May 19, 2025
b4b77c2
null check ui builder and simplify
ghzdude May 19, 2025
15e92bf
Actually merge master in properly :facepalm:
Zorbatron Jul 2, 2025
593305f
remove old ui code from SteamBoiler and extending classes
ghzdude Aug 15, 2025
042fffc
fix SteamLavaBoiler lava fluid slot
ghzdude Aug 15, 2025
2fba2a5
use `slotOverlay()` directly
ghzdude Aug 15, 2025
0270525
rename mui2 special drawable
ghzdude Aug 15, 2025
52784ce
rename mui2 special drawable and method
ghzdude Aug 15, 2025
ff77844
remove irrelevant todo
ghzdude Aug 15, 2025
4fb5504
remove commented code
ghzdude Aug 15, 2025
9974eef
actually sync the sync value and remove todo
ghzdude Aug 15, 2025
63223ef
spotless
ghzdude Aug 15, 2025
0d89b67
initial rework of `addInventorySlotGroup()` for mui2
ghzdude Aug 17, 2025
109205d
more work on the rewrite
ghzdude Aug 18, 2025
835cef9
use modular panel instead of redundant parent widget
ghzdude Sep 20, 2025
93cb0a1
rework mostly done
ghzdude Sep 27, 2025
f6e27ac
clean + spotless
ghzdude Sep 27, 2025
700c07f
cleanup pt 2
ghzdude Sep 28, 2025
ffdc085
fix no energy indicator
ghzdude Sep 28, 2025
38c20bc
replace special texture with a widget consumer
ghzdude Sep 28, 2025
6c7d69d
fix special textures
ghzdude Sep 28, 2025
f24033c
remove if condition for simple machines
ghzdude Sep 28, 2025
d827551
increase progress widget margin
ghzdude Sep 29, 2025
aa30cfa
improve centering slots around progress widget
ghzdude Sep 29, 2025
e55ce6f
improve item/fluid groups
ghzdude Sep 29, 2025
7d70dfc
make `setSize()` a builder method
ghzdude Sep 29, 2025
85eedce
create CalculatedGrid to simplify and cleanup logic
ghzdude Sep 30, 2025
7620130
fix logo in SimpleGeneratorMetaTileEntity
ghzdude Sep 30, 2025
f2bd4f5
remove unused field
ghzdude Oct 16, 2025
82d269e
fix rebase
ghzdude Nov 13, 2025
d6ea518
add gt logo to steam machines
ghzdude Dec 24, 2025
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 @@ -10,6 +10,7 @@
import gregtech.api.gui.ModularUI;
import gregtech.api.gui.widgets.LabelWidget;
import gregtech.api.metatileentity.interfaces.IGregTechTileEntity;
import gregtech.api.mui.GTGuiTextures;
import gregtech.api.recipes.RecipeMap;
import gregtech.client.renderer.ICubeRenderer;
import gregtech.client.renderer.texture.Textures;
Expand All @@ -28,10 +29,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.screen.UISettings;
import com.cleanroommc.modularui.value.sync.PanelSyncManager;
import com.cleanroommc.modularui.widget.Widget;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.util.List;
import java.util.Objects;
import java.util.function.Function;

public class SimpleGeneratorMetaTileEntity extends WorkableTieredMetaTileEntity implements IActiveOutputSide {
Expand Down Expand Up @@ -128,6 +136,40 @@ protected void renderOverlays(CCRenderState renderState, Matrix4 translation, IV
workable.isWorkingEnabled());
}

@Override
public boolean usesMui2() {
RecipeMap<?> map = getRecipeMap();
return map != null && map.getRecipeMapUI().usesMui2();
}

@Override
public ModularPanel buildUI(PosGuiData guiData, PanelSyncManager panelSyncManager, UISettings settings) {
RecipeMap<?> workableRecipeMap = Objects.requireNonNull(workable.getRecipeMap(), "recipe map is null");
int yOffset = 0;
if (workableRecipeMap.getMaxInputs() >= 6 || workableRecipeMap.getMaxFluidInputs() >= 6 ||
workableRecipeMap.getMaxOutputs() >= 6 || workableRecipeMap.getMaxFluidOutputs() >= 6) {
yOffset = FONT_HEIGHT;
}

ModularPanel panel = workableRecipeMap.getRecipeMapUI()
.setSize(176, 166 + yOffset)
.constructPanel(this, workable::getProgressPercent,
importItems, exportItems,
importFluids, exportFluids,
yOffset, panelSyncManager)
.child(IKey.lang(getMetaFullName()).asWidget().pos(5, 5))
.bindPlayerInventory();

if (exportItems.getSlots() + exportFluids.getTanks() <= 9) {
panel.child(new Widget<>()
.size(17)
.right(7)
.top(45 + yOffset)
.background(GTGuiTextures.getLogo(getUITheme())));
}
return panel;
}

@Override
protected ModularUI createUI(EntityPlayer entityPlayer) {
return createGuiTemplate(entityPlayer).build(getHolder(), entityPlayer);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,10 @@
import gregtech.api.gui.GuiTextures;
import gregtech.api.gui.ModularUI;
import gregtech.api.gui.resources.TextureArea;
import gregtech.api.gui.widgets.GhostCircuitSlotWidget;
import gregtech.api.gui.widgets.ImageWidget;
import gregtech.api.gui.widgets.LabelWidget;
import gregtech.api.gui.widgets.SlotWidget;
import gregtech.api.gui.widgets.ToggleButtonWidget;
import gregtech.api.items.itemhandlers.GTItemStackHandler;
import gregtech.api.metatileentity.interfaces.IGregTechTileEntity;
import gregtech.api.mui.GTGuiTextures;
import gregtech.api.mui.widget.GhostCircuitSlotWidget;
import gregtech.api.recipes.RecipeMap;
import gregtech.api.util.GTTransferUtils;
import gregtech.api.util.GTUtility;
Expand Down Expand Up @@ -54,11 +51,24 @@
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.screen.UISettings;
import com.cleanroommc.modularui.value.sync.BooleanSyncValue;
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.SlotGroupWidget;
import com.cleanroommc.modularui.widgets.ToggleButton;
import com.cleanroommc.modularui.widgets.layout.Flow;
import com.cleanroommc.modularui.widgets.slot.ItemSlot;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.util.Arrays;
import java.util.List;
import java.util.Objects;
import java.util.function.Function;

import static gregtech.api.capability.GregtechDataCodes.*;
Expand Down Expand Up @@ -478,6 +488,92 @@ public void clearMachineInventory(@NotNull List<@NotNull ItemStack> itemBuffer)
clearInventory(itemBuffer, chargerInventory);
}

@Override
public boolean usesMui2() {
RecipeMap<?> map = getRecipeMap();
return map != null && map.getRecipeMapUI().usesMui2();
}

@Override
public ModularPanel buildUI(PosGuiData guiData, PanelSyncManager panelSyncManager, UISettings settings) {
RecipeMap<?> workableRecipeMap = Objects.requireNonNull(workable.getRecipeMap(), "recipe map is null");
int yOffset = 0;
if (workableRecipeMap.getMaxInputs() >= 6 || workableRecipeMap.getMaxFluidInputs() >= 6 ||
workableRecipeMap.getMaxOutputs() >= 6 || workableRecipeMap.getMaxFluidOutputs() >= 6) {
yOffset = FONT_HEIGHT;
}

Flow col = Flow.column()
.name("col:special.buttons")
.right(7).bottom(7)
.height(18 * 4 + 4)
.width(18);

BooleanSyncValue hasEnergy = new BooleanSyncValue(workable::isHasNotEnoughEnergy);
panelSyncManager.syncValue("has_energy", hasEnergy);

ModularPanel panel = workableRecipeMap.getRecipeMapUI()
.setSize(176 + 20, 166 + yOffset)
.constructPanel(this, workable::getProgressPercent,
importItems, exportItems,
importFluids, exportFluids,
yOffset, panelSyncManager)
.child(IKey.lang(getMetaFullName()).asWidget().pos(5, 5))
.child(GTGuiTextures.INDICATOR_NO_ENERGY.asWidget()
.name("energy.indicator")
.size(18)
.alignX(0.5f)
.top(42 + yOffset + 18)
.setEnabledIf($ -> hasEnergy.getBoolValue()))
.child(col)
.child(SlotGroupWidget.playerInventory(true).left(7));

if (exportItems.getSlots() > 0) {
col.child(new ToggleButton()
.overlay(GTGuiTextures.BUTTON_ITEM_OUTPUT)
.value(new BooleanSyncValue(() -> autoOutputItems, val -> autoOutputItems = val))
.addTooltip(true, IKey.lang("gregtech.gui.item_auto_output.tooltip.enabled"))
.addTooltip(false, IKey.lang("gregtech.gui.item_auto_output.tooltip.disabled")));
}

if (exportFluids.getTanks() > 0) {
col.child(new ToggleButton()
.overlay(GTGuiTextures.BUTTON_FLUID_OUTPUT)
.value(new BooleanSyncValue(() -> autoOutputFluids, val -> autoOutputFluids = val))
.addTooltip(true, IKey.lang("gregtech.gui.fluid_auto_output.tooltip.enabled"))
.addTooltip(false, IKey.lang("gregtech.gui.fluid_auto_output.tooltip.disabled")));
}

col.child(new ItemSlot()
.name("charger.slot")
.slot(SyncHandlers.itemSlot(chargerInventory, 0))
.background(GTGuiTextures.SLOT, GTGuiTextures.CHARGER_OVERLAY)
.bottom(18 + 4)
.addTooltipLine(IKey.lang("gregtech.gui.charger_slot.tooltip",
GTValues.VNF[getTier()], GTValues.VNF[getTier()])));

col.child(new Widget<>()
.size(17)
.marginTop(1)
.marginRight(1)
.top(-17 - 2)
.background(GTGuiTextures.getLogo(getUITheme())));

if (hasGhostCircuitInventory() && circuitInventory != null) {
col.child(new GhostCircuitSlotWidget()
.bottom(0)
.slot(circuitInventory, 0)
.background(GTGuiTextures.SLOT, GTGuiTextures.INT_CIRCUIT_OVERLAY));
}
return panel;
}

@Override
protected ModularUI createUI(EntityPlayer entityPlayer) {
return createGuiTemplate(entityPlayer).build(getHolder(), entityPlayer);
}

@Deprecated
protected ModularUI.Builder createGuiTemplate(EntityPlayer player) {
RecipeMap<?> workableRecipeMap = workable.getRecipeMap();
int yOffset = 0;
Expand All @@ -489,38 +585,42 @@ protected ModularUI.Builder createGuiTemplate(EntityPlayer player) {
ModularUI.Builder builder = workableRecipeMap.getRecipeMapUI()
.createUITemplate(workable::getProgressPercent, importItems, exportItems, importFluids, exportFluids,
yOffset)
.widget(new LabelWidget(5, 5, getMetaFullName()))
.widget(new SlotWidget(chargerInventory, 0, 79, 62 + yOffset, true, true, false)
.setBackgroundTexture(GuiTextures.SLOT, GuiTextures.CHARGER_OVERLAY)
.setTooltipText("gregtech.gui.charger_slot.tooltip", GTValues.VNF[getTier()],
GTValues.VNF[getTier()]))
.widget(new ImageWidget(79, 42 + yOffset, 18, 18, GuiTextures.INDICATOR_NO_ENERGY).setIgnoreColor(true)
.setPredicate(workable::isHasNotEnoughEnergy))
.widget(new gregtech.api.gui.widgets.LabelWidget(5, 5, getMetaFullName()))
.widget(new gregtech.api.gui.widgets.SlotWidget(chargerInventory, 0, 79, 62 + yOffset, true, true,
false)
.setBackgroundTexture(GuiTextures.SLOT, GuiTextures.CHARGER_OVERLAY)
.setTooltipText("gregtech.gui.charger_slot.tooltip", GTValues.VNF[getTier()],
GTValues.VNF[getTier()]))
.widget(new gregtech.api.gui.widgets.ImageWidget(79, 42 + yOffset, 18, 18,
GuiTextures.INDICATOR_NO_ENERGY).setIgnoreColor(true)
.setPredicate(workable::isHasNotEnoughEnergy))
.bindPlayerInventory(player.inventory, GuiTextures.SLOT, yOffset);

int leftButtonStartX = 7;

if (exportItems.getSlots() > 0) {
builder.widget(new ToggleButtonWidget(leftButtonStartX, 62 + yOffset, 18, 18,
builder.widget(new gregtech.api.gui.widgets.ToggleButtonWidget(leftButtonStartX, 62 + yOffset, 18, 18,
GuiTextures.BUTTON_ITEM_OUTPUT, this::isAutoOutputItems, this::setAutoOutputItems)
.setTooltipText("gregtech.gui.item_auto_output.tooltip")
.shouldUseBaseBackground());
leftButtonStartX += 18;
}
if (exportFluids.getTanks() > 0) {
builder.widget(new ToggleButtonWidget(leftButtonStartX, 62 + yOffset, 18, 18,
builder.widget(new gregtech.api.gui.widgets.ToggleButtonWidget(leftButtonStartX, 62 + yOffset, 18, 18,
GuiTextures.BUTTON_FLUID_OUTPUT, this::isAutoOutputFluids, this::setAutoOutputFluids)
.setTooltipText("gregtech.gui.fluid_auto_output.tooltip")
.shouldUseBaseBackground());
}

if (exportItems.getSlots() + exportFluids.getTanks() <= 9) {
ImageWidget logo = new ImageWidget(152, 63 + yOffset, 17, 17,
gregtech.api.gui.widgets.ImageWidget logo = new gregtech.api.gui.widgets.ImageWidget(152, 63 + yOffset, 17,
17,
GTValues.XMAS.get() ? getXmasLogo() : getLogo()).setIgnoreColor(true);

if (this.circuitInventory != null) {
SlotWidget circuitSlot = new GhostCircuitSlotWidget(circuitInventory, 0, 124, 62 + yOffset)
.setBackgroundTexture(GuiTextures.SLOT, getCircuitSlotOverlay());
gregtech.api.gui.widgets.SlotWidget circuitSlot = new gregtech.api.gui.widgets.GhostCircuitSlotWidget(
circuitInventory, 0, 124, 62 + yOffset)
.setBackgroundTexture(GuiTextures.SLOT, getCircuitSlotOverlay());
builder.widget(circuitSlot.setConsumer(this::getCircuitSlotTooltip)).widget(logo);
}
}
Expand All @@ -546,7 +646,7 @@ protected TextureArea getCircuitSlotOverlay() {
}

// Method provided to override
protected void getCircuitSlotTooltip(SlotWidget widget) {
protected void getCircuitSlotTooltip(gregtech.api.gui.widgets.SlotWidget widget) {
String configString;
if (circuitInventory == null || circuitInventory.getCircuitValue() == GhostCircuitItemStackHandler.NO_CONFIG) {
configString = new TextComponentTranslation("gregtech.gui.configurator_slot.no_value").getFormattedText();
Expand All @@ -557,11 +657,6 @@ protected void getCircuitSlotTooltip(SlotWidget widget) {
widget.setTooltipText("gregtech.gui.configurator_slot.tooltip", configString);
}

@Override
protected ModularUI createUI(EntityPlayer entityPlayer) {
return createGuiTemplate(entityPlayer).build(getHolder(), entityPlayer);
}

@Override
public void addInformation(ItemStack stack, @Nullable World player, List<String> tooltip, boolean advanced) {
super.addInformation(stack, player, tooltip, advanced);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import gregtech.api.gui.GuiTextures;
import gregtech.api.gui.ModularUI;
import gregtech.api.gui.widgets.ImageWidget;
import gregtech.api.mui.GTGuiTheme;
import gregtech.api.recipes.RecipeMap;
import gregtech.api.util.GTUtility;
import gregtech.client.particle.VanillaParticleEffects;
Expand All @@ -22,7 +23,12 @@
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.SoundEvents;
import net.minecraft.item.ItemStack;
import net.minecraft.util.*;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.EnumParticleTypes;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.SoundCategory;
import net.minecraft.util.SoundEvent;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.fluids.FluidTank;
Expand All @@ -34,6 +40,11 @@
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.screen.UISettings;
import com.cleanroommc.modularui.value.sync.PanelSyncManager;
import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.tuple.Pair;
import org.jetbrains.annotations.Nullable;
Expand All @@ -43,6 +54,8 @@

public abstract class SteamMetaTileEntity extends MetaTileEntity {

// todo quick and dirty fix to not show input tank in ui, find better solution
protected static final FluidTankList EMPTY = new FluidTankList(false);
protected static final int STEAM_CAPACITY = 16000;

protected final boolean isHighPressure;
Expand Down Expand Up @@ -127,6 +140,34 @@ public FluidTankList createImportFluidHandler() {
return new FluidTankList(false, steamFluidTank);
}

@Override
public boolean usesMui2() {
RecipeMap<?> map = getRecipeMap();
return map != null && map.getRecipeMapUI().usesMui2();
}

@Override
public ModularPanel buildUI(PosGuiData guiData, PanelSyncManager panelSyncManager, UISettings settings) {
RecipeMap<?> map = Objects.requireNonNull(getRecipeMap());

return map.getRecipeMapUI()
.constructPanel(this, workableHandler::getProgressPercent,
importItems, exportItems,
EMPTY, exportFluids,
0, panelSyncManager)
.child(IKey.lang(getMetaFullName()).asWidget().pos(5, 5))
.child(getUITheme().getLogo().asWidget()
.size(16)
.right(7)
.top(46))
.bindPlayerInventory();
}

@Override
public GTGuiTheme getUITheme() {
return isHighPressure ? GTGuiTheme.STEEL : GTGuiTheme.BRONZE;
}

public ModularUI.Builder createUITemplate(EntityPlayer player) {
return ModularUI.builder(GuiTextures.BACKGROUND_STEAM.get(isHighPressure), 176, 166)
.label(6, 6, getMetaFullName()).shouldColor(false)
Expand Down
Loading
Loading