Пример #1
0
 public override void Decode(MinecraftStream stream)
 {
     X        = stream.ReadDouble();
     FeetY    = stream.ReadDouble();
     Z        = stream.ReadDouble();
     OnGround = stream.ReadBool();
 }
Пример #2
0
        public override void Decode(MinecraftStream stream)
        {
            EntityId = stream.ReadVarInt();
            int count = stream.ReadInt();

            for (int i = 0; i < count; i++)
            {
                string key   = stream.ReadString();
                double value = stream.ReadDouble();

                int        propCount = stream.ReadVarInt();
                Modifier[] modifiers = new Modifier[propCount];

                for (int y = 0; y < modifiers.Length; y++)
                {
                    UUID         uuid   = new UUID(stream.ReadUuid().ToByteArray());
                    double       amount = stream.ReadDouble();
                    ModifierMode op     = (ModifierMode)stream.ReadByte();

                    modifiers[y] = EntityProperty.Factory.CreateModifier(uuid, amount, op);
                }

                EntityProperty prop = EntityProperty.Factory.Create(key, value, modifiers);

                if (!Properties.ContainsKey(prop.Key))
                {
                    Properties.Add(prop.Key, prop);
                }
            }
        }
Пример #3
0
 public override void Decode(MinecraftStream stream)
 {
     X        = stream.ReadDouble();
     Y        = stream.ReadDouble();
     Z        = stream.ReadDouble();
     Yaw      = stream.ReadFloat();
     Pitch    = stream.ReadFloat();
     OnGround = stream.ReadBool();
 }
Пример #4
0
 public override void Decode(MinecraftStream stream)
 {
     X          = stream.ReadDouble();
     Y          = stream.ReadDouble();
     Z          = stream.ReadDouble();
     Yaw        = stream.ReadFloat();
     Pitch      = stream.ReadFloat();
     Flags      = (byte)stream.ReadByte();
     TeleportId = stream.ReadVarInt();
 }
Пример #5
0
 public override void Decode(MinecraftStream stream)
 {
     EntityID = stream.ReadVarInt();
     X        = stream.ReadDouble();
     Y        = stream.ReadDouble();
     Z        = stream.ReadDouble();
     Yaw      = (sbyte)stream.ReadByte();
     Pitch    = (sbyte)stream.ReadByte();
     OnGround = stream.ReadBool();
 }
Пример #6
0
 public override void Decode(MinecraftStream stream)
 {
     EntityId = stream.ReadVarInt();
     Uuid     = stream.ReadUuid();
     X        = stream.ReadDouble();
     Y        = stream.ReadDouble();
     Z        = stream.ReadDouble();
     Yaw      = (sbyte)stream.ReadByte();
     Pitch    = (sbyte)stream.ReadByte();
     stream.ReadByte();
 }
Пример #7
0
 public override void Decode(MinecraftStream stream)
 {
     EntityId  = stream.ReadVarInt();
     Uuid      = stream.ReadUuid();
     Type      = stream.ReadVarInt();
     X         = stream.ReadDouble();
     Y         = stream.ReadDouble();
     Z         = stream.ReadDouble();
     Yaw       = (byte)stream.ReadByte();
     Pitch     = (byte)stream.ReadByte();
     HeadPitch = (byte)stream.ReadByte();
     VelocityX = stream.ReadShort();
     VelocityY = stream.ReadShort();
     VelocityZ = stream.ReadShort();
 }
Пример #8
0
        /// <inheritdoc />
        public override void Decode(MinecraftStream stream)
        {
            AimWithHead = stream.ReadVarInt() == 1;
            var x = (float)stream.ReadDouble();
            var y = (float)stream.ReadDouble();
            var z = (float)stream.ReadDouble();

            Target   = new Vector3(x, y, z);
            IsEntity = stream.ReadBool();

            if (IsEntity)
            {
                EntityId   = stream.ReadVarInt();
                LookAtEyes = stream.ReadVarInt() == 1;
            }
        }
Пример #9
0
        public override Packet Read(byte[] data)
        {
            var             re = new PlayerPositionAndLook();
            MinecraftStream ms = new MinecraftStream(data);

            re.ID = ms.ReadVarInt();

            re.X = ms.ReadDouble();
            re.Y = ms.ReadDouble();
            re.Z = ms.ReadDouble();

            //re.Yaw = ms.ReadFloat(data);
            //  re.Pitch = ms.ReadFloat(data);

            // re.OnGround = ms.ReadByte(data);
            return(re);
        }
Пример #10
0
        public override void Decode(MinecraftStream stream)
        {
            EntityId = stream.ReadVarInt();
            int count = stream.ReadInt();

            for (int i = 0; i < count; i++)
            {
                Property prop  = new Property();
                string   key   = stream.ReadString();
                double   value = stream.ReadDouble();

                int        propCount = stream.ReadVarInt();
                Modifier[] modifiers = new Modifier[propCount];
                for (int y = 0; y < modifiers.Length; y++)
                {
                    UUID   uuid   = new UUID(stream.ReadUuid().ToByteArray());
                    double amount = stream.ReadDouble();
                    byte   op     = (byte)stream.ReadByte();

                    modifiers[y] = new Modifier()
                    {
                        Amount    = amount,
                        Operation = op,
                        Uuid      = uuid
                    };
                }

                prop.Value     = value;
                prop.Modifiers = modifiers;
                prop.Key       = key;

                if (!Properties.ContainsKey(key))
                {
                    Properties.Add(key, prop);
                }
            }
        }