Refactored SFKeyBindings to CameraShortcut

This commit is contained in:
2025-05-20 11:59:51 +02:00
parent ccbb15f7c4
commit 2be7c16e8b
2 changed files with 3 additions and 3 deletions

View File

@ -0,0 +1,22 @@
package wtf.hak.survivalfabric.features;
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents;
import net.fabricmc.fabric.api.client.keybinding.v1.KeyBindingHelper;
import net.minecraft.client.option.KeyBinding;
import net.minecraft.client.util.InputUtil;
import org.lwjgl.glfw.GLFW;
public class CameraShortcut {
private static final KeyBinding CAMERA_BIND = KeyBindingHelper.registerKeyBinding(new KeyBinding("key.survivalfabric.camera", InputUtil.Type.KEYSYM, GLFW.GLFW_KEY_PERIOD, "category.survivalfabric.survivalfabric"));
public static void register() {
ClientTickEvents.END_CLIENT_TICK.register(client -> {
if (client.player != null) {
if (CAMERA_BIND.wasPressed()) {
client.player.networkHandler.sendChatCommand("camera");
}
}
});
}
}