net.minecraft.block.Block.dropXpOnBlockBreak()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(2.9k)|赞(0)|评价(0)|浏览(142)

本文整理了Java中net.minecraft.block.Block.dropXpOnBlockBreak()方法的一些代码示例,展示了Block.dropXpOnBlockBreak()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Block.dropXpOnBlockBreak()方法的具体详情如下:
包路径:net.minecraft.block.Block
类名称:Block
方法名:dropXpOnBlockBreak

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);

相关文章

Block类方法