Skip to content

Commit 3636d8d

Browse files
committed
Improve keybind registration
1 parent 783ebe9 commit 3636d8d

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

src/client/java/com/coflnet/CoflModClient.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ public class CoflModClient implements ClientModInitializer {
9494
private static boolean keyPressed = false;
9595
private static int counter = 0;
9696
private static final KeyBinding.Category SKYCOFL_CATEGORY = KeyBinding.Category.create(Identifier.of("coflnet", "skycofl"));
97+
private static final KeyBinding.Category SKYCOFL_UNCHANGEABLE_CATEGORY = KeyBinding.Category.create(Identifier.of("coflnet", "skycofl_unchangeable"));
9798
public static KeyBinding bestflipsKeyBinding;
9899
public static KeyBinding uploadItemKeyBinding;
99100
public static List<KeyBinding> additionalKeyBindings = new ArrayList<KeyBinding>();
@@ -1250,7 +1251,6 @@ private static void clickSlotInContainer(GenericContainerScreen gcs, int slotId)
12501251
private boolean checkVersionCompability() {
12511252
try {
12521253
String v = net.minecraft.SharedConstants.getGameVersion().id();
1253-
System.out.println("Detected Minecraft version:" + v);
12541254
boolean b = v.compareTo(targetVersion) == 0;
12551255

12561256
return b;
@@ -1290,8 +1290,7 @@ public static void setHotKeys(HotkeyRegister[] keys) {
12901290
int keyIndex = getKeyIndex(keys[i].DefaultKey.toUpperCase());
12911291

12921292
HotkeyRegister hotkey = keys[i];
1293-
KeyBinding.Category unchangeableCategory = KeyBinding.Category.create(Identifier.of("coflnet", "skycofl_unchangeable"));
1294-
KeyBinding keyBinding = new KeyBinding(hotkey.Name, keyIndex, unchangeableCategory);
1293+
KeyBinding keyBinding = new KeyBinding(hotkey.Name, keyIndex, SKYCOFL_UNCHANGEABLE_CATEGORY);
12951294
additionalKeyBindings.add(keyBinding);
12961295
keybindingsToHotkeys.put(keyBinding, hotkey);
12971296
System.out.println("Registered Key: " + hotkey.Name + " with key " + hotkey.DefaultKey.toUpperCase() + " (" +keyIndex+")");
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
{
2-
"keybinding.coflmod.bestflips": "Cofl: Show best flips"
2+
"keybinding.coflmod.bestflips": "Cofl: Show best flips",
3+
"key.category.coflnet.skycofl": "SkyCofl keys",
4+
"key.category.coflnet.skycofl_unchangeable": "SkyCofl keys"
35
}
Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
{
22
"keybinding.coflmod.bestflips": "Open Best/Next Flip",
3-
"keybinding.coflmod.uploaditem": "Upload Selected Item"
3+
"keybinding.coflmod.uploaditem": "Upload Selected Item",
4+
5+
"key.category.coflnet.skycofl": "SkyCofl keys",
6+
"key.category.coflnet.skycofl_unchangeable": "SkyCofl keys"
47
}

0 commit comments

Comments
 (0)