Skip to content

Commit 231aeeb

Browse files
committed
port creative tank
creative tank and chest done
1 parent c2a2da9 commit 231aeeb

File tree

2 files changed

+56
-1
lines changed

2 files changed

+56
-1
lines changed

src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityCreativeChest.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ public ModularPanel buildUI(PosGuiData guiData, PanelSyncManager guiSyncManager)
102102
.child(IKey.lang("gregtech.creative.chest.ipc").asWidget()
103103
.marginBottom(2))
104104
.child(new TextFieldWidget()
105+
.left(2)
105106
.marginBottom(15)
106107
.size(152, 14)
107108
.setMaxLength(11)
@@ -110,6 +111,7 @@ public ModularPanel buildUI(PosGuiData guiData, PanelSyncManager guiSyncManager)
110111
.child(IKey.lang("gregtech.creative.chest.tpc").asWidget()
111112
.marginBottom(2))
112113
.child(new TextFieldWidget()
114+
.left(2)
113115
.setTextAlignment(Alignment.CenterLeft)
114116
.size(152, 14)
115117
.setMaxLength(11)

src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityCreativeTank.java

Lines changed: 54 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
import gregtech.api.metatileentity.interfaces.IGregTechTileEntity;
1212
import gregtech.api.mui.GTGuis;
1313
import gregtech.api.util.GTUtility;
14+
import gregtech.api.util.LocalizationUtils;
1415
import gregtech.client.renderer.texture.Textures;
1516
import gregtech.client.renderer.texture.custom.QuantumStorageRenderer;
1617
import gregtech.client.utils.TooltipHelper;
@@ -34,9 +35,18 @@
3435
import codechicken.lib.render.pipeline.ColourMultiplier;
3536
import codechicken.lib.render.pipeline.IVertexOperation;
3637
import codechicken.lib.vec.Matrix4;
38+
import com.cleanroommc.modularui.api.drawable.IKey;
3739
import com.cleanroommc.modularui.factory.PosGuiData;
3840
import com.cleanroommc.modularui.screen.ModularPanel;
41+
import com.cleanroommc.modularui.utils.Alignment;
42+
import com.cleanroommc.modularui.value.sync.BooleanSyncValue;
43+
import com.cleanroommc.modularui.value.sync.FluidSlotSyncHandler;
44+
import com.cleanroommc.modularui.value.sync.IntSyncValue;
3945
import com.cleanroommc.modularui.value.sync.PanelSyncManager;
46+
import com.cleanroommc.modularui.widgets.FluidSlot;
47+
import com.cleanroommc.modularui.widgets.ToggleButton;
48+
import com.cleanroommc.modularui.widgets.layout.Column;
49+
import com.cleanroommc.modularui.widgets.textfield.TextFieldWidget;
4050
import org.apache.commons.lang3.ArrayUtils;
4151
import org.jetbrains.annotations.Nullable;
4252

@@ -84,7 +94,50 @@ public MetaTileEntity createMetaTileEntity(IGregTechTileEntity tileEntity) {
8494

8595
@Override
8696
public ModularPanel buildUI(PosGuiData guiData, PanelSyncManager guiSyncManager) {
87-
return GTGuis.createPanel(this, 176, 166);
97+
return GTGuis.createPanel(this, 176, 166)
98+
.child(IKey.lang("gregtech.creative.tank.fluid").asWidget()
99+
.pos(7, 9))
100+
// todo replace with our fluid slot
101+
.child(new FluidSlot()
102+
.syncHandler(new FluidSlotSyncHandler(this.fluidTank)
103+
.phantom(true)
104+
.controlsAmount(true))
105+
.pos(36, 6))
106+
.child(new Column()
107+
.pos(7, 28)
108+
.crossAxisAlignment(Alignment.CrossAxis.START)
109+
.coverChildren()
110+
.child(IKey.lang("gregtech.creative.tank.mbpc").asWidget()
111+
.marginBottom(2))
112+
.child(new TextFieldWidget()
113+
.left(2)
114+
.marginBottom(15)
115+
.size(154, 14)
116+
.setNumbers(1, Integer.MAX_VALUE)
117+
.setMaxLength(11)
118+
.value(new IntSyncValue(() -> mBPerCycle, value -> mBPerCycle = value)))
119+
.child(IKey.lang("gregtech.creative.tank.tpc").asWidget()
120+
.marginBottom(2))
121+
.child(new TextFieldWidget()
122+
.left(2)
123+
.size(154, 14)
124+
.setNumbers(1, Integer.MAX_VALUE)
125+
.setMaxLength(11)
126+
.value(new IntSyncValue(() -> ticksPerCycle, value -> ticksPerCycle = value))))
127+
.child(new ToggleButton()
128+
.disableHoverBackground()
129+
.pos(7, 101)
130+
.size(162, 20)
131+
.overlay(IKey.dynamic(() -> LocalizationUtils.format(
132+
active ? "gregtech.creative.activity.on" : "gregtech.creative.activity.off")))
133+
.value(new BooleanSyncValue(() -> active, value -> {
134+
active = value;
135+
scheduleRenderUpdate();
136+
var c = getQuantumController();
137+
if (c != null) c.updateHandler();
138+
})))
139+
.child(createConnectionButton()
140+
.top(6));
88141
}
89142

90143
@Override

0 commit comments

Comments
 (0)