TerraFirmaCraft

TerraFirmaCraft

2M Downloads

neighborChanged on raw stone blocks broken, makes breaking blocks pop as if in the silk touch effect

DisasterMoo opened this issue ยท 0 comments

commented

And i must say, as a developer that this is VERY funny. Why? well this:

if (worldIn.getBlockState(pos.up()).getMaterial().isReplaceable()
    && worldIn.getBlockState(pos.down()).getMaterial().isReplaceable()
    && worldIn.getBlockState(pos.north()).getMaterial().isReplaceable()
    && worldIn.getBlockState(pos.south()).getMaterial().isReplaceable()
    && worldIn.getBlockState(pos.east()).getMaterial().isReplaceable()
    && worldIn.getBlockState(pos.west()).getMaterial().isReplaceable())
{
    //Silk touch effect
    worldIn.setBlockToAir(pos);
    Helpers.spawnItemStack(worldIn, pos, new ItemStack(state.getBlock(), 1));
}

works, but this:

public void neighborChanged(IBlockState state, World worldIn, BlockPos pos, Block blockIn, BlockPos fromPos)
{
    for (EnumFacing face : EnumFacing.values())
    {
        if (!worldIn.getBlockState(pos.offset(face)).getBlock().isReplaceable(worldIn, pos))
        {
            break;
        }
        // No supporting solid blocks, so pop off as an item
        worldIn.setBlockToAir(pos);
        Helpers.spawnItemStack(worldIn, pos, new ItemStack(state.getBlock(), 1));
    }
    super.neighborChanged(state, worldIn, pos, blockIn, fromPos);
}

don't!