Skip to content

Commit 8fb0da8

Browse files
committed
Add new 'toggle' keybind
1 parent 368d496 commit 8fb0da8

File tree

3 files changed

+29
-9
lines changed

3 files changed

+29
-9
lines changed

src/main/java/ca/atlasengine/ClientMod.java

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -36,63 +36,70 @@ public void onInitializeClient() {
3636
"key.atlasengine.nextframe", // The translation key of the keybinding's name
3737
InputUtil.Type.KEYSYM, // The type of the keybinding, KEYSYM for keyboard, MOUSE for mouse.
3838
GLFW.GLFW_KEY_RIGHT_BRACKET, // The keycode of the key
39-
"category.atlasengine.animation" // The translation key of the keybinding's category.
39+
"category.atlasengine.build" // The translation key of the keybinding's category.
4040
));
4141

4242
Keybinds.previous = KeyBindingHelper.registerKeyBinding(new KeyBinding(
4343
"key.atlasengine.previousframe", // The translation key of the keybinding's name
4444
InputUtil.Type.KEYSYM, // The type of the keybinding, KEYSYM for keyboard, MOUSE for mouse.
4545
GLFW.GLFW_KEY_LEFT_BRACKET, // The keycode of the key
46-
"category.atlasengine.animation" // The translation key of the keybinding's category.
46+
"category.atlasengine.build" // The translation key of the keybinding's category.
4747
));
4848

4949
Keybinds.createBlocks = KeyBindingHelper.registerKeyBinding(new KeyBinding(
5050
"key.atlasengine.createblockregion", // The translation key of the keybinding's name
5151
InputUtil.Type.KEYSYM, // The type of the keybinding, KEYSYM for keyboard, MOUSE for mouse.
5252
GLFW.GLFW_KEY_P, // The keycode of the key
53-
"category.atlasengine.animation" // The translation key of the keybinding's category.
53+
"category.atlasengine.build" // The translation key of the keybinding's category.
5454
));
5555

5656
Keybinds.createCutscene = KeyBindingHelper.registerKeyBinding(new KeyBinding(
5757
"key.atlasengine.createcutscene", // The translation key of the keybinding's name
5858
InputUtil.Type.KEYSYM, // The type of the keybinding, KEYSYM for keyboard, MOUSE for mouse.
5959
GLFW.GLFW_KEY_U, // The keycode of the key
60-
"category.atlasengine.animation" // The translation key of the keybinding's category.
60+
"category.atlasengine.build" // The translation key of the keybinding's category.
6161
));
6262

6363
Keybinds.destroy = KeyBindingHelper.registerKeyBinding(new KeyBinding(
6464
"key.atlasengine.destroy", // The translation key of the keybinding's name
6565
InputUtil.Type.KEYSYM, // The type of the keybinding, KEYSYM for keyboard, MOUSE for mouse.
6666
GLFW.GLFW_KEY_DELETE, // The keycode of the key
67-
"category.atlasengine.animation" // The translation key of the keybinding's category.
67+
"category.atlasengine.build" // The translation key of the keybinding's category.
6868
));
6969

7070
Keybinds.add = KeyBindingHelper.registerKeyBinding(new KeyBinding(
7171
"key.atlasengine.add", // The translation key of the keybinding's name
7272
InputUtil.Type.KEYSYM, // The type of the keybinding, KEYSYM for keyboard, MOUSE for mouse.
7373
61, // The keycode of the key
74-
"category.atlasengine.animation" // The translation key of the keybinding's category.
74+
"category.atlasengine.build" // The translation key of the keybinding's category.
7575
));
7676

7777
Keybinds.remove = KeyBindingHelper.registerKeyBinding(new KeyBinding(
7878
"key.atlasengine.remove", // The translation key of the keybinding's name
7979
InputUtil.Type.KEYSYM, // The type of the keybinding, KEYSYM for keyboard, MOUSE for mouse.
8080
GLFW.GLFW_KEY_MINUS, // The keycode of the key
81-
"category.atlasengine.animation" // The translation key of the keybinding's category.
81+
"category.atlasengine.build" // The translation key of the keybinding's category.
8282
));
8383

8484
Keybinds.open = KeyBindingHelper.registerKeyBinding(new KeyBinding(
8585
"key.atlasengine.open", // The translation key of the keybinding's name
8686
InputUtil.Type.KEYSYM, // The type of the keybinding, KEYSYM for keyboard, MOUSE for mouse.
8787
GLFW.GLFW_KEY_O, // The keycode of the key
88-
"category.atlasengine.animation" // The translation key of the keybinding's category.
88+
"category.atlasengine.build" // The translation key of the keybinding's category.
8989
));
9090

9191
Keybinds.createRegion = KeyBindingHelper.registerKeyBinding(new KeyBinding(
9292
"key.atlasengine.createregion", // The translation key of the keybinding's name
9393
InputUtil.Type.KEYSYM, // The type of the keybinding, KEYSYM for keyboard, MOUSE for mouse.
9494
GLFW.GLFW_KEY_R, // The keycode of the key
95-
"category.atlasengine.region" // The translation key of the keybinding's category.
95+
"category.atlasengine.build" // The translation key of the keybinding's category.
96+
));
97+
98+
Keybinds.toggle = KeyBindingHelper.registerKeyBinding(new KeyBinding(
99+
"key.atlasengine.toggle", // The translation key of the keybinding's name
100+
InputUtil.Type.KEYSYM, // The type of the keybinding, KEYSYM for keyboard, MOUSE for mouse.
101+
GLFW.GLFW_KEY_G, // The keycode of the key
102+
"category.atlasengine.build" // The translation key of the keybinding's category.
96103
));
97104
}
98105
}

src/main/java/ca/atlasengine/Keybinds.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ public class Keybinds {
1616
public static KeyBinding createRegion;
1717
public static KeyBinding createBlocks;
1818
public static KeyBinding createCutscene;
19+
public static KeyBinding toggle;
1920

2021
static {
2122
ClientTickEvents.END_CLIENT_TICK.register(client -> {
@@ -35,6 +36,10 @@ public class Keybinds {
3536
KeybindsManager.sendAdd();
3637
}
3738

39+
while (toggle.wasPressed()) {
40+
KeybindsManager.sendToggle();
41+
}
42+
3843
while (next.wasPressed()) {
3944
if (ModelManager.isPlacing()) {
4045
ModelManager.updateRotation(1);

src/main/java/ca/atlasengine/KeybindsManager.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,4 +73,12 @@ public static void sendCreateCutscene() {
7373

7474
ClientPlayNetworking.send(keypressIdentifier, buf);
7575
}
76+
77+
public static void sendToggle() {
78+
PacketByteBuf buf = PacketByteBufs.create();
79+
buf.writeByte(1);
80+
buf.writeByte(1);
81+
82+
ClientPlayNetworking.send(keypressIdentifier, buf);
83+
}
7684
}

0 commit comments

Comments
 (0)