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


C# World.getBlockMaterial方法代码示例

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


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

示例1: canPlaceBlockAt

 public override bool canPlaceBlockAt(World world, int i, int j, int k)
 {
     int l = world.getBlockId(i, j - 1, k);
     if (l == blockID)
     {
         return true;
     }
     if (l != grass.blockID && l != dirt.blockID)
     {
         return false;
     }
     if (world.getBlockMaterial(i - 1, j - 1, k) == Material.water)
     {
         return true;
     }
     if (world.getBlockMaterial(i + 1, j - 1, k) == Material.water)
     {
         return true;
     }
     if (world.getBlockMaterial(i, j - 1, k - 1) == Material.water)
     {
         return true;
     }
     return world.getBlockMaterial(i, j - 1, k + 1) == Material.water;
 }
开发者ID:riverar,项目名称:Crafty,代码行数:25,代码来源:BlockReed.cs

示例2: generate

        public override bool generate(World world, Random random, int i, int j, int k)
        {
            for (int l = 0; l < 20; l++)
            {
                int i1 = (i + random.nextInt(4)) - random.nextInt(4);
                int j1 = j;
                int k1 = (k + random.nextInt(4)) - random.nextInt(4);
                if (!world.isAirBlock(i1, j1, k1) ||
                    world.getBlockMaterial(i1 - 1, j1 - 1, k1) != Material.water &&
                    world.getBlockMaterial(i1 + 1, j1 - 1, k1) != Material.water &&
                    world.getBlockMaterial(i1, j1 - 1, k1 - 1) != Material.water &&
                    world.getBlockMaterial(i1, j1 - 1, k1 + 1) != Material.water)
                {
                    continue;
                }
                int l1 = 2 + random.nextInt(random.nextInt(3) + 1);
                for (int i2 = 0; i2 < l1; i2++)
                {
                    if (Block.reed.canBlockStay(world, i1, j1 + i2, k1))
                    {
                        world.setBlock(i1, j1 + i2, k1, Block.reed.blockID);
                    }
                }
            }

            return true;
        }
开发者ID:riverar,项目名称:Crafty,代码行数:27,代码来源:WorldGenReed.cs

示例3: updateTick

 public override void updateTick(World world, int i, int j, int k, Random random)
 {
     if (world.singleplayerWorld)
     {
         return;
     }
     if (world.getBlockLightValue(i, j + 1, k) < 4 && world.getBlockMaterial(i, j + 1, k).getCanBlockGrass())
     {
         if (random.nextInt(4) != 0)
         {
             return;
         }
         world.setBlockWithNotify(i, j, k, dirt.blockID);
     }
     else if (world.getBlockLightValue(i, j + 1, k) >= 9)
     {
         int l = (i + random.nextInt(3)) - 1;
         int i1 = (j + random.nextInt(5)) - 3;
         int j1 = (k + random.nextInt(3)) - 1;
         if (world.getBlockId(l, i1, j1) == dirt.blockID && world.getBlockLightValue(l, i1 + 1, j1) >= 4 &&
             !world.getBlockMaterial(l, i1 + 1, j1).getCanBlockGrass())
         {
             world.setBlockWithNotify(l, i1, j1, grass.blockID);
         }
     }
 }
开发者ID:riverar,项目名称:Crafty,代码行数:26,代码来源:BlockGrass.cs

示例4: onBlockRemoval

 public override void onBlockRemoval(World world, int i, int j, int k)
 {
     Material material = world.getBlockMaterial(i, j - 1, k);
     if (material.getIsSolid() || material.getIsLiquid())
     {
         world.setBlockWithNotify(i, j, k, waterStill.blockID);
     }
 }
开发者ID:riverar,项目名称:Crafty,代码行数:8,代码来源:BlockIce.cs

示例5: onNeighborBlockChange

 public override void onNeighborBlockChange(World world, int i, int j, int k, int l)
 {
     base.onNeighborBlockChange(world, i, j, k, l);
     Material material = world.getBlockMaterial(i, j + 1, k);
     if (material.isSolid())
     {
         world.setBlockWithNotify(i, j, k, dirt.blockID);
     }
 }
开发者ID:riverar,项目名称:Crafty,代码行数:9,代码来源:BlockSoil.cs

