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


C# World.setBlockAndMetadataWithNotify方法代码示例

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


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

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

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

示例3: func_311_f

 private void func_311_f(World world, int i, int j, int k, int l)
 {
     if (func_312_l(world, i, j, k))
     {
         int i1 = world.getBlockId(i, j, k);
         if (i1 > 0)
         {
             if (blockMaterial == Material.lava)
             {
                 func_300_h(world, i, j, k);
             }
             else
             {
                 blocksList[i1].dropBlockAsItem(world, i, j, k, world.getBlockMetadata(i, j, k));
             }
         }
         world.setBlockAndMetadataWithNotify(i, j, k, blockID, l);
     }
 }
开发者ID:riverar,项目名称:Crafty,代码行数:19,代码来源:BlockFlowing.cs

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

示例5: updateTick

 public override void updateTick(World world, int i, int j, int k, Random random)
 {
     bool flag = func_22016_g(world, i, j, k);
     for (;
         torchUpdates.size() > 0 &&
         world.getWorldTime() - ((RedstoneUpdateInfo) torchUpdates.get(0)).updateTime > 100L;
         torchUpdates.remove(0))
     {
     }
     if (torchActive)
     {
         if (flag)
         {
             world.setBlockAndMetadataWithNotify(i, j, k, torchRedstoneIdle.blockID,
                                                 world.getBlockMetadata(i, j, k));
             if (checkForBurnout(world, i, j, k, true))
             {
                 world.playSoundEffect(i + 0.5F, j + 0.5F, k + 0.5F, "random.fizz", 0.5F,
                                       2.6F + (world.rand.nextFloat() - world.rand.nextFloat())*0.8F);
                 for (int l = 0; l < 5; l++)
                 {
                     double d = i + random.nextDouble()*0.59999999999999998D + 0.20000000000000001D;
                     double d1 = j + random.nextDouble()*0.59999999999999998D + 0.20000000000000001D;
                     double d2 = k + random.nextDouble()*0.59999999999999998D + 0.20000000000000001D;
                     world.spawnParticle("smoke", d, d1, d2, 0.0D, 0.0D, 0.0D);
                 }
             }
         }
     }
     else if (!flag && !checkForBurnout(world, i, j, k, false))
     {
         world.setBlockAndMetadataWithNotify(i, j, k, torchRedstoneActive.blockID,
                                             world.getBlockMetadata(i, j, k));
     }
 }
开发者ID:riverar,项目名称:Crafty,代码行数:35,代码来源:BlockRedstoneTorch.cs

示例6: updateTick

 public override void updateTick(World world, int i, int j, int k, Random random)
 {
     int l = world.getBlockMetadata(i, j, k);
     bool flag = func_22012_g(world, i, j, k, l);
     if (field_22015_c && !flag)
     {
         world.setBlockAndMetadataWithNotify(i, j, k, field_22011_bh.blockID, l);
     }
     else if (!field_22015_c)
     {
         world.setBlockAndMetadataWithNotify(i, j, k, field_22010_bi.blockID, l);
         if (!flag)
         {
             int i1 = (l & 0xc) >> 2;
             world.func_22074_c(i, j, k, field_22010_bi.blockID, field_22013_b[i1]*2);
         }
     }
 }
开发者ID:riverar,项目名称:Crafty,代码行数:18,代码来源:BlockRedstoneRepeater.cs


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