Handle face player packet

This commit is contained in:
KennyTV 2020-01-14 13:51:33 +01:00
parent 8c1923b077
commit d7f67065be

View File

@ -272,22 +272,20 @@ public class EntityPackets1_13 extends EntityRewriter<Protocol1_12_2To1_13> {
PlayerPositionStorage1_13 positionStorage = wrapper.user().get(PlayerPositionStorage1_13.class); PlayerPositionStorage1_13 positionStorage = wrapper.user().get(PlayerPositionStorage1_13.class);
PacketWrapper pPacket = wrapper.create(0x12); // Send teleport packet to client
EntityPositionHandler.writeFacingDegrees(pPacket, positionStorage.getX(), PacketWrapper positionAndLook = wrapper.create(0x2F);
anchor == 1 ? positionStorage.getY() + 1.62 : positionStorage.getY(), positionAndLook.write(Type.DOUBLE, 0D);
positionStorage.getZ(), x, y, z); positionAndLook.write(Type.DOUBLE, 0D);
pPacket.write(Type.BOOLEAN, false); positionAndLook.write(Type.DOUBLE, 0D);
pPacket.sendToServer(Protocol1_12_2To1_13.class);
PacketWrapper lookPacket = wrapper.create(0x28);
lookPacket.write(Type.VAR_INT, positionStorage.getEntityId());
//TODO properly cache and calculate head position //TODO properly cache and calculate head position
EntityPositionHandler.writeFacingAngles(lookPacket, positionStorage.getX(), EntityPositionHandler.writeFacingDegrees(positionAndLook, positionStorage.getX(),
anchor == 1 ? positionStorage.getY() + 1.62 : positionStorage.getY(), anchor == 1 ? positionStorage.getY() + 1.62 : positionStorage.getY(),
positionStorage.getZ(), x, y, z); positionStorage.getZ(), x, y, z);
lookPacket.write(Type.BOOLEAN, false);
lookPacket.send(Protocol1_12_2To1_13.class); positionAndLook.write(Type.BYTE, (byte) 7); // bitfield, 0=absolute, 1=relative - x,y,z relative, yaw,pitch absolute
positionAndLook.write(Type.VAR_INT, -1);
positionAndLook.send(Protocol1_12_2To1_13.class, true, true);
} }
}); });
} }