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

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

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

Block.onBlockHarvested介绍

暂无

代码示例

代码示例来源:origin: JurassiCraftTeam/JurassiCraft2

@Override
public void onBlockHarvested(World world, BlockPos pos, IBlockState state, EntityPlayer player) {
  BlockPos opposite = this.getOpposite(pos, state);
  world.setBlockToAir(opposite);
  super.onBlockHarvested(world, pos, state, player);
}

代码示例来源:origin: TheGreyGhost/MinecraftByExample

@Override
public void onBlockHarvested(World worldIn, BlockPos pos, IBlockState state, EntityPlayer player) {
 StartupCommon.methodCallLogger.enterMethod("BlockToolTest.onBlockHarvested",
                    "{world}, " + pos + ", " + String.valueOf(state) + ", " + player.getDisplayNameString());
 super.onBlockHarvested(worldIn, pos, state, player);
 StartupCommon.methodCallLogger.exitMethod("BlockToolTest.onBlockHarvested", "");
 return;
}

代码示例来源:origin: JurassiCraftTeam/JurassiCraft2

@Override
public void onBlockHarvested(World worldIn, BlockPos pos, IBlockState state, EntityPlayer player) {
  super.onBlockHarvested(worldIn, pos, state, player);
  AncientItemHoldingBlockEntity tile = (AncientItemHoldingBlockEntity) worldIn.getTileEntity(pos);
  if (tile != null && tile.getDisplayItemStack() != null) {
    spawnAsEntity(worldIn, pos, tile.getDisplayItemStack());
  }
}

代码示例来源:origin: amadornes/MCMultiPart

public default void onPartHarvested(IPartInfo part, EntityPlayer player) {
  part.getState().getBlock().onBlockHarvested(part.getPartWorld(), part.getPartPos(), part.getState(), player);
}

代码示例来源:origin: GregTechCE/GregTech

private boolean tryBreakRailBlock(IBlockState blockState, World world, BlockPos blockPos, EntityPlayer player) {
  if (world.canMineBlockBody(player, blockPos) && blockState.getBlock().canHarvestBlock(world, blockPos, player)) {
    for (ItemStack drops : blockState.getBlock().getDrops(world, blockPos, blockState, 0)) {
      Block.spawnAsEntity(world, blockPos, drops);
    }
    blockState.getBlock().onBlockDestroyedByPlayer(world, blockPos, blockState);
    blockState.getBlock().onBlockHarvested(world, blockPos, blockState, player);
    blockState.getBlock().breakBlock(world, blockPos, blockState);
    world.setBlockToAir(blockPos);
    return true;
  }
  return false;
}

代码示例来源:origin: vadis365/TheErebus

@Override
public void onBlockHarvested(World world, BlockPos pos, IBlockState state, EntityPlayer player) {
  if (state.getValue(HALF) == EnumBlockTorchHalf.UPPER) {
    if (world.getBlockState(pos.down()).getBlock() == this) {
      if (player.capabilities.isCreativeMode)
        world.setBlockToAir(pos.down());
      else {
        world.destroyBlock(pos.down(), true);
        if (world.isRemote)
          world.setBlockToAir(pos.down());
      }
    }
  }
  else if (world.getBlockState(pos.up()).getBlock() == this) {
    world.setBlockState(pos.up(), Blocks.AIR.getDefaultState(), 2);
    dropBlockAsItem(world, pos, state.withProperty(HALF, EnumBlockTorchHalf.UPPER), 0);
  }
  super.onBlockHarvested(world, pos, state, player);
}

代码示例来源:origin: CyclopsMC/EvilCraft

if (expToDrop >= 0) {
  block.onBlockHarvested(world, pos, blockState, player);
  if(block.removedByPlayer(blockState, world, pos, player, true)) {
    block.onBlockDestroyedByPlayer(world, pos, blockState);

相关文章

Block类方法