Java Code Examples for net.minecraft.block.state.IBlockState#isNormalCube()

The following examples show how to use net.minecraft.block.state.IBlockState#isNormalCube() . 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: BlockTofu.java    From TofuCraftReload with MIT License 5 votes vote down vote up
public boolean isUnderWeight(World world, BlockPos pos) {
    IBlockState weightBlock = world.getBlockState(pos.up());
    IBlockState baseBlock = world.getBlockState(pos.down());

    boolean isWeightValid = weightBlock != null
            && (weightBlock.getMaterial() == Material.ROCK || weightBlock.getMaterial() == Material.IRON) && weightBlock != BlockLoader.ISHITOFU.getDefaultState();

    float baseHardness = baseBlock.getBlockHardness(world, pos.down());
    boolean isBaseValid = baseBlock.isNormalCube() &&
            (baseBlock.getMaterial() == Material.ROCK || baseBlock.getMaterial() == Material.IRON || baseHardness >= 1.0F || baseHardness < 0.0F);

    return isWeightValid && isBaseValid;
}
 
Example 2
Source File: BlockBarrel.java    From TofuCraftReload with MIT License 5 votes vote down vote up
public boolean isUnderWeight(World world, BlockPos pos) {
    IBlockState weightBlock = world.getBlockState(pos.up());
    IBlockState baseBlock = world.getBlockState(pos.down());

    boolean isWeightValid = weightBlock != null
            && (weightBlock.getMaterial() == Material.ROCK || weightBlock.getMaterial() == Material.IRON);

    float baseHardness = baseBlock.getBlockHardness(world, pos.down());
    boolean isBaseValid = baseBlock.isNormalCube() &&
            (baseBlock.getMaterial() == Material.ROCK || baseBlock.getMaterial() == Material.IRON || baseHardness >= 1.0F || baseHardness < 0.0F);

    return isWeightValid && isBaseValid;
}
 
Example 3
Source File: BlockNattoBed.java    From TofuCraftReload with MIT License 4 votes vote down vote up
public boolean isUnderWeight(World world, BlockPos pos) {
    IBlockState baseBlock = world.getBlockState(pos.down());
    return baseBlock.isNormalCube();
}