public IPlayerList FromReader(IMinecraftDataReader reader)
        {
            HasDisplayName = reader.ReadBoolean();
            DisplayName    = reader.ReadString();

            return(this);
        }
Exemplo n.º 2
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);
        }
Exemplo n.º 3
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 IPacket ReadPacket(IMinecraftDataReader reader)
        {
            Text = reader.ReadString();
            HasPosition = reader.ReadBoolean();
            LookedAtBlock = Position.FromReaderLong(reader);

            return this;
        }
Exemplo n.º 5
0
        public IPacket ReadPacket(IMinecraftDataReader reader)
        {
            Yaw = reader.ReadFloat();
            Pitch = reader.ReadFloat();
            OnGround = reader.ReadBoolean();

            return this;
        }
        public IPacket ReadPacket(IMinecraftDataReader reader)
        {
            WindowID = reader.ReadByte();
            Slot = reader.ReadShort();
            Accepted = reader.ReadBoolean();

            return this;
        }
Exemplo n.º 7
0
        public IPacket ReadPacket(IMinecraftDataReader reader)
        {
            EntityID     = reader.ReadVarInt();
            DeltaVector3 = Vector3.FromReaderSByteFixedPoint(reader);
            OnGround     = reader.ReadBoolean();

            return(this);
        }
Exemplo n.º 8
0
        public IPacket ReadPacket(IMinecraftDataReader reader)
        {
            WindowId     = reader.ReadByte();
            ActionNumber = reader.ReadShort();
            Accepted     = reader.ReadBoolean();

            return(this);
        }
Exemplo n.º 9
0
        public IPacket ReadPacket(IMinecraftDataReader reader)
        {
            EntityID  = reader.ReadInt();
            VehicleID = reader.ReadInt();
            Leash     = reader.ReadBoolean();

            return(this);
        }
Exemplo n.º 10
0
        public IPacket ReadPacket(IMinecraftDataReader reader)
        {
            Yaw      = reader.ReadFloat();
            Pitch    = reader.ReadFloat();
            OnGround = reader.ReadBoolean();

            return(this);
        }
Exemplo n.º 11
0
        public IPacket ReadPacket(IMinecraftDataReader reader)
        {
            EntityID = reader.ReadInt();
            VehicleID = reader.ReadInt();
            Leash = reader.ReadBoolean();

            return this;
        }
Exemplo n.º 12
0
        public IPacket ReadPacket(IMinecraftDataReader reader)
        {
            Text          = reader.ReadString();
            HasPosition   = reader.ReadBoolean();
            LookedAtBlock = Position.FromReaderLong(reader);

            return(this);
        }
        public IPacket ReadPacket(IMinecraftDataReader reader)
        {
            EntityID = reader.ReadVarInt();
            DeltaVector3 = Vector3.FromReaderSByteFixedPoint(reader);
            OnGround = reader.ReadBoolean();

            return this;
        }
Exemplo n.º 14
0
        public IPacket ReadPacket(IMinecraftDataReader reader)
        {
            EffectID = (EffectID)reader.ReadInt();
            Location = Position.FromReaderLong(reader);
            Data     = reader.ReadInt();
            DisableRelativeVolume = reader.ReadBoolean();

            return(this);
        }
Exemplo n.º 15
0
        public IPacket ReadPacket(IMinecraftDataReader reader)
        {
            EntityID = reader.ReadVarInt();
            Yaw = reader.ReadSByte();
            Pitch = reader.ReadSByte();
            OnGround = reader.ReadBoolean();

            return this;
        }
        public IPacket ReadPacket(IMinecraftDataReader reader)
        {
            X        = reader.ReadDouble();
            FeetY    = reader.ReadDouble();
            Z        = reader.ReadDouble();
            OnGround = reader.ReadBoolean();

            return(this);
        }
        public IPacket ReadPacket(IMinecraftDataReader reader)
        {
            X = reader.ReadDouble();
            FeetY = reader.ReadDouble();
            Z = reader.ReadDouble();
            OnGround = reader.ReadBoolean();

            return this;
        }
