new sitting keybind, executes the sit command on sit servers

This commit is contained in:
Oth3r 2024-08-06 11:10:45 -05:00
commit 14f232e3fc

View file

@ -27,6 +27,7 @@ public class Events {
private static class Keybindings {
private static KeyBinding toggle_key;
private static KeyBinding sit_key;
private static void register() {
toggle_key = KeyBindingHelper.registerKeyBinding(new KeyBinding(
@ -34,6 +35,11 @@ public class Events {
GLFW.GLFW_KEY_UNKNOWN,
"category.sit"
));
sit_key = KeyBindingHelper.registerKeyBinding(new KeyBinding(
"key.sit",
GLFW.GLFW_KEY_UNKNOWN,
"category.sit"
));
}
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);
}
}
}
}
}