本文整理汇总了C#中World.setBlockWithNotify方法的典型用法代码示例。如果您正苦于以下问题:C# World.setBlockWithNotify方法的具体用法?C# World.setBlockWithNotify怎么用?C# World.setBlockWithNotify使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类World
的用法示例。
在下文中一共展示了World.setBlockWithNotify方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: onItemUse
public override bool onItemUse(ItemStack itemstack, EntityPlayer entityplayer, World world, int i, int j, int k,
int l)
{
if (world.getBlockId(i, j, k) == Block.snow.blockID)
{
l = 0;
}
else
{
if (l == 0)
{
j--;
}
if (l == 1)
{
j++;
}
if (l == 2)
{
k--;
}
if (l == 3)
{
k++;
}
if (l == 4)
{
i--;
}
if (l == 5)
{
i++;
}
}
if (itemstack.stackSize == 0)
{
return false;
}
if (world.canBlockBePlacedAt(field_253_a, i, j, k, false))
{
Block block = Block.blocksList[field_253_a];
if (world.setBlockWithNotify(i, j, k, field_253_a))
{
Block.blocksList[field_253_a].onBlockPlaced(world, i, j, k, l);
Block.blocksList[field_253_a].onBlockPlacedBy(world, i, j, k, entityplayer);
world.playSoundEffect(i + 0.5F, j + 0.5F, k + 0.5F,
block.stepSound.func_737_c(), (block.stepSound.func_738_a() + 1.0F)/2.0F,
block.stepSound.func_739_b()*0.8F);
itemstack.stackSize--;
}
}
return true;
}
示例2: onItemUse
public override bool onItemUse(ItemStack itemstack, EntityPlayer entityplayer, World world, int i, int j, int k,
int l)
{
int i1 = world.getBlockId(i, j, k);
Material material = world.getBlockMaterial(i, j + 1, k);
if (!material.isSolid() && i1 == Block.grass.blockID || i1 == Block.dirt.blockID)
{
Block block = Block.tilledField;
world.playSoundEffect(i + 0.5F, j + 0.5F, k + 0.5F, block.stepSound.func_737_c(),
(block.stepSound.func_738_a() + 1.0F)/2.0F, block.stepSound.func_739_b()*0.8F);
if (world.singleplayerWorld)
{
return true;
}
world.setBlockWithNotify(i, j, k, block.blockID);
itemstack.damageItem(1);
if (world.rand.nextInt(8) == 0 && i1 == Block.grass.blockID)
{
int j1 = 1;
for (int k1 = 0; k1 < j1; k1++)
{
float f = 0.7F;
float f1 = world.rand.nextFloat()*f + (1.0F - f)*0.5F;
float f2 = 1.2F;
float f3 = world.rand.nextFloat()*f + (1.0F - f)*0.5F;
var entityitem = new EntityItem(world, i + f1, j + f2, k + f3,
new ItemStack(seeds));
entityitem.delayBeforeCanPickup = 10;
world.entityJoinedWorld(entityitem);
}
}
return true;
}
else
{
return false;
}
}
示例3: onItemUse
public override bool onItemUse(ItemStack itemstack, EntityPlayer entityplayer, World world, int i, int j, int k,
int l)
{
if (l == 0)
{
j--;
}
if (l == 1)
{
j++;
}
if (l == 2)
{
k--;
}
if (l == 3)
{
k++;
}
if (l == 4)
{
i--;
}
if (l == 5)
{
i++;
}
int i1 = world.getBlockId(i, j, k);
if (i1 == 0)
{
world.playSoundEffect(i + 0.5D, j + 0.5D, k + 0.5D, "fire.ignite", 1.0F,
itemRand.nextFloat()*0.4F + 0.8F);
world.setBlockWithNotify(i, j, k, Block.fire.blockID);
}
itemstack.damageItem(1);
return true;
}
示例4: checkIfAttachedToBlock
private bool checkIfAttachedToBlock(World world, int i, int j, int k)
{
if (!canPlaceBlockAt(world, i, j, k))
{
dropBlockAsItem(world, i, j, k, world.getBlockMetadata(i, j, k));
world.setBlockWithNotify(i, j, k, 0);
return false;
}
else
{
return true;
}
}
示例5: onNeighborBlockChange
public override void onNeighborBlockChange(World world, int i, int j, int k, int l)
{
if (checkIfAttachedToBlock(world, i, j, k))
{
int i1 = world.getBlockMetadata(i, j, k) & 7;
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);
}
}
}