Skip to content

Commit 041ea73

Browse files
committed
Finish off the large miner.
Prevent the mode button from being pressed while active. Revert flex button texture split.
1 parent 84431a1 commit 041ea73

File tree

2 files changed

+16
-23
lines changed

2 files changed

+16
-23
lines changed

src/main/java/gregtech/api/mui/GTGuiTextures.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -427,8 +427,7 @@ public static class IDs {
427427
"textures/gui/widget/button_no_distinct_buses.png", true);
428428
public static final UITexture BUTTON_NO_FLEX = fullImage("textures/gui/widget/button_no_flex.png", true);
429429
public static final UITexture BUTTON_MULTI_MAP = fullImage("textures/gui/widget/button_multi_map.png", true);
430-
public static final UITexture[] BUTTON_MINER_MODES = slice("textures/gui/widget/button_miner_modes.png", 18, 72, 18,
431-
18, true);
430+
public static final UITexture BUTTON_MINER_MODES = fullImage("textures/gui/widget/button_miner_modes.png", true);
432431
public static final UITexture BUTTON_THROTTLE_MINUS = fullImage("textures/gui/widget/button_throttle_minus.png",
433432
true); // TODO new texture
434433
public static final UITexture BUTTON_THROTTLE_PLUS = fullImage("textures/gui/widget/button_throttle_plus.png",

src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityLargeMiner.java

Lines changed: 15 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,6 @@
66
import gregtech.api.capability.impl.FluidTankList;
77
import gregtech.api.capability.impl.ItemHandlerList;
88
import gregtech.api.capability.impl.miner.MultiblockMinerLogic;
9-
import gregtech.api.gui.GuiTextures;
10-
import gregtech.api.gui.Widget;
11-
import gregtech.api.gui.widgets.ImageCycleButtonWidget;
129
import gregtech.api.items.itemhandlers.GTItemStackHandler;
1310
import gregtech.api.metatileentity.IDataInfoProvider;
1411
import gregtech.api.metatileentity.MetaTileEntity;
@@ -57,6 +54,7 @@
5754
import codechicken.lib.render.pipeline.IVertexOperation;
5855
import codechicken.lib.vec.Matrix4;
5956
import com.cleanroommc.modularui.api.drawable.IKey;
57+
import com.cleanroommc.modularui.api.widget.Interactable;
6058
import com.cleanroommc.modularui.value.sync.IntSyncValue;
6159
import com.cleanroommc.modularui.widgets.CycleButtonWidget;
6260
import com.google.common.collect.Lists;
@@ -239,17 +237,25 @@ protected MultiblockUIFactory createUIFactory() {
239237
.createFlexButton((posGuiData, panelSyncManager) -> {
240238
IntSyncValue buttonSync = new IntSyncValue(this::getCurrentMode, this::setCurrentMode);
241239

242-
return new CycleButtonWidget()
240+
return new CycleButtonWidget() {
241+
242+
@Override
243+
public @NotNull Result onMousePressed(int mouseButton) {
244+
if (minerLogic.isWorking()) {
245+
Interactable.playButtonClickSound();
246+
return Result.IGNORE;
247+
} else {
248+
return super.onMousePressed(mouseButton);
249+
}
250+
}
251+
}
243252
.stateCount(4)
244253
.value(buttonSync)
254+
.stateBackground(GTGuiTextures.BUTTON_MINER_MODES)
245255
.addTooltip(0, IKey.lang("gregtech.multiblock.miner.neither_mode"))
246256
.addTooltip(1, IKey.lang("gregtech.multiblock.miner.chunk_mode"))
247257
.addTooltip(2, IKey.lang("gregtech.multiblock.miner.silk_touch_mode"))
248-
.addTooltip(3, IKey.lang("gregtech.multiblock.miner.both_modes"))
249-
.stateBackground(0, GTGuiTextures.BUTTON_MINER_MODES[0])
250-
.stateBackground(1, GTGuiTextures.BUTTON_MINER_MODES[1])
251-
.stateBackground(2, GTGuiTextures.BUTTON_MINER_MODES[2])
252-
.stateBackground(3, GTGuiTextures.BUTTON_MINER_MODES[3]);
258+
.addTooltip(3, IKey.lang("gregtech.multiblock.miner.both_modes"));
253259
});
254260
}
255261

@@ -423,18 +429,6 @@ private void setCurrentMode(int mode) {
423429
}
424430
}
425431

426-
@Override
427-
protected @NotNull Widget getFlexButton(int x, int y, int width, int height) {
428-
return new ImageCycleButtonWidget(x, y, width, height, GuiTextures.BUTTON_MINER_MODES, 4, this::getCurrentMode,
429-
this::setCurrentMode)
430-
.setTooltipHoverString(mode -> switch (mode) {
431-
case 0 -> "gregtech.multiblock.miner.neither_mode";
432-
case 1 -> "gregtech.multiblock.miner.chunk_mode";
433-
case 2 -> "gregtech.multiblock.miner.silk_touch_mode";
434-
default -> "gregtech.multiblock.miner.both_modes";
435-
});
436-
}
437-
438432
@Override
439433
public boolean onScrewdriverClick(EntityPlayer playerIn, EnumHand hand, EnumFacing facing,
440434
CuboidRayTraceResult hitResult) {

0 commit comments

Comments
 (0)