Skip to content

Commit

Permalink
Fix axes not working when rebound (close #274)
Browse files Browse the repository at this point in the history
  • Loading branch information
isXander committed Apr 10, 2024
1 parent 538e0da commit e3cb0d3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -610,14 +610,14 @@ public boolean fromJson(JsonObject json) {
boolean clean = true;
for (var binding : registry().values()) {
if (!json.has(binding.id().toString())) {
CUtil.LOGGER.warn("Missing binding: " + binding.id() + " in config file. Skipping!");
CUtil.LOGGER.warn("Missing binding: {} in config file. Skipping!", binding.id());
clean = false;
continue;
}

var bind = json.get(binding.id().toString()).getAsJsonObject();
if (bind == null) {
CUtil.LOGGER.warn("Unknown binding: " + binding.id() + " in config file. Skipping!");
CUtil.LOGGER.warn("Unknown binding: {} in config file. Skipping!", binding.id());
clean = false;
continue;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package dev.isxander.controlify.gui.controllers;

import dev.isxander.controlify.bindings.AxisBind;
import dev.isxander.controlify.bindings.ButtonBind;
import dev.isxander.controlify.bindings.HatBind;
import dev.isxander.controlify.bindings.IBind;
Expand Down Expand Up @@ -143,7 +144,7 @@ public Optional<IBind> getPressedBind() {

for (ResourceLocation axis : state.getAxes()) {
if (state.getAxisState(axis) > 0.5f && prevState.getAxisState(axis) <= 0.5f) {
return Optional.of(new ButtonBind(axis));
return Optional.of(new AxisBind(axis));
}
}

Expand Down

0 comments on commit e3cb0d3

Please sign in to comment.