public override int TryReadPacket(byte[] buffer, int length) { byte flags; byte walkingSpeed, flyingSpeed; int offset = 1; if (!DataUtility.TryReadByte(buffer, ref offset, out flags)) return -1; if (!DataUtility.TryReadByte(buffer, ref offset, out walkingSpeed)) return -1; if (!DataUtility.TryReadByte(buffer, ref offset, out flyingSpeed)) return -1; Abilities = new PlayerAbilities(null); Abilities.WalkingSpeed = walkingSpeed; Abilities.FlyingSpeed = flyingSpeed; Abilities.Invulnerable = (flags & 1) == 1; Abilities.IsFlying = (flags & 2) == 2; Abilities.MayFly = (flags & 4) == 4; Abilities.InstantMine = (flags & 8) == 8; return offset; }
public PlayerAbilitiesPacket(PlayerAbilities abilities) { Abilities = abilities; }