public override void FromReader(IMinecraftDataReader reader)
 {
     Coordinates = new Position(
         reader.ReadInt(),
         reader.ReadInt(),
         reader.ReadInt());
 }
        public IPacket ReadPacket(IMinecraftDataReader reader)
        {
            ParticleID = (Particle) reader.ReadInt();
            LongDistance = reader.ReadBoolean();
            X = reader.ReadFloat();
            Y = reader.ReadFloat();
            Z = reader.ReadFloat();
            OffsetX = reader.ReadFloat();
            OffsetY = reader.ReadFloat();
            OffsetZ = reader.ReadFloat();
            ParticleData = reader.ReadFloat();
            NumberOfParticles = reader.ReadInt();

            switch (ParticleID)
            {
                case Particle.ITEM_CRACK:
                case Particle.BLOCK_CRACK:
                //case Particle.BLOCK_DUST:
                    Data = reader.ReadVarIntArray(2);
                    break;

                default:
                    Data = reader.ReadVarIntArray(0);
                    break;
            }

            return this;
        }
 public override void FromReader(IMinecraftDataReader reader)
 {
     Coordinates = new Position(
         reader.ReadInt(),
         reader.ReadInt(),
         reader.ReadInt());
 }
Example #4
0
        public IPacket ReadPacket(IMinecraftDataReader reader)
        {
            ParticleID        = (Particle)reader.ReadInt();
            LongDistance      = reader.ReadBoolean();
            X                 = reader.ReadFloat();
            Y                 = reader.ReadFloat();
            Z                 = reader.ReadFloat();
            OffsetX           = reader.ReadFloat();
            OffsetY           = reader.ReadFloat();
            OffsetZ           = reader.ReadFloat();
            ParticleData      = reader.ReadFloat();
            NumberOfParticles = reader.ReadInt();

            switch (ParticleID)
            {
            case Particle.ITEM_CRACK:
            case Particle.BLOCK_CRACK:
                //case Particle.BLOCK_DUST:
                Data = reader.ReadVarIntArray(2);
                break;

            default:
                Data = reader.ReadVarIntArray(0);
                break;
            }

            return(this);
        }
 public static Coordinates2D FromReaderInt(IMinecraftDataReader reader)
 {
     return(new Coordinates2D
            (
                reader.ReadInt(),
                reader.ReadInt()
            ));
 }
Example #6
0
        public IPacket ReadPacket(IMinecraftDataReader reader)
        {
            EntityID  = reader.ReadInt();
            VehicleID = reader.ReadInt();
            Leash     = reader.ReadBoolean();

            return(this);
        }
Example #7
0
        public ITitle FromReader(IMinecraftDataReader reader)
        {
            FadeIn = reader.ReadInt();
            Stay = reader.ReadInt();
            FadeOut = reader.ReadInt();

            return this;
        }
Example #8
0
 public static Vector3 FromReaderIntFixedPoint(IMinecraftDataReader reader)
 {
     return(new Vector3(
                reader.ReadInt() / 32.0f,
                reader.ReadInt() / 32.0f,
                reader.ReadInt() / 32.0f
                ));
 }
        public IPacket ReadPacket(IMinecraftDataReader reader)
        {
            EntityID = reader.ReadInt();
            VehicleID = reader.ReadInt();
            Leash = reader.ReadBoolean();

            return this;
        }
Example #10
0
        public ITitle FromReader(IMinecraftDataReader reader)
        {
            FadeIn  = reader.ReadInt();
            Stay    = reader.ReadInt();
            FadeOut = reader.ReadInt();

            return(this);
        }
Example #11
0
 public static Position FromReaderInt(IMinecraftDataReader reader)
 {
     return(new Position
            (
                reader.ReadInt(),
                reader.ReadInt(),
                reader.ReadInt()
            ));
 }
Example #12
0
        public IPacket ReadPacket(IMinecraftDataReader reader)
        {
            EffectID = (EffectID) reader.ReadInt();
            Location = Position.FromReaderLong(reader);
            Data = reader.ReadInt();
            DisableRelativeVolume = reader.ReadBoolean();

            return this;
        }
Example #13
0
        public IPacket ReadPacket(IMinecraftDataReader reader)
        {
            EffectID = (EffectID)reader.ReadInt();
            Location = Position.FromReaderLong(reader);
            Data     = reader.ReadInt();
            DisableRelativeVolume = reader.ReadBoolean();

            return(this);
        }
