ProtocolLib

3M Downloads

Input Handling in 1.21.2+

Ste3et opened this issue ยท 3 comments

commented
  • [ x] This feature is not currently present in a development build

Is your feature request related to a problem? Please describe.
The PacketType.Play.Client.STEER_VEHICLE works internal with net.minecraft.world.entity.player.Input and the set/get methode inside PacketContainer is mising and there isn't a data type present.

Describe the solution you'd like
Please add an function to get the Player Input and work with an Wrapped Object

Error Log from 1.21.3
Error Log

1.21.3 Internal Code from ServerboundPlayerInputPacket Screenshot 2024-11-05 164354
1.21.1 Internal Code from ServerboundPlayerInputPacket Screenshot 2024-11-05 164510

commented

Try something like this:

            PacketContainer packet = event.getPacket();
            InternalStructure input = packet.getStructures().read(0);
            boolean forward = input.getBooleans().read(0);
            boolean backward = input.getBooleans().read(1);
            boolean left = input.getBooleans().read(2);
            boolean right = input.getBooleans().read(3);
            boolean space = input.getBooleans().read(4);
            boolean shift = input.getBooleans().read(5);

Thank you @Brokkonaut i forget about it, atm i have so much trouble with my shool that i make simultaneously as my fulltime job

commented

Try something like this:

            PacketContainer packet = event.getPacket();
            InternalStructure input = packet.getStructures().read(0);
            boolean forward = input.getBooleans().read(0);
            boolean backward = input.getBooleans().read(1);
            boolean left = input.getBooleans().read(2);
            boolean right = input.getBooleans().read(3);
            boolean space = input.getBooleans().read(4);
            boolean shift = input.getBooleans().read(5);
commented

Yep, that works. Is the package still sent multiple times when i keep like W pressed?