1
mirror of https://github.com/Shiewk/Widgets.git synced 2026-04-28 11:34:17 +02:00

Allow changing RGBAColorWidgetSetting with arrow keys

This commit is contained in:
Shy
2025-11-24 19:41:17 +01:00
parent 5910e5581f
commit 3e044078d6
@@ -12,6 +12,7 @@ import net.minecraft.client.gui.cursor.StandardCursors;
import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.gui.screen.narration.NarrationMessageBuilder; import net.minecraft.client.gui.screen.narration.NarrationMessageBuilder;
import net.minecraft.client.gui.widget.ClickableWidget; import net.minecraft.client.gui.widget.ClickableWidget;
import net.minecraft.client.input.KeyInput;
import net.minecraft.sound.SoundEvents; import net.minecraft.sound.SoundEvents;
import net.minecraft.text.Text; import net.minecraft.text.Text;
import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.MathHelper;
@@ -305,6 +306,19 @@ public class RGBAColorWidgetSetting extends WidgetSettingOption {
}; };
} }
@Override
public boolean keyPressed(KeyInput input) {
if (input.isUp()) {
setValue(getValue() + 1);
return true;
} else if (input.isDown()) {
setValue(getValue() - 1);
return true;
} else {
return super.keyPressed(input);
}
}
private int bottomColor() { private int bottomColor() {
return RGBAColorWidgetSetting.this.getColor() & ~componentMask(); return RGBAColorWidgetSetting.this.getColor() & ~componentMask();
} }