public static void Main(string[] argv) { var stream = new FileStream(@"D:\projects\Survivalist\data.dat", FileMode.Open); var net = new NetworkReader(stream); while (true) { var packet = Packet.Get(net); Console.WriteLine(packet.GetType()); if (packet is PlayerMoveLookPacket) { var mypacket = packet as PlayerMoveLookPacket; Console.WriteLine("PlayerMoveLook: {0:0.00}, {1:0.00}, {2:0.00}, {3:0.00}", mypacket.X, mypacket.Y, mypacket.Stance, mypacket.Z); Console.WriteLine("Rot: {0:0.00}; {1:0.00}", mypacket.RotationX, mypacket.RotationY); } if (packet is SetSpawnPacket) { var mypacket = packet as SetSpawnPacket; Console.WriteLine("Pos: {0}, {1}, {2}", mypacket.X, mypacket.Y, mypacket.Z); } if (packet is UpdateTimePacket) { var mypacket = packet as UpdateTimePacket; Console.WriteLine("Time: " + mypacket.Time); } if (packet is UpdateBlockPacket) { var mypacket = packet as UpdateBlockPacket; Console.WriteLine("Update block: {0}, {1}, {2}, {3}, {4}", mypacket.ChunkX, mypacket.ChunkY, mypacket.ChunkZ, mypacket.Type, mypacket.MetaData); } if (packet is PlayerDigPacket) { var mypacket = packet as PlayerDigPacket; Console.WriteLine("Dig: {0}, {1}, {2}", mypacket.DigX, mypacket.DigY, mypacket.DigZ); } if (packet is LoginPacket) { var mypacket = packet as LoginPacket; Console.WriteLine("Login: {0}, {1}", mypacket.Time, mypacket.DimensionType); } } }
public PacketPipe(TcpClient client, PacketHandler handler) { this.client = client; this.handler = handler; var stream = client.GetStream(); reader = new NetworkReader(stream); writer = new NetworkWriter(stream); readThread = new Thread(new ThreadStart(ReadLoop)); writeThread = new Thread(new ThreadStart(WriteLoop)); readThread.Start(); writeThread.Start(); }
public override void Read(NetworkReader reader) { EntityId = reader.ReadInt32(); TypeId = reader.ReadInt16(); Count = reader.ReadByte(); X = reader.ReadInt32(); Y = reader.ReadInt32(); Z = reader.ReadInt32(); MoveX = reader.ReadByte(); MoveY = reader.ReadByte(); MoveZ = reader.ReadByte(); }
public override void Read(NetworkReader reader) { Message = reader.ReadUTF8(); }
public override void Read(NetworkReader reader) { Type = (InventoryType)reader.ReadInt32(); int count = reader.ReadInt16(); Items = new InventoryItem[count]; for (int i = 0; i < count; i++) { int id = reader.ReadInt16(); if (id == -1) { Items[i] = null; } else { int itemCount = reader.ReadByte(); int damage = reader.ReadInt16(); Items[i] = new InventoryItem(id, itemCount, damage); } } }
public override void Read(NetworkReader reader) { X = reader.ReadDouble(); Y = reader.ReadDouble(); Stance = reader.ReadDouble(); Z = reader.ReadDouble(); base.Read(reader); }
public override void Read(NetworkReader reader) { State = reader.ReadByte(); DigX = reader.ReadInt32(); DigY = reader.ReadByte(); DigZ = reader.ReadInt32(); Face = reader.ReadByte(); }
public override void Read(NetworkReader reader) { Unknown = reader.ReadInt32(); Slot = reader.ReadInt16(); }
public override void Read(NetworkReader reader) { EntityId = reader.ReadInt32(); TypeId = reader.ReadByte(); X = reader.ReadInt32(); Y = reader.ReadInt32(); Z = reader.ReadInt32(); RotationX = reader.ReadByte(); RotationY = reader.ReadByte(); }
public override void Read(NetworkReader reader) { base.Read(reader); XDiff = reader.ReadByte(); YDiff = reader.ReadByte(); ZDiff = reader.ReadByte(); }
public override void Read(NetworkReader reader) { base.Read(reader); RotationX = reader.ReadByte(); RotationY = reader.ReadByte(); }
public override void Read(NetworkReader reader) { Contents = reader.ReadUTF8(); }
public override void Read(NetworkReader reader) { Time = reader.ReadInt64(); }
public override void Read(NetworkReader reader) { ChunkX = reader.ReadInt32(); ChunkY = reader.ReadInt16(); ChunkZ = reader.ReadInt32(); Width = reader.ReadByte() + 1; Height = reader.ReadByte() + 1; Depth = reader.ReadByte() + 1; byte[] data = new byte[reader.ReadInt32()]; reader.Read(data, 0, data.Length); var uncompressed = new MemoryStream(data.Length); // TODO: use better guess here var zlib = new ZOutputStream(uncompressed); zlib.Write(data, 0, data.Length); zlib.Flush(); zlib.finish(); Data = new byte[zlib.TotalOut]; uncompressed.Read(Data, 0, Data.Length); zlib.Close(); uncompressed.Close(); }
public abstract void Read(NetworkReader reader);
public override void Read(NetworkReader reader) { TypeId = reader.ReadInt16(); Count = reader.ReadByte(); Durability = reader.ReadInt16(); }
public override void Read(NetworkReader reader) { ChunkX = reader.ReadInt32(); ChunkY = reader.ReadInt32(); Add = reader.ReadBoolean(); }
public override void Read(NetworkReader reader) { throw new NotImplementedException(); }
public override void Read(NetworkReader reader) { CollectEntityId = reader.ReadInt32(); CollectingEntityId = reader.ReadInt32(); }
public override void Read(NetworkReader reader) { Reason = reader.ReadUTF8(); }
public override void Read(NetworkReader reader) { RotationX = reader.ReadSingle(); RotationY = reader.ReadSingle(); base.Read(reader); }
public override void Read(NetworkReader reader) { EntityId = reader.ReadInt32(); }
public override void Read(NetworkReader reader) { Type = reader.ReadInt16(); X = reader.ReadInt32(); Y = reader.ReadByte(); Z = reader.ReadInt32(); Face = reader.ReadByte(); }
public override void Read(NetworkReader reader) { base.Read(reader); ForwardAnimation = reader.ReadBoolean(); }
//public SendTileEntityAttributesPacket(TileEntity e) { // TODO: encode tile entity attributes as NBT } public override void Read(NetworkReader reader) { X = reader.ReadInt32(); Y = reader.ReadInt16(); Z = reader.ReadInt32(); var dataLength = reader.ReadInt16(); Data = new byte[dataLength]; reader.Read(Data, 0, dataLength); }
public override void Read(NetworkReader reader) { Flying = reader.ReadBoolean(); }
public override void Read(NetworkReader reader) { X = reader.ReadInt32(); Y = reader.ReadInt32(); Z = reader.ReadInt32(); }
public override void Read(NetworkReader reader) { Version = reader.ReadInt32(); AccountName = reader.ReadUTF8(); Password = reader.ReadUTF8(); Time = reader.ReadInt64(); DimensionType = reader.ReadByte(); }
public override void Read(NetworkReader reader) { ChunkX = reader.ReadInt32(); ChunkY = reader.ReadByte(); ChunkZ = reader.ReadInt32(); Type = reader.ReadByte(); MetaData = reader.ReadByte(); }
public override void Read(NetworkReader reader) { }