Exemplo n.º 18
0
        public IPacket ReadPacket(IMinecraftDataReader reader)
        {
            EntityID = reader.ReadVarInt();
            Yaw      = reader.ReadSByte();
            Pitch    = reader.ReadSByte();
            OnGround = reader.ReadBoolean();

            return(this);
        }
Exemplo n.º 19
0
        public IPacket ReadPacket(IMinecraftDataReader reader)
        {
            EffectID = (EffectID) reader.ReadInt();
            Location = Position.FromReaderLong(reader);
            Data = reader.ReadInt();
            DisableRelativeVolume = reader.ReadBoolean();

            return this;
        }
Exemplo n.º 20
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);
        }
Exemplo n.º 21
0
        public IPacket ReadPacket(IMinecraftDataReader reader)
        {
            EntityID = reader.ReadVarInt();
            Vector3  = Vector3.FromReaderIntFixedPoint(reader);
            Yaw      = reader.ReadSByte();
            Pitch    = reader.ReadSByte();
            OnGround = reader.ReadBoolean();

            return(this);
        }
Exemplo n.º 22
0
        public IPacket ReadPacket(IMinecraftDataReader reader)
        {
            EntityID = reader.ReadVarInt();
            EffectID = (EffectID) reader.ReadSByte();
            Amplifier = reader.ReadSByte();
            Duration = reader.ReadVarInt();
            HideParticles = reader.ReadBoolean();

            return this;
        }
        public IPacket ReadPacket(IMinecraftDataReader reader)
        {
            Locale = reader.ReadString();
            ViewDistance = reader.ReadByte();
            ChatFlags = (ChatFlags) reader.ReadByte();
            ChatColours = reader.ReadBoolean();
            DisplayedSkinParts = DisplayedSkinParts.FromReader(reader);

            return this;
        }
        public IPacket ReadPacket(IMinecraftDataReader reader)
        {
            EntityID = reader.ReadVarInt();
            Vector3 = Vector3.FromReaderIntFixedPoint(reader);
            Yaw = reader.ReadSByte();
            Pitch = reader.ReadSByte();
            OnGround = reader.ReadBoolean();

            return this;
        }
Exemplo n.º 25
0
        public IPacket ReadPacket(IMinecraftDataReader reader)
        {
            EntityID      = reader.ReadVarInt();
            EffectID      = (EffectID)reader.ReadSByte();
            Amplifier     = reader.ReadSByte();
            Duration      = reader.ReadVarInt();
            HideParticles = reader.ReadBoolean();

            return(this);
        }
        public IPacket ReadPacket(IMinecraftDataReader reader)
        {
            Locale             = reader.ReadString();
            ViewDistance       = reader.ReadByte();
            ChatFlags          = (ChatFlags)reader.ReadByte();
            ChatColours        = reader.ReadBoolean();
            DisplayedSkinParts = DisplayedSkinParts.FromReader(reader);

            return(this);
        }
Exemplo n.º 27
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);
        }
Exemplo n.º 28
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;
        }
Exemplo n.º 29
0
        public IPacket ReadPacket(IMinecraftDataReader reader)
        {
            ScoreName  = reader.ReadString();
            RemoveItem = reader.ReadBoolean();
            if (RemoveItem)
            {
                ObjectiveName = reader.ReadString();
                Value         = reader.ReadInt();
            }

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

            return this;
        }
        public IPlayerList FromReader(IMinecraftDataReader reader)
        {
            Name       = reader.ReadString();
            Properties = PlayerListActionProperties.FromReader(reader);

            Gamemode       = reader.ReadVarInt();
            Ping           = reader.ReadVarInt();
            HasDisplayName = reader.ReadBoolean();
            if (HasDisplayName)
            {
                DisplayName = reader.ReadString();
            }

            return(this);
        }
        public static PlayerListActionProperties FromReader(IMinecraftDataReader reader)
        {
            var count = reader.ReadVarInt();

            var value = new PlayerListActionProperties();
            for (var i = 0; i < count; i++)
            {
                var property = new Properties();

                property.Name = reader.ReadString();
                property.Value = reader.ReadString();
                property.IsSigned = reader.ReadBoolean();

                if (property.IsSigned)
                    property.Signature = reader.ReadString();

                value[i] = property;
            }

            return value;
        }
        public static PlayerListActionProperties FromReader(IMinecraftDataReader reader)
        {
            var count = reader.ReadVarInt();

            var value = new PlayerListActionProperties();

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

                property.Name     = reader.ReadString();
                property.Value    = reader.ReadString();
                property.IsSigned = reader.ReadBoolean();

                if (property.IsSigned)
                {
                    property.Signature = reader.ReadString();
                }

                value[i] = property;
            }

            return(value);
        }
        public IPlayerList FromReader(IMinecraftDataReader reader)
        {
            Name = reader.ReadString();
            Properties = PlayerListActionProperties.FromReader(reader);

            Gamemode = reader.ReadVarInt();
            Ping = reader.ReadVarInt();
            HasDisplayName = reader.ReadBoolean();
            if (HasDisplayName)
                DisplayName = reader.ReadString();

            return this;
        }
