Fixed key bindings not appearing in the settings screen and adjust the defaults for one-handed gameplay

This commit is contained in:
Sollace 2020-09-25 13:06:41 +02:00
parent cc0d661ae7
commit d9e92ff0ea
3 changed files with 11 additions and 15 deletions

View file

@ -19,15 +19,17 @@ public class KeyBindingsHandler {
public static final KeyBindingsHandler INSTANCE = new KeyBindingsHandler();
static void bootstrap() {}
private final Map<KeyBinding, AbilitySlot> keys = new HashMap<>();
private final Map<AbilitySlot, KeyBinding> reverse = new HashMap<>();
private final Set<KeyBinding> pressed = new HashSet<>();
public KeyBindingsHandler() {
addKeybind(GLFW.GLFW_KEY_O, AbilitySlot.PRIMARY);
addKeybind(GLFW.GLFW_KEY_P, AbilitySlot.SECONDARY);
addKeybind(GLFW.GLFW_KEY_L, AbilitySlot.TERTIARY);
addKeybind(GLFW.GLFW_KEY_R, AbilitySlot.PRIMARY);
addKeybind(GLFW.GLFW_KEY_F, AbilitySlot.SECONDARY);
addKeybind(GLFW.GLFW_KEY_C, AbilitySlot.TERTIARY);
}
public KeyBinding getBinding(AbilitySlot slot) {
@ -35,7 +37,7 @@ public class KeyBindingsHandler {
}
public void addKeybind(int code, AbilitySlot slot) {
KeyBinding binding = KeyBindingHelper.registerKeyBinding(new KeyBinding("key.unicopia" + slot.name().toLowerCase(), code, KEY_CATEGORY));
KeyBinding binding = KeyBindingHelper.registerKeyBinding(new KeyBinding("key.unicopia." + slot.name().toLowerCase(), code, KEY_CATEGORY));
reverse.put(slot, binding);
keys.put(binding, slot);
}

View file

@ -33,6 +33,7 @@ public class UnicopiaClient implements ClientModInitializer {
public void onInitializeClient() {
InteractionManager.INSTANCE = new ClientInteractionManager();
KeyBindingsHandler.bootstrap();
URenderers.bootstrap();
ClientTickEvents.END_CLIENT_TICK.register(this::onTick);

View file

@ -172,17 +172,10 @@
"unicopia.category.name": "Pony Abilities",
"unicopia.power.grow": "Primary Earth Pony ability",
"unicopia.power.earth": "Secondary Earth Pony ability",
"unicopia.power.teleport": "Primary Unicorn ability",
"unicopia.power.magic": "Secondary Unicorn ability",
"unicopia.power.cloud": "Primary Pegasus ability",
"unicopia.power.carry": "Pick up & Drop riders",
"unicopia.power.feed": "Primary Changeling ability",
"unicopia.power.disguise": "Secondary Changeling ability",
"key.unicopia.primary": "Primary Ability",
"key.unicopia.secondary": "Secondary Ability",
"key.unicopia.tertiary": "Tertiary Ability",
"key.unicopia.passive": "Passive Ability",
"death.attack.magical_exhaustion": "%1$s exhausted themselves",
"death.attack.alicorn_amulet": "%1$s was driven insane",