本文整理匯總了Java中thaumcraft.common.lib.utils.BlockUtils.harvestBlock方法的典型用法代碼示例。如果您正苦於以下問題:Java BlockUtils.harvestBlock方法的具體用法?Java BlockUtils.harvestBlock怎麽用?Java BlockUtils.harvestBlock使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類thaumcraft.common.lib.utils.BlockUtils
的用法示例。
在下文中一共展示了BlockUtils.harvestBlock方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: onBlockDestroyed
import thaumcraft.common.lib.utils.BlockUtils; //導入方法依賴的package包/類
@Override
public boolean onBlockDestroyed(ItemStack stack, World world, Block block, int x, int y, int z, EntityLivingBase player) {
if(EnchantmentHelper.getEnchantmentLevel(DarkEnchantments.impact.effectId, stack) <= 0)
return super.onBlockDestroyed(stack, world, block, x, y, z, player);
if(!player.worldObj.isRemote) {
int meta = world.getBlockMetadata(x, y, z);
if(ForgeHooks.isToolEffective(stack, block, meta)) {
for(int aa = -1; aa <= 1; ++aa) {
for(int bb = -1; bb <= 1; ++bb) {
int xx = 0;
int yy = 0;
int zz = 0;
if(this.side <= 1) {
xx = aa;
zz = bb;
} else if(this.side <= 3) {
xx = aa;
yy = bb;
} else {
zz = aa;
yy = bb;
}
if(!(player instanceof EntityPlayer) || world.canMineBlock((EntityPlayer)player, x + xx, y + yy, z + zz)) {
Block bl = world.getBlock(x + xx, y + yy, z + zz);
meta = world.getBlockMetadata(x + xx, y + yy, z + zz);
if(bl.getBlockHardness(world, x + xx, y + yy, z + zz) >= 0.0F && ForgeHooks.isToolEffective(stack, bl, meta)) {
stack.damageItem(1, player);
BlockUtils.harvestBlock(world, (EntityPlayer)player, x + xx, y + yy, z + zz, true, 2);
}
}
}
}
}
else
return super.onBlockDestroyed(stack, world, block, x, y, z, player);
}
return super.onBlockDestroyed(stack, world, block, x, y, z, player);
}