本文整理了Java中net.minecraft.block.Block.dropXpOnBlockBreak()
方法的一些代码示例,展示了Block.dropXpOnBlockBreak()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Block.dropXpOnBlockBreak()
方法的具体详情如下:
包路径:net.minecraft.block.Block
类名称:Block
方法名:dropXpOnBlockBreak
暂无
代码示例来源:origin: Vazkii/Botania
public static void removeBlockWithDrops(EntityPlayer player, ItemStack stack, World world, BlockPos pos,
Predicate<IBlockState> filter,
boolean dispose, boolean particles) {
if(!world.isBlockLoaded(pos))
return;
IBlockState state = world.getBlockState(pos);
Block block = state.getBlock();
if(!world.isRemote && filter.test(state)
&& !block.isAir(state, world, pos) && state.getPlayerRelativeBlockHardness(player, world, pos) > 0
&& block.canHarvestBlock(player.world, pos, player)) {
int exp = ForgeHooks.onBlockBreakEvent(world, ((EntityPlayerMP) player).interactionManager.getGameType(), (EntityPlayerMP) player, pos);
if(exp == -1)
return;
if(!player.capabilities.isCreativeMode) {
TileEntity tile = world.getTileEntity(pos);
if(block.removedByPlayer(state, world, pos, player, true)) {
block.onPlayerDestroy(world, pos, state);
if(!dispose || !ItemElementiumPick.isDisposable(block)) {
block.harvestBlock(world, player, pos, state, tile, stack);
block.dropXpOnBlockBreak(world, pos, exp);
}
}
damageItem(stack, 1, player, 80);
} else world.setBlockToAir(pos);
if(particles && ConfigHandler.blockBreakParticles && ConfigHandler.blockBreakParticlesTool)
world.playEvent(2001, pos, Block.getStateId(state));
}
}
代码示例来源:origin: SleepyTrousers/EnderIO
block.harvestBlock(world, player, target, blockstate, null, item);
if (!gameType.isCreative() && exp > 0) {
block.dropXpOnBlockBreak(world, target, exp);
代码示例来源:origin: PrinceOfAmber/Cyclic
block.dropXpOnBlockBreak(world, targetPos, block.getExpDrop(targetState, world, targetPos, fortuneXp));
world.destroyBlock(targetPos, false);
wasHarvested.add(targetPos);
代码示例来源:origin: CyclopsMC/EvilCraft
block.onBlockDestroyedByPlayer(world, pos, blockState);
block.harvestBlock(world, player, pos, blockState, world.getTileEntity(pos), null);
block.dropXpOnBlockBreak(world, pos, expToDrop);
代码示例来源:origin: Ellpeck/ActuallyAdditions
block.onPlayerDestroy(world, pos, state);
block.harvestBlock(world, player, pos, state, tileEntity, stack);
block.dropXpOnBlockBreak(world, pos, xp);
代码示例来源:origin: CoFH/CoFHCore
block.harvestBlock(world, player, pos, state, world.getTileEntity(pos), player.getHeldItemMainhand());
if (xpToDrop > 0) {
block.dropXpOnBlockBreak(world, pos, xpToDrop);
代码示例来源:origin: PrinceOfAmber/Cyclic
blockCurrent.onPlayerDestroy(world, posCurrent, bsCurrent);
blockCurrent.harvestBlock(world, player, posCurrent, bsCurrent, tile, stack);
blockCurrent.dropXpOnBlockBreak(world, posCurrent, xpGivenOnDrop);
代码示例来源:origin: CoFH/CoFHCore
block.harvestBlock(world, player, pos, state, world.getTileEntity(pos), player.getHeldItemMainhand());
if (xpToDrop > 0) {
block.dropXpOnBlockBreak(world, pos, xpToDrop);
内容来源于网络,如有侵权,请联系作者删除!