本文整理汇总了C#中SMP.World.SetBlock方法的典型用法代码示例。如果您正苦于以下问题:C# World.SetBlock方法的具体用法?C# World.SetBlock怎么用?C# World.SetBlock使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SMP.World
的用法示例。
在下文中一共展示了World.SetBlock方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PostPopulate
public void PostPopulate(World w)
{
byte bType, bMeta;
ushort bExtra;
int xxx, zzz;
for (int xx = 0; xx < Width; xx++)
for (int zz = 0; zz < Depth; zz++)
for (int yy = 0; yy < Height; yy++)
{
xxx = (x << 4) + xx; zzz = (z << 4) + zz;
bType = GetBlock(xx, yy, zz);
if (!w.CanBlockStay(bType, xxx, yy, zzz))
w.SetBlock(xxx, yy, zzz, 0, 0);
}
}
示例2: PlaceDoor
public static void PlaceDoor(World world, int i, int j, int k, int l, byte block)
{
sbyte byte0 = 0;
sbyte byte1 = 0;
if (l == 0)
{
byte1 = 1;
}
if (l == 1)
{
byte0 = -1;
}
if (l == 2)
{
byte1 = -1;
}
if (l == 3)
{
byte0 = 1;
}
int i1 = (BlockData.IsNormalCube(world.GetBlock(i - byte0, j, k - byte1)) ? 1 : 0) + (BlockData.IsNormalCube(world.GetBlock(i - byte0, j + 1, k - byte1)) ? 1 : 0);
int j1 = (BlockData.IsNormalCube(world.GetBlock(i + byte0, j, k + byte1)) ? 1 : 0) + (BlockData.IsNormalCube(world.GetBlock(i + byte0, j + 1, k + byte1)) ? 1 : 0);
bool flag = world.GetBlock(i - byte0, j, k - byte1) == block || world.GetBlock(i - byte0, j + 1, k - byte1) == block;
bool flag1 = world.GetBlock(i + byte0, j, k + byte1) == block || world.GetBlock(i + byte0, j + 1, k + byte1) == block;
bool flag2 = false;
if (flag && !flag1)
{
flag2 = true;
}
else
if (j1 > i1)
{
flag2 = true;
}
if (flag2)
{
l = l - 1 & 3;
l += 4;
}
world.SetBlock(i, j, k, block, (byte)l);
world.SetBlock(i, j + 1, k, block, (byte)(l + 8));
}