Пример #1
0
  @Override
  public void breakBlock(World world, BlockPos pos, IBlockState state) {
    TileEntityPedestal pedestal = (TileEntityPedestal) world.getTileEntity(pos);

    if (pedestal != null) {
      net.minecraft.inventory.InventoryHelper.dropInventoryItems(world, pos, pedestal);
    }

    super.breakBlock(world, pos, state);
  }
Пример #2
0
  @Override
  public void onBlockAdded(World worldIn, BlockPos pos, IBlockState state) {
    super.onBlockAdded(worldIn, pos, state);

    if (worldIn.isBlockPowered(pos)) {
      this.onBlockDestroyedByPlayer(
          worldIn, pos, state.withProperty(EXPLODE, Boolean.valueOf(true)));
      worldIn.setBlockToAir(pos);
    }
  }