ProtocolLib

3M Downloads

PacketType.Play.Server.POSITION Flags not Working

SkyLicks opened this issue ยท 0 comments

commented

Describe the bug
I'm not sure whether this is an issue with the packetwrapper or plib itself, but the issue is the WrapperPlayServerPosition#setFlags() does not work.

To Reproduce

  1. Lets begin by sending an arbitrary player the Server Position packet. I'm using dmulloy2's packetwrapper version 1.12.1 for this. https://repo.dmulloy2.net/#browse/browse:snapshots:com%2Fcomphenix%2Fpacketwrapper%2FPacketWrapper%2F1.12.1-R0.1-SNAPSHOT%2F1.12.1-R0.1-20180529.035844-6 '
// create an empty packet
WrapperPlayServerPosition updatePos = new WrapperPlayServerPosition();
// create a set of flags, according to https://wiki.vg/Protocol#Player_Position_And_Look_.28clientbound.29, all flags set will make the position relative and not absolute
Set<WrapperPlayServerPosition.PlayerTeleportFlag> flags = EnumSet.of(WrapperPlayServerPosition.PlayerTeleportFlag.X_ROT, WrapperPlayServerPosition.PlayerTeleportFlag.Y_ROT, WrapperPlayServerPosition.PlayerTeleportFlag.X, WrapperPlayServerPosition.PlayerTeleportFlag.Y, WrapperPlayServerPosition.PlayerTeleportFlag.Z);
// now lets set these flags
updatePos.setFlags(flags);
// and the rest of the packet fields (again remember, due to our flags, all these values should be relative
// this means, that this packet should be the same as doing /minecraft:tp player ~ ~ ~ ~1 ~1
updatePos.setYaw(1);
updatePos.setPitch(1);
updatePos.setX(0);
updatePos.setY(0);
updatePos.setZ(0);
// Print the packet we have so we can see what we are sending
System.err.println(updatePos.getFlags() + " / " + updatePos.getPitch() + ", " + updatePos.getYaw() + " / " + updatePos.getX() + ", " + updatePos.getY() + ", " + updatePos.getZ());
// And offcourse send the packet
updatePos.sendPacket(player);
  1. Now we need to set up a packet listener listening to PacketType.Play.Server.POSITION to see what we are actually sending.
WrapperPlayServerPosition pos = new WrapperPlayServerPosition(packet);
System.out.println(pos.getFlags() + " / " + pos.getPitch() + ", " + pos.getYaw() + " / " + pos.getX() + ", " + pos.getY() + ", " + pos.getZ());
  1. You will see that this is what we end up with:
    image
    The top message is the packet right before we sent it (debug as seen from step 1)
    And the bottom message is the packet that was actually sent (from step 2)

Expected behavior
What should have happened is that the flags we set in step 1 should have actually gotten sent to the player. But in fact, we see that WrapperPlayServerPosition#setFlags does not work.

Version Info
Provide your ProtocolLib install info with /protocol dump through pastebin.
https://pastebin.com/y9JBBq0K

Additional context
Add any other context about the problem here.