Search in sources :

Example 1 with FluidTankProperties

use of net.minecraftforge.fluids.capability.FluidTankProperties in project MinecraftForge by MinecraftForge.

the class BlockLiquidWrapper method getTankProperties.

@Override
public IFluidTankProperties[] getTankProperties() {
    FluidStack containedStack = null;
    IBlockState blockState = world.getBlockState(blockPos);
    if (blockState.getBlock() == blockLiquid) {
        containedStack = getStack(blockState);
    }
    return new FluidTankProperties[] { new FluidTankProperties(containedStack, Fluid.BUCKET_VOLUME, false, true) };
}
Also used : IBlockState(net.minecraft.block.state.IBlockState) FluidTankProperties(net.minecraftforge.fluids.capability.FluidTankProperties) IFluidTankProperties(net.minecraftforge.fluids.capability.IFluidTankProperties) FluidStack(net.minecraftforge.fluids.FluidStack)

Example 2 with FluidTankProperties

use of net.minecraftforge.fluids.capability.FluidTankProperties in project MinecraftForge by MinecraftForge.

the class FluidBlockWrapper method getTankProperties.

@Override
public IFluidTankProperties[] getTankProperties() {
    float percentFilled = fluidBlock.getFilledPercentage(world, blockPos);
    if (percentFilled < 0) {
        percentFilled *= -1;
    }
    int amountFilled = Math.round(Fluid.BUCKET_VOLUME * percentFilled);
    FluidStack fluid = amountFilled > 0 ? new FluidStack(fluidBlock.getFluid(), amountFilled) : null;
    return new FluidTankProperties[] { new FluidTankProperties(fluid, Fluid.BUCKET_VOLUME, false, true) };
}
Also used : IFluidTankProperties(net.minecraftforge.fluids.capability.IFluidTankProperties) FluidTankProperties(net.minecraftforge.fluids.capability.FluidTankProperties) FluidStack(net.minecraftforge.fluids.FluidStack)

Aggregations

FluidStack (net.minecraftforge.fluids.FluidStack)2 FluidTankProperties (net.minecraftforge.fluids.capability.FluidTankProperties)2 IFluidTankProperties (net.minecraftforge.fluids.capability.IFluidTankProperties)2 IBlockState (net.minecraft.block.state.IBlockState)1