Exemple #1
0
 public void SendMultiBlockChange(Point a, BlockChangeData[] blocks)
 {
     SendMultiBlockChange(a.x, a.z, blocks);
 }
Exemple #2
0
        public void SendMultiBlockChange(int x, int z, BlockChangeData[] blocks)
        {
            blocks = (BlockChangeData[])blocks.Truncate(short.MaxValue);
                byte[] bytes = new byte[10 + (blocks.Length * 4)];
                util.EndianBitConverter.Big.GetBytes(x).CopyTo(bytes, 0);
                util.EndianBitConverter.Big.GetBytes(z).CopyTo(bytes, 4);
                util.EndianBitConverter.Big.GetBytes((short)blocks.Length).CopyTo(bytes, 8);

                BlockChangeData block;
                short[] coord = new short[blocks.Length];
                byte[] type = new byte[blocks.Length];
                byte[] meta = new byte[blocks.Length];
                for (int i = 0; i < blocks.Length; i++)
                {
                    block = blocks[i];
                    coord[i] = (short)((block.x << 12) | (block.z << 8) | block.y);
                    type[i] = block.type;
                    meta[i] = block.meta;
                }
                for (int i = 0; i < coord.Length; i++)
                    util.EndianBitConverter.Big.GetBytes(coord[i]).CopyTo(bytes, 10 + (i * 2));
                type.CopyTo(bytes, 10 + (blocks.Length * 2));
                meta.CopyTo(bytes, 10 + (blocks.Length * 3));

                SendRaw(0x34, bytes);
        }