Exemplo n.º 35
0
        public static ChunkList FromReader(IMinecraftDataReader reader)
        {
            var value = new ChunkList();

            value.GroundUp = reader.ReadBoolean();
            value.Metadata = ChunkColumnMetadataList.FromReader(reader);

            int totalSections = 0;

            foreach (var metadata in value.Metadata.GetMetadata())
            {
                totalSections += Chunk.GetSectionCount(metadata.PrimaryBitMap);
            }


            var size = totalSections * (Chunk.TwoByteData + Chunk.HalfByteData + (value.GroundUp ? Chunk.HalfByteData : 0)) + value.Metadata.Count * Chunk.BiomesLength;
            var data = reader.ReadByteArray(size);

            int offset = 0;

            foreach (var metadata in value.Metadata.GetMetadata())
            {
                var chunk = new Chunk(metadata.Coordinates);
                chunk.PrimaryBitMap = metadata.PrimaryBitMap;
                chunk.OverWorld     = true;

                var sectionCount = Chunk.GetSectionCount(chunk.PrimaryBitMap);

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

                var chunkLength = sectionCount * (Chunk.TwoByteData + Chunk.HalfByteData + (chunk.OverWorld ? Chunk.HalfByteData : 0)) + Chunk.BiomesLength;
                var chunkData   = new byte[chunkLength];
                Array.Copy(data, offset, chunkData, 0, chunkData.Length);

                Array.Copy(chunkData, 0, chunkRawBlocks, 0, chunkRawBlocks.Length);
                Array.Copy(chunkData, chunkRawBlocks.Length, chunkRawBlocksLight, 0, chunkRawBlocksLight.Length);
                Array.Copy(chunkData, chunkRawBlocks.Length + chunkRawBlocksLight.Length, chunkRawSkylight, 0, chunkRawSkylight.Length);
                if (value.GroundUp)
                {
                    Array.Copy(chunkData, chunkRawBlocks.Length + chunkRawBlocksLight.Length + chunkRawSkylight.Length, chunk.Biomes, 0, Chunk.BiomesLength);
                }

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

                        // Light
                        var rawBlockLight = new byte[Chunk.HalfByteData];
                        Array.Copy(chunkRawSkylight, i * rawBlockLight.Length, rawBlockLight, 0, rawBlockLight.Length);

                        // Sky light
                        var rawSkyLight = new byte[Chunk.HalfByteData];
                        if (chunk.OverWorld)
                        {
                            Array.Copy(chunkRawSkylight, i * rawSkyLight.Length, rawSkyLight, 0, rawSkyLight.Length);
                        }

                        chunk.Sections[i].BuildFromRawData(rawBlocks, rawBlockLight, rawSkyLight);
                        i++;
                    }
                }
                value._entries.Add(chunk);

                offset += chunkLength;
            }

            return(value);
        }
Exemplo n.º 36
0
        public IPacket ReadPacket(IMinecraftDataReader reader)
        {
            OnGround = reader.ReadBoolean();

            return(this);
        }
Exemplo n.º 37
0
        public IPacket ReadPacket(IMinecraftDataReader reader)
        {
            OnGround = reader.ReadBoolean();

            return this;
        }
        public IPlayerList FromReader(IMinecraftDataReader reader)
        {
            HasDisplayName = reader.ReadBoolean();
            DisplayName = reader.ReadString();

            return this;
        }