
Kragast
Members-
Content Count
9 -
Joined
-
Last visited
Community Reputation
0 NeutralAbout Kragast
-
Rank
Tree Puncher
-
[Solved] [1.16.4] KeyInputEvent is not listened
Kragast replied to Kragast's topic in Modder Support
Why? There is no server key-bindings -
[Solved] [1.16.4] KeyInputEvent is not listened
Kragast replied to Kragast's topic in Modder Support
Yes, thank you! -
It does nothing. Why? @Mod.EventBusSubscriber(modid = Mod.MOD_ID, bus = Mod.EventBusSubscriber.Bus.FORGE, value = Dist.CLIENT) public class ClientEventsHandler { @OnlyIn(Dist.CLIENT) @SubscribeEvent public void onKeyInput(InputEvent.KeyInputEvent event) { System.out.println(event.getKey()); System.out.println("Key is down!"); Mod.LOGGER.info("Key is down!"); Mod.LOGGER.info(event.getKey()); } }
-
Thanks!
-
Yes, it is so. Now I don't understand, how then I can connect Client-Side-Keyboard-Input with server interactions. Should I send packages?
-
Because I want to setRenderViewEntity to my dummy entity. When I place the block in my world, it works. @Mod.EventBusSubscriber(modid = FreeCam.MOD_ID, bus = Mod.EventBusSubscriber.Bus.FORGE, value = Dist.CLIENT) public class ModClientEvents { @SubscribeEvent public static void onKeyPress(InputEvent.KeyInputEvent event) {} }
-
And another question. I'm writing one-side client mode, that changes camera position. And I'd like it to work on servers. This is why I think, I need to summon it in client side.
-
I've copied vanilla code and then my minecraft crashed How can I summon entity in specific coordinates? I could change this later, but addEntity returns boolean, not Entity.
-
Kragast started following [Solved] [1.16.4] How to spawn an entity?
-
I need to spawn an entity in the world, but i can't found any information how to do this in 1.16.4. I tryed with a pig, but i couldn't :(( Tell me, please, how to do that @SubscribeEvent public static void onKeyPress(InputEvent.KeyInputEvent event) { int key = event.getKey(); int action = event.getAction(); if ((key == 93) && (action == 1)) { System.out.print("KEY IS DOWN!\n"); PlayerEntity player = Minecraft.getInstance().player; World world = player.getEntityWorld(); world.setBlockState(player.getPosition().add(0, -1, 0), Block.getStateById(1)) // spawn a mob here } }