1
0
forked from Clones/Controlify

🐛 Make the reset button act as an unbind button. (close #120)

This commit is contained in:
isXander
2023-07-27 20:22:58 +01:00
parent 1df7925109
commit 276cdff132
3 changed files with 3 additions and 15 deletions

View File

@ -169,9 +169,9 @@ public class ControllerBindingImpl<T extends ControllerState> implements Control
@Override @Override
public Option.Builder<?> startYACLOption() { public Option.Builder<?> startYACLOption() {
Option.Builder<IBind<T>> option = Option.createBuilder((Class<IBind<T>>) (Class<?>) IBind.class) Option.Builder<IBind<T>> option = Option.<IBind<T>>createBuilder()
.name(name()) .name(name())
.binding(defaultBind(), this::currentBind, this::setCurrentBind) .binding(new EmptyBind<>(), this::currentBind, this::setCurrentBind)
.description(OptionDescription.of(this.description())); .description(OptionDescription.of(this.description()));
if (controller instanceof GamepadController gamepad) { if (controller instanceof GamepadController gamepad) {

View File

@ -65,8 +65,7 @@ public class ControllerBindings<T extends ControllerState> {
VMOUSE_SHIFT, VMOUSE_SHIFT,
VMOUSE_TOGGLE, VMOUSE_TOGGLE,
GUI_NAVI_UP, GUI_NAVI_DOWN, GUI_NAVI_LEFT, GUI_NAVI_RIGHT, GUI_NAVI_UP, GUI_NAVI_DOWN, GUI_NAVI_LEFT, GUI_NAVI_RIGHT,
CYCLE_OPT_FORWARD, CYCLE_OPT_BACKWARD, CYCLE_OPT_FORWARD, CYCLE_OPT_BACKWARD;
CLEAR_BINDING;
private final Map<ResourceLocation, ControllerBinding> registry = new LinkedHashMap<>(); private final Map<ResourceLocation, ControllerBinding> registry = new LinkedHashMap<>();
@ -397,12 +396,6 @@ public class ControllerBindings<T extends ControllerState> {
.category(GUI_CATEGORY) .category(GUI_CATEGORY)
.context(BindContexts.GUI) .context(BindContexts.GUI)
.build()); .build());
register(CLEAR_BINDING = ControllerBindingBuilder.create(controller)
.identifier("controlify", "clear_binding")
.defaultBind(GamepadBinds.RIGHT_STICK_PRESS)
.category(GUI_CATEGORY)
.context(BindContexts.CONTROLIFY_CONFIG)
.build());
for (var constructor : CUSTOM_BINDS.values()) { for (var constructor : CUSTOM_BINDS.values()) {
register(constructor.apply(this)); register(constructor.apply(this));

View File

@ -95,11 +95,6 @@ public abstract class AbstractBindController<T extends ControllerState> implemen
if (controller != control.controller) return true; if (controller != control.controller) return true;
if (!justTookInput && !awaitingControllerInput) { if (!justTookInput && !awaitingControllerInput) {
if (controller.bindings().CLEAR_BINDING.justPressed()) {
control.option().requestSet(new EmptyBind<>());
return true;
}
if (controller.bindings().GUI_PRESS.justPressed()) { if (controller.bindings().GUI_PRESS.justPressed()) {
ControllerBindHandler.setBindListener(this); ControllerBindHandler.setBindListener(this);
return awaitingControllerInput = true; return awaitingControllerInput = true;