Skip to content

Commit

Permalink
Add new 'toggle' keybind
Browse files Browse the repository at this point in the history
  • Loading branch information
iam4722202468 committed Apr 27, 2023
1 parent 368d496 commit 8fb0da8
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 9 deletions.
25 changes: 16 additions & 9 deletions src/main/java/ca/atlasengine/ClientMod.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,63 +36,70 @@ public void onInitializeClient() {
"key.atlasengine.nextframe", // The translation key of the keybinding's name
InputUtil.Type.KEYSYM, // The type of the keybinding, KEYSYM for keyboard, MOUSE for mouse.
GLFW.GLFW_KEY_RIGHT_BRACKET, // The keycode of the key
"category.atlasengine.animation" // The translation key of the keybinding's category.
"category.atlasengine.build" // The translation key of the keybinding's category.
));

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

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

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

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

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

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

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

Keybinds.createRegion = KeyBindingHelper.registerKeyBinding(new KeyBinding(
"key.atlasengine.createregion", // The translation key of the keybinding's name
InputUtil.Type.KEYSYM, // The type of the keybinding, KEYSYM for keyboard, MOUSE for mouse.
GLFW.GLFW_KEY_R, // The keycode of the key
"category.atlasengine.region" // The translation key of the keybinding's category.
"category.atlasengine.build" // The translation key of the keybinding's category.
));

Keybinds.toggle = KeyBindingHelper.registerKeyBinding(new KeyBinding(
"key.atlasengine.toggle", // The translation key of the keybinding's name
InputUtil.Type.KEYSYM, // The type of the keybinding, KEYSYM for keyboard, MOUSE for mouse.
GLFW.GLFW_KEY_G, // The keycode of the key
"category.atlasengine.build" // The translation key of the keybinding's category.
));
}
}
5 changes: 5 additions & 0 deletions src/main/java/ca/atlasengine/Keybinds.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ public class Keybinds {
public static KeyBinding createRegion;
public static KeyBinding createBlocks;
public static KeyBinding createCutscene;
public static KeyBinding toggle;

static {
ClientTickEvents.END_CLIENT_TICK.register(client -> {
Expand All @@ -35,6 +36,10 @@ public class Keybinds {
KeybindsManager.sendAdd();
}

while (toggle.wasPressed()) {
KeybindsManager.sendToggle();
}

while (next.wasPressed()) {
if (ModelManager.isPlacing()) {
ModelManager.updateRotation(1);
Expand Down
8 changes: 8 additions & 0 deletions src/main/java/ca/atlasengine/KeybindsManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,12 @@ public static void sendCreateCutscene() {

ClientPlayNetworking.send(keypressIdentifier, buf);
}

public static void sendToggle() {
PacketByteBuf buf = PacketByteBufs.create();
buf.writeByte(1);
buf.writeByte(1);

ClientPlayNetworking.send(keypressIdentifier, buf);
}
}

0 comments on commit 8fb0da8

Please sign in to comment.