Skip to content

Commit c2a2da9

Browse files
committed
creative chest mostly done
1 parent 87998d3 commit c2a2da9

2 files changed

Lines changed: 33 additions & 28 deletions

File tree

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

Lines changed: 27 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
import gregtech.api.mui.GTGuis;
1414
import gregtech.api.util.GTTransferUtils;
1515
import gregtech.api.util.GTUtility;
16+
import gregtech.api.util.LocalizationUtils;
1617
import gregtech.client.renderer.texture.Textures;
1718
import gregtech.client.renderer.texture.custom.QuantumStorageRenderer;
1819
import gregtech.client.utils.TooltipHelper;
@@ -36,12 +37,14 @@
3637
import com.cleanroommc.modularui.api.drawable.IKey;
3738
import com.cleanroommc.modularui.factory.PosGuiData;
3839
import com.cleanroommc.modularui.screen.ModularPanel;
40+
import com.cleanroommc.modularui.utils.Alignment;
3941
import com.cleanroommc.modularui.value.sync.BooleanSyncValue;
4042
import com.cleanroommc.modularui.value.sync.IntSyncValue;
4143
import com.cleanroommc.modularui.value.sync.PanelSyncManager;
4244
import com.cleanroommc.modularui.value.sync.SyncHandlers;
4345
import com.cleanroommc.modularui.widgets.ItemSlot;
4446
import com.cleanroommc.modularui.widgets.ToggleButton;
47+
import com.cleanroommc.modularui.widgets.layout.Column;
4548
import com.cleanroommc.modularui.widgets.textfield.TextFieldWidget;
4649
import org.apache.commons.lang3.ArrayUtils;
4750
import org.jetbrains.annotations.NotNull;
@@ -92,34 +95,32 @@ public ModularPanel buildUI(PosGuiData guiData, PanelSyncManager guiSyncManager)
9295
return GTGuis.createPanel(this, 176, 166)
9396
.child(IKey.lang("gregtech.creative.chest.item").asWidget()
9497
.pos(7, 9))
95-
// .child(GTGuiTextures.DISPLAY.asWidget()
96-
// .pos(7, 48)
97-
// .size(154, 14))
98-
.child(new TextFieldWidget()
99-
.pos(7, 50)
100-
.size(152, 10)
101-
.setMaxLength(11)
102-
.setNumbers(1, Integer.MAX_VALUE)
103-
.value(new IntSyncValue(() -> itemsPerCycle, value -> itemsPerCycle = value)))
104-
.child(IKey.lang("gregtech.creative.chest.ipc").asWidget()
105-
.pos(7, 28))
106-
// .child(GTGuiTextures.DISPLAY.asWidget()
107-
// .pos(7, 85)
108-
// .size(154, 14))
109-
.child(new TextFieldWidget()
110-
.pos(7, 85)
111-
.size(152, 10)
112-
.setMaxLength(11)
113-
.setNumbers(1, Integer.MAX_VALUE)
114-
.value(new IntSyncValue(() -> ticksPerCycle, value -> ticksPerCycle = value)))
115-
.child(IKey.lang("gregtech.creative.chest.tpc").asWidget()
116-
.pos(7, 65))
98+
.child(new Column()
99+
.pos(7, 28)
100+
.coverChildren()
101+
.crossAxisAlignment(Alignment.CrossAxis.START)
102+
.child(IKey.lang("gregtech.creative.chest.ipc").asWidget()
103+
.marginBottom(2))
104+
.child(new TextFieldWidget()
105+
.marginBottom(15)
106+
.size(152, 14)
107+
.setMaxLength(11)
108+
.setNumbers(1, Integer.MAX_VALUE)
109+
.value(new IntSyncValue(() -> itemsPerCycle, value -> itemsPerCycle = value)))
110+
.child(IKey.lang("gregtech.creative.chest.tpc").asWidget()
111+
.marginBottom(2))
112+
.child(new TextFieldWidget()
113+
.setTextAlignment(Alignment.CenterLeft)
114+
.size(152, 14)
115+
.setMaxLength(11)
116+
.setNumbers(1, Integer.MAX_VALUE)
117+
.value(new IntSyncValue(() -> ticksPerCycle, value -> ticksPerCycle = value))))
117118
.child(new ToggleButton()
118119
.pos(7, 101)
119120
.size(162, 20)
120-
.overlay(IKey.dynamic(() -> IKey
121-
.lang(active ? "gregtech.creative.activity.on" : "gregtech.creative.activity.off")
122-
.get()))
121+
.overlay(IKey.dynamic(() -> LocalizationUtils.format(active ?
122+
"gregtech.creative.activity.on" :
123+
"gregtech.creative.activity.off")))
123124
.value(new BooleanSyncValue(() -> active, value -> {
124125
active = value;
125126
scheduleRenderUpdate();
@@ -130,7 +131,7 @@ public ModularPanel buildUI(PosGuiData guiData, PanelSyncManager guiSyncManager)
130131
.slot(SyncHandlers.phantomItemSlot(handler, 0)
131132
.changeListener((newItem, onlyAmountChanged, client, init) -> markDirty()))
132133
.pos(36, 6))
133-
.child(createConnectedGui()
134+
.child(createConnectionButton()
134135
.top(7));
135136
}
136137

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ public abstract class MetaTileEntityQuantumStorage<T> extends MetaTileEntity imp
7272
protected static final String INPUT_FROM_OUTPUT = "AllowInputFromOutputSide";
7373
protected static final String INPUT_FROM_OUTPUT_FLUID = "AllowInputFromOutputSideF";
7474

75+
@Deprecated
7576
private ClickButtonWidget connectedIcon;
7677
protected EnumFacing outputFacing;
7778
protected boolean voiding = false;
@@ -416,7 +417,7 @@ else if (data.hasKey(INPUT_FROM_OUTPUT_FLUID))
416417
}
417418
}
418419

419-
protected ButtonWidget<?> createConnectedGui() {
420+
protected ButtonWidget<?> createConnectionButton() {
420421
return new ButtonWidget<>()
421422
.left(151)
422423
.disableHoverBackground()
@@ -430,7 +431,9 @@ protected ButtonWidget<?> createConnectedGui() {
430431
.tooltip(tooltip -> tooltip.setAutoUpdate(true))
431432
.tooltipBuilder(tooltip -> {
432433
if (isConnected()) {
433-
tooltip.addLine(IKey.lang("gregtech.machine.quantum_storage.connected"));
434+
var pos = getControllerPos();
435+
tooltip.addLine(IKey.lang("gregtech.machine.quantum_storage.connected", pos.getX(), pos.getY(),
436+
pos.getZ()));
434437
} else {
435438
tooltip.addLine(IKey.lang("gregtech.machine.quantum_storage.disconnected"));
436439
}
@@ -439,6 +442,7 @@ protected ButtonWidget<?> createConnectedGui() {
439442
() -> isConnected() ? GTGuiTextures.GREGTECH_LOGO : GTGuiTextures.GREGTECH_LOGO_DARK));
440443
}
441444

445+
@Deprecated
442446
protected ClickButtonWidget createConnectedGui(int y) {
443447
connectedIcon = new ClickButtonWidget(151, y, 18, 18, "",
444448
clickData -> {

0 commit comments

Comments
 (0)