Example #14
0
        public static Chunk FromReader(IMinecraftDataReader reader)
        {
            var overWorld     = true;// TODO: From World class
            var coordinates   = new Coordinates2D(reader.ReadInt(), reader.ReadInt());
            var groundUp      = reader.ReadBoolean();
            var primaryBitMap = reader.ReadUShort();

            var value = new Chunk(coordinates);

            value.OverWorld     = overWorld;
            value.GroundUp      = groundUp;
            value.PrimaryBitMap = primaryBitMap;

            var size = reader.ReadVarInt();
            var data = reader.ReadByteArray(size);

            var sectionCount = GetSectionCount(value.PrimaryBitMap);

            var chunkRawBlocks      = new byte[sectionCount * TwoByteData];
            var chunkRawBlocksLight = new byte[sectionCount * HalfByteData];
            var chunkRawSkylight    = new byte[sectionCount * HalfByteData];

            Array.Copy(data, 0, chunkRawBlocks, 0, chunkRawBlocks.Length);
            Array.Copy(data, chunkRawBlocks.Length, chunkRawBlocksLight, 0, chunkRawBlocksLight.Length);
            Array.Copy(data, chunkRawBlocks.Length + chunkRawBlocksLight.Length, chunkRawSkylight, 0, chunkRawSkylight.Length);

            for (int y = 0, i = 0; y < 16; y++)
            {
                if ((value.PrimaryBitMap & (1 << y)) > 0)
                {
                    // Blocks & Metadata
                    var rawBlocks = new byte[TwoByteData];
                    Array.Copy(chunkRawBlocks, i * rawBlocks.Length, rawBlocks, 0, rawBlocks.Length);

                    // Light, convert to 1 byte per block
                    var rawBlockLight = new byte[HalfByteData];
                    Array.Copy(chunkRawSkylight, i * rawBlockLight.Length, rawBlockLight, 0, rawBlockLight.Length);

                    // Sky light, convert to 1 byte per block
                    var rawSkyLight = new byte[HalfByteData];
                    if (value.OverWorld)
                    {
                        Array.Copy(chunkRawSkylight, i * rawSkyLight.Length, rawSkyLight, 0, rawSkyLight.Length);
                    }

                    value.Sections[i].BuildFromRawData(rawBlocks, rawBlockLight, rawSkyLight);
                    i++;
                }
            }
            if (value.GroundUp)
            {
                Array.Copy(data, data.Length - value.Biomes.Length, value.Biomes, 0, value.Biomes.Length);
            }

            return(value);
        }
Example #15
0
        public IPacketWithSize ReadPacket(IMinecraftDataReader reader)
        {
            Username   = reader.ReadString();
            Protocol1  = reader.ReadInt();
            Protocol2  = reader.ReadInt();
            ClientID   = reader.ReadInt();
            RealmsData = reader.ReadString();

            return(this);
        }
Example #16
0
        public IPacketWithSize ReadPacket(IMinecraftDataReader reader)
        {
            Username = reader.ReadString();
            Protocol1 = reader.ReadInt();
            Protocol2 = reader.ReadInt();
            ClientID = reader.ReadInt();
            RealmsData = reader.ReadString();

            return this;
        }
        public IPacketWithSize ReadPacket(IMinecraftDataReader reader)
        {
            LevelSeed = reader.ReadInt();
            Unknown = reader.ReadInt();
            Gamemode = reader.ReadInt();
            EntityID = reader.ReadInt();
            X = reader.ReadFloat();
            Y = reader.ReadFloat();
            Z = reader.ReadFloat();

            return this;
        }
        public IPacketWithSize ReadPacket(IMinecraftDataReader reader)
        {
            LevelSeed = reader.ReadInt();
            Unknown   = reader.ReadInt();
            Gamemode  = reader.ReadInt();
            EntityID  = reader.ReadInt();
            X         = reader.ReadFloat();
            Y         = reader.ReadFloat();
            Z         = reader.ReadFloat();

            return(this);
        }
Example #19
0
        public ICombatEvent FromReader(IMinecraftDataReader reader)
        {
            Duration = reader.ReadVarInt();
            EntityID = reader.ReadInt();

            return(this); // Hope works
        }
