本文整理汇总了C#中CraftyServer.Core.World.setBlockAndMetadata方法的典型用法代码示例。如果您正苦于以下问题:C# World.setBlockAndMetadata方法的具体用法?C# World.setBlockAndMetadata怎么用?C# World.setBlockAndMetadata使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CraftyServer.Core.World
的用法示例。
在下文中一共展示了World.setBlockAndMetadata方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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;
}
示例2: generate
public override bool generate(World world, Random random, int i, int j, int k)
{
int l = random.nextInt(5) + 7;
int i1 = l - random.nextInt(2) - 3;
int j1 = l - i1;
int k1 = 1 + random.nextInt(j1 + 1);
bool flag = true;
if (j < 1 || j + l + 1 > 128)
{
return false;
}
for (int l1 = j; l1 <= j + 1 + l && flag; l1++)
{
int j2 = 1;
if (l1 - j < i1)
{
j2 = 0;
}
else
{
j2 = k1;
}
for (int l2 = i - j2; l2 <= i + j2 && flag; l2++)
{
for (int k3 = k - j2; k3 <= k + j2 && flag; k3++)
{
if (l1 >= 0 && l1 < 128)
{
int j4 = world.getBlockId(l2, l1, k3);
if (j4 != 0 && j4 != Block.leaves.blockID)
{
flag = false;
}
}
else
{
flag = false;
}
}
}
}
if (!flag)
{
return false;
}
int i2 = world.getBlockId(i, j - 1, k);
if (i2 != Block.grass.blockID && i2 != Block.dirt.blockID || j >= 128 - l - 1)
{
return false;
}
world.setBlock(i, j - 1, k, Block.dirt.blockID);
int k2 = 0;
for (int i3 = j + l; i3 >= j + i1; i3--)
{
for (int l3 = i - k2; l3 <= i + k2; l3++)
{
int k4 = l3 - i;
for (int l4 = k - k2; l4 <= k + k2; l4++)
{
int i5 = l4 - k;
if ((Math.abs(k4) != k2 || Math.abs(i5) != k2 || k2 <= 0) &&
!Block.opaqueCubeLookup[world.getBlockId(l3, i3, l4)])
{
world.setBlockAndMetadata(l3, i3, l4, Block.leaves.blockID, 1);
}
}
}
if (k2 >= 1 && i3 == j + i1 + 1)
{
k2--;
continue;
}
if (k2 < k1)
{
k2++;
}
}
for (int j3 = 0; j3 < l - 1; j3++)
{
int i4 = world.getBlockId(i, j + j3, k);
if (i4 == 0 || i4 == Block.leaves.blockID)
{
world.setBlockAndMetadata(i, j + j3, k, Block.wood.blockID, 1);
}
}
return true;
}
示例3: func_22024_i
private void func_22024_i(World world, int i, int j, int k)
{
int l = world.getBlockMetadata(i, j, k);
world.setBlockAndMetadata(i, j, k, blockID + 1, l);
world.markBlocksDirty(i, j, k, i, j, k);
world.markBlockNeedsUpdate(i, j, k);
}
示例4: generate
public override bool generate(World world, Random random, int i, int j, int k)
{
int l = random.nextInt(3) + 5;
bool flag = true;
if (j < 1 || j + l + 1 > 128)
{
return false;
}
for (int i1 = j; i1 <= j + 1 + l; i1++)
{
byte byte0 = 1;
if (i1 == j)
{
byte0 = 0;
}
if (i1 >= (j + 1 + l) - 2)
{
byte0 = 2;
}
for (int i2 = i - byte0; i2 <= i + byte0 && flag; i2++)
{
for (int l2 = k - byte0; l2 <= k + byte0 && flag; l2++)
{
if (i1 >= 0 && i1 < 128)
{
int j3 = world.getBlockId(i2, i1, l2);
if (j3 != 0 && j3 != Block.leaves.blockID)
{
flag = false;
}
}
else
{
flag = false;
}
}
}
}
if (!flag)
{
return false;
}
int j1 = world.getBlockId(i, j - 1, k);
if (j1 != Block.grass.blockID && j1 != Block.dirt.blockID || j >= 128 - l - 1)
{
return false;
}
world.setBlock(i, j - 1, k, Block.dirt.blockID);
for (int k1 = (j - 3) + l; k1 <= j + l; k1++)
{
int j2 = k1 - (j + l);
int i3 = 1 - j2/2;
for (int k3 = i - i3; k3 <= i + i3; k3++)
{
int l3 = k3 - i;
for (int i4 = k - i3; i4 <= k + i3; i4++)
{
int j4 = i4 - k;
if ((Math.abs(l3) != i3 || Math.abs(j4) != i3 || random.nextInt(2) != 0 && j2 != 0) &&
!Block.opaqueCubeLookup[world.getBlockId(k3, k1, i4)])
{
world.setBlockAndMetadata(k3, k1, i4, Block.leaves.blockID, 2);
}
}
}
}
for (int l1 = 0; l1 < l; l1++)
{
int k2 = world.getBlockId(i, j + l1, k);
if (k2 == 0 || k2 == Block.leaves.blockID)
{
world.setBlockAndMetadata(i, j + l1, k, Block.wood.blockID, 2);
}
}
return true;
}
示例5: generate
public override bool generate(World world, Random random, int i, int j, int k)
{
int l = random.nextInt(4) + 6;
int i1 = 1 + random.nextInt(2);
int j1 = l - i1;
int k1 = 2 + random.nextInt(2);
bool flag = true;
if (j < 1 || j + l + 1 > 128)
{
return false;
}
for (int l1 = j; l1 <= j + 1 + l && flag; l1++)
{
int j2 = 1;
if (l1 - j < i1)
{
j2 = 0;
}
else
{
j2 = k1;
}
for (int l2 = i - j2; l2 <= i + j2 && flag; l2++)
{
for (int j3 = k - j2; j3 <= k + j2 && flag; j3++)
{
if (l1 >= 0 && l1 < 128)
{
int k3 = world.getBlockId(l2, l1, j3);
if (k3 != 0 && k3 != Block.leaves.blockID)
{
flag = false;
}
}
else
{
flag = false;
}
}
}
}
if (!flag)
{
return false;
}
int i2 = world.getBlockId(i, j - 1, k);
if (i2 != Block.grass.blockID && i2 != Block.dirt.blockID || j >= 128 - l - 1)
{
return false;
}
world.setBlock(i, j - 1, k, Block.dirt.blockID);
int k2 = random.nextInt(2);
int i3 = 1;
bool flag1 = false;
for (int l3 = 0; l3 <= j1; l3++)
{
int j4 = (j + l) - l3;
for (int l4 = i - k2; l4 <= i + k2; l4++)
{
int j5 = l4 - i;
for (int k5 = k - k2; k5 <= k + k2; k5++)
{
int l5 = k5 - k;
if ((Math.abs(j5) != k2 || Math.abs(l5) != k2 || k2 <= 0) &&
!Block.opaqueCubeLookup[world.getBlockId(l4, j4, k5)])
{
world.setBlockAndMetadata(l4, j4, k5, Block.leaves.blockID, 1);
}
}
}
if (k2 >= i3)
{
k2 = ((flag1) ? 1 : 0);
flag1 = true;
if (++i3 > k1)
{
i3 = k1;
}
}
else
{
k2++;
}
}
int i4 = random.nextInt(3);
for (int k4 = 0; k4 < l - i4; k4++)
{
int i5 = world.getBlockId(i, j + k4, k);
if (i5 == 0 || i5 == Block.leaves.blockID)
{
world.setBlockAndMetadata(i, j + k4, k, Block.wood.blockID, 1);
}
}
return true;
}