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

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

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

Block.breakBlock介绍

暂无

代码示例

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

@Override
public void breakBlock(World worldIn, BlockPos pos, IBlockState state)
{
 final boolean CASCADE_UPDATE = false;  // I'm not sure what this flag does, but vanilla always sets it to false
 // except for calls by World.setBlockState()
 worldIn.notifyNeighborsOfStateChange(pos, this, CASCADE_UPDATE);
 super.breakBlock(worldIn, pos, state);
}

代码示例来源:origin: sinkillerj/ProjectE

@Override
public void breakBlock(@Nonnull World world, @Nonnull BlockPos pos, @Nonnull IBlockState state)
{
  dropItem(world, pos);
  super.breakBlock(world, pos, state);
}

代码示例来源:origin: RS485/LogisticsPipes

@Override
public void breakBlock(World worldIn, @Nonnull BlockPos pos, @Nonnull IBlockState state) {
  TileEntity tile = worldIn.getTileEntity(pos);
  if (tile instanceof LogisticsSolidTileEntity) {
    ((LogisticsSolidTileEntity) tile).onBlockBreak();
  }
  super.breakBlock(worldIn, pos, state);
}

代码示例来源:origin: P3pp3rF1y/AncientWarfare2

@Override
  public void breakBlock(World world, BlockPos pos, IBlockState state) {
    if (hasTileEntity(state)) {
      WorldTools.getTile(world, pos, IBlockBreakHandler.class).ifPresent(IBlockBreakHandler::onBlockBroken);
    }
    super.breakBlock(world, pos, state);
  }
}

代码示例来源:origin: sinkillerj/ProjectE

@Override
public void breakBlock(@Nonnull World world, @Nonnull BlockPos pos, @Nonnull IBlockState state)
{
  TileEntity tile = world.getTileEntity(pos);
  if (tile != null)
  {
    IItemHandler inv = tile.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, null);
    WorldHelper.dropInventory(inv, world, pos);
  }
  super.breakBlock(world, pos, state);
}

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

public void breakBlock(World worldIn, BlockPos pos, IBlockState state)
{
 super.breakBlock(worldIn, pos, state);
 worldIn.removeTileEntity(pos);
 final boolean CASCADE_UPDATE = false;  // I'm not sure what this flag does, but vanilla always sets it to false
 // except for calls by World.setBlockState()
 worldIn.notifyNeighborsOfStateChange(pos, this, CASCADE_UPDATE);
}

代码示例来源:origin: WayofTime/BloodMagic

@Override
public void breakBlock(World world, BlockPos blockPos, IBlockState blockState) {
  TileEntity tile = world.getTileEntity(blockPos);
  if (tile instanceof TileAltar)
    ((TileAltar) tile).dropItems();
  super.breakBlock(world, blockPos, blockState);
}

代码示例来源:origin: Electrical-Age/ElectricalAge

@Override
public void breakBlock(World world, int x, int y, int z, Block par5, int par6) {
  if (world.isRemote == false) {
    GhostElement element = getElement(world, x, y, z);
    if (element != null) element.breakBlock();
  }
  super.breakBlock(world, x, y, z, par5, par6);
}

代码示例来源:origin: MrCrayfish/MrCrayfishFurnitureMod

@Override
public void breakBlock(World world, BlockPos pos, IBlockState state)
{
  InventoryUtil.dropTileEntityInventoryItems(world, pos, world.getTileEntity(pos));
  super.breakBlock(world, pos, state);
}

代码示例来源:origin: TerraFirmaCraft/TerraFirmaCraft

@Override
public void breakBlock(World worldIn, BlockPos pos, IBlockState state)
{
  TEIngotPile te = Helpers.getTE(worldIn, pos, TEIngotPile.class);
  if (te != null) te.onBreakBlock();
  super.breakBlock(worldIn, pos, state);
}

代码示例来源:origin: WayofTime/BloodMagic

@Override
public void breakBlock(World world, BlockPos blockPos, IBlockState blockState) {
  TileIncenseAltar TileIncenseAltar = (TileIncenseAltar) world.getTileEntity(blockPos);
  if (TileIncenseAltar != null)
    TileIncenseAltar.dropItems();
  super.breakBlock(world, blockPos, blockState);
}

