本文整理汇总了C#中World.getBlockId方法的典型用法代码示例。如果您正苦于以下问题:C# World.getBlockId方法的具体用法?C# World.getBlockId怎么用?C# World.getBlockId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类World
的用法示例。
在下文中一共展示了World.getBlockId方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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(blockID, i, j, k, false))
{
Block block = Block.blocksList[blockID];
if (world.setBlockAndMetadataWithNotify(i, j, k, blockID, getMetadata(itemstack.getItemDamage())))
{
Block.blocksList[blockID].onBlockPlaced(world, i, j, k, l);
Block.blocksList[blockID].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)
{
if (world.getBlockId(i, j, k) == Block.jukebox.blockID && world.getBlockMetadata(i, j, k) == 0)
{
world.setBlockMetadataWithNotify(i, j, k, (shiftedIndex - record13.shiftedIndex) + 1);
world.playRecord(recordName, i, j, k);
itemstack.stackSize--;
return true;
}
else
{
return false;
}
}
示例3: 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);
}
}
示例4: activeBlockOrUseItem
public bool activeBlockOrUseItem(EntityPlayer entityplayer, World world, ItemStack itemstack, int i, int j,
int k, int l)
{
int i1 = world.getBlockId(i, j, k);
if (i1 > 0 && Block.blocksList[i1].blockActivated(world, i, j, k, entityplayer))
{
return true;
}
if (itemstack == null)
{
return false;
}
else
{
return itemstack.useItem(entityplayer, world, i, j, k, l);
}
}
示例5: onItemUse
public override bool onItemUse(ItemStack itemstack, EntityPlayer entityplayer, World world, int i, int j, int k,
int l)
{
if (itemstack.getItemDamage() == 15)
{
int i1 = world.getBlockId(i, j, k);
if (i1 == Block.sapling.blockID)
{
((BlockSapling) Block.sapling).func_21027_b(world, i, j, k, world.rand);
itemstack.stackSize--;
return true;
}
if (i1 == Block.crops.blockID)
{
((BlockCrops) Block.crops).func_21028_c(world, i, j, k);
itemstack.stackSize--;
return true;
}
}
return false;
}
示例6: 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;
}
}
示例7: 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;
}
示例8: canBlockStay
public override bool canBlockStay(World world, int i, int j, int k)
{
return world.getBlockLightValue(i, j, k) <= 13 &&
canThisPlantGrowOnThisBlockID(world.getBlockId(i, j - 1, k));
}
示例9: func_4107_a
public void func_4107_a(World world)
{
int i = (field_960_e - field_956_b) + 1;
int j = (field_959_f - field_962_c) + 1;
int k = (field_958_g - field_961_d) + 1;
int l = i*j*k;
if (l > 32768)
{
[email protected]("Light too large, skipping!");
return;
}
int i1 = 0;
int j1 = 0;
bool flag = false;
bool flag1 = false;
for (int k1 = field_956_b; k1 <= field_960_e; k1++)
{
for (int l1 = field_961_d; l1 <= field_958_g; l1++)
{
int i2 = k1 >> 4;
int j2 = l1 >> 4;
bool flag2 = false;
if (flag && i2 == i1 && j2 == j1)
{
flag2 = flag1;
}
else
{
flag2 = world.doChunksNearChunkExist(k1, 0, l1, 1);
if (flag2)
{
Chunk chunk = world.getChunkFromChunkCoords(k1 >> 4, l1 >> 4);
if (chunk.func_21101_g())
{
flag2 = false;
}
}
flag1 = flag2;
i1 = i2;
j1 = j2;
}
if (!flag2)
{
continue;
}
if (field_962_c < 0)
{
field_962_c = 0;
}
if (field_959_f >= 128)
{
field_959_f = 127;
}
for (int k2 = field_962_c; k2 <= field_959_f; k2++)
{
int l2 = world.getSavedLightValue(field_957_a, k1, k2, l1);
int i3 = 0;
int j3 = world.getBlockId(k1, k2, l1);
int k3 = Block.lightOpacity[j3];
if (k3 == 0)
{
k3 = 1;
}
int l3 = 0;
if (field_957_a == EnumSkyBlock.Sky)
{
if (world.canExistingBlockSeeTheSky(k1, k2, l1))
{
l3 = 15;
}
}
else if (field_957_a == EnumSkyBlock.Block)
{
l3 = Block.lightValue[j3];
}
if (k3 >= 15 && l3 == 0)
{
i3 = 0;
}
else
{
int i4 = world.getSavedLightValue(field_957_a, k1 - 1, k2, l1);
int k4 = world.getSavedLightValue(field_957_a, k1 + 1, k2, l1);
int l4 = world.getSavedLightValue(field_957_a, k1, k2 - 1, l1);
int i5 = world.getSavedLightValue(field_957_a, k1, k2 + 1, l1);
int j5 = world.getSavedLightValue(field_957_a, k1, k2, l1 - 1);
int k5 = world.getSavedLightValue(field_957_a, k1, k2, l1 + 1);
i3 = i4;
if (k4 > i3)
{
i3 = k4;
}
if (l4 > i3)
{
i3 = l4;
}
if (i5 > i3)
{
i3 = i5;
}
//.........这里部分代码省略.........
示例10: canPlaceBlockAt
public override bool canPlaceBlockAt(World world, int i, int j, int k)
{
int l = world.getBlockId(i, j, k);
return (l == 0 || blocksList[l].blockMaterial.getIsLiquid()) && world.isBlockOpaqueCube(i, j - 1, k);
}