Example #20
0
        public IPacket ReadPacket(IMinecraftDataReader reader)
        {
            EntityID = reader.ReadInt();
            Status   = (EntityStatus)reader.ReadSByte();

            return(this);
        }
        public IPacket ReadPacket(IMinecraftDataReader reader)
        {
            EntityID = reader.ReadInt();
            Status = (EntityStatus) reader.ReadSByte();

            return this;
        }
        public ICombatEvent FromReader(IMinecraftDataReader reader)
        {
            Duration = reader.ReadVarInt();
            EntityID = reader.ReadInt();

            return this; // Hope works
        }
        public IPacketWithSize ReadPacket(IMinecraftDataReader reader)
        {
            ExtName = reader.ReadString();
            Version = reader.ReadInt();

            return(this);
        }
Example #24
0
        public static EntityPropertyList FromReader(IMinecraftDataReader reader)
        {
            var count = reader.ReadInt();

            var value = new EntityPropertyList();

            for (int i = 0; i < count; i++)
            {
                var property = new EntityProperty();

                property.Key   = reader.ReadString();
                property.Value = (float)reader.ReadDouble();
                var listLength = reader.ReadVarInt();

                property.Modifiers = new Modifiers[listLength];
                for (var j = 0; j < listLength; j++)
                {
                    var item = new Modifiers
                    {
                        UUID      = reader.ReadBigInteger(),
                        Amount    = (float)reader.ReadDouble(),
                        Operation = reader.ReadSByte()
                    };

                    property.Modifiers[j] = item;
                }

                value[i] = property;
            }

            return(value);
        }
Example #25
0
        public ICombatEvent FromReader(IMinecraftDataReader reader)
        {
            PlayerID = reader.ReadVarInt();
            EntityID = reader.ReadInt();
            Message  = reader.ReadString();

            return(this); // Hope works
        }
        public ICombatEvent FromReader(IMinecraftDataReader reader)
        {
            PlayerID = reader.ReadVarInt();
            EntityID = reader.ReadInt();
            Message = reader.ReadString();

            return this; // Hope works
        }
        public IPacketWithSize ReadPacket(IMinecraftDataReader reader)
        {
            Label = reader.ReadString();
            Action = reader.ReadString();
            KeyCode = reader.ReadInt();
            KeyMods = (KeyMods) reader.ReadByte();

            return this;
        }
Example #28
0
        public IPacketWithSize ReadPacket(IMinecraftDataReader reader)
        {
            Label   = reader.ReadString();
            Action  = reader.ReadString();
            KeyCode = reader.ReadInt();
            KeyMods = (KeyMods)reader.ReadByte();

            return(this);
        }
        public IPacket ReadPacket(IMinecraftDataReader reader)
        {
            EntityID = reader.ReadVarInt();
            Title = reader.ReadString();
            Location = Position.FromReaderLong(reader);
            Direction = reader.ReadInt();

            return this;
        }
Example #30
0
        public IPacket ReadPacket(IMinecraftDataReader reader)
        {
            Dimension  = (Dimension)reader.ReadInt();
            Difficulty = (Difficulty)reader.ReadByte();
            GameMode   = (GameMode)reader.ReadByte();
            LevelType  = reader.ReadString();

            return(this);
        }
Example #31
0
        public static ChunkColumnMetadataList FromReader(IMinecraftDataReader reader)
        {
            var value = new ChunkColumnMetadataList();

            var count = reader.ReadVarInt();

            for (int i = 0; i < count; i++)
            {
                value[i] = new ChunkColumnMetadata
                {
                    Coordinates   = new Coordinates2D(reader.ReadInt(), reader.ReadInt()),
                    PrimaryBitMap = reader.ReadUShort()
                }
            }
            ;

            return(value);
        }
Example #32
0
        public IPacket ReadPacket(IMinecraftDataReader reader)
        {
            EntityID  = reader.ReadVarInt();
            Title     = reader.ReadString();
            Location  = Position.FromReaderLong(reader);
            Direction = reader.ReadInt();

            return(this);
        }
        public IPacket ReadPacket(IMinecraftDataReader reader)
        {
            Dimension = (Dimension) reader.ReadInt();
            Difficulty = (Difficulty) reader.ReadByte();
            GameMode = (GameMode) reader.ReadByte();
            LevelType = reader.ReadString();

            return this;
        }
        public IPacket ReadPacket(IMinecraftDataReader reader)
        {
            WindowID = reader.ReadByte();
            InventoryType = reader.ReadString();
            WindowTitle = reader.ReadString();
            NumberOfSlots = reader.ReadByte();
            if (InventoryType == "EntityHorse")
                EntityID = reader.ReadInt();

            return this;
        }
        public IPacket ReadPacket(IMinecraftDataReader reader)
        {
            EntityID = reader.ReadInt();
            GameMode = (GameMode) reader.ReadByte();
            Dimension = (Dimension) reader.ReadSByte();
            Difficulty = (Difficulty) reader.ReadByte();
            MaxPlayers = reader.ReadByte();
            LevelType = reader.ReadString();
            ReducedDebugInfo = reader.ReadBoolean();

            return this;
        }
        public IPacket ReadPacket(IMinecraftDataReader reader)
        {
            ScoreName = reader.ReadString();
            RemoveItem = reader.ReadBoolean();
            if (RemoveItem)
            {
                ObjectiveName = reader.ReadString();
                Value = reader.ReadInt();
            }

            return this;
        }