代码示例来源:origin: WayofTime/BloodMagic

@Override
public void breakBlock(World world, BlockPos blockPos, IBlockState blockState) {
  TileDemonCrucible tile = (TileDemonCrucible) world.getTileEntity(blockPos);
  if (tile != null)
    tile.dropItems();
  super.breakBlock(world, blockPos, blockState);
}

代码示例来源:origin: Darkhax-Minecraft/Bookshelf

@Override
public void breakBlock (World worldIn, BlockPos pos, IBlockState state) {
  
  final TileEntity tile = worldIn.getTileEntity(pos);
  if (tile instanceof TileEntityBasic) {
    
    ((TileEntityBasic) tile).onTileRemoved(worldIn, pos, state);
  }
  
  super.breakBlock(worldIn, pos, state);
  worldIn.removeTileEntity(pos);
}

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

@Override
public void breakBlock(World world, BlockPos pos, IBlockState state) {
  world.playEvent(2001, pos, Block.getStateId(Blocks.STONE.getDefaultState()));
  super.breakBlock(world, pos, state);
}

代码示例来源:origin: MightyPirates/TIS-3D

@Override
public void breakBlock(final World world, final BlockPos pos, final IBlockState state) {
  final TileEntity tileentity = world.getTileEntity(pos);
  if (tileentity instanceof TileEntityCasing) {
    InventoryHelper.dropInventoryItems(world, pos, (TileEntityCasing) tileentity);
    world.updateComparatorOutputLevel(pos, this);
  }
  super.breakBlock(world, pos, state);
}

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

@Override
public void breakBlock(World world, BlockPos pos, IBlockState state) {
  super.breakBlock(world, pos, state);
  if (!world.isRemote) {
    world.notifyNeighborsOfStateChange(pos, this, true);
    world.notifyNeighborsOfStateChange(pos.down(), this, true);
  }
}

代码示例来源:origin: Esteemed-Innovation/Esteemed-Innovation

@Override
public void breakBlock(@Nonnull World world, @Nonnull BlockPos pos, @Nonnull IBlockState state) {
  TileEntity tileentity = world.getTileEntity(pos);
  IItemHandler itemHandler = tileentity.getCapability(ITEM_HANDLER_CAPABILITY, null);
  if (itemHandler != null) {
    InventoryHelper.spawnItemStack(world, pos.getX(), pos.getY(), pos.getZ(), itemHandler.getStackInSlot(0));
  }
  super.breakBlock(world, pos, state);
}

代码示例来源:origin: Esteemed-Innovation/Esteemed-Innovation

@Override
public void breakBlock(World world, BlockPos pos, IBlockState state) {
  TileEntityItemMortar tileentitymortar = (TileEntityItemMortar) world.getTileEntity(pos);
  if (tileentitymortar != null) {
    InventoryHelper.dropInventoryItems(world, pos, tileentitymortar);
    world.updateComparatorOutputLevel(pos, state.getBlock());
  }
  super.breakBlock(world, pos, state);
}

代码示例来源:origin: Esteemed-Innovation/Esteemed-Innovation

@Override
public void breakBlock(World world, BlockPos pos, IBlockState state) {
  // No need to break the Thumper itself because that is handled by BlockThumper#neighborChanged.
  for (int i = -1; i < 1; i++) {
    BlockPos next = pos.up(i);
    if (world.getBlockState(next).getBlock() == this) {
      world.setBlockToAir(next);
    }
  }
  super.breakBlock(world, pos, state);
}

代码示例来源:origin: Chisel-Team/Chisel

@Override
public void breakBlock(World worldIn, BlockPos pos, IBlockState state) {
  TileEntity tileentity = worldIn.getTileEntity(pos);
  if (tileentity instanceof TileAutoChisel) {
    TileAutoChisel autochisel = (TileAutoChisel) tileentity;
    dumpItems(worldIn, pos, autochisel.getInputInv());
    dumpItems(worldIn, pos, autochisel.getOtherInv());
    dumpItems(worldIn, pos, autochisel.getOutputInv());
    worldIn.updateComparatorOutputLevel(pos, this);
  }
  super.breakBlock(worldIn, pos, state);
}

相关文章

Block类方法