本文整理汇总了C#中CraftyServer.Core.World.isAirBlock方法的典型用法代码示例。如果您正苦于以下问题:C# World.isAirBlock方法的具体用法?C# World.isAirBlock怎么用?C# World.isAirBlock使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CraftyServer.Core.World
的用法示例。
在下文中一共展示了World.isAirBlock方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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;
}
示例2: 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;
}
示例3: 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;
}
示例4: 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) &&
(Block.blocksList[plantBlockId]).canBlockStay(world, i1, j1, k1))
{
world.setBlock(i1, j1, k1, plantBlockId);
}
}
return true;
}
示例5: generate
public override bool generate(World world, Random random, int i, int j, int k)
{
for (int l = 0; l < 10; 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))
{
continue;
}
int l1 = 1 + random.nextInt(random.nextInt(3) + 1);
for (int i2 = 0; i2 < l1; i2++)
{
if (Block.cactus.canBlockStay(world, i1, j1 + i2, k1))
{
world.setBlock(i1, j1 + i2, k1, Block.cactus.blockID);
}
}
}
return true;
}
示例6: 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);
}
}
}
}
示例7: 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;
//.........这里部分代码省略.........
示例8: 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++)
{
//.........这里部分代码省略.........
示例9: generate
public override bool generate(World world, Random random, int i, int j, int k)
{
if (world.getBlockId(i, j + 1, k) != Block.bloodStone.blockID)
{
return false;
}
if (world.getBlockId(i, j, k) != 0 && world.getBlockId(i, j, k) != Block.bloodStone.blockID)
{
return false;
}
int l = 0;
if (world.getBlockId(i - 1, j, k) == Block.bloodStone.blockID)
{
l++;
}
if (world.getBlockId(i + 1, j, k) == Block.bloodStone.blockID)
{
l++;
}
if (world.getBlockId(i, j, k - 1) == Block.bloodStone.blockID)
{
l++;
}
if (world.getBlockId(i, j, k + 1) == Block.bloodStone.blockID)
{
l++;
}
if (world.getBlockId(i, j - 1, k) == Block.bloodStone.blockID)
{
l++;
}
int i1 = 0;
if (world.isAirBlock(i - 1, j, k))
{
i1++;
}
if (world.isAirBlock(i + 1, j, k))
{
i1++;
}
if (world.isAirBlock(i, j, k - 1))
{
i1++;
}
if (world.isAirBlock(i, j, k + 1))
{
i1++;
}
if (world.isAirBlock(i, j - 1, k))
{
i1++;
}
if (l == 4 && i1 == 1)
{
world.setBlockWithNotify(i, j, k, field_4250_a);
world.scheduledUpdatesAreImmediate = true;
Block.blocksList[field_4250_a].updateTick(world, i, j, k, random);
world.scheduledUpdatesAreImmediate = false;
}
return true;
}
示例10: 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);
}
//.........这里部分代码省略.........
示例11: generate
public override bool generate(World world, Random random, int i, int j, int k)
{
if (!world.isAirBlock(i, j, k))
{
return false;
}
if (world.getBlockId(i, j + 1, k) != Block.bloodStone.blockID)
{
return false;
}
world.setBlockWithNotify(i, j, k, Block.lightStone.blockID);
for (int l = 0; l < 1500; l++)
{
int i1 = (i + random.nextInt(8)) - random.nextInt(8);
int j1 = j - random.nextInt(12);
int k1 = (k + random.nextInt(8)) - random.nextInt(8);
if (world.getBlockId(i1, j1, k1) != 0)
{
continue;
}
int l1 = 0;
for (int i2 = 0; i2 < 6; i2++)
{
int j2 = 0;
if (i2 == 0)
{
j2 = world.getBlockId(i1 - 1, j1, k1);
}
if (i2 == 1)
{
j2 = world.getBlockId(i1 + 1, j1, k1);
}
if (i2 == 2)
{
j2 = world.getBlockId(i1, j1 - 1, k1);
}
if (i2 == 3)
{
j2 = world.getBlockId(i1, j1 + 1, k1);
}
if (i2 == 4)
{
j2 = world.getBlockId(i1, j1, k1 - 1);
}
if (i2 == 5)
{
j2 = world.getBlockId(i1, j1, k1 + 1);
}
if (j2 == Block.lightStone.blockID)
{
l1++;
}
}
if (l1 == 1)
{
world.setBlockWithNotify(i1, j1, k1, Block.lightStone.blockID);
}
}
return true;
}