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


C# World.getBlockId方法代码示例

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


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

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

示例2: onBlockRemoval

 public override void onBlockRemoval(World world, int i, int j, int k)
 {
     byte byte0 = 4;
     int l = byte0 + 1;
     if (world.checkChunksExist(i - l, j - l, k - l, i + l, j + l, k + l))
     {
         for (int i1 = -byte0; i1 <= byte0; i1++)
         {
             for (int j1 = -byte0; j1 <= byte0; j1++)
             {
                 for (int k1 = -byte0; k1 <= byte0; k1++)
                 {
                     int l1 = world.getBlockId(i + i1, j + j1, k + k1);
                     if (l1 != leaves.blockID)
                     {
                         continue;
                     }
                     int i2 = world.getBlockMetadata(i + i1, j + j1, k + k1);
                     if ((i2 & 4) == 0)
                     {
                         world.setBlockMetadata(i + i1, j + j1, k + k1, i2 | 4);
                     }
                 }
             }
         }
     }
 }
开发者ID:riverar,项目名称:Crafty,代码行数:27,代码来源:BlockLog.cs

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

示例4: onBlockAdded

 public override void onBlockAdded(World world, int i, int j, int k)
 {
     base.onBlockAdded(world, i, j, k);
     if (world.getBlockId(i, j, k) == blockID)
     {
         world.func_22074_c(i, j, k, blockID, tickRate());
     }
 }
开发者ID:riverar,项目名称:Crafty,代码行数:8,代码来源:BlockFlowing.cs

示例5: Packet53BlockChange

 public Packet53BlockChange(int i, int j, int k, World world)
 {
     isChunkDataPacket = true;
     xPosition = i;
     yPosition = j;
     zPosition = k;
     type = world.getBlockId(i, j, k);
     metadata = world.getBlockMetadata(i, j, k);
 }
开发者ID:riverar,项目名称:Crafty,代码行数:9,代码来源:Packet53BlockChange.cs

示例6: blockActivated

 public override bool blockActivated(World world, int i, int j, int k, EntityPlayer entityplayer)
 {
     object obj = world.getBlockTileEntity(i, j, k);
     if (world.isBlockOpaqueCube(i, j + 1, k))
     {
         return true;
     }
     if (world.getBlockId(i - 1, j, k) == blockID && world.isBlockOpaqueCube(i - 1, j + 1, k))
     {
         return true;
     }
     if (world.getBlockId(i + 1, j, k) == blockID && world.isBlockOpaqueCube(i + 1, j + 1, k))
     {
         return true;
     }
     if (world.getBlockId(i, j, k - 1) == blockID && world.isBlockOpaqueCube(i, j + 1, k - 1))
     {
         return true;
     }
     if (world.getBlockId(i, j, k + 1) == blockID && world.isBlockOpaqueCube(i, j + 1, k + 1))
     {
         return true;
     }
     if (world.getBlockId(i - 1, j, k) == blockID)
     {
         obj = new InventoryLargeChest("Large chest", (TileEntityChest) world.getBlockTileEntity(i - 1, j, k),
                                       ((IInventory) (obj)));
     }
     if (world.getBlockId(i + 1, j, k) == blockID)
     {
         obj = new InventoryLargeChest("Large chest", ((IInventory) (obj)),
                                       (TileEntityChest) world.getBlockTileEntity(i + 1, j, k));
     }
     if (world.getBlockId(i, j, k - 1) == blockID)
     {
         obj = new InventoryLargeChest("Large chest", (TileEntityChest) world.getBlockTileEntity(i, j, k - 1),
                                       ((IInventory) (obj)));
     }
     if (world.getBlockId(i, j, k + 1) == blockID)
     {
         obj = new InventoryLargeChest("Large chest", ((IInventory) (obj)),
                                       (TileEntityChest) world.getBlockTileEntity(i, j, k + 1));
     }
     if (world.singleplayerWorld)
     {
         return true;
     }
     else
     {
         entityplayer.displayGUIChest(((IInventory) (obj)));
         return true;
     }
 }
开发者ID:riverar,项目名称:Crafty,代码行数:53,代码来源:BlockChest.cs

示例7: generate

        public override bool generate(World world, Random random, int i, int j, int k)
        {
            for (int l = 0; l < 64; l++)
            {
                int i1 = (i + random.nextInt(8)) - random.nextInt(8);
                int j1 = (j + random.nextInt(4)) - random.nextInt(4);
                int k1 = (k + random.nextInt(8)) - random.nextInt(8);
                if (world.isAirBlock(i1, j1, k1) && world.getBlockId(i1, j1 - 1, k1) == Block.bloodStone.blockID)
                {
                    world.setBlockWithNotify(i1, j1, k1, Block.fire.blockID);
                }
            }

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

示例8: generate

        public override bool generate(World world, Random random, int i, int j, int k)
        {
            for (int l = 0; l < 64; l++)
            {
                int i1 = (i + random.nextInt(8)) - random.nextInt(8);
                int j1 = (j + random.nextInt(4)) - random.nextInt(4);
                int k1 = (k + random.nextInt(8)) - random.nextInt(8);
                if (world.isAirBlock(i1, j1, k1) && world.getBlockId(i1, j1 - 1, k1) == Block.grass.blockID &&
                    Block.pumpkin.canPlaceBlockAt(world, i1, j1, k1))
                {
                    world.setBlockAndMetadata(i1, j1, k1, Block.pumpkin.blockID, random.nextInt(4));
                }
            }

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

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

示例10: onBlockAdded

 public override void onBlockAdded(World world, int i, int j, int k)
 {
     if (this != stairSingle)
     {
         base.onBlockAdded(world, i, j, k);
     }
     int l = world.getBlockId(i, j - 1, k);
     int i1 = world.getBlockMetadata(i, j, k);
     int j1 = world.getBlockMetadata(i, j - 1, k);
     if (i1 != j1)
     {
         return;
     }
     if (l == stairSingle.blockID)
     {
         world.setBlockWithNotify(i, j, k, 0);
         world.setBlockAndMetadataWithNotify(i, j - 1, k, stairDouble.blockID, i1);
     }
 }
开发者ID:riverar,项目名称:Crafty,代码行数:19,代码来源:BlockStep.cs

示例11: updateTick

 public override void updateTick(World world, int i, int j, int k, Random random)
 {
     if (world.isAirBlock(i, j + 1, k))
     {
         int l;
         for (l = 1; world.getBlockId(i, j - l, k) == blockID; l++)
         {
         }
         if (l < 3)
         {
             int i1 = world.getBlockMetadata(i, j, k);
             if (i1 == 15)
             {
                 world.setBlockWithNotify(i, j + 1, k, blockID);
                 world.setBlockMetadataWithNotify(i, j, k, 0);
             }
             else
             {
                 world.setBlockMetadataWithNotify(i, j, k, i1 + 1);
             }
         }
     }
 }
开发者ID:riverar,项目名称:Crafty,代码行数:23,代码来源:BlockReed.cs

示例12: canPlaceBlockAt

 public override bool canPlaceBlockAt(World world, int i, int j, int k)
 {
     int l = 0;
     if (world.getBlockId(i - 1, j, k) == blockID)
     {
         l++;
     }
     if (world.getBlockId(i + 1, j, k) == blockID)
     {
         l++;
     }
     if (world.getBlockId(i, j, k - 1) == blockID)
     {
         l++;
     }
     if (world.getBlockId(i, j, k + 1) == blockID)
     {
         l++;
     }
     if (l > 1)
     {
         return false;
     }
     if (isThereANeighborChest(world, i - 1, j, k))
     {
         return false;
     }
     if (isThereANeighborChest(world, i + 1, j, k))
     {
         return false;
     }
     if (isThereANeighborChest(world, i, j, k - 1))
     {
         return false;
     }
     return !isThereANeighborChest(world, i, j, k + 1);
 }
开发者ID:riverar,项目名称:Crafty,代码行数:37,代码来源:BlockChest.cs

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

示例14: notifyWireNeighborsOfNeighborChange

 private void notifyWireNeighborsOfNeighborChange(World world, int i, int j, int k)
 {
     if (world.getBlockId(i, j, k) != blockID)
     {
         return;
     }
     else
     {
         world.notifyBlocksOfNeighborChange(i, j, k, blockID);
         world.notifyBlocksOfNeighborChange(i - 1, j, k, blockID);
         world.notifyBlocksOfNeighborChange(i + 1, j, k, blockID);
         world.notifyBlocksOfNeighborChange(i, j, k - 1, blockID);
         world.notifyBlocksOfNeighborChange(i, j, k + 1, blockID);
         world.notifyBlocksOfNeighborChange(i, j - 1, k, blockID);
         world.notifyBlocksOfNeighborChange(i, j + 1, k, blockID);
         return;
     }
 }
开发者ID:riverar,项目名称:Crafty,代码行数:18,代码来源:BlockRedstoneWire.cs

示例15: isThereANeighborChest

 private bool isThereANeighborChest(World world, int i, int j, int k)
 {
     if (world.getBlockId(i, j, k) != blockID)
     {
         return false;
     }
     if (world.getBlockId(i - 1, j, k) == blockID)
     {
         return true;
     }
     if (world.getBlockId(i + 1, j, k) == blockID)
     {
         return true;
     }
     if (world.getBlockId(i, j, k - 1) == blockID)
     {
         return true;
     }
     return world.getBlockId(i, j, k + 1) == blockID;
 }
开发者ID:riverar,项目名称:Crafty,代码行数:20,代码来源:BlockChest.cs


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