当前位置: 首页>>代码示例>>C#>>正文


C# World.GetBlock方法代码示例

本文整理汇总了C#中SMP.World.GetBlock方法的典型用法代码示例。如果您正苦于以下问题:C# World.GetBlock方法的具体用法?C# World.GetBlock怎么用?C# World.GetBlock使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SMP.World的用法示例。


在下文中一共展示了World.GetBlock方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Normal

        public void Normal(World w, int x, int y, int z, byte type)
        {
            byte dist, tile;
            byte height = (byte)(rand.nextInt(4) + 3);
            byte top = (byte)(height - 2);
            short xx, yy, zz;
            int xxx, yyy, zzz;
            for (yy = 0; yy <= height; yy++)
            {
                yyy = y + yy;
                tile = tile = w.GetBlock(x, yyy, z);
                if (tile == (byte)Blocks.Air || (yyy == y && tile == (byte)Blocks.Sapling))
                    w.BlockChange(x, yyy, z, (byte)Blocks.Wood, type);
            }

            for (yy = top; yy <= height + 1; yy++)
            {
                dist = yy > height - 1 ? (byte)1 : (byte)2;
                for (xx = (short)-dist; xx <= dist; xx++)
                {
                    for (zz = (short)-dist; zz <= dist; zz++)
                    {
                        xxx = x + xx;
                        yyy = y + yy;
                        zzz = z + zz;
                        tile = w.GetBlock(xxx, yyy, zzz);
                        //Server.s.Log(String.Format("{0} {1} {2}", xxx, yyy, zzz));

                        if ((xxx == x && zzz == z && yy <= height) || tile != (byte)Blocks.Air)
                            continue;

                        if (Math.Abs(xx) == dist && Math.Abs(zz) == dist)
                        {
                            if (yy > height) continue;
                            if (rand.nextInt(2) == 0)
                                w.BlockChange(xxx, yyy, zzz, (byte)Blocks.Leaves, type);
                        }
                        else
                            w.BlockChange(xxx, yyy, zzz, (byte)Blocks.Leaves, type);
                    }
                }
            }
        }
开发者ID:eszanto8,项目名称:ForgeCraft,代码行数:43,代码来源:GenTrees.cs

示例2: PlaceDoor

 public static void PlaceDoor(World world, int i, int j, int k, int l, byte block)
 {
     sbyte byte0 = 0;
     sbyte byte1 = 0;
     if (l == 0)
     {
         byte1 = 1;
     }
     if (l == 1)
     {
         byte0 = -1;
     }
     if (l == 2)
     {
         byte1 = -1;
     }
     if (l == 3)
     {
         byte0 = 1;
     }
     int i1 = (BlockData.IsNormalCube(world.GetBlock(i - byte0, j, k - byte1)) ? 1 : 0) + (BlockData.IsNormalCube(world.GetBlock(i - byte0, j + 1, k - byte1)) ? 1 : 0);
     int j1 = (BlockData.IsNormalCube(world.GetBlock(i + byte0, j, k + byte1)) ? 1 : 0) + (BlockData.IsNormalCube(world.GetBlock(i + byte0, j + 1, k + byte1)) ? 1 : 0);
     bool flag = world.GetBlock(i - byte0, j, k - byte1) == block || world.GetBlock(i - byte0, j + 1, k - byte1) == block;
     bool flag1 = world.GetBlock(i + byte0, j, k + byte1) == block || world.GetBlock(i + byte0, j + 1, k + byte1) == block;
     bool flag2 = false;
     if (flag && !flag1)
     {
         flag2 = true;
     }
     else
         if (j1 > i1)
         {
             flag2 = true;
         }
     if (flag2)
     {
         l = l - 1 & 3;
         l += 4;
     }
     world.SetBlock(i, j, k, block, (byte)l);
     world.SetBlock(i, j + 1, k, block, (byte)(l + 8));
 }
开发者ID:MinedroidFTW,项目名称:ForgeCraft,代码行数:42,代码来源:DataValues.cs


注:本文中的SMP.World.GetBlock方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。