Java Code Examples for net.minecraft.world.World#breakBlock()

The following examples show how to use net.minecraft.world.World#breakBlock() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may want to check out the right sidebar which shows the related API usage.
Example 1
@Override
public void neighborUpdate(BlockState state, World world, BlockPos pos, Block block, BlockPos pos_2, boolean boolean_1) {
    super.neighborUpdate(state, world, pos, block, pos_2, boolean_1);
    if (!canPlaceAt(state, world, pos)) {
        world.breakBlock(pos, false);
    }
}
 
Example 2
void onPartDestroyed(World world, BlockState partState, BlockPos partPos, BlockState baseState, BlockPos basePos, boolean dropBase) {
    dropInventory(world, basePos);
    world.breakBlock(basePos, dropBase);

    for (BlockPos otherPart : getOtherParts(baseState, basePos)) {
        if (!world.getBlockState(otherPart).isAir()) {
            world.setBlockState(otherPart, Blocks.AIR.getDefaultState(), 3);
        }
    }
}