示例6: onNeighborBlockChange

 public override void onNeighborBlockChange(World world, int i, int j, int k, int l)
 {
     bool flag = false;
     if (isFreestanding)
     {
         if (!world.getBlockMaterial(i, j - 1, k).isSolid())
         {
             flag = true;
         }
     }
     else
     {
         int i1 = world.getBlockMetadata(i, j, k);
         flag = true;
         if (i1 == 2 && world.getBlockMaterial(i, j, k + 1).isSolid())
         {
             flag = false;
         }
         if (i1 == 3 && world.getBlockMaterial(i, j, k - 1).isSolid())
         {
             flag = false;
         }
         if (i1 == 4 && world.getBlockMaterial(i + 1, j, k).isSolid())
         {
             flag = false;
         }
         if (i1 == 5 && world.getBlockMaterial(i - 1, j, k).isSolid())
         {
             flag = false;
         }
     }
     if (flag)
     {
         dropBlockAsItem(world, i, j, k, world.getBlockMetadata(i, j, k));
         world.setBlockWithNotify(i, j, k, 0);
     }
     base.onNeighborBlockChange(world, i, j, k, l);
 }
开发者ID:riverar,项目名称:Crafty,代码行数:38,代码来源:BlockSign.cs

示例7: canBlockStay

 public override bool canBlockStay(World world, int i, int j, int k)
 {
     if (world.getBlockMaterial(i - 1, j, k).isSolid())
     {
         return false;
     }
     if (world.getBlockMaterial(i + 1, j, k).isSolid())
     {
         return false;
     }
     if (world.getBlockMaterial(i, j, k - 1).isSolid())
     {
         return false;
     }
     if (world.getBlockMaterial(i, j, k + 1).isSolid())
     {
         return false;
     }
     else
     {
         int l = world.getBlockId(i, j - 1, k);
         return l == cactus.blockID || l == sand.blockID;
     }
 }
开发者ID:riverar,项目名称:Crafty,代码行数:24,代码来源:BlockCactus.cs

示例8: generate

        public override bool generate(World world, Random random, int i, int j, int k)
        {
            if (world.getBlockMaterial(i, j, k) != Material.water)
            {
                return false;
            }
            float f = random.nextFloat()*3.141593F;
            double d = (i + 8) + (MathHelper.sin(f)*numberOfBlocks)/8F;
            double d1 = (i + 8) - (MathHelper.sin(f)*numberOfBlocks)/8F;
            double d2 = (k + 8) + (MathHelper.cos(f)*numberOfBlocks)/8F;
            double d3 = (k + 8) - (MathHelper.cos(f)*numberOfBlocks)/8F;
            double d4 = j + random.nextInt(3) + 2;
            double d5 = j + random.nextInt(3) + 2;
            for (int l = 0; l <= numberOfBlocks; l++)
            {
                double d6 = d + ((d1 - d)*l)/numberOfBlocks;
                double d7 = d4 + ((d5 - d4)*l)/numberOfBlocks;
                double d8 = d2 + ((d3 - d2)*l)/numberOfBlocks;
                double d9 = (random.nextDouble()*numberOfBlocks)/16D;
                double d10 = (MathHelper.sin((l*3.141593F)/numberOfBlocks) + 1.0F)*d9 + 1.0D;
                double d11 = (MathHelper.sin((l*3.141593F)/numberOfBlocks) + 1.0F)*d9 + 1.0D;
                for (var i1 = (int) (d6 - d10/2D); i1 <= (int) (d6 + d10/2D); i1++)
                {
                    for (var j1 = (int) (d7 - d11/2D); j1 <= (int) (d7 + d11/2D); j1++)
                    {
                        for (var k1 = (int) (d8 - d10/2D); k1 <= (int) (d8 + d10/2D); k1++)
                        {
                            double d12 = ((i1 + 0.5D) - d6)/(d10/2D);
                            double d13 = ((j1 + 0.5D) - d7)/(d11/2D);
                            double d14 = ((k1 + 0.5D) - d8)/(d10/2D);
                            if (d12*d12 + d13*d13 + d14*d14 >= 1.0D)
                            {
                                continue;
                            }
                            int l1 = world.getBlockId(i1, j1, k1);
                            if (l1 == Block.sand.blockID)
                            {
                                world.setBlock(i1, j1, k1, clayBlockId);
                            }
                        }
                    }
                }
            }

            return true;
        }
