mirror of
https://github.com/FabricMC/fabric.git
synced 2025-03-29 00:02:45 -04:00
Update key-binding-api-v1 example (#1309)
Switches from events-lifecycle-v0 to lifecycle-events-v1
This commit is contained in:
parent
cd0f1d33c1
commit
4ee10f8910
3 changed files with 4 additions and 4 deletions
fabric-key-binding-api-v1
build.gradle
src/testmod
|
@ -3,6 +3,6 @@ version = getSubprojectVersion(project, "1.0.2")
|
|||
|
||||
dependencies {
|
||||
testmodCompile project(path: ':fabric-api-base', configuration: 'dev')
|
||||
testmodCompile project(path: ':fabric-events-lifecycle-v0', configuration: 'dev')
|
||||
testmodCompile project(path: ':fabric-lifecycle-events-v1', configuration: 'dev')
|
||||
testmodCompile project(path: ':fabric-resource-loader-v0', configuration: 'dev')
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@ import net.minecraft.text.LiteralText;
|
|||
|
||||
import net.fabricmc.api.ClientModInitializer;
|
||||
import net.fabricmc.fabric.api.client.keybinding.v1.KeyBindingHelper;
|
||||
import net.fabricmc.fabric.api.event.client.ClientTickCallback;
|
||||
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents;
|
||||
|
||||
public class KeyBindingsTest implements ClientModInitializer {
|
||||
@Override
|
||||
|
@ -34,7 +34,7 @@ public class KeyBindingsTest implements ClientModInitializer {
|
|||
KeyBinding binding2 = KeyBindingHelper.registerKeyBinding(new KeyBinding("key.fabric-key-binding-api-v1-testmod.test_keybinding_2", InputUtil.Type.KEYSYM, GLFW.GLFW_KEY_U, "key.category.second.test"));
|
||||
KeyBinding stickyBinding = KeyBindingHelper.registerKeyBinding(new StickyKeyBinding("key.fabric-key-binding-api-v1-testmod.test_keybinding_sticky", GLFW.GLFW_KEY_R, "key.category.first.test", () -> true));
|
||||
|
||||
ClientTickCallback.EVENT.register(client -> {
|
||||
ClientTickEvents.END_CLIENT_TICK.register(client -> {
|
||||
while (binding1.wasPressed()) {
|
||||
client.player.sendMessage(new LiteralText("Key 1 was pressed!"), false);
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
"license": "Apache-2.0",
|
||||
"depends": {
|
||||
"fabric-api-base": "*",
|
||||
"fabric-events-lifecycle-v0": "*",
|
||||
"fabric-lifecycle-events-v1": "*",
|
||||
"fabric-key-binding-api-v1": "*"
|
||||
},
|
||||
"entrypoints": {
|
||||
|
|
Loading…
Add table
Reference in a new issue