Skip to content

Commit

Permalink
feat: add keybind to inform users about the jutsu menu being missing
Browse files Browse the repository at this point in the history
  • Loading branch information
sekwah41 committed Sep 11, 2022
1 parent e0567ea commit 1e34e22
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ public class NarutoKeyHandler {
private static KeyBindingTickHeld JUTSU_V_KEY;
private static KeyBindingTickHeld JUTSU_B_KEY;

private static KeyBindingTickHeld JUTSU_MENU_KEY;

/**
* Attached on the main NarutoMod file to the mod bus as this isn't a forge bus event
* @param event
Expand All @@ -64,11 +66,13 @@ public static void registerKeyBinds(RegisterKeyMappingsEvent event) {
JUTSU_C_KEY = registerKeyBind("naruto.keys.key1", KeyEvent.VK_C, event);
JUTSU_V_KEY = registerKeyBind("naruto.keys.key2", KeyEvent.VK_V, event);
JUTSU_B_KEY = registerKeyBind("naruto.keys.key3", KeyEvent.VK_B, event);
JUTSU_MENU_KEY = registerKeyBind("naruto.keys.jutsu_menu", KeyEvent.VK_J, event);

JUTSU_KEYS.add(LEAP_KEY);
JUTSU_KEYS.add(JUTSU_C_KEY);
JUTSU_KEYS.add(JUTSU_V_KEY);
JUTSU_KEYS.add(JUTSU_B_KEY);
JUTSU_KEYS.add(JUTSU_MENU_KEY);

LEAP_KEY.registerClickConsumer( () -> {
Minecraft mc = Minecraft.getInstance();
Expand All @@ -77,6 +81,13 @@ public static void registerKeyBinds(RegisterKeyMappingsEvent event) {
}
});

JUTSU_MENU_KEY.registerClickConsumer( () -> {
Minecraft mc = Minecraft.getInstance();
if(mc.player != null ) {
mc.player.displayClientMessage(Component.translatable("naruto.gui.jutsu.placeholder"), true);
}
});

JUTSU_C_KEY.registerClickConsumer(() -> handleJustuKey(1));
JUTSU_V_KEY.registerClickConsumer(() -> handleJustuKey(2));
JUTSU_B_KEY.registerClickConsumer(() -> handleJustuKey(3));
Expand Down Expand Up @@ -189,7 +200,7 @@ private static void checkNonCharging() {
if(mc.player != null ) {
LOGGER.debug("Casting jutsu {}", currentJutsuCombo);
if(!NarutoAbilities.triggerAbility(currentJutsuCombo)) {
mc.player.displayClientMessage((Component.translatable("jutsu.error.notfound", currentJutsuCombo)).withStyle(ChatFormatting.RED), false);
mc.player.displayClientMessage((Component.translatable("jutsu.error.notfound", currentJutsuCombo)).withStyle(ChatFormatting.RED), true);
} else {
//mc.player.sendMessage(Component.translatable("trying.jutsu", currentJutsuCombo), true);
}
Expand Down
4 changes: 3 additions & 1 deletion src/main/resources/assets/narutomod/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -98,5 +98,7 @@
"naruto.keys.key3": "Jutsu Key 3",
"naruto.keys.leap": "Leap",
"narutomod:substitution": "Substitution",
"narutomod:substitution.mark": "Substitution - Location Marked"
"narutomod:substitution.mark": "Substitution - Location Marked",
"naruto.gui.jutsu.placeholder": "Please type '/jutsu list'. We will be adding a new menu soon.",
"naruto.keys.jutsu_menu": "Jutsu Menu (Coming Soonish)"
}

0 comments on commit 1e34e22

Please sign in to comment.