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

The following examples show how to use net.minecraft.world.World#breakBlock() . 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 check out the related API usage on the sidebar.
Example 1
Source File: CavernousVineBlock.java    From Galacticraft-Rewoven with MIT License 5 votes vote down vote up
@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
Source File: BasicSolarPanelBlock.java    From Galacticraft-Rewoven with MIT License 5 votes vote down vote up
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);
        }
    }
}