Example #37
0
        public IPacket ReadPacket(IMinecraftDataReader reader)
        {
            EntityID         = reader.ReadInt();
            GameMode         = (GameMode)reader.ReadByte();
            Dimension        = (Dimension)reader.ReadSByte();
            Difficulty       = (Difficulty)reader.ReadByte();
            MaxPlayers       = reader.ReadByte();
            LevelType        = reader.ReadString();
            ReducedDebugInfo = reader.ReadBoolean();

            return(this);
        }
        public IPacket ReadPacket(IMinecraftDataReader reader)
        {
            ScoreName  = reader.ReadString();
            RemoveItem = reader.ReadBoolean();
            if (RemoveItem)
            {
                ObjectiveName = reader.ReadString();
                Value         = reader.ReadInt();
            }

            return(this);
        }
Example #39
0
        public IPacket ReadPacket(IMinecraftDataReader reader)
        {
            WindowID      = reader.ReadByte();
            InventoryType = reader.ReadString();
            WindowTitle   = reader.ReadString();
            NumberOfSlots = reader.ReadByte();
            if (InventoryType == "EntityHorse")
            {
                EntityID = reader.ReadInt();
            }

            return(this);
        }
        public IPacket ReadPacket(IMinecraftDataReader reader)
        {
            X = reader.ReadFloat();
            Y = reader.ReadFloat();
            Z = reader.ReadFloat();
            Radius = reader.ReadFloat();
            RecordCount = reader.ReadInt();
            Records = reader.ReadByteArray(3 * RecordCount);
            PlayerMotionX = reader.ReadFloat();
            PlayerMotionY = reader.ReadFloat();
            PlayerMotionZ = reader.ReadFloat();

            return this;
        }
Example #41
0
        public IPacket ReadPacket(IMinecraftDataReader reader)
        {
            X             = reader.ReadFloat();
            Y             = reader.ReadFloat();
            Z             = reader.ReadFloat();
            Radius        = reader.ReadFloat();
            RecordCount   = reader.ReadInt();
            Records       = reader.ReadByteArray(3 * RecordCount);
            PlayerMotionX = reader.ReadFloat();
            PlayerMotionY = reader.ReadFloat();
            PlayerMotionZ = reader.ReadFloat();

            return(this);
        }
        public IPacket ReadPacket(IMinecraftDataReader reader)
        {
            EntityID = reader.ReadVarInt();
            Type = (Objects) reader.ReadByte();
            Vector3 = Vector3.FromReaderIntFixedPoint(reader);
            Yaw = reader.ReadByte();
            Pitch = reader.ReadByte();
            var data = reader.ReadInt();
            if (data > 0)
            {
                SpeedX = reader.ReadShort();
                SpeedY = reader.ReadShort();
                SpeedZ = reader.ReadShort();
            }

            return this;
        }
Example #43
0
        public IPacket ReadPacket(IMinecraftDataReader reader)
        {
            EntityID = reader.ReadVarInt();
            Type     = (Objects)reader.ReadByte();
            Vector3  = Vector3.FromReaderIntFixedPoint(reader);
            Yaw      = reader.ReadByte();
            Pitch    = reader.ReadByte();
            var data = reader.ReadInt();

            if (data > 0)
            {
                SpeedX = reader.ReadShort();
                SpeedY = reader.ReadShort();
                SpeedZ = reader.ReadShort();
            }

            return(this);
        }
        public IPacketWithSize ReadPacket(IMinecraftDataReader reader)
        {
            Time = reader.ReadInt();

            return this;
        }
Example #45
0
 public override void FromReader(IMinecraftDataReader reader)
 {
     Value = reader.ReadInt();
 }
 public override void FromReader(IMinecraftDataReader reader)
 {
     Value = reader.ReadInt();
 }
Example #47
0
        public IPacketWithSize ReadPacket(IMinecraftDataReader reader)
        {
            Time = reader.ReadInt();

            return(this);
        }