public static void Call() { BinaryReader r = SMPInterface.Reader; int x = SMPInterface.SwapByteOrder(r.ReadInt32()); byte y = r.ReadByte(); int z = SMPInterface.SwapByteOrder(r.ReadInt32()); byte type = r.ReadByte(); byte meta = r.ReadByte(); int ChunkPosX = -1 + x / MinecraftLevel.ChunkXSize; int ChunkPosY = y / MinecraftLevel.ChunkYSize; int ChunkPosZ = z / MinecraftLevel.ChunkZSize; int cx = (ChunkPosX * MinecraftLevel.ChunkXSize); int cy = (ChunkPosY * MinecraftLevel.ChunkYSize); int cz = (ChunkPosZ * MinecraftLevel.ChunkZSize); MinecraftLevel.Chunk c; MinecraftLevel.Chunk ct; Cubia.Point <int> p = new Cubia.Point <int>(ChunkPosX, ChunkPosZ); if (!SMPInterface.Chunks.TryGetValue(p, out c)) { c = MinecraftLevel.Chunk.EmptyChunk(); SMPInterface.Chunks.Add(p, c); } if (!SMPInterface.TransChunks.TryGetValue(p, out ct)) { ct = MinecraftLevel.Chunk.EmptyChunk(); ct.Trans = true; SMPInterface.TransChunks.Add(p, ct); } MinecraftBlock b = new MinecraftBlock() { BlockLight = 0, SkyLight = 0, Type = type }; int rx = mod((x - cx), MinecraftLevel.ChunkXSize); // fixes the negatives int ry = mod((y - cy), MinecraftLevel.ChunkYSize); int rz = mod((z - cz), MinecraftLevel.ChunkZSize); if (GCScheme.IsTrans(type)) { ct.UpdateBlock(new Cubia.Vector <int>(rx, ry, rz), b); } else { c.UpdateBlock(new Cubia.Vector <int>(rx, ry, rz), b); } }
private static void Call() { double exx = SMPInterface.SwapByteOrder(SMPInterface.Reader.ReadDouble()); double exy = SMPInterface.SwapByteOrder(SMPInterface.Reader.ReadDouble()); double exz = SMPInterface.SwapByteOrder(SMPInterface.Reader.ReadDouble()); SMPInterface.Reader.ReadSingle(); int blocksaffected = SMPInterface.SwapByteOrder(SMPInterface.Reader.ReadInt32()); SMPInterface.Reader.ReadBytes(blocksaffected * 3); SMPInterface.Debug(string.Format("ASPLODIE AT: {0}, {1}, {2}\n", exx, exy, exz)); }
private static void Call() { BinaryReader r = SMPInterface.Reader; byte windowid = r.ReadByte(); short slot = SMPInterface.SwapByteOrder(r.ReadInt16()); short itemid = SMPInterface.SwapByteOrder(r.ReadInt16()); if (itemid != -1) { r.ReadBytes(3); // count and uses } }
private static void Call() { short h = SMPInterface.SwapByteOrder((short)SMPInterface.Reader.ReadInt16()); if (h == 0) { SMPInterface.Debug("You are now dead"); } else { SMPInterface.Debug("Health is now " + h.ToString()); } }
private static void Call() { SMPInterface.PlayerX = SMPInterface.SwapByteOrder(SMPInterface.Reader.ReadInt32()); SMPInterface.PlayerY = SMPInterface.SwapByteOrder(SMPInterface.Reader.ReadInt32()); SMPInterface.PlayerZ = SMPInterface.SwapByteOrder(SMPInterface.Reader.ReadInt32()); SMPInterface.Debug(string.Format("Player Spawn Pos recived @ ({0}, {1}, {2})\n", SMPInterface.PlayerX, SMPInterface.PlayerY, SMPInterface.PlayerZ)); if (UpdateSpawnPos != null) { UpdateSpawnPos.Invoke(new Cubia.Vector <int>((int)SMPInterface.PlayerX, (int)SMPInterface.PlayerY, (int)SMPInterface.PlayerZ)); } }
private static void Call() { int pid = SMPInterface.SwapByteOrder(SMPInterface.Reader.ReadInt32()); SMPInterface.Reader.ReadByte(); string name = SMPInterface.Reader.ReadString(); SMPInterface.Reader.ReadInt32(); //x SMPInterface.Reader.ReadInt32(); SMPInterface.Reader.ReadInt32(); // z SMPInterface.Reader.ReadByte(); // rotation SMPInterface.Reader.ReadByte(); SMPInterface.Reader.ReadInt16(); // current item SMPInterface.Debug("Player: " + name + "\n"); }
private static void Call() { int cx = SMPInterface.SwapByteOrder(SMPInterface.Reader.ReadInt32()); short cy = SMPInterface.SwapByteOrder(SMPInterface.Reader.ReadInt16()); int cz = SMPInterface.SwapByteOrder(SMPInterface.Reader.ReadInt32()); byte sizex = SMPInterface.Reader.ReadByte(); byte sizey = SMPInterface.Reader.ReadByte(); byte sizez = SMPInterface.Reader.ReadByte(); int sizedata = SMPInterface.SwapByteOrder(SMPInterface.Reader.ReadInt32()); byte[] data = SMPInterface.Reader.ReadBytes(sizedata); byte[] ddata; DecompressData(data, out ddata); //SMPInterface.Debug(string.Format("Got chunk: {0}, {1}, {2}\n", cx, cy, cz)); ProccesChunk(ddata, cx, cy, cz, sizex, sizey, sizez); }
private static void Call() { byte type = SMPInterface.Reader.ReadByte(); short count = SMPInterface.SwapByteOrder(SMPInterface.Reader.ReadInt16()); int totalBlocks = 0; for (int i = 0; i < count; i++) { int bid = SMPInterface.SwapByteOrder(SMPInterface.Reader.ReadInt16()); if (bid != -1) { byte amm = SMPInterface.Reader.ReadByte(); totalBlocks += amm; SMPInterface.Reader.ReadInt16(); // uses } } //SMPInterface.Reader.ReadBytes(2); SMPInterface.Debug("Got Inv, " + totalBlocks.ToString() + " blocks in total\n"); }
private static void Call() { int x = SMPInterface.SwapByteOrder(SMPInterface.Reader.ReadInt32()); int y = SMPInterface.SwapByteOrder(SMPInterface.Reader.ReadInt32()); byte load = SMPInterface.Reader.ReadByte(); }
private static void Call() { int bx = SMPInterface.SwapByteOrder(SMPInterface.Reader.ReadInt32()); int bz = SMPInterface.SwapByteOrder(SMPInterface.Reader.ReadInt32()); MinecraftLevel.Chunk c; MinecraftLevel.Chunk ct; Cubia.Point <int> p = new Cubia.Point <int>(bx, bz); if (!SMPInterface.Chunks.TryGetValue(p, out c)) { c = MinecraftLevel.Chunk.EmptyChunk(); SMPInterface.Chunks.Add(p, c); } if (!SMPInterface.TransChunks.TryGetValue(p, out ct)) { ct = MinecraftLevel.Chunk.EmptyChunk(); ct.Trans = true; SMPInterface.TransChunks.Add(p, ct); } short arraysize = SMPInterface.SwapByteOrder(SMPInterface.Reader.ReadInt16()); LinkedList <Cubia.Vector <int> > vec = new LinkedList <Cubia.Vector <int> >(); byte[] blocks = new byte[arraysize]; for (int i = 0; i < arraysize; i++) { MapChunkReader r = new MapChunkReader(SMPInterface.Reader.ReadBytes(2)); // 2 for coords, 1 for type byte x = (byte)r.Read(4); byte z = (byte)r.Read(4); byte y = (byte)r.Read(8); vec.AddLast(new Cubia.Vector <int>(x, y, z)); } for (int i = 0; i < arraysize; i++) { blocks[i] = SMPInterface.Reader.ReadByte(); } SMPInterface.Reader.ReadBytes(arraysize); // discard metadata for (int t = 0; t < arraysize; t++) { MinecraftBlock block = new MinecraftBlock() { BlockLight = 0, SkyLight = 0, Type = blocks[t] }; if (GCScheme.IsTrans(blocks[t])) { ct.UpdateBlock(vec.ElementAt <Cubia.Vector <int> >(t), block); } else { c.UpdateBlock(vec.ElementAt <Cubia.Vector <int> >(t), block); } } }