Skip to content

Commit

Permalink
Keybinding 1.16 compile fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
modmuss50 committed Jun 12, 2020
1 parent 3fa9f7c commit e16a977
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public static KeyBinding registerKeyBinding(KeyBinding keyBinding) {
* @param keyBinding the keybinding
* @return configured KeyCode
*/
public static InputUtil.KeyCode getBoundKeyOf(KeyBinding keyBinding) {
return ((KeyCodeAccessor) keyBinding).getKeyCode();
public static InputUtil.Key getBoundKeyOf(KeyBinding keyBinding) {
return ((KeyCodeAccessor) keyBinding).getBoundKey();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ public static KeyBinding registerKeyBinding(KeyBinding binding) {
for (KeyBinding existingKeyBindings : moddedKeyBindings) {
if (existingKeyBindings == binding) {
throw null;
} else if (existingKeyBindings.getId().equals(binding.getId())) {
throw new RuntimeException("Attempted to register two key bindings with equal ID: " + binding.getId() + "!");
} else if (existingKeyBindings.getTranslationKey().equals(binding.getTranslationKey())) {
throw new RuntimeException("Attempted to register two key bindings with equal ID: " + binding.getTranslationKey() + "!");
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,15 @@ public void onInitializeClient() {

ClientTickCallback.EVENT.register(client -> {
while (binding1.wasPressed()) {
client.player.sendMessage(new LiteralText("Key 1 was pressed!"));
client.player.sendMessage(new LiteralText("Key 1 was pressed!"), false);
}

while (binding2.wasPressed()) {
client.player.sendMessage(new LiteralText("Key 2 was pressed!"));
client.player.sendMessage(new LiteralText("Key 2 was pressed!"), false);
}

if (stickyBinding.isPressed()) {
client.player.sendMessage(new LiteralText("Sticky Key was pressed!"));
client.player.sendMessage(new LiteralText("Sticky Key was pressed!"), false);
}
});
}
Expand Down

0 comments on commit e16a977

Please sign in to comment.