Skip to content

Commit

Permalink
Finish off the large miner.
Browse files Browse the repository at this point in the history
Prevent the mode button from being pressed while active.
Revert flex button texture split.
  • Loading branch information
Zorbatron committed Feb 4, 2025
1 parent 84431a1 commit 041ea73
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 23 deletions.
3 changes: 1 addition & 2 deletions src/main/java/gregtech/api/mui/GTGuiTextures.java
Original file line number Diff line number Diff line change
Expand Up @@ -427,8 +427,7 @@ public static class IDs {
"textures/gui/widget/button_no_distinct_buses.png", true);
public static final UITexture BUTTON_NO_FLEX = fullImage("textures/gui/widget/button_no_flex.png", true);
public static final UITexture BUTTON_MULTI_MAP = fullImage("textures/gui/widget/button_multi_map.png", true);
public static final UITexture[] BUTTON_MINER_MODES = slice("textures/gui/widget/button_miner_modes.png", 18, 72, 18,
18, true);
public static final UITexture BUTTON_MINER_MODES = fullImage("textures/gui/widget/button_miner_modes.png", true);
public static final UITexture BUTTON_THROTTLE_MINUS = fullImage("textures/gui/widget/button_throttle_minus.png",
true); // TODO new texture
public static final UITexture BUTTON_THROTTLE_PLUS = fullImage("textures/gui/widget/button_throttle_plus.png",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@
import gregtech.api.capability.impl.FluidTankList;
import gregtech.api.capability.impl.ItemHandlerList;
import gregtech.api.capability.impl.miner.MultiblockMinerLogic;
import gregtech.api.gui.GuiTextures;
import gregtech.api.gui.Widget;
import gregtech.api.gui.widgets.ImageCycleButtonWidget;
import gregtech.api.items.itemhandlers.GTItemStackHandler;
import gregtech.api.metatileentity.IDataInfoProvider;
import gregtech.api.metatileentity.MetaTileEntity;
Expand Down Expand Up @@ -57,6 +54,7 @@
import codechicken.lib.render.pipeline.IVertexOperation;
import codechicken.lib.vec.Matrix4;
import com.cleanroommc.modularui.api.drawable.IKey;
import com.cleanroommc.modularui.api.widget.Interactable;
import com.cleanroommc.modularui.value.sync.IntSyncValue;
import com.cleanroommc.modularui.widgets.CycleButtonWidget;
import com.google.common.collect.Lists;
Expand Down Expand Up @@ -239,17 +237,25 @@ protected MultiblockUIFactory createUIFactory() {
.createFlexButton((posGuiData, panelSyncManager) -> {
IntSyncValue buttonSync = new IntSyncValue(this::getCurrentMode, this::setCurrentMode);

return new CycleButtonWidget()
return new CycleButtonWidget() {

@Override
public @NotNull Result onMousePressed(int mouseButton) {
if (minerLogic.isWorking()) {
Interactable.playButtonClickSound();
return Result.IGNORE;
} else {
return super.onMousePressed(mouseButton);
}
}
}
.stateCount(4)
.value(buttonSync)
.stateBackground(GTGuiTextures.BUTTON_MINER_MODES)
.addTooltip(0, IKey.lang("gregtech.multiblock.miner.neither_mode"))
.addTooltip(1, IKey.lang("gregtech.multiblock.miner.chunk_mode"))
.addTooltip(2, IKey.lang("gregtech.multiblock.miner.silk_touch_mode"))
.addTooltip(3, IKey.lang("gregtech.multiblock.miner.both_modes"))
.stateBackground(0, GTGuiTextures.BUTTON_MINER_MODES[0])
.stateBackground(1, GTGuiTextures.BUTTON_MINER_MODES[1])
.stateBackground(2, GTGuiTextures.BUTTON_MINER_MODES[2])
.stateBackground(3, GTGuiTextures.BUTTON_MINER_MODES[3]);
.addTooltip(3, IKey.lang("gregtech.multiblock.miner.both_modes"));
});
}

Expand Down Expand Up @@ -423,18 +429,6 @@ private void setCurrentMode(int mode) {
}
}

@Override
protected @NotNull Widget getFlexButton(int x, int y, int width, int height) {
return new ImageCycleButtonWidget(x, y, width, height, GuiTextures.BUTTON_MINER_MODES, 4, this::getCurrentMode,
this::setCurrentMode)
.setTooltipHoverString(mode -> switch (mode) {
case 0 -> "gregtech.multiblock.miner.neither_mode";
case 1 -> "gregtech.multiblock.miner.chunk_mode";
case 2 -> "gregtech.multiblock.miner.silk_touch_mode";
default -> "gregtech.multiblock.miner.both_modes";
});
}

@Override
public boolean onScrewdriverClick(EntityPlayer playerIn, EnumHand hand, EnumFacing facing,
CuboidRayTraceResult hitResult) {
Expand Down

0 comments on commit 041ea73

Please sign in to comment.