Пример #1
0
        /// <summary>
        /// Fill the blocks
        /// </summary>
        /// <param name="editor"></param>
        /// <param name="x1"></param>
        /// <param name="y1"></param>
        /// <param name="z1"></param>
        /// <param name="x2"></param>
        /// <param name="y2"></param>
        /// <param name="z2"></param>
        /// <param name="block"></param>
        /// <returns>The count of filled blocks</returns>
        public static int Fill(this IBlockEditor editor, int x1, int y1, int z1, int x2, int y2, int z2, BlockState block)
        {
            int count = 0;
            int ix1   = Math.Min(x1, x2),
                ix2   = Math.Max(x1, x2),
                iy1   = Math.Min(y1, y2),
                iy2   = Math.Max(y1, y2),
                iz1   = Math.Min(z1, z2),
                iz2   = Math.Max(z1, z2);

            for (int y = iy1; y <= iy2; y++)
            {
                for (int z = iz1; z <= iz2; z++)
                {
                    for (int x = ix1; x <= ix2; x++)
                    {
                        if (editor.SetBlock(x, y, z, block))
                        {
                            count++;
                        }
                    }
                }
            }
            return(count);
        }
Пример #2
0
 public static void UpdateBlockReference(this IBlockEditor blockEditor, IBlockReference blockRef)
 {
     blockRef.TagBlock = new TagBlock(blockEditor.EntryCount, blockRef.TagBlock.Pointer);
 }