Search in sources :

Example 1 with BlockStaticLiquid

use of net.minecraft.block.BlockStaticLiquid in project ImmersiveEngineering by BluSunrize.

the class TileEntityThermoelectricGen method getFluid.

Fluid getFluid(BlockPos pos) {
    IBlockState state = worldObj.getBlockState(pos);
    Block b = state.getBlock();
    Fluid f = FluidRegistry.lookupFluidForBlock(b);
    if (f == null && b instanceof BlockDynamicLiquid && b.getMetaFromState(state) == 0)
        if (state.getMaterial().equals(Material.WATER))
            f = FluidRegistry.WATER;
        else if (state.getMaterial().equals(Material.LAVA))
            f = FluidRegistry.LAVA;
    if (b instanceof IFluidBlock && !((IFluidBlock) b).canDrain(worldObj, pos))
        return null;
    if (b instanceof BlockStaticLiquid && b.getMetaFromState(state) != 0)
        return null;
    if (f == null)
        return null;
    return f;
}
Also used : IBlockState(net.minecraft.block.state.IBlockState) BlockStaticLiquid(net.minecraft.block.BlockStaticLiquid) Fluid(net.minecraftforge.fluids.Fluid) IFluidBlock(net.minecraftforge.fluids.IFluidBlock) IFluidBlock(net.minecraftforge.fluids.IFluidBlock) Block(net.minecraft.block.Block) BlockDynamicLiquid(net.minecraft.block.BlockDynamicLiquid)

Example 2 with BlockStaticLiquid

use of net.minecraft.block.BlockStaticLiquid in project NewHorizonsCoreMod by GTNewHorizons.

the class OilGeneratorFix method getTopBlock.

private int getTopBlock(World pWorld, int pLocX, int pLocZ) {
    Chunk tChunk = pWorld.getChunkFromBlockCoords(pLocX, pLocZ);
    int y = tChunk.getTopFilledSegment() + 15;
    int trimmedX = pLocX & 0xF;
    int trimmedZ = pLocZ & 0xF;
    for (; y > 0; y--) {
        Block tBlock = tChunk.getBlock(trimmedX, y, trimmedZ);
        if (!tBlock.isAir(pWorld, pLocX, y, pLocZ)) {
            if ((tBlock instanceof BlockStaticLiquid)) {
                return y;
            }
            if ((tBlock instanceof BlockFluidBase)) {
                return y;
            }
            if ((tBlock instanceof IFluidBlock)) {
                return y;
            }
            if (tBlock.getMaterial().blocksMovement()) {
                if (!(tBlock instanceof BlockFlower)) {
                    return y - 1;
                }
            }
        }
    }
    return -1;
}
Also used : BlockFluidBase(net.minecraftforge.fluids.BlockFluidBase) BlockStaticLiquid(net.minecraft.block.BlockStaticLiquid) IFluidBlock(net.minecraftforge.fluids.IFluidBlock) IFluidBlock(net.minecraftforge.fluids.IFluidBlock) Block(net.minecraft.block.Block) Chunk(net.minecraft.world.chunk.Chunk) BlockFlower(net.minecraft.block.BlockFlower)

Aggregations

Block (net.minecraft.block.Block)2 BlockStaticLiquid (net.minecraft.block.BlockStaticLiquid)2 IFluidBlock (net.minecraftforge.fluids.IFluidBlock)2 BlockDynamicLiquid (net.minecraft.block.BlockDynamicLiquid)1 BlockFlower (net.minecraft.block.BlockFlower)1 IBlockState (net.minecraft.block.state.IBlockState)1 Chunk (net.minecraft.world.chunk.Chunk)1 BlockFluidBase (net.minecraftforge.fluids.BlockFluidBase)1 Fluid (net.minecraftforge.fluids.Fluid)1