开发者ID:riverar,项目名称:Crafty,代码行数:46,代码来源:WorldGenClay.cs

示例9: 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

示例10: generate

        public override bool generate(World world, Random random, int i, int j, int k)
        {
            byte byte0 = 3;
            int l = random.nextInt(2) + 2;
            int i1 = random.nextInt(2) + 2;
            int j1 = 0;
            for (int k1 = i - l - 1; k1 <= i + l + 1; k1++)
            {
                for (int j2 = j - 1; j2 <= j + byte0 + 1; j2++)
                {
                    for (int i3 = k - i1 - 1; i3 <= k + i1 + 1; i3++)
                    {
                        Material material = world.getBlockMaterial(k1, j2, i3);
                        if (j2 == j - 1 && !material.isSolid())
                        {
                            return false;
                        }
                        if (j2 == j + byte0 + 1 && !material.isSolid())
                        {
                            return false;
                        }
                        if ((k1 == i - l - 1 || k1 == i + l + 1 || i3 == k - i1 - 1 || i3 == k + i1 + 1) && j2 == j &&
                            world.isAirBlock(k1, j2, i3) && world.isAirBlock(k1, j2 + 1, i3))
                        {
                            j1++;
                        }
                    }
                }
            }

            if (j1 < 1 || j1 > 5)
            {
                return false;
            }
            for (int l1 = i - l - 1; l1 <= i + l + 1; l1++)
            {
                for (int k2 = j + byte0; k2 >= j - 1; k2--)
                {
                    for (int j3 = k - i1 - 1; j3 <= k + i1 + 1; j3++)
                    {
                        if (l1 == i - l - 1 || k2 == j - 1 || j3 == k - i1 - 1 || l1 == i + l + 1 || k2 == j + byte0 + 1 ||
                            j3 == k + i1 + 1)
                        {
                            if (k2 >= 0 && !world.getBlockMaterial(l1, k2 - 1, j3).isSolid())
                            {
                                world.setBlockWithNotify(l1, k2, j3, 0);
                                continue;
                            }
                            if (!world.getBlockMaterial(l1, k2, j3).isSolid())
                            {
                                continue;
                            }
                            if (k2 == j - 1 && random.nextInt(4) != 0)
                            {
                                world.setBlockWithNotify(l1, k2, j3, Block.cobblestoneMossy.blockID);
                            }
                            else
                            {
                                world.setBlockWithNotify(l1, k2, j3, Block.cobblestone.blockID);
                            }
                        }
                        else
                        {
                            world.setBlockWithNotify(l1, k2, j3, 0);
                        }
                    }
                }
            }

            for (int i2 = 0; i2 < 2; i2++)
            {
                for (int l2 = 0; l2 < 3; l2++)
                {
                    int k3 = (i + random.nextInt(l*2 + 1)) - l;
                    int l3 = j;
                    int i4 = (k + random.nextInt(i1*2 + 1)) - i1;
                    if (!world.isAirBlock(k3, l3, i4))
                    {
                        continue;
                    }
                    int j4 = 0;
                    if (world.getBlockMaterial(k3 - 1, l3, i4).isSolid())
                    {
                        j4++;
                    }
                    if (world.getBlockMaterial(k3 + 1, l3, i4).isSolid())
                    {
                        j4++;
                    }
                    if (world.getBlockMaterial(k3, l3, i4 - 1).isSolid())
                    {
                        j4++;
                    }
                    if (world.getBlockMaterial(k3, l3, i4 + 1).isSolid())
                    {
                        j4++;
                    }
                    if (j4 != 1)
                    {
                        continue;
//.........这里部分代码省略.........
开发者ID:riverar,项目名称:Crafty,代码行数:101,代码来源:WorldGenDungeons.cs

示例11: canBlockStay

 public override bool canBlockStay(World world, int i, int j, int k)
 {
     return world.getBlockMaterial(i, j - 1, k).isSolid();
 }
开发者ID:riverar,项目名称:Crafty,代码行数:4,代码来源:BlockCake.cs

示例12: onItemRightClick

 public override ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer entityplayer)
 {
     float f = 1.0F;
     float f1 = entityplayer.prevRotationPitch + (entityplayer.rotationPitch - entityplayer.prevRotationPitch)*f;
     float f2 = entityplayer.prevRotationYaw + (entityplayer.rotationYaw - entityplayer.prevRotationYaw)*f;
     double d = entityplayer.prevPosX + (entityplayer.posX - entityplayer.prevPosX)*f;
     double d1 = (entityplayer.prevPosY + (entityplayer.posY - entityplayer.prevPosY)*f +
                  1.6200000000000001D) - entityplayer.yOffset;
     double d2 = entityplayer.prevPosZ + (entityplayer.posZ - entityplayer.prevPosZ)*f;
     Vec3D vec3d = Vec3D.createVector(d, d1, d2);
     float f3 = MathHelper.cos(-f2*0.01745329F - 3.141593F);
     float f4 = MathHelper.sin(-f2*0.01745329F - 3.141593F);
     float f5 = -MathHelper.cos(-f1*0.01745329F);
     float f6 = MathHelper.sin(-f1*0.01745329F);
     float f7 = f4*f5;
     float f8 = f6;
     float f9 = f3*f5;
     double d3 = 5D;
     Vec3D vec3d1 = vec3d.addVector(f7*d3, f8*d3, f9*d3);
     MovingObjectPosition movingobjectposition = world.rayTraceBlocks_do(vec3d, vec3d1, isFull == 0);
     if (movingobjectposition == null)
     {
         return itemstack;
     }
     if (movingobjectposition.typeOfHit == EnumMovingObjectType.TILE)
     {
         int i = movingobjectposition.blockX;
         int j = movingobjectposition.blockY;
         int k = movingobjectposition.blockZ;
         if (!world.canMineBlock(entityplayer, i, j, k))
         {
             return itemstack;
         }
         if (isFull == 0)
         {
             if (world.getBlockMaterial(i, j, k) == Material.water && world.getBlockMetadata(i, j, k) == 0)
             {
                 world.setBlockWithNotify(i, j, k, 0);
                 return new ItemStack(bucketWater);
             }
             if (world.getBlockMaterial(i, j, k) == Material.lava && world.getBlockMetadata(i, j, k) == 0)
             {
                 world.setBlockWithNotify(i, j, k, 0);
                 return new ItemStack(bucketLava);
             }
         }
         else
         {
             if (isFull < 0)
             {
                 return new ItemStack(bucketEmpty);
             }
             if (movingobjectposition.sideHit == 0)
             {
                 j--;
             }
             if (movingobjectposition.sideHit == 1)
             {
                 j++;
             }
             if (movingobjectposition.sideHit == 2)
             {
                 k--;
             }
             if (movingobjectposition.sideHit == 3)
             {
                 k++;
             }
             if (movingobjectposition.sideHit == 4)
             {
                 i--;
             }
             if (movingobjectposition.sideHit == 5)
             {
                 i++;
             }
             if (world.isAirBlock(i, j, k) || !world.getBlockMaterial(i, j, k).isSolid())
             {
                 if (world.worldProvider.isHellWorld && isFull == Block.waterStill.blockID)
                 {
                     world.playSoundEffect(d + 0.5D, d1 + 0.5D, d2 + 0.5D, "random.fizz", 0.5F,
                                           2.6F + (world.rand.nextFloat() - world.rand.nextFloat())*0.8F);
                     for (int l = 0; l < 8; l++)
                     {
                         world.spawnParticle("largesmoke", i + Math.random(), j + Math.random(),
                                             k + Math.random(), 0.0D, 0.0D, 0.0D);
                     }
                 }
                 else
                 {
                     world.setBlockAndMetadataWithNotify(i, j, k, isFull, 0);
                 }
                 return new ItemStack(bucketEmpty);
             }
         }
     }
     else if (isFull == 0 && (movingobjectposition.entityHit is EntityCow))
     {
         return new ItemStack(bucketMilk);
     }
//.........这里部分代码省略.........
开发者ID:riverar,项目名称:Crafty,代码行数:101,代码来源:ItemBucket.cs

示例13: updateTick

 public override void updateTick(World world, int i, int j, int k, Random random)
 {
     int l = func_301_g(world, i, j, k);
     byte byte0 = 1;
     if (blockMaterial == Material.lava && !world.worldProvider.isHellWorld)
     {
         byte0 = 2;
     }
     bool flag = true;
     if (l > 0)
     {
         int i1 = -100;
         field_659_a = 0;
         i1 = func_307_e(world, i - 1, j, k, i1);
         i1 = func_307_e(world, i + 1, j, k, i1);
         i1 = func_307_e(world, i, j, k - 1, i1);
         i1 = func_307_e(world, i, j, k + 1, i1);
         int j1 = i1 + byte0;
         if (j1 >= 8 || i1 < 0)
         {
             j1 = -1;
         }
         if (func_301_g(world, i, j + 1, k) >= 0)
         {
             int l1 = func_301_g(world, i, j + 1, k);
             if (l1 >= 8)
             {
                 j1 = l1;
             }
             else
             {
                 j1 = l1 + 8;
             }
         }
         if (field_659_a >= 2 && blockMaterial == Material.water)
         {
             if (world.isBlockOpaqueCube(i, j - 1, k))
             {
                 j1 = 0;
             }
             else if (world.getBlockMaterial(i, j - 1, k) == blockMaterial && world.getBlockMetadata(i, j, k) == 0)
             {
                 j1 = 0;
             }
         }
         if (blockMaterial == Material.lava && l < 8 && j1 < 8 && j1 > l && random.nextInt(4) != 0)
         {
             j1 = l;
             flag = false;
         }
         if (j1 != l)
         {
             l = j1;
             if (l < 0)
             {
                 world.setBlockWithNotify(i, j, k, 0);
             }
             else
             {
                 world.setBlockMetadataWithNotify(i, j, k, l);
                 world.func_22074_c(i, j, k, blockID, tickRate());
                 world.notifyBlocksOfNeighborChange(i, j, k, blockID);
             }
         }
         else if (flag)
         {
             func_22024_i(world, i, j, k);
         }
     }
     else
     {
         func_22024_i(world, i, j, k);
     }
     if (func_312_l(world, i, j - 1, k))
     {
         if (l >= 8)
         {
             world.setBlockAndMetadataWithNotify(i, j - 1, k, blockID, l);
         }
         else
         {
             world.setBlockAndMetadataWithNotify(i, j - 1, k, blockID, l + 8);
         }
     }
     else if (l >= 0 && (l == 0 || func_309_k(world, i, j - 1, k)))
     {
         bool[] aflag = func_4035_j(world, i, j, k);
         int k1 = l + byte0;
         if (l >= 8)
         {
             k1 = 1;
         }
         if (k1 >= 8)
         {
             return;
         }
         if (aflag[0])
         {
             func_311_f(world, i - 1, j, k, k1);
         }
//.........这里部分代码省略.........
开发者ID:riverar,项目名称:Crafty,代码行数:101,代码来源:BlockFlowing.cs

示例14: performSpawning

        public static int performSpawning(World var0, bool var1, bool var2)
        {
            if (!var1 && !var2)
            {
                return 0;
            }
            else
            {
                eligibleChunksForSpawning.clear();

                int var3;
                int var6;
                for (var3 = 0; var3 < var0.playerEntities.size(); ++var3)
                {
                    var var4 = (EntityPlayer) var0.playerEntities.get(var3);
                    int var5 = MathHelper.floor_double(var4.posX/16.0D);
                    var6 = MathHelper.floor_double(var4.posZ/16.0D);
                    byte var7 = 8;

                    for (int var8 = -var7; var8 <= var7; ++var8)
                    {
                        for (int var9 = -var7; var9 <= var7; ++var9)
                        {
                            eligibleChunksForSpawning.add(new ChunkCoordIntPair(var8 + var5, var9 + var6));
                        }
                    }
                }

                var3 = 0;
                ChunkCoordinates var33 = var0.func_22078_l();
                EnumCreatureType[] var34 = EnumCreatureType.values();
                var6 = var34.Length;

                for (int var35 = 0; var35 < var6; ++var35)
                {
                    EnumCreatureType var36 = var34[var35];
                    if ((!var36.func_21103_d() || var2) && (var36.func_21103_d() || var1) &&
                        var0.countEntities(var36.getCreatureClass()) <=
                        var36.getMaxNumberOfCreature()*eligibleChunksForSpawning.size()/256)
                    {
                        Iterator var37 = eligibleChunksForSpawning.iterator();

                        while (var37.hasNext())
                        {
                            var var10 = (ChunkCoordIntPair) var37.next();
                            MobSpawnerBase var11 = var0.getWorldChunkManager().func_4066_a(var10);
                            Class[] var12 = var11.getEntitiesForType(var36);
                            if (var12 != null && var12.Length != 0)
                            {
                                int var13 = var0.rand.nextInt(var12.Length);
                                ChunkPosition var14 = getRandomSpawningPointInChunk(var0, var10.chunkXPos*16,
                                                                                    var10.chunkZPos*16);
                                int var15 = var14.x;
                                int var16 = var14.y;
                                int var17 = var14.z;
                                if (!var0.isBlockOpaqueCube(var15, var16, var17) &&
                                    var0.getBlockMaterial(var15, var16, var17) == var36.getCreatureMaterial())
                                {
                                    int var18 = 0;

                                    for (int var19 = 0; var19 < 3; ++var19)
                                    {
                                        int var20 = var15;
                                        int var21 = var16;
                                        int var22 = var17;
                                        byte var23 = 6;

                                        for (int var24 = 0; var24 < 4; ++var24)
                                        {
                                            var20 += var0.rand.nextInt(var23) - var0.rand.nextInt(var23);
                                            var21 += var0.rand.nextInt(1) - var0.rand.nextInt(1);
                                            var22 += var0.rand.nextInt(var23) - var0.rand.nextInt(var23);
                                            if (func_21167_a(var36, var0, var20, var21, var22))
                                            {
                                                float var25 = var20 + 0.5F;
                                                float var26 = var21;
                                                float var27 = var22 + 0.5F;
                                                if (
                                                    var0.getClosestPlayer(var25, var26, var27,
                                                                          24.0D) == null)
                                                {
                                                    float var28 = var25 - var33.posX;
                                                    float var29 = var26 - var33.posY;
                                                    float var30 = var27 - var33.posZ;
                                                    float var31 = var28*var28 + var29*var29 + var30*var30;
                                                    if (var31 >= 576.0F)
                                                    {
                                                        EntityLiving var38;
                                                        try
                                                        {
                                                            var38 =
                                                                (EntityLiving)
                                                                var12[var13].getConstructor(new Class[] {typeof (World)})
                                                                    .newInstance(new object[] {var0});
                                                        }
                                                        catch (Exception var32)
                                                        {
                                                            var32.printStackTrace();
                                                            return var3;
                                                        }
//.........这里部分代码省略.........
开发者ID:riverar,项目名称:Crafty,代码行数:101,代码来源:SpawnerAnimals.cs

示例15: func_4035_j

        private bool[] func_4035_j(World world, int i, int j, int k)
        {
            for (int l = 0; l < 4; l++)
            {
                field_660_c[l] = 1000;
                int j1 = i;
                int i2 = j;
                int j2 = k;
                if (l == 0)
                {
                    j1--;
                }
                if (l == 1)
                {
                    j1++;
                }
                if (l == 2)
                {
                    j2--;
                }
                if (l == 3)
                {
                    j2++;
                }
                if (func_309_k(world, j1, i2, j2) ||
                    world.getBlockMaterial(j1, i2, j2) == blockMaterial && world.getBlockMetadata(j1, i2, j2) == 0)
                {
                    continue;
                }
                if (!func_309_k(world, j1, i2 - 1, j2))
                {
                    field_660_c[l] = 0;
                }
                else
                {
                    field_660_c[l] = func_4034_a(world, j1, i2, j2, 1, l);
                }
            }

            int i1 = field_660_c[0];
            for (int k1 = 1; k1 < 4; k1++)
            {
                if (field_660_c[k1] < i1)
                {
                    i1 = field_660_c[k1];
                }
            }

            for (int l1 = 0; l1 < 4; l1++)
            {
                field_658_b[l1] = field_660_c[l1] == i1;
            }

            return field_658_b;
        }
开发者ID:riverar,项目名称:Crafty,代码行数:55,代码来源:BlockFlowing.cs


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