Java Code Examples for net.minecraft.world.IBlockAccess#isAirBlock()

The following examples show how to use net.minecraft.world.IBlockAccess#isAirBlock() . 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: MixinStateImplementation.java    From MinecraftX-RAY with BSD 2-Clause "Simplified" License 6 votes vote down vote up
@Inject(method="shouldSideBeRendered(Lnet/minecraft/world/IBlockAccess;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/util/EnumFacing;)Z", at=@At("HEAD"), cancellable=true)
private void onShouldSideBeRendered(IBlockAccess blockAccess, BlockPos pos, EnumFacing facing, CallbackInfoReturnable<Boolean> ci) {
    if (UyjuliansXrayModMain.xrayEnabled()) {
        ci.setReturnValue((!UyjuliansXrayModMain.checkBlockList(this.getBlock())) && UyjuliansXrayModMain.checkBlockList(blockAccess.getBlockState(pos.offset(facing)).getBlock()));
    }
    else if (UyjuliansXrayModMain.caveFinderEnabled()) {
        ci.setReturnValue((!UyjuliansXrayModMain.checkBlockList(this.getBlock())) && blockAccess.isAirBlock(pos.offset(facing)));
    }
    else if (UyjuliansXrayModMain.specialMode1Enabled()) {
        if (!UyjuliansXrayModMain.checkBlockList(this.getBlock())) {
            boolean shouldRender = true;
            for (EnumFacing facing1 : new EnumFacing[]{EnumFacing.NORTH, EnumFacing.EAST, EnumFacing.SOUTH, EnumFacing.WEST}) {
                if (blockAccess.isAirBlock(pos.offset(facing1))) {
                    shouldRender = true;
                }
                else {
                    shouldRender = false;
                    break;
                }
            }
            ci.setReturnValue(shouldRender);
        } else {
            ci.setReturnValue(false);
        }
    }
}
 
Example 2
Source File: BlockGarden.java    From GardenCollection with MIT License 5 votes vote down vote up
protected boolean enoughSpaceAround (IBlockAccess blockAccess, int x, int y, int z, int slot, PlantItem plant) {
    int height = plant.getPlantHeight();

    boolean enough = true;
    for (int i = 0; i < height; i++)
        enough &= blockAccess.isAirBlock(x, y + 1 + i, z) || blockAccess.getBlock(x, y + 1 + i, z) instanceof IPlantProxy;

    return enough;
}
 
Example 3
Source File: WorldHelper.java    From CommunityMod with GNU Lesser General Public License v2.1 4 votes vote down vote up
public static boolean isAirBlock(IBlockAccess access, int x, int y, int z)
{
	return access.isAirBlock(new BlockPos(x,y,z));
}