Skip to content

Commit

Permalink
display area selection keybind on HUD component (closes #77)
Browse files Browse the repository at this point in the history
  • Loading branch information
gliscowo committed Nov 29, 2023
1 parent 502a06e commit 1fe37ec
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public class IsometricRenders implements ClientModInitializer {
public static boolean skipWorldRender = false;
public static boolean centerNextTooltip = false;

private static final KeyBinding SELECT = new KeyBinding("key.isometric-renders.area_select", GLFW.GLFW_KEY_C, KeyBinding.MISC_CATEGORY);
public static final KeyBinding SELECT = new KeyBinding("key.isometric-renders.area_select", GLFW.GLFW_KEY_C, KeyBinding.MISC_CATEGORY);

@Override
public void onInitializeClient() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
package com.glisco.isometricrenders.widget;

import com.glisco.isometricrenders.IsometricRenders;
import com.glisco.isometricrenders.util.Translate;
import io.wispforest.owo.ui.component.Components;
import io.wispforest.owo.ui.container.FlowLayout;
import io.wispforest.owo.ui.core.Insets;
import io.wispforest.owo.ui.core.Sizing;
import io.wispforest.owo.ui.core.Surface;
import net.fabricmc.fabric.api.client.keybinding.v1.KeyBindingHelper;
import net.minecraft.client.MinecraftClient;
import net.minecraft.text.Text;
import net.minecraft.util.math.BlockPos;
Expand Down Expand Up @@ -35,7 +37,7 @@ public AreaSelectionComponent() {
.shadow(false).margins(Insets.bottom(10))
);

this.child(Components.label(Translate.gui("hud.area_selection.clear_hint")));
this.child(Components.label(Translate.gui("hud.area_selection.clear_hint", KeyBindingHelper.getBoundKeyOf(IsometricRenders.SELECT).getLocalizedText())));
}

private static Supplier<Text> positionText(Supplier<BlockPos> pos, String name) {
Expand Down
4 changes: 3 additions & 1 deletion src/main/resources/assets/isometric-renders/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,9 @@
{"index": 0, "color": "gray"}
],
"gui.isometric-renders.hud.area_selection.clear_hint": [
{"text": "Clear by sneak-clicking", "color": "gray"}
{"text": "To clear, press ", "color": "gray"},
{"index": 0, "color": "yellow"},
" while sneaking"
],

"gui.isometric-renders.click_to_open": [
Expand Down

0 comments on commit 1fe37ec

Please sign in to comment.