Search in sources :

Example 1 with FluidTankWrapper

use of mekanism.common.capabilities.fluid.FluidTankWrapper in project Mekanism by mekanism.

the class LookingAtUtils method displayFluid.

private static void displayFluid(LookingAtHelper info, IFluidHandler fluidHandler) {
    if (fluidHandler instanceof IMekanismFluidHandler) {
        IMekanismFluidHandler mekFluidHandler = (IMekanismFluidHandler) fluidHandler;
        for (IExtendedFluidTank fluidTank : mekFluidHandler.getFluidTanks(null)) {
            if (fluidTank instanceof FluidTankWrapper) {
                MergedTank mergedTank = ((FluidTankWrapper) fluidTank).getMergedTank();
                CurrentType currentType = mergedTank.getCurrentType();
                if (currentType != CurrentType.EMPTY && currentType != CurrentType.FLUID) {
                    // Skip if the tank is on a chemical
                    continue;
                }
            }
            addFluidInfo(info, fluidTank.getFluid(), fluidTank.getCapacity());
        }
    } else {
        // Fallback handling if it is not our fluid handler (probably never gets used)
        for (int tank = 0; tank < fluidHandler.getTanks(); tank++) {
            addFluidInfo(info, fluidHandler.getFluidInTank(tank), fluidHandler.getTankCapacity(tank));
        }
    }
}
Also used : IMekanismFluidHandler(mekanism.api.fluid.IMekanismFluidHandler) CurrentType(mekanism.common.capabilities.merged.MergedTank.CurrentType) MergedTank(mekanism.common.capabilities.merged.MergedTank) FluidTankWrapper(mekanism.common.capabilities.fluid.FluidTankWrapper) IExtendedFluidTank(mekanism.api.fluid.IExtendedFluidTank)

Aggregations

IExtendedFluidTank (mekanism.api.fluid.IExtendedFluidTank)1 IMekanismFluidHandler (mekanism.api.fluid.IMekanismFluidHandler)1 FluidTankWrapper (mekanism.common.capabilities.fluid.FluidTankWrapper)1 MergedTank (mekanism.common.capabilities.merged.MergedTank)1 CurrentType (mekanism.common.capabilities.merged.MergedTank.CurrentType)1