Esempio n. 1
0
        public override BlockID NextBlock(DrawOp op)
        {
            // Figure out local coords for this block
            int x = (op.Coords.X - op.Min.X) % state.Width;

            if (x < 0)
            {
                x += state.Width;
            }
            int y = (op.Coords.Y - op.Min.Y) % state.Height;

            if (y < 0)
            {
                y += state.Height;
            }
            int z = (op.Coords.Z - op.Min.Z) % state.Length;

            if (z < 0)
            {
                z += state.Length;
            }

            int     index = (y * state.Length + z) * state.Width + x;
            BlockID block = state.Get(index);

            for (int i = 0; i < Include.Length; i++)
            {
                if (block == Include[i])
                {
                    return(block);
                }
            }
            return(Block.Invalid);
        }
Esempio n. 2
0
        public override BlockID NextBlock(DrawOp op)
        {
            // Figure out local coords for this block
            int x = (op.Coords.X - op.Min.X) % state.Width;

            if (x < 0)
            {
                x += state.Width;
            }
            int y = (op.Coords.Y - op.Min.Y) % state.Height;

            if (y < 0)
            {
                y += state.Height;
            }
            int z = (op.Coords.Z - op.Min.Z) % state.Length;

            if (z < 0)
            {
                z += state.Length;
            }

            int index = (y * state.Length + z) * state.Width + x;

            return(state.Get(index));
        }
Esempio n. 3
0
        public override ExtBlock NextBlock(DrawOp op)
        {
            // Figure out local coords for this block
            int x = (op.Coords.X - op.Min.X) % state.Width;

            if (x < 0)
            {
                x += state.Width;
            }
            int y = (op.Coords.Y - op.Min.Y) % state.Height;

            if (y < 0)
            {
                y += state.Height;
            }
            int z = (op.Coords.Z - op.Min.Z) % state.Length;

            if (z < 0)
            {
                z += state.Length;
            }

            ExtBlock block = state.Get(x, y, z);

            if (Exclude != null)
            {
                for (int i = 0; i < Exclude.Length; i++)
                {
                    if (block == Exclude[i])
                    {
                        return(ExtBlock.Invalid);
                    }
                }
                return(block);
            }
            else
            {
                for (int i = 0; i < Include.Length; i++)
                {
                    if (block == Include[i])
                    {
                        return(block);
                    }
                }
                return(ExtBlock.Invalid);
            }
        }
Esempio n. 4
0
        public override ExtBlock NextBlock(DrawOp op)
        {
            // Figure out local coords for this block
            int x = (op.Coords.X - op.Min.X) % state.Width;

            if (x < 0)
            {
                x += state.Width;
            }
            int y = (op.Coords.Y - op.Min.Y) % state.Height;

            if (y < 0)
            {
                y += state.Height;
            }
            int z = (op.Coords.Z - op.Min.Z) % state.Length;

            if (z < 0)
            {
                z += state.Length;
            }

            return(state.Get(x, y, z));
        }