public IPacket ReadPacket(IMinecraftDataReader reader)
        {
            WindowId = reader.ReadByte();
            Enchantment = reader.ReadByte();

            return this;
        }
Example #2
0
        public IPacketWithSize ReadPacket(IMinecraftDataReader reader)
        {
            Coordinates = Position.FromReaderShort(reader);
            BlockType   = reader.ReadByte();

            return(this);
        }
Example #3
0
        public IPacket ReadPacket(IMinecraftDataReader reader)
        {
            Position  = (ScoreboardPosition)reader.ReadSByte();
            ScoreName = reader.ReadString();

            return(this);
        }
 public override void FromReader(IMinecraftDataReader reader)
 {
     Rotation = new Rotation(
         reader.ReadFloat(),
         reader.ReadFloat(),
         reader.ReadFloat());
 }
Example #5
0
        public IPacket ReadPacket(IMinecraftDataReader reader)
        {
            AgeOfTheWorld = reader.ReadLong();
            TimeOfDay     = reader.ReadLong();

            return(this);
        }
        public IPacket ReadPacket(IMinecraftDataReader reader)
        {
            Reason = (GameStateReason) reader.ReadByte();
            Value = reader.ReadFloat();

            return this;
        }
Example #7
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);
        }
Example #8
0
        public IPacket ReadPacket(IMinecraftDataReader reader)
        {
            Coordinates = Coordinates2D.FromReaderInt(reader);
            RecordList  = RecordList.FromReader(reader);

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

            return this;
        }
        public IPacket ReadPacket(IMinecraftDataReader reader)
        {
            Reason = (GameStateReason)reader.ReadByte();
            Value  = reader.ReadFloat();

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

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

            return this;
        }
 public override void FromReader(IMinecraftDataReader reader)
 {
     Coordinates = new Position(
         reader.ReadInt(),
         reader.ReadInt(),
         reader.ReadInt());
 }
        public IPacket ReadPacket(IMinecraftDataReader reader)
        {
            Header = reader.ReadString();
            Footer = reader.ReadString();

            return this;
        }
Example #15
0
        public IPacketWithSize ReadPacket(IMinecraftDataReader reader)
        {
            PlayerID = reader.ReadSByte();
            Message = reader.ReadString();

            return this;
        }
        public IPacket ReadPacket(IMinecraftDataReader reader)
        {
            Coordinates = Coordinates2D.FromReaderInt(reader);
            RecordList = RecordList.FromReader(reader);

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

            return this;
        }
        public IPacketWithSize ReadPacket(IMinecraftDataReader reader)
        {
            EntityID = reader.ReadByte();
            ModelName = reader.ReadString();

            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);
        }
Example #20
0
        public IPacket ReadPacket(IMinecraftDataReader reader)
        {
            EntityID = reader.ReadInt();
            Status   = (EntityStatus)reader.ReadSByte();

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

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

            return this;
        }
Example #23
0
        public IPacket ReadPacket(IMinecraftDataReader reader)
        {
            WindowID      = reader.ReadByte();
            ItemStackList = ItemStackList.FromReader(reader);

            return(this);
        }
        public IPacket ReadPacket(IMinecraftDataReader reader)
        {
            Position = (ScoreboardPosition) reader.ReadSByte();
            ScoreName = reader.ReadString();

            return this;
        }
        public IPacketWithSize ReadPacket(IMinecraftDataReader reader)
        {
            PlayerID       = reader.ReadSByte();
            ChangeLocation = Position.FromReaderSByte(reader);

            return(this);
        }
Example #26
0
        public IPacket ReadPacket(IMinecraftDataReader reader)
        {
            CollectedEntityID = reader.ReadVarInt();
            CollectorEntityID = reader.ReadVarInt();

            return(this);
        }
        public IPacket ReadPacket(IMinecraftDataReader reader)
        {
            Header = reader.ReadString();
            Footer = reader.ReadString();

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

            return this;
        }
        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)
        {
            Message = reader.ReadString();
            Position = (ChatMessagePosition) reader.ReadByte();

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

            return this;
        }
        public IPacketWithSize ReadPacket(IMinecraftDataReader reader)
        {
            BlockToHold = reader.ReadByte();
            PreventChange = (PreventChange) reader.ReadByte();

            return this;
        }
        public IPacketWithSize ReadPacket(IMinecraftDataReader reader)
        {
            EntityID  = reader.ReadByte();
            ModelName = reader.ReadString();

            return(this);
        }
 public override void FromReader(IMinecraftDataReader reader)
 {
     Rotation = new Rotation(
         reader.ReadFloat(), 
         reader.ReadFloat(), 
         reader.ReadFloat());
 }
Example #35
0
        public IPacket ReadPacket(IMinecraftDataReader reader)
        {
            EntityID = reader.ReadVarInt();
            Action   = (EntityAction)reader.ReadByte();

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

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

            return(this);
        }
Example #38
0
        public IPacket ReadPacket(IMinecraftDataReader reader)
        {
            Slot        = reader.ReadShort();
            ClickedItem = ItemStack.FromReader(reader);

            return(this);
        }
Example #39
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);
        }
Example #40
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 #41
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 IPacketWithSize ReadPacket(IMinecraftDataReader reader)
        {
            ExtName = reader.ReadString();
            Version = reader.ReadInt();

            return(this);
        }
 public override void FromReader(IMinecraftDataReader reader)
 {
     Coordinates = new Position(
         reader.ReadInt(),
         reader.ReadInt(),
         reader.ReadInt());
 }
        public IPacket ReadPacket(IMinecraftDataReader reader)
        {
            WindowID = reader.ReadByte();
            ItemStackList = ItemStackList.FromReader(reader);

            return this;
        }
Example #45
0
        public IPacket ReadPacket(IMinecraftDataReader reader)
        {
            EntityID = reader.ReadVarInt();
            Location = Position.FromReaderLong(reader);

            return this;
        }
Example #46
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;
        }
Example #48
0
        public IWorldBorder FromReader(IMinecraftDataReader reader)
        {
            X = reader.ReadDouble();
            Z = reader.ReadDouble();

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

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

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

            return this;
        }
        public IPacket ReadPacket(IMinecraftDataReader reader)
        {
            AgeOfTheWorld = reader.ReadLong();
            TimeOfDay = reader.ReadLong();

            return this;
        }
        public IPacketWithSize ReadPacket(IMinecraftDataReader reader)
        {
            AppName = reader.ReadString();
            ExtensionCount = reader.ReadShort();

            return this;
        }
Example #54
0
        public IPacketWithSize ReadPacket(IMinecraftDataReader reader)
        {
            Coordinates = Position.FromReaderShort(reader);
            BlockType = reader.ReadByte();

            return this;
        }
Example #55
0
        public IPacketWithSize ReadPacket(IMinecraftDataReader reader)
        {
            UnUsed  = reader.ReadByte();
            Message = reader.ReadString();

            return(this);
        }
Example #56
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;
        }
Example #58
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);
        }
Example #59
0
        public IPacket ReadPacket(IMinecraftDataReader reader)
        {
            TeamName = reader.ReadString();
            Action   = (TeamAction)reader.ReadByte();

            switch (Action)
            {
            case TeamAction.CreateTeam:
                Team = new TeamsCreateTeam().FromReader(reader);
                break;

            case TeamAction.RemoveTeam:
                Team = new TeamsRemoveTeam().FromReader(reader);
                break;

            case TeamAction.UpdateTeam:
                Team = new TeamsUpdateTeam().FromReader(reader);
                break;

            case TeamAction.AddPlayers:
                Team = new TeamsAddPlayers().FromReader(reader);
                break;

            case TeamAction.RemovePlayers:
                Team = new TeamsRemovePlayers().FromReader(reader);
                break;
            }

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

            return this;
        }