void HandleMovement(byte[] buffer, int offset) { if (!loggedIn || trainGrab || following.Length > 0) { CheckBlocks(Pos); return; } if (Supports(CpeExt.HeldBlock)) { RawHeldBlock = ExtBlock.FromRaw(buffer[offset + 1]); } int x, y, z; if (hasExtPositions) { x = NetUtils.ReadI32(buffer, offset + 2); y = NetUtils.ReadI32(buffer, offset + 6); z = NetUtils.ReadI32(buffer, offset + 10); offset += 6; // for yaw/pitch offset below } else { x = NetUtils.ReadI16(buffer, offset + 2); y = NetUtils.ReadI16(buffer, offset + 4); z = NetUtils.ReadI16(buffer, offset + 6); } byte yaw = buffer[offset + 8], pitch = buffer[offset + 9]; Position next = new Position(x, y, z); CheckBlocks(next); OnPlayerMoveEvent.Call(this, next, yaw, pitch); if (cancelmove) { cancelmove = false; return; } Pos = next; SetYawPitch(yaw, pitch); if (!Moved() || Loading) { return; } if (DateTime.UtcNow < AFKCooldown) { return; } LastAction = DateTime.UtcNow; if (IsAfk) { CmdAfk.ToggleAfk(this, ""); } }