本文整理汇总了C#中World.getBlockMaterial方法的典型用法代码示例。如果您正苦于以下问题:C# World.getBlockMaterial方法的具体用法?C# World.getBlockMaterial怎么用?C# World.getBlockMaterial使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类World
的用法示例。
在下文中一共展示了World.getBlockMaterial方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: triggerNote
public void triggerNote(World world, int i, int j, int k)
{
if (world.getBlockMaterial(i, j + 1, k) != Material.air)
{
return;
}
Material material = world.getBlockMaterial(i, j - 1, k);
byte byte0 = 0;
if (material == Material.rock)
{
byte0 = 1;
}
if (material == Material.sand)
{
byte0 = 2;
}
if (material == Material.glass)
{
byte0 = 3;
}
if (material == Material.wood)
{
byte0 = 4;
}
world.playNoteAt(i, j, k, byte0, note);
}
示例2: canPlaceBlockAt
public override bool canPlaceBlockAt(World world, int i, int j, int k)
{
if (world.getBlockId(i, j - 1, k) == blockID)
{
return false;
}
if (!world.getBlockMaterial(i, j - 1, k).isSolid())
{
return false;
}
else
{
return base.canPlaceBlockAt(world, i, j, k);
}
}
示例3: 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;
}
}