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


C# World.getSavedLightValue方法代码示例

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


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

示例1: updateTick

 public override void updateTick(World world, int i, int j, int k, Random random)
 {
     if (world.getSavedLightValue(EnumSkyBlock.Block, i, j, k) > 11 - lightOpacity[blockID])
     {
         dropBlockAsItem(world, i, j, k, world.getBlockMetadata(i, j, k));
         world.setBlockWithNotify(i, j, k, waterMoving.blockID);
     }
 }
开发者ID:riverar,项目名称:Crafty,代码行数:8,代码来源:BlockIce.cs

示例2: generate

        public override bool generate(World world, Random random, int i, int j, int k)
        {
            i -= 8;
            for (k -= 8; j > 0 && world.isAirBlock(i, j, k); j--)
            {
            }
            j -= 4;
            var aflag = new bool[2048];
            int l = random.nextInt(4) + 4;
            for (int i1 = 0; i1 < l; i1++)
            {
                double d = random.nextDouble()*6D + 3D;
                double d1 = random.nextDouble()*4D + 2D;
                double d2 = random.nextDouble()*6D + 3D;
                double d3 = random.nextDouble()*(16D - d - 2D) + 1.0D + d/2D;
                double d4 = random.nextDouble()*(8D - d1 - 4D) + 2D + d1/2D;
                double d5 = random.nextDouble()*(16D - d2 - 2D) + 1.0D + d2/2D;
                for (int j4 = 1; j4 < 15; j4++)
                {
                    for (int k4 = 1; k4 < 15; k4++)
                    {
                        for (int l4 = 1; l4 < 7; l4++)
                        {
                            double d6 = (j4 - d3)/(d/2D);
                            double d7 = (l4 - d4)/(d1/2D);
                            double d8 = (k4 - d5)/(d2/2D);
                            double d9 = d6*d6 + d7*d7 + d8*d8;
                            if (d9 < 1.0D)
                            {
                                aflag[(j4*16 + k4)*8 + l4] = true;
                            }
                        }
                    }
                }
            }

            for (int j1 = 0; j1 < 16; j1++)
            {
                for (int j2 = 0; j2 < 16; j2++)
                {
                    for (int j3 = 0; j3 < 8; j3++)
                    {
                        bool flag = !aflag[(j1*16 + j2)*8 + j3] &&
                                    (j1 < 15 && aflag[((j1 + 1)*16 + j2)*8 + j3] ||
                                     j1 > 0 && aflag[((j1 - 1)*16 + j2)*8 + j3] ||
                                     j2 < 15 && aflag[(j1*16 + (j2 + 1))*8 + j3] ||
                                     j2 > 0 && aflag[(j1*16 + (j2 - 1))*8 + j3] ||
                                     j3 < 7 && aflag[(j1*16 + j2)*8 + (j3 + 1)] ||
                                     j3 > 0 && aflag[(j1*16 + j2)*8 + (j3 - 1)]);
                        if (!flag)
                        {
                            continue;
                        }
                        Material material = world.getBlockMaterial(i + j1, j + j3, k + j2);
                        if (j3 >= 4 && material.getIsLiquid())
                        {
                            return false;
                        }
                        if (j3 < 4 && !material.isSolid() && world.getBlockId(i + j1, j + j3, k + j2) != field_15005_a)
                        {
                            return false;
                        }
                    }
                }
            }

            for (int k1 = 0; k1 < 16; k1++)
            {
                for (int k2 = 0; k2 < 16; k2++)
                {
                    for (int k3 = 0; k3 < 8; k3++)
                    {
                        if (aflag[(k1*16 + k2)*8 + k3])
                        {
                            world.setBlock(i + k1, j + k3, k + k2, k3 < 4 ? field_15005_a : 0);
                        }
                    }
                }
            }

            for (int l1 = 0; l1 < 16; l1++)
            {
                for (int l2 = 0; l2 < 16; l2++)
                {
                    for (int l3 = 4; l3 < 8; l3++)
                    {
                        if (aflag[(l1*16 + l2)*8 + l3] &&
                            world.getBlockId(i + l1, (j + l3) - 1, k + l2) == Block.dirt.blockID &&
                            world.getSavedLightValue(EnumSkyBlock.Sky, i + l1, j + l3, k + l2) > 0)
                        {
                            world.setBlock(i + l1, (j + l3) - 1, k + l2, Block.grass.blockID);
                        }
                    }
                }
            }

            if (Block.blocksList[field_15005_a].blockMaterial == Material.lava)
            {
                for (int i2 = 0; i2 < 16; i2++)
                {
//.........这里部分代码省略.........
开发者ID:riverar,项目名称:Crafty,代码行数:101,代码来源:WorldGenLakes.cs


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