mirror of
https://github.com/Oth3r/Sit.git
synced 2025-09-19 16:03:22 +02:00
new sitting keybind, executes the sit command on sit servers
This commit is contained in:
parent
6da81cb4af
commit
14f232e3fc
1 changed files with 19 additions and 0 deletions
|
@ -27,6 +27,7 @@ public class Events {
|
||||||
|
|
||||||
private static class Keybindings {
|
private static class Keybindings {
|
||||||
private static KeyBinding toggle_key;
|
private static KeyBinding toggle_key;
|
||||||
|
private static KeyBinding sit_key;
|
||||||
|
|
||||||
private static void register() {
|
private static void register() {
|
||||||
toggle_key = KeyBindingHelper.registerKeyBinding(new KeyBinding(
|
toggle_key = KeyBindingHelper.registerKeyBinding(new KeyBinding(
|
||||||
|
@ -34,6 +35,11 @@ public class Events {
|
||||||
GLFW.GLFW_KEY_UNKNOWN,
|
GLFW.GLFW_KEY_UNKNOWN,
|
||||||
"category.sit"
|
"category.sit"
|
||||||
));
|
));
|
||||||
|
sit_key = KeyBindingHelper.registerKeyBinding(new KeyBinding(
|
||||||
|
"key.sit",
|
||||||
|
GLFW.GLFW_KEY_UNKNOWN,
|
||||||
|
"category.sit"
|
||||||
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void loopLogic(ClientPlayerEntity player) {
|
private static void loopLogic(ClientPlayerEntity player) {
|
||||||
|
@ -68,6 +74,19 @@ public class Events {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
while (sit_key.wasPressed()) {
|
||||||
|
// just send the sit command
|
||||||
|
if (Data.isInGame()) {
|
||||||
|
if (Data.isSupportedServer()) {
|
||||||
|
player.networkHandler.sendCommand("sit");
|
||||||
|
} else {
|
||||||
|
// unsupported server message if not in a Sit! server
|
||||||
|
player.sendMessage(Utl.lang("msg.unsupported")
|
||||||
|
.formatted(Formatting.RED), true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue