Search in sources :

Example 1 with FilteredTank

use of forestry.core.fluids.FilteredTank in project ForestryMC by ForestryMC.

the class ClimateSourceHygroregulator method removeResources.

@Override
protected void removeResources(IClimateState currentState, ClimateSourceType oppositeType) {
    FilteredTank liquidTank = owner.getLiquidTank();
    liquidTank.drainInternal(currentRecipe.liquid.amount, true);
}
Also used : FilteredTank(forestry.core.fluids.FilteredTank)

Example 2 with FilteredTank

use of forestry.core.fluids.FilteredTank in project ForestryMC by ForestryMC.

the class ClimateSourceHygroregulator method canWork.

@Override
public boolean canWork(IClimateState currentState, ClimateSourceType oppositeType) {
    createRecipe();
    FilteredTank liquidTank = owner.getLiquidTank();
    IErrorLogic errorLogic = owner.getErrorLogic();
    if (currentRecipe != null && liquidTank.drainInternal(currentRecipe.liquid.amount, false) != null) {
        errorLogic.setCondition(false, EnumErrorCode.NO_RESOURCE_LIQUID);
        return true;
    }
    errorLogic.setCondition(true, EnumErrorCode.NO_RESOURCE_LIQUID);
    return false;
}
Also used : FilteredTank(forestry.core.fluids.FilteredTank) IErrorLogic(forestry.api.core.IErrorLogic)

Example 3 with FilteredTank

use of forestry.core.fluids.FilteredTank in project ForestryMC by ForestryMC.

the class ClimateSourceHygroregulator method createRecipe.

private void createRecipe() {
    if (currentRecipe == null) {
        FilteredTank liquidTank = owner.getLiquidTank();
        FluidStack fluid = liquidTank.getFluid();
        if (fluid != null && fluid.amount > 0) {
            currentRecipe = owner.getRecipe(fluid);
        } else {
            currentRecipe = null;
        }
    }
}
Also used : FluidStack(net.minecraftforge.fluids.FluidStack) FilteredTank(forestry.core.fluids.FilteredTank)

Aggregations

FilteredTank (forestry.core.fluids.FilteredTank)3 IErrorLogic (forestry.api.core.IErrorLogic)1 FluidStack (net.minecraftforge.fluids.FluidStack)1