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


C# World.isBlockOpaqueCube方法代码示例

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


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

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

示例2: canPlaceBlockAt

 public override bool canPlaceBlockAt(World world, int i, int j, int k)
 {
     if (world.isBlockOpaqueCube(i - 1, j, k))
     {
         return true;
     }
     if (world.isBlockOpaqueCube(i + 1, j, k))
     {
         return true;
     }
     if (world.isBlockOpaqueCube(i, j, k - 1))
     {
         return true;
     }
     return world.isBlockOpaqueCube(i, j, k + 1);
 }
开发者ID:riverar,项目名称:Crafty,代码行数:16,代码来源:BlockLadder.cs

示例3: canPlaceBlockAt

 public override bool canPlaceBlockAt(World world, int i, int j, int k)
 {
     if (!world.isBlockOpaqueCube(i, j - 1, k))
     {
         return false;
     }
     else
     {
         return base.canPlaceBlockAt(world, i, j, k);
     }
 }
开发者ID:riverar,项目名称:Crafty,代码行数:11,代码来源:BlockRedstoneRepeater.cs

示例4: onBlockPlaced

 public override void onBlockPlaced(World world, int i, int j, int k, int l)
 {
     int i1 = world.getBlockMetadata(i, j, k);
     if ((i1 == 0 || l == 2) && world.isBlockOpaqueCube(i, j, k + 1))
     {
         i1 = 2;
     }
     if ((i1 == 0 || l == 3) && world.isBlockOpaqueCube(i, j, k - 1))
     {
         i1 = 3;
     }
     if ((i1 == 0 || l == 4) && world.isBlockOpaqueCube(i + 1, j, k))
     {
         i1 = 4;
     }
     if ((i1 == 0 || l == 5) && world.isBlockOpaqueCube(i - 1, j, k))
     {
         i1 = 5;
     }
     world.setBlockMetadataWithNotify(i, j, k, i1);
 }
开发者ID:riverar,项目名称:Crafty,代码行数:21,代码来源:BlockLadder.cs

示例5: func_320_h

 private void func_320_h(World world, int i, int j, int k)
 {
     Random random = world.rand;
     double d = 0.0625D;
     for (int l = 0; l < 6; l++)
     {
         double d1 = i + random.nextFloat();
         double d2 = j + random.nextFloat();
         double d3 = k + random.nextFloat();
         if (l == 0 && !world.isBlockOpaqueCube(i, j + 1, k))
         {
             d2 = (j + 1) + d;
         }
         if (l == 1 && !world.isBlockOpaqueCube(i, j - 1, k))
         {
             d2 = (j + 0) - d;
         }
         if (l == 2 && !world.isBlockOpaqueCube(i, j, k + 1))
         {
             d3 = (k + 1) + d;
         }
         if (l == 3 && !world.isBlockOpaqueCube(i, j, k - 1))
         {
             d3 = (k + 0) - d;
         }
         if (l == 4 && !world.isBlockOpaqueCube(i + 1, j, k))
         {
             d1 = (i + 1) + d;
         }
         if (l == 5 && !world.isBlockOpaqueCube(i - 1, j, k))
         {
             d1 = (i + 0) - d;
         }
         if (d1 < i || d1 > (i + 1) || d2 < 0.0D || d2 > (j + 1) || d3 < k ||
             d3 > (k + 1))
         {
             world.spawnParticle("reddust", d1, d2, d3, 0.0D, 0.0D, 0.0D);
         }
     }
 }
开发者ID:riverar,项目名称:Crafty,代码行数:40,代码来源:BlockRedstoneOre.cs

示例6: onNeighborBlockChange

 public override void onNeighborBlockChange(World world, int i, int j, int k, int l)
 {
     if (world.singleplayerWorld)
     {
         return;
     }
     int i1 = world.getBlockMetadata(i, j, k);
     bool flag = false;
     if (!world.isBlockOpaqueCube(i, j - 1, k))
     {
         flag = true;
     }
     if (i1 == 2 && !world.isBlockOpaqueCube(i + 1, j, k))
     {
         flag = true;
     }
     if (i1 == 3 && !world.isBlockOpaqueCube(i - 1, j, k))
     {
         flag = true;
     }
     if (i1 == 4 && !world.isBlockOpaqueCube(i, j, k - 1))
     {
         flag = true;
     }
     if (i1 == 5 && !world.isBlockOpaqueCube(i, j, k + 1))
     {
         flag = true;
     }
     if (flag)
     {
         dropBlockAsItem(world, i, j, k, world.getBlockMetadata(i, j, k));
         world.setBlockWithNotify(i, j, k, 0);
     }
     else if (l > 0 && blocksList[l].canProvidePower() &&
              MinecartTrackLogic.getNAdjacentTracks(new MinecartTrackLogic(this, world, i, j, k)) == 3)
     {
         func_4038_g(world, i, j, k);
     }
 }
开发者ID:riverar,项目名称:Crafty,代码行数:39,代码来源:BlockMinecartTrack.cs

示例7: onBlockAdded

 public override void onBlockAdded(World world, int i, int j, int k)
 {
     if (world.isBlockOpaqueCube(i - 1, j, k))
     {
         world.setBlockMetadataWithNotify(i, j, k, 1);
     }
     else if (world.isBlockOpaqueCube(i + 1, j, k))
     {
         world.setBlockMetadataWithNotify(i, j, k, 2);
     }
     else if (world.isBlockOpaqueCube(i, j, k - 1))
     {
         world.setBlockMetadataWithNotify(i, j, k, 3);
     }
     else if (world.isBlockOpaqueCube(i, j, k + 1))
     {
         world.setBlockMetadataWithNotify(i, j, k, 4);
     }
     else if (world.isBlockOpaqueCube(i, j - 1, k))
     {
         world.setBlockMetadataWithNotify(i, j, k, 5);
     }
     dropTorchIfCantStay(world, i, j, k);
 }
开发者ID:riverar,项目名称:Crafty,代码行数:24,代码来源:BlockTorch.cs

示例8: onNeighborBlockChange

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

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

示例10: onNeighborBlockChange

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

示例11: onBlockPlaced

 public override void onBlockPlaced(World world, int i, int j, int k, int l)
 {
     int i1 = world.getBlockMetadata(i, j, k);
     int j1 = i1 & 8;
     i1 &= 7;
     if (l == 2 && world.isBlockOpaqueCube(i, j, k + 1))
     {
         i1 = 4;
     }
     else if (l == 3 && world.isBlockOpaqueCube(i, j, k - 1))
     {
         i1 = 3;
     }
     else if (l == 4 && world.isBlockOpaqueCube(i + 1, j, k))
     {
         i1 = 2;
     }
     else if (l == 5 && world.isBlockOpaqueCube(i - 1, j, k))
     {
         i1 = 1;
     }
     else
     {
         i1 = func_22026_g(world, i, j, k);
     }
     world.setBlockMetadataWithNotify(i, j, k, i1 + j1);
 }
开发者ID:riverar,项目名称:Crafty,代码行数:27,代码来源:BlockButton.cs

示例12: func_22026_g

 private int func_22026_g(World world, int i, int j, int k)
 {
     if (world.isBlockOpaqueCube(i - 1, j, k))
     {
         return 1;
     }
     if (world.isBlockOpaqueCube(i + 1, j, k))
     {
         return 2;
     }
     if (world.isBlockOpaqueCube(i, j, k - 1))
     {
         return 3;
     }
     return !world.isBlockOpaqueCube(i, j, k + 1) ? 1 : 4;
 }
开发者ID:riverar,项目名称:Crafty,代码行数:16,代码来源:BlockButton.cs

示例13: func_21167_a

 private static bool func_21167_a(EnumCreatureType enumcreaturetype, World world, int i, int j, int k)
 {
     if (enumcreaturetype.getCreatureMaterial() == Material.water)
     {
         return world.getBlockMaterial(i, j, k).getIsLiquid() && !world.isBlockOpaqueCube(i, j + 1, k);
     }
     else
     {
         return world.isBlockOpaqueCube(i, j - 1, k) && !world.isBlockOpaqueCube(i, j, k) &&
                !world.getBlockMaterial(i, j, k).getIsLiquid() && !world.isBlockOpaqueCube(i, j + 1, k);
     }
 }
开发者ID:riverar,项目名称:Crafty,代码行数:12,代码来源:SpawnerAnimals.cs

示例14: performSleepSpawning

 public static bool performSleepSpawning(World world, List list)
 {
     bool flag = false;
     var pathfinder = new Pathfinder(world);
     Iterator iterator = list.iterator();
     do
     {
         if (!iterator.hasNext())
         {
             break;
         }
         var entityplayer = (EntityPlayer) iterator.next();
         Class[] aclass = field_22213_a;
         if (aclass != null && aclass.Length != 0)
         {
             bool flag1 = false;
             int i = 0;
             while (i < 20 && !flag1)
             {
                 int j = (MathHelper.floor_double(entityplayer.posX) + world.rand.nextInt(32)) -
                         world.rand.nextInt(32);
                 int k = (MathHelper.floor_double(entityplayer.posZ) + world.rand.nextInt(32)) -
                         world.rand.nextInt(32);
                 int l = (MathHelper.floor_double(entityplayer.posY) + world.rand.nextInt(16)) -
                         world.rand.nextInt(16);
                 if (l < 1)
                 {
                     l = 1;
                 }
                 else if (l > 128)
                 {
                     l = 128;
                 }
                 int i1 = world.rand.nextInt(aclass.Length);
                 int j1;
                 for (j1 = l; j1 > 2 && !world.isBlockOpaqueCube(j, j1 - 1, k); j1--)
                 {
                 }
                 for (;
                     !func_21167_a(EnumCreatureType.monster, world, j, j1, k) && j1 < l + 16 && j1 < 128;
                     j1++)
                 {
                 }
                 if (j1 >= l + 16 || j1 >= 128)
                 {
                     j1 = l;
                 }
                 else
                 {
                     float f = j + 0.5F;
                     float f1 = j1;
                     float f2 = k + 0.5F;
                     EntityLiving entityliving;
                     try
                     {
                         entityliving = (EntityLiving) aclass[i1].getConstructor(new Class[]
                                                                                 {
                                                                                     typeof (World)
                                                                                 }).newInstance(new object[]
                                                                                                {
                                                                                                    world
                                                                                                });
                     }
                     catch (Exception exception)
                     {
                         exception.printStackTrace();
                         return flag;
                     }
                     entityliving.setLocationAndAngles(f, f1, f2, world.rand.nextFloat()*360F, 0.0F);
                     if (entityliving.getCanSpawnHere())
                     {
                         PathEntity pathentity = pathfinder.createEntityPathTo(entityliving, entityplayer, 32F);
                         if (pathentity != null && pathentity.pathLength > 1)
                         {
                             PathPoint pathpoint = pathentity.func_22211_c();
                             if (Math.abs(pathpoint.xCoord - entityplayer.posX) < 1.5D &&
                                 Math.abs(pathpoint.zCoord - entityplayer.posZ) < 1.5D &&
                                 Math.abs(pathpoint.yCoord - entityplayer.posY) < 1.5D)
                             {
                                 ChunkCoordinates chunkcoordinates = BlockBed.func_22021_g(world,
                                                                                           MathHelper.
                                                                                               floor_double(
                                                                                                   entityplayer.
                                                                                                       posX),
                                                                                           MathHelper.
                                                                                               floor_double(
                                                                                                   entityplayer.
                                                                                                       posY),
                                                                                           MathHelper.
                                                                                               floor_double(
                                                                                                   entityplayer.
                                                                                                       posZ), 1);
                                 entityliving.setLocationAndAngles(chunkcoordinates.posX + 0.5F,
                                                                   chunkcoordinates.posY,
                                                                   chunkcoordinates.posZ + 0.5F, 0.0F,
                                                                   0.0F);
                                 world.entityJoinedWorld(entityliving);
                                 func_21166_a(entityliving, world, chunkcoordinates.posX + 0.5F,
                                              chunkcoordinates.posY, chunkcoordinates.posZ + 0.5F);
                                 entityplayer.wakeUpPlayer(true, false);
//.........这里部分代码省略.........
开发者ID:riverar,项目名称:Crafty,代码行数:101,代码来源:SpawnerAnimals.cs

示例15: func_21031_a

        private void func_21031_a(World world, int i, int j, int k, int l, int i1, int j1)
        {
            int k1 = world.getBlockMetadata(i, j, k);
            int l1 = 0;
            wiresProvidePower = false;
            bool flag = world.isBlockIndirectlyGettingPowered(i, j, k);
            wiresProvidePower = true;
            if (flag)
            {
                l1 = 15;
            }
            else
            {
                for (int i2 = 0; i2 < 4; i2++)
                {
                    int k2 = i;
                    int i3 = k;
                    if (i2 == 0)
                    {
                        k2--;
                    }
                    if (i2 == 1)
                    {
                        k2++;
                    }
                    if (i2 == 2)
                    {
                        i3--;
                    }
                    if (i2 == 3)
                    {
                        i3++;
                    }
                    if (k2 != l || j != i1 || i3 != j1)
                    {
                        l1 = getMaxCurrentStrength(world, k2, j, i3, l1);
                    }
                    if (world.isBlockOpaqueCube(k2, j, i3) && !world.isBlockOpaqueCube(i, j + 1, k))
                    {
                        if (k2 != l || j + 1 != i1 || i3 != j1)
                        {
                            l1 = getMaxCurrentStrength(world, k2, j + 1, i3, l1);
                        }
                        continue;
                    }
                    if (!world.isBlockOpaqueCube(k2, j, i3) && (k2 != l || j - 1 != i1 || i3 != j1))
                    {
                        l1 = getMaxCurrentStrength(world, k2, j - 1, i3, l1);
                    }
                }

                if (l1 > 0)
                {
                    l1--;
                }
                else
                {
                    l1 = 0;
                }
            }
            if (k1 != l1)
            {
                world.editingBlocks = true;
                world.setBlockMetadataWithNotify(i, j, k, l1);
                world.markBlocksDirty(i, j, k, i, j, k);
                world.editingBlocks = false;
                for (int j2 = 0; j2 < 4; j2++)
                {
                    int l2 = i;
                    int j3 = k;
                    int k3 = j - 1;
                    if (j2 == 0)
                    {
                        l2--;
                    }
                    if (j2 == 1)
                    {
                        l2++;
                    }
                    if (j2 == 2)
                    {
                        j3--;
                    }
                    if (j2 == 3)
                    {
                        j3++;
                    }
                    if (world.isBlockOpaqueCube(l2, j, j3))
                    {
                        k3 += 2;
                    }
                    int l3 = 0;
                    l3 = getMaxCurrentStrength(world, l2, j, j3, -1);
                    l1 = world.getBlockMetadata(i, j, k);
                    if (l1 > 0)
                    {
                        l1--;
                    }
                    if (l3 >= 0 && l3 != l1)
                    {
//.........这里部分代码省略.........
开发者ID:riverar,项目名称:Crafty,代码行数:101,代码来源:BlockRedstoneWire.cs


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