public IPacket ReadPacket(IMinecraftDataReader reader)
        {
            CollectedEntityID = reader.ReadVarInt();
            CollectorEntityID = reader.ReadVarInt();

            return this;
        }
Esempio n. 2
0
        public IPacket ReadPacket(IMinecraftDataReader reader)
        {
            CollectedEntityID = reader.ReadVarInt();
            CollectorEntityID = reader.ReadVarInt();

            return(this);
        }
        public IPacket ReadPacket(IMinecraftDataReader reader)
        {
            Action = (PlayerListAction)reader.ReadVarInt();
            Length = reader.ReadVarInt();
            UUID   = reader.ReadBigInteger();

            switch (Action)
            {
            case PlayerListAction.AddPlayer:
                PlayerList = new PlayerListActionAddPlayer().FromReader(reader);
                break;

            case PlayerListAction.UpdateGamemode:
                PlayerList = new PlayerListActionUpdateGamemode().FromReader(reader);
                break;

            case PlayerListAction.UpdateLatency:
                PlayerList = new PlayerListActionUpdateLatency().FromReader(reader);
                break;

            case PlayerListAction.UpdateDisplayName:
                PlayerList = new PlayerListActionUpdateDisplayName().FromReader(reader);
                break;

            case PlayerListAction.RemovePlayer:
                PlayerList = new PlayerListActionRemovePlayer().FromReader(reader);
                break;
            }

            return(this);
        }
        public IPacket ReadPacket(IMinecraftDataReader reader)
        {
            ExperienceBar = reader.ReadFloat();
            Level = reader.ReadVarInt();
            TotalExperience = reader.ReadVarInt();

            return this;
        }
        public IPacket ReadPacket(IMinecraftDataReader reader)
        {
            EntityID = reader.ReadVarInt();
            var length = reader.ReadVarInt(); // TODO: Check that
            NBTTag = reader.ReadByteArray(length);

            return this;
        }
Esempio n. 6
0
 public static Coordinates2D FromReaderVarInt(IMinecraftDataReader reader)
 {
     return(new Coordinates2D
            (
                reader.ReadVarInt(),
                reader.ReadVarInt()
            ));
 }
        public IPacket ReadPacket(IMinecraftDataReader reader)
        {
            ExperienceBar   = reader.ReadFloat();
            Level           = reader.ReadVarInt();
            TotalExperience = reader.ReadVarInt();

            return(this);
        }
Esempio n. 8
0
        public IPacket ReadPacket(IMinecraftDataReader reader)
        {
            EntityID = reader.ReadVarInt();
            var length = reader.ReadVarInt(); // TODO: Check that

            NBTTag = reader.ReadByteArray(length);

            return(this);
        }
        public IPacket ReadPacket(IMinecraftDataReader reader)
        {
            var ssLength = reader.ReadVarInt();
            SharedSecret = reader.ReadByteArray(ssLength);
            var vtLength = reader.ReadVarInt();
            VerificationToken = reader.ReadByteArray(vtLength);

            return this;
        }
Esempio n. 10
0
        public IPacket ReadPacket(IMinecraftDataReader reader)
        {
            ProtocolVersion = reader.ReadVarInt();
            ServerAddress   = reader.ReadString();
            ServerPort      = reader.ReadShort();
            NextState       = (NextState)reader.ReadVarInt();

            return(this);
        }
Esempio n. 11
0
 public static Position FromReaderVarInt(IMinecraftDataReader reader)
 {
     return(new Position
            (
                reader.ReadVarInt(),
                reader.ReadVarInt(),
                reader.ReadVarInt()
            ));
 }
        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)
        {
            EntityID = reader.ReadVarInt();
            EffectID = (EffectID) reader.ReadSByte();
            Amplifier = reader.ReadSByte();
            Duration = reader.ReadVarInt();
            HideParticles = reader.ReadBoolean();

            return this;
        }
        public IPacket ReadPacket(IMinecraftDataReader reader)
        {
            var ssLength = reader.ReadVarInt();

            SharedSecret = reader.ReadByteArray(ssLength);
            var vtLength = reader.ReadVarInt();

            VerificationToken = reader.ReadByteArray(vtLength);

            return(this);
        }
Esempio n. 15
0
        public static StatisticsEntryList FromReader(IMinecraftDataReader reader)
        {
            var count = reader.ReadVarInt();

            var value = new StatisticsEntryList();
            for (int i = 0; i < count; i++)
                value[i] = new StatisticsEntry { StatisticsName = reader.ReadString(), Value = reader.ReadVarInt() };
            

            return value;
        }
Esempio n. 16
0
        public IPacket ReadPacket(IMinecraftDataReader reader)
        {
            Target = reader.ReadVarInt();
            Type = (UseEntity) reader.ReadVarInt();

            if (Type == UseEntity.INTERACT_AT)
            {
                TargetX = reader.ReadFloat();
                TargetY = reader.ReadFloat();
                TargetZ = reader.ReadFloat();
            }

            return this;
        }
Esempio n. 17
0
        public IPacket ReadPacket(IMinecraftDataReader reader)
        {
            Target = reader.ReadVarInt();
            Type = (UseEntity) reader.ReadVarInt();

            if (Type == UseEntity.INTERACT_AT)
            {
                TargetX = reader.ReadFloat();
                TargetY = reader.ReadFloat();
                TargetZ = reader.ReadFloat();
            }

            return this;
        }
Esempio n. 18
0
        public IWorldBorder FromReader(IMinecraftDataReader reader)
        {
            X = reader.ReadDouble();
            Z = reader.ReadDouble();

            OldRadius = reader.ReadDouble();
            NewRadius = reader.ReadDouble();
            //Speed = reader.ReadVarLong(); TODO: VarLong
            PortalTeleportBoundary = reader.ReadVarInt();
            WarningTime            = reader.ReadVarInt();
            WarningBlocks          = reader.ReadVarInt();

            return(this);
        }
        public IPacket ReadPacket(IMinecraftDataReader reader)
        {
            ServerId = reader.ReadString();
            var pkLength = reader.ReadVarInt();
            PublicKey = reader.ReadByteArray(pkLength);
            var vtLength = reader.ReadVarInt();
            VerificationToken = reader.ReadByteArray(vtLength);

            SharedKey = new byte[16];

            var random = RandomNumberGenerator.Create();
            random.GetBytes(SharedKey);

            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);
        }
Esempio n. 21
0
        public ICombatEvent FromReader(IMinecraftDataReader reader)
        {
            Duration = reader.ReadVarInt();
            EntityID = reader.ReadInt();

            return(this); // Hope works
        }
        public IPacket ReadPacket(IMinecraftDataReader reader)
        {
            EntityID = reader.ReadVarInt();
            EntityProperties = EntityPropertyList.FromReader(reader);

            return this;
        }
        public IPacket ReadPacket(IMinecraftDataReader reader)
        {
            Hash   = reader.ReadString();
            Result = (ResourcePackStatus)reader.ReadVarInt();

            return(this);
        }
Esempio n. 24
0
        public IPacket ReadPacket(IMinecraftDataReader reader)
        {
            EntityID = reader.ReadVarInt();
            HeadYaw  = reader.ReadSByte();

            return(this);
        }
        public IPacket ReadPacket(IMinecraftDataReader reader)
        {
            EntityID = reader.ReadVarInt();
            Metadata = EntityMetadataList.FromReader(reader);

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

            return this; // Hope works
        }
        public IPacket ReadPacket(IMinecraftDataReader reader)
        {
            Location = Position.FromLong(reader.ReadLong());
            BlockIDMeta = reader.ReadVarInt();

            return this;
        }
Esempio n. 28
0
        public IPacket ReadPacket(IMinecraftDataReader reader)
        {
            EntityID = reader.ReadVarInt();
            EffectID = (EffectID)reader.ReadSByte();

            return(this);
        }
        public IPacket ReadPacket(IMinecraftDataReader reader)
        {
            EntityID = reader.ReadVarInt();
            Action = (EntityAction) reader.ReadByte();

            return this;
        }
Esempio n. 30
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);
        }
Esempio n. 31
0
        public IPacket ReadPacket(IMinecraftDataReader reader)
        {
            Action = (WorldBorderAction)reader.ReadVarInt();

            switch (Action)
            {
            case WorldBorderAction.SetSize:
                WorldBorder = new WorldBorderSetSize().FromReader(reader);
                break;

            case WorldBorderAction.LerpSize:
                WorldBorder = new WorldBorderLerpSize().FromReader(reader);
                break;

            case WorldBorderAction.SetCenter:
                WorldBorder = new WorldBorderSetCenter().FromReader(reader);
                break;

            case WorldBorderAction.Initialize:
                WorldBorder = new WorldBorderInitialize().FromReader(reader);
                break;

            case WorldBorderAction.SetWarningTime:
                WorldBorder = new WorldBorderSetWarningTime().FromReader(reader);
                break;

            case WorldBorderAction.SetWarningBlocks:
                WorldBorder = new WorldBorderSetWarningBlocks().FromReader(reader);
                break;
            }

            return(this);
        }
        public IPacket ReadPacket(IMinecraftDataReader reader)
        {
            EntityID = reader.ReadVarInt();
            HeadYaw = reader.ReadSByte();

            return this;
        }
Esempio n. 33
0
        public IPacket ReadPacket(IMinecraftDataReader reader)
        {
            Location  = Position.FromReaderLong(reader);
            Byte1     = reader.ReadByte();
            Byte2     = reader.ReadByte();
            BlockType = reader.ReadVarInt();

            switch (BlockType)
            {
            case 25:
                BlockAction = new BlockActionNoteBlock(Byte1, Byte2, BlockType);
                break;

            case 29:
            case 33:
                BlockAction = new BlockActionPiston(Byte1, Byte2, BlockType);
                break;

            case 54:
            case 130:     // TODO: Check
            case 146:     // TODO: Check
                BlockAction = new BlockActionChest(Byte1, Byte2, BlockType);
                break;
            }


            return(this);
        }
        public IPacket ReadPacket(IMinecraftDataReader reader)
        {
            Count = reader.ReadVarInt();
            Text = reader.ReadString();

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

            var count = reader.ReadShort();

            for (int i = 0; i < count; i++)
            {
                var slot = new ItemStack(reader.ReadShort()); // -- ID

                if (slot.ID == -1 || slot.Count == -1)
                {
                    value[i] = ItemStack.EmptyStack;
                    break;
                }

                slot.Count  = reader.ReadSByte();
                slot.Damage = reader.ReadShort();

                var length = reader.ReadVarInt();
                if (length == -1)
                {
                    value[i] = slot;
                    break;
                }

                slot.NBTData = reader.ReadByteArray(length);
            }

            return(value);
        }
Esempio n. 36
0
        public static ItemStack FromReader(IMinecraftDataReader reader)
        {
            var itemStack = new ItemStack(reader.ReadShort()); // -- ID

            if (itemStack.ID == -1 || itemStack.Count == -1)
            {
                return(EmptyStack);
            }


            itemStack.Count  = reader.ReadSByte();
            itemStack.Damage = reader.ReadShort();

            var length = reader.ReadVarInt();

            if (length == -1 || length == 0)
            {
                return(itemStack);
            }

            itemStack.NBTData = reader.ReadByteArray(length);
            // TODO: NBTTag reading

            return(itemStack);
        }
Esempio n. 37
0
        public IPacket ReadPacket(IMinecraftDataReader reader)
        {
            EntityID = reader.ReadVarInt();
            Location = Position.FromReaderLong(reader);

            return(this);
        }
Esempio n. 38
0
        public IPacket ReadPacket(IMinecraftDataReader reader)
        {
            EntityID = reader.ReadVarInt();
            Action   = (EntityAction)reader.ReadByte();

            return(this);
        }
Esempio n. 39
0
        public IPacket ReadPacket(IMinecraftDataReader reader)
        {
            EntityID = reader.ReadVarInt();
            Metadata = EntityMetadataList.FromReader(reader);

            return(this);
        }
Esempio n. 40
0
        public IPacket ReadPacket(IMinecraftDataReader reader)
        {
            EntityID         = reader.ReadVarInt();
            EntityProperties = EntityPropertyList.FromReader(reader);

            return(this);
        }
Esempio n. 41
0
        public IPacket ReadPacket(IMinecraftDataReader reader)
        {
            Count = reader.ReadVarInt();
            Text  = reader.ReadString();

            return(this);
        }
Esempio n. 42
0
        public IPacket ReadPacket(IMinecraftDataReader reader)
        {
            Action = (TitleAction)reader.ReadVarInt();

            switch (Action)
            {
            case TitleAction.Title:
                Title = new TitleTitle();
                Title.FromReader(reader);
                break;

            case TitleAction.Subtitle:
                Title = new TitleSubtitle();
                Title.FromReader(reader);
                break;

            case TitleAction.Times:
                Title = new TitleTimes();
                Title.FromReader(reader);
                break;

            case TitleAction.Clear:
                Title = new TitleClear();
                Title.FromReader(reader);
                break;

            case TitleAction.Reset:
                Title = new TitleReset();
                Title.FromReader(reader);
                break;
            }

            return(this);
        }
        public IPacket ReadPacket(IMinecraftDataReader reader)
        {
            var count = reader.ReadVarInt();
            EntityIDs = reader.ReadVarIntArray(count);

            return this;
        }
Esempio n. 44
0
        public IPacket ReadPacket(IMinecraftDataReader reader)
        {
            EntityID = reader.ReadVarInt();
            Location = Position.FromReaderLong(reader);

            return this;
        }
        public IPacket ReadPacket(IMinecraftDataReader reader)
        {
            EntityID = reader.ReadVarInt();
            EffectID = (EffectID) reader.ReadSByte();

            return this;
        }
Esempio n. 46
0
        public IPacket ReadPacket(IMinecraftDataReader reader)
        {
            Location    = Position.FromLong(reader.ReadLong());
            BlockIDMeta = reader.ReadVarInt();

            return(this);
        }
Esempio n. 47
0
        public IPacket ReadPacket(IMinecraftDataReader reader)
        {
            var count = reader.ReadVarInt();

            EntityIDs = reader.ReadVarIntArray(count);

            return(this);
        }
        public IPacket ReadPacket(IMinecraftDataReader reader)
        {
            Channel = reader.ReadString();
            var length = reader.ReadVarInt();
            Data = reader.ReadByteArray(length);

            return this;
        }
        public IPacket ReadPacket(IMinecraftDataReader reader)
        {
            EntityID = reader.ReadVarInt();
            Vector3  = Vector3.FromReaderIntFixedPoint(reader);
            Count    = reader.ReadShort();

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

            return this;
        }
        public IPacket ReadPacket(IMinecraftDataReader reader)
        {
            EntityID = reader.ReadVarInt();
            Vector3 = Vector3.FromReaderIntFixedPoint(reader);
            Count = reader.ReadShort();

            return this;
        }
        public IPacket ReadPacket(IMinecraftDataReader reader)
        {
            EntityID = reader.ReadVarInt();
            Slot = (EntityEquipmentSlot) reader.ReadShort();
            Item = ItemStack.FromReader(reader);

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

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

            return this;
        }
        public IPacket ReadPacket(IMinecraftDataReader reader)
        {
            Location = Position.FromReaderLong(reader);
            Action = (UpdateBlockEntityAction) reader.ReadByte();
            int length = reader.ReadVarInt();
            NBTData = reader.ReadByteArray(length);

            return this;
        }
        public IPacket ReadPacket(IMinecraftDataReader reader)
        {
            EntityID = reader.ReadVarInt();
            VelocityX = reader.ReadShort();
            VelocityY = reader.ReadShort();
            VelocityZ = reader.ReadShort();

            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;
        }
        public IPacket ReadPacket(IMinecraftDataReader reader)
        {
            EntityID = reader.ReadVarInt();
            PlayerUUID = reader.ReadBigInteger();
            Vector3 = Vector3.FromReaderIntFixedPoint(reader);
            Yaw = reader.ReadSByte();
            Pitch = reader.ReadSByte();
            CurrentItem = reader.ReadShort();
            EntityMetadata = EntityMetadataList.FromReader(reader);

            return this;
        }
Esempio n. 59
0
        public static RecordList FromReader(IMinecraftDataReader reader)
        {
            var value = new RecordList();

            var count = reader.ReadVarInt();

            for (int i = 0; i < count; i++)
            {
                var record = new Record();

                var coordinates = reader.ReadShort();
                var y = coordinates & 0xFF;
                var z = (coordinates >> 8) & 0xf; 
                var x = (coordinates >> 12) & 0xf;

                record.BlockIDMeta = reader.ReadVarInt();
                record.Coordinates = new Position(x, y, z);

                value[i] = record;
            }

            return value;
        }
Esempio n. 60
0
        public IPacket ReadPacket(IMinecraftDataReader reader)
        {
            EntityID = reader.ReadVarInt();
            Type = (Mobs) reader.ReadByte();
            Vector3 = Vector3.FromReaderIntFixedPoint(reader);
            Yaw = reader.ReadSByte();
            Pitch = reader.ReadSByte();
            HeadPitch = reader.ReadSByte();
            VelocityX = reader.ReadShort();
            VelocityY = reader.ReadShort();
            VelocityZ = reader.ReadShort();
            EntityMetadata = EntityMetadataList.FromReader(reader);

            return this;
        }