aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gregtech/api/interfaces/modularui
diff options
context:
space:
mode:
authorGlease <4586901+Glease@users.noreply.github.com>2023-07-30 20:26:53 +0800
committerGitHub <noreply@github.com>2023-07-30 14:26:53 +0200
commitf983308b936c54f3331424b0d6d51d8a3b11f415 (patch)
treeeabcbe297913884a7acc2997d7464d5fb355d2f2 /src/main/java/gregtech/api/interfaces/modularui
parent9812da7aabe91ce96d9ece08f792912aa7d1882c (diff)
downloadGT5-Unofficial-f983308b936c54f3331424b0d6d51d8a3b11f415.tar.gz
GT5-Unofficial-f983308b936c54f3331424b0d6d51d8a3b11f415.tar.bz2
GT5-Unofficial-f983308b936c54f3331424b0d6d51d8a3b11f415.zip
enable subclass to allow less voiding mode being set (#2191)
* enable subclass to allow less voiding mode being set * fix bug * rename
Diffstat (limited to 'src/main/java/gregtech/api/interfaces/modularui')
-rw-r--r--src/main/java/gregtech/api/interfaces/modularui/ControllerWithOptionalFeatures.java6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/main/java/gregtech/api/interfaces/modularui/ControllerWithOptionalFeatures.java b/src/main/java/gregtech/api/interfaces/modularui/ControllerWithOptionalFeatures.java
index 3d4ed80f67..22694cdafd 100644
--- a/src/main/java/gregtech/api/interfaces/modularui/ControllerWithOptionalFeatures.java
+++ b/src/main/java/gregtech/api/interfaces/modularui/ControllerWithOptionalFeatures.java
@@ -6,6 +6,7 @@ import static gregtech.api.metatileentity.BaseTileEntity.TOOLTIP_DELAY;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
+import java.util.Set;
import net.minecraft.util.StatCollector;
@@ -80,9 +81,10 @@ public interface ControllerWithOptionalFeatures extends IVoidable, IRecipeLockab
default ButtonWidget createVoidExcessButton(IWidgetBuilder<?> builder) {
Widget button = new ButtonWidget().setOnClick((clickData, widget) -> {
if (supportsVoidProtection()) {
+ Set<VoidingMode> allowed = getAllowedVoidingModes();
switch (clickData.mouseButton) {
- case 0 -> setVoidingMode(getVoidingMode().next());
- case 1 -> setVoidingMode(getVoidingMode().previous());
+ case 0 -> setVoidingMode(getVoidingMode().nextInCollection(allowed));
+ case 1 -> setVoidingMode(getVoidingMode().previousInCollection(allowed));
}
widget.notifyTooltipChange();
}