|
6 | 6 | import gregtech.api.capability.impl.FluidTankList; |
7 | 7 | import gregtech.api.capability.impl.ItemHandlerList; |
8 | 8 | 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; |
12 | 9 | import gregtech.api.items.itemhandlers.GTItemStackHandler; |
13 | 10 | import gregtech.api.metatileentity.IDataInfoProvider; |
14 | 11 | import gregtech.api.metatileentity.MetaTileEntity; |
|
57 | 54 | import codechicken.lib.render.pipeline.IVertexOperation; |
58 | 55 | import codechicken.lib.vec.Matrix4; |
59 | 56 | import com.cleanroommc.modularui.api.drawable.IKey; |
| 57 | +import com.cleanroommc.modularui.api.widget.Interactable; |
60 | 58 | import com.cleanroommc.modularui.value.sync.IntSyncValue; |
61 | 59 | import com.cleanroommc.modularui.widgets.CycleButtonWidget; |
62 | 60 | import com.google.common.collect.Lists; |
@@ -239,17 +237,25 @@ protected MultiblockUIFactory createUIFactory() { |
239 | 237 | .createFlexButton((posGuiData, panelSyncManager) -> { |
240 | 238 | IntSyncValue buttonSync = new IntSyncValue(this::getCurrentMode, this::setCurrentMode); |
241 | 239 |
|
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 | + } |
243 | 252 | .stateCount(4) |
244 | 253 | .value(buttonSync) |
| 254 | + .stateBackground(GTGuiTextures.BUTTON_MINER_MODES) |
245 | 255 | .addTooltip(0, IKey.lang("gregtech.multiblock.miner.neither_mode")) |
246 | 256 | .addTooltip(1, IKey.lang("gregtech.multiblock.miner.chunk_mode")) |
247 | 257 | .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")); |
253 | 259 | }); |
254 | 260 | } |
255 | 261 |
|
@@ -423,18 +429,6 @@ private void setCurrentMode(int mode) { |
423 | 429 | } |
424 | 430 | } |
425 | 431 |
|
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 | | - |
438 | 432 | @Override |
439 | 433 | public boolean onScrewdriverClick(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, |
440 | 434 | CuboidRayTraceResult hitResult) { |
|
0 commit comments