Skip to content

Commit c862d5a

Browse files
committed
Add descriptions to most key bindings
1 parent e732c6e commit c862d5a

File tree

2 files changed

+25
-10
lines changed

2 files changed

+25
-10
lines changed

src/main/java/de/siphalor/mousewheelie/client/keybinding/OpenConfigScreenKeybinding.java

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -38,17 +38,24 @@ public OpenConfigScreenKeybinding(Identifier id, InputUtil.Type type, int code,
3838
@Override
3939
public boolean onPressedPriority() {
4040
MinecraftClient minecraftClient = MinecraftClient.getInstance();
41-
if (minecraftClient.currentScreen == null || minecraftClient.currentScreen instanceof HandledScreen || minecraftClient.currentScreen instanceof TitleScreen) {
42-
TweedRegistry.TAILORS.getOrEmpty(new Identifier("tweed4", "coat")).ifPresent(tailor -> {
43-
if (tailor instanceof CoatTailor) {
44-
ScreenTailorScreenFactory<?> screenFactory = ((CoatTailor) tailor).getScreenFactories().get(MouseWheelie.MOD_ID);
45-
if (screenFactory != null) {
46-
minecraftClient.openScreen(screenFactory.create(minecraftClient.currentScreen));
47-
}
48-
}
49-
});
50-
return true;
41+
if (canOpen(minecraftClient)) {
42+
ScreenTailorScreenFactory<?> screenFactory = getScreenFactory();
43+
if (screenFactory != null) {
44+
minecraftClient.openScreen(screenFactory.create(minecraftClient.currentScreen));
45+
return true;
46+
}
5147
}
5248
return false;
5349
}
50+
51+
private boolean canOpen(MinecraftClient minecraftClient) {
52+
return minecraftClient.currentScreen == null || minecraftClient.currentScreen instanceof HandledScreen || minecraftClient.currentScreen instanceof TitleScreen;
53+
}
54+
55+
private ScreenTailorScreenFactory<?> getScreenFactory() {
56+
return TweedRegistry.TAILORS.getOrEmpty(new Identifier("tweed4", "coat"))
57+
.filter(tailor -> tailor instanceof CoatTailor)
58+
.map(tailor -> ((CoatTailor) tailor).getScreenFactories().get(MouseWheelie.MOD_ID))
59+
.orElse(null);
60+
}
5461
}

src/main/resources/assets/mousewheelie/lang/en_us.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,23 @@
11
{
22
"key.categories.mousewheelie": "Mouse Wheelie",
33
"key.mousewheelie.open_config_screen": "Open Config Screen",
4+
"key.mousewheelie.open_config_screen.amecsapi.description": "Opens the Mouse Wheelie config screen\nif pressed in-game or in the main menu.",
45
"key.mousewheelie.whole_stack_modifier": "Whole Stack Modifier",
6+
"key.mousewheelie.whole_stack_modifier.amecsapi.description": "Holding this modifier while scrolling\nwill send the whole stack.",
57
"key.mousewheelie.all_of_kind_modifier": "All of Kind Modifier",
8+
"key.mousewheelie.all_of_kind_modifier.amecsapi.description": "Holding this modifier while scrolling\nwill send all stacks of the same kind.",
69
"key.mousewheelie.drop_modifier": "Drop Modifier",
10+
"key.mousewheelie.drop_modifier.amecsapi.description": "Holding this modifier while clicking\nwill drop the item.",
711
"key.mousewheelie.deposit_modifier": "Deposit Modifier",
12+
"key.mousewheelie.deposit_modifier.amecsapi.description": "Holding this modifier while clicking\nwill deposit the item to the open container.",
813
"key.mousewheelie.restock_modifier": "Restock Modifier",
14+
"key.mousewheelie.restock_modifier.amecsapi.description": "Holding this modifier while clicking\nwill restock the item from the open container.",
915
"key.mousewheelie.sort_inventory": "Sort Inventory",
16+
"key.mousewheelie.sort_inventory.amecsapi.description": "Sorts the inventory that the mouse is currently over.",
1017
"key.mousewheelie.scroll_up": "Scroll Items Up",
1118
"key.mousewheelie.scroll_down": "Scroll Items Down",
1219
"key.mousewheelie.pick_tool": "Pick the correct tool",
20+
"key.mousewheelie.pick_tool.amecsapi.description": "Manually triggers that the correct tool\nfor the currently faced block is selected.",
1321
"mousewheelie.gui.config-screen-unavailable": "Opening the config screen with the keybinding is currently unavailable.",
1422
"mousewheelie.gui.config-screen-unavailable.note": "Please use Mod Menu to edit the config or use an external application to edit the config directly.",
1523
"mousewheelie.sortmode.alphabet": "By Alphabet",

0 commit comments

Comments
 (0)