Ejemplo n.º 1
0
 public NetworkMode ReadPacket(MinecraftStream stream, NetworkMode mode, PacketDirection direction)
 {
     ProtocolVersion = stream.ReadVarInt();
     ServerHostname = stream.ReadString();
     ServerPort = stream.ReadUInt16();
     NextState = (NetworkMode)stream.ReadVarInt();
     return NextState;
 }
Ejemplo n.º 2
0
 public NetworkMode ReadPacket(MinecraftStream stream, NetworkMode mode, PacketDirection direction)
 {
     Metadata = stream.ReadVarInt();
     var length = stream.ReadInt16();
     Data = stream.ReadUInt8Array(length);
     return mode;
 }
Ejemplo n.º 3
0
 public NetworkMode ReadPacket(MinecraftStream stream, NetworkMode mode, PacketDirection direction)
 {
     if (direction == PacketDirection.Clientbound)
         EntityId = stream.ReadVarInt();
     else
         EntityId = stream.ReadInt32();
     var animation = stream.ReadUInt8();
     if (direction == PacketDirection.Clientbound)
     {
         switch (animation)
         {
             case 0: Animation = AnimationType.SwingArm; break;
             case 1: Animation = AnimationType.Damage; break;
             case 2: Animation = AnimationType.LeaveBed; break;
             case 3: Animation = AnimationType.EatFood; break;
             case 4: Animation = AnimationType.CriticalEffect; break;
             case 5: Animation = AnimationType.MagicCriticalEffect; break;
             case 104: Animation = AnimationType.Crouch; break;
             case 105: Animation = AnimationType.Uncrouch; break;
         }
     }
     else
     {
         switch (animation)
         {
             case 0: Animation = AnimationType.NoAnimation; break;
             case 1: Animation = AnimationType.SwingArm; break;
             case 2: Animation = AnimationType.Damage; break;
             case 3: Animation = AnimationType.LeaveBed; break;
             case 5: Animation = AnimationType.EatFood; break;
             case 6: Animation = AnimationType.CriticalEffect; break;
             case 7: Animation = AnimationType.MagicCriticalEffect; break;
             case 104: Animation = AnimationType.Crouch; break;
             case 105: Animation = AnimationType.Uncrouch; break;
         }
     }
     return mode;
 }
Ejemplo n.º 4
0
 public NetworkMode ReadPacket(MinecraftStream stream, NetworkMode mode, PacketDirection direction)
 {
     EntityId = stream.ReadVarInt();
     Type = stream.ReadUInt8();
     X = stream.ReadInt32();
     Y = stream.ReadInt32();
     Z = stream.ReadInt32();
     Yaw = stream.ReadUInt8();
     Pitch = stream.ReadUInt8();
     HeadYaw = stream.ReadUInt8();
     VelocityX = stream.ReadInt16();
     VelocityY = stream.ReadInt16();
     VelocityZ = stream.ReadInt16();
     Metadata = MetadataDictionary.FromStream(stream);
     return mode;
 }
Ejemplo n.º 5
0
 public NetworkMode ReadPacket(MinecraftStream stream, NetworkMode mode, PacketDirection direction) {
     ItemId = stream.ReadVarInt();
     PlayerId = stream.ReadVarInt();
     return mode;
 }
Ejemplo n.º 6
0
        public NetworkMode ReadPacket(MinecraftStream stream, NetworkMode mode, PacketDirection direction) {
            if (direction == PacketDirection.Serverbound)
                return mode; // -- Server bound has no fields.

            EntityId = stream.ReadVarInt();
            Animation = (AnimationType) stream.ReadUInt8();
            return mode;
        }
Ejemplo n.º 7
0
 public NetworkMode ReadPacket(MinecraftStream stream, NetworkMode mode, PacketDirection direction)
 {
     Health = stream.ReadSingle();
     Food = stream.ReadVarInt();
     FoodSaturation = stream.ReadSingle();
     return mode;
 }
Ejemplo n.º 8
0
 public NetworkMode ReadPacket(MinecraftStream stream, NetworkMode mode, PacketDirection direction) {
     KeepAlive = stream.ReadVarInt();
     return mode;
 }
Ejemplo n.º 9
0
 public NetworkMode ReadPacket(MinecraftStream stream, NetworkMode mode, PacketDirection direction)
 {
     ExperienceBar = stream.ReadSingle();
     Level = stream.ReadVarInt();
     TotalExperience = stream.ReadVarInt();
     return mode;
 }
Ejemplo n.º 10
0
 public NetworkMode ReadPacket(MinecraftStream stream, NetworkMode mode, PacketDirection direction)
 {
     EntityId = stream.ReadVarInt();
     EffectId = stream.ReadUInt8();
     return mode;
 }
Ejemplo n.º 11
0
 public NetworkMode ReadPacket(MinecraftStream stream, NetworkMode mode, PacketDirection direction)
 {
     EntityId = stream.ReadVarInt();
     EffectId = stream.ReadUInt8();
     Amplifier = stream.ReadUInt8();
     Duration = stream.ReadVarInt();
     HideParticles = stream.ReadBoolean();
     return mode;
 }
Ejemplo n.º 12
0
 public NetworkMode ReadPacket(MinecraftStream stream, NetworkMode mode, PacketDirection direction)
 {
     EntityId = stream.ReadVarInt();
     Metadata = MetadataDictionary.FromStream(stream);
     return mode;
 }
Ejemplo n.º 13
0
 public NetworkMode ReadPacket(MinecraftStream stream, NetworkMode mode, PacketDirection direction)
 {
     EntityId = stream.ReadVarInt();
     X = stream.ReadInt32();
     Y = stream.ReadInt32();
     Z = stream.ReadInt32();
     Yaw = stream.ReadUInt8();
     Pitch = stream.ReadUInt8();
     OnGround = stream.ReadBoolean();
     return mode;
 }
Ejemplo n.º 14
0
 public NetworkMode ReadPacket(MinecraftStream stream, NetworkMode mode, PacketDirection direction)
 {
     EntityId = stream.ReadVarInt();
     DeltaX = stream.ReadInt8();
     DeltaY = stream.ReadInt8();
     DeltaZ = stream.ReadInt8();
     return mode;
 }
Ejemplo n.º 15
0
 public NetworkMode ReadPacket(MinecraftStream stream, NetworkMode mode, PacketDirection direction) {
     EntityId = stream.ReadVarInt();
     VelocityX = stream.ReadInt16();
     VelocityY = stream.ReadInt16();
     VelocityZ = stream.ReadInt16();
     return mode;
 }
Ejemplo n.º 16
0
 public NetworkMode ReadPacket(MinecraftStream stream, NetworkMode mode, PacketDirection direction)
 {
     var length = stream.ReadVarInt();
     Statistics = new Statistic[length];
     for (long i = 0; i < length; i++)
     {
         Statistics[i] = new Statistic(
             stream.ReadString(),
             stream.ReadVarInt());
     }
     return mode;
 }
Ejemplo n.º 17
0
 public NetworkMode ReadPacket(MinecraftStream stream, NetworkMode mode, PacketDirection direction)
 {
     if (direction == PacketDirection.Clientbound)
     {
         var count = stream.ReadVarInt();
         Completions = new string[count];
         for (long i = 0; i < Completions.LongLength; i++)
             Completions[i] = stream.ReadString();
     }
     else
         Text = stream.ReadString();
     return mode;
 }
Ejemplo n.º 18
0
 public NetworkMode ReadPacket(MinecraftStream stream, NetworkMode mode, PacketDirection direction)
 {
     EntityId = stream.ReadVarInt();
     var count = stream.ReadInt32();
     if (count < 0)
         throw new InvalidOperationException("Cannot specify less than zero properties.");
     Properties = new EntityProperty[count];
     for (int i = 0; i < count; i++)
     {
         var property = new EntityProperty();
         property.Key = stream.ReadString();
         property.Value = stream.ReadDouble();
         var listLength = stream.ReadVarInt();
         property.Modifiers = new EntityPropertyListItem[listLength];
         for (int j = 0; j < listLength; j++)
         {
             var item = new EntityPropertyListItem();
             item.PropertUUID = new Guid(stream.ReadUInt8Array(16));
             item.Amount = stream.ReadDouble();
             item.Operation = stream.ReadUInt8();
             property.Modifiers[j] = item;
         }
         Properties[i] = property;
     }
     return mode;
 }
Ejemplo n.º 19
0
 public NetworkMode ReadPacket(MinecraftStream stream, NetworkMode mode, PacketDirection direction) {
     EntityId = stream.ReadVarInt();
     Slot = (EntityEquipmentSlot)stream.ReadInt16();
     Item = ItemStack.FromStream(stream);
     return mode;
 }
Ejemplo n.º 20
0
 public NetworkMode ReadPacket(MinecraftStream stream, NetworkMode mode, PacketDirection direction)
 {
     X = stream.ReadInt32();
     Z = stream.ReadInt32();
     GroundUpContinuous = stream.ReadBoolean();
     PrimaryBitMap = stream.ReadUInt16();
     var length = stream.ReadVarInt();
     Data = stream.ReadUInt8Array(length);
     return mode;
 }
Ejemplo n.º 21
0
        public NetworkMode ReadPacket(MinecraftStream stream, NetworkMode mode, PacketDirection direction)
        {
            ChunkX = stream.ReadInt32();
            ChunkZ = stream.ReadInt32();
            RecordCount = stream.ReadVarInt();
            Records = new BlockChangeRecord[RecordCount];

            for (int i = 0; i < RecordCount; i++) {
                Records[i] = new BlockChangeRecord();
                Records[i].HorizonalPosition = stream.ReadUInt8();
                Records[i].Y = stream.ReadUInt8();
                Records[i].BlockId = stream.ReadVarInt();
            }

            return mode;
        }
Ejemplo n.º 22
0
 public NetworkMode ReadPacket(MinecraftStream stream, NetworkMode mode, PacketDirection direction) {
     Location = stream.ReadPosition();
     BlockType = stream.ReadVarInt();
     return mode;
 }
Ejemplo n.º 23
0
 public NetworkMode ReadPacket(MinecraftStream stream, NetworkMode mode, PacketDirection direction)
 {
     EntityId = stream.ReadVarInt();
     PlayerUuid = new Guid(stream.ReadUInt8Array(16)); 
     PlayerName = stream.ReadString();
     X = stream.ReadInt32();
     Y = stream.ReadInt32();
     Z = stream.ReadInt32();
     Yaw = stream.ReadUInt8();
     Pitch = stream.ReadUInt8();
     HeldItem = stream.ReadInt16();
     Metadata = MetadataDictionary.FromStream(stream);
     return mode;
 }
Ejemplo n.º 24
0
 public NetworkMode ReadPacket(MinecraftStream stream, NetworkMode mode, PacketDirection direction)
 {
     X = stream.ReadInt32();
     Y = stream.ReadInt16();
     Z = stream.ReadInt32();
     Data1 = stream.ReadUInt8();
     Data2 = stream.ReadUInt8();
     BlockId = stream.ReadVarInt();
     return mode;
 }
Ejemplo n.º 25
0
 public NetworkMode ReadPacket(MinecraftStream stream, NetworkMode mode, PacketDirection direction)
 {
     EntityId = stream.ReadVarInt();
     Type = stream.ReadUInt8();
     X = stream.ReadInt32();
     Y = stream.ReadInt32();
     Z = stream.ReadInt32();
     Yaw = stream.ReadUInt8();
     Pitch = stream.ReadUInt8();
     Data = stream.ReadInt32();
     if (Data != 0)
     {
         SpeedX = stream.ReadInt16();
         SpeedY = stream.ReadInt16();
         SpeedZ = stream.ReadInt16();
     }
     return mode;
 }
Ejemplo n.º 26
0
 public NetworkMode ReadPacket(MinecraftStream stream, NetworkMode mode, PacketDirection direction)
 {
     EntityId = stream.ReadVarInt();
     Type = stream.ReadUInt8();
     X = stream.ReadInt32();
     Y = stream.ReadInt32();
     Z = stream.ReadInt32();
     return mode;
 }
Ejemplo n.º 27
0
 public NetworkMode ReadPacket(MinecraftStream stream, NetworkMode mode, PacketDirection direction)
 {
     EntityId = stream.ReadVarInt();
     Title = stream.ReadString();
     Location = stream.ReadPosition();
     Direction = stream.ReadUInt8();
     return mode;
 }
Ejemplo n.º 28
0
 public NetworkMode ReadPacket(MinecraftStream stream, NetworkMode mode, PacketDirection direction)
 {
     X = stream.ReadInt32();
     Y = stream.ReadUInt8();
     Z = stream.ReadInt32();
     BlockType = stream.ReadVarInt();
     BlockMetadata = stream.ReadUInt8();
     return mode;
 }