MCSharp.World.Map.GetTile C# (CSharp) Method

GetTile() public method

public GetTile ( int b ) : byte
b int
return byte
        public byte GetTile(int b)
        {
            ushort x = 0, y = 0, z = 0;
            IntToPos(b, out x, out y, out z);
            return GetTile(x, y, z);
        }

Same methods

Map::GetTile ( ushort x, ushort y, ushort z ) : byte

Usage Example

Exemplo n.º 1
0
        //
        void AddTree(Map Lvl, ushort x, ushort z, ushort y, Random Rand)
        {
            byte height = (byte)Rand.Next(4, 7);

            for (ushort zz = 0; zz < height; zz++)
            {
                if (Lvl.GetTile(x, (ushort)(z + zz), y) == Block.air)   //Not likly to trigger anyway
                {
                    Lvl.Blockchange(x, (ushort)(z + zz), y, Block.trunk);
                }
                else
                {
                    height = (byte)zz;
                }
            }

            short top = (short)(height - 3);

            for (short xx = (short)-top; xx <= top; ++xx)
            {
                for (short yy = (short)-top; yy <= top; ++yy)
                {
                    for (short zz = (short)-top; zz <= top; ++zz)
                    {
                        if (Lvl.GetTile((ushort)(x + xx), (ushort)(z + zz + height), (ushort)(y + yy)) == Block.air)   //Not likly to trigger anyway
                        {
                            //short Dist = (short)(Math.Abs(xx) + Math.Abs(yy) + Math.Abs(zz));
                            short Dist = (short)(Math.Sqrt(xx * xx + yy * yy + zz * zz));
                            if (Dist < top + 1)
                            {
                                if (Rand.Next((int)(Dist)) < 2)
                                {
                                    Lvl.Blockchange((ushort)(x + xx), (ushort)(z + zz + height), (ushort)(y + yy), Block.leaf);
                                }
                            }
                        }
                    }
                }
            }
        }
All Usage Examples Of MCSharp.World.Map::GetTile