Skip to content

Commit

Permalink
Fix keybind not being configurable in menu
Browse files Browse the repository at this point in the history
  • Loading branch information
Tenzin Pelletier committed Jan 12, 2022
1 parent b10bbd1 commit b20fb42
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 6 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ org.gradle.jvmargs=-Xmx1G
loader_version=0.12.12

# Mod Properties
mod_version = 2.0.0-b2
mod_version = 2.0.1-b1
maven_group = com.t2pellet
archives_base_name = teams

Expand Down
10 changes: 7 additions & 3 deletions src/main/java/com/t2pellet/teams/client/TeamsKeys.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,19 @@ public interface OnPress {
}

private TeamsKey(String keyName, int keyBind, OnPress action) {
keyBinding = KeyBindingHelper.registerKeyBinding(new KeyBinding(
keyBinding = new KeyBinding(
keyName,
InputUtil.Type.KEYSYM,
keyBind,
"category.teams"
));
"key.category.teams"
);
onPress = action;
}

public void register() {
KeyBindingHelper.registerKeyBinding(keyBinding);
}

public String getLocalizedName() {
return keyBinding.getBoundKeyLocalizedText().asString();
}
Expand Down
6 changes: 5 additions & 1 deletion src/main/java/com/t2pellet/teams/client/TeamsModClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,11 @@ public void onInitializeClient() {
status.render(matrixStack);
compass.render(matrixStack);
});
// Register Keybinds
// Register keybinds
for (TeamsKeys.TeamsKey key : TeamsKeys.KEYS) {
key.register();
}
// Handle keybinds
ClientTickEvents.END_CLIENT_TICK.register(client -> {
for (var key : TeamsKeys.KEYS) {
if (key.keyBinding.wasPressed()) {
Expand Down
6 changes: 5 additions & 1 deletion src/main/resources/assets/teams/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,9 @@
"teams.menu.create.text": "Create Team",
"teams.menu.create": "Create a Team",
"teams.menu.lonely.title": "Teams Menu",
"teams.menu.lonely.alone": "No other teams are online right now :("
"teams.menu.lonely.alone": "No other teams are online right now :(",
"key.teams.accept": "Accept Team",
"key.teams.reject": "Reject Team",
"key.teams.toggle_hud": "Toggle HUD",
"key.category.teams": "Teams"
}

0 comments on commit b20fb42

Please sign in to comment.