Java Code Examples for gregtech.api.metatileentity.MetaTileEntity#addFluidsToFluidHandler()

The following examples show how to use gregtech.api.metatileentity.MetaTileEntity#addFluidsToFluidHandler() . 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: AbstractRecipeLogic.java    From GregTech with GNU Lesser General Public License v3.0 5 votes vote down vote up
protected boolean setupAndConsumeRecipeInputs(Recipe recipe) {
    int[] resultOverclock = calculateOverclock(recipe.getEUt(), getMaxVoltage(), recipe.getDuration());
    int totalEUt = resultOverclock[0] * resultOverclock[1];
    IItemHandlerModifiable importInventory = getInputInventory();
    IItemHandlerModifiable exportInventory = getOutputInventory();
    IMultipleTankHandler importFluids = getInputTank();
    IMultipleTankHandler exportFluids = getOutputTank();
    return (totalEUt >= 0 ? getEnergyStored() >= (totalEUt > getEnergyCapacity() / 2 ? resultOverclock[0] : totalEUt) :
        (getEnergyStored() - resultOverclock[0] <= getEnergyCapacity())) &&
        MetaTileEntity.addItemsToItemHandler(exportInventory, true, recipe.getAllItemOutputs(exportInventory.getSlots())) &&
        MetaTileEntity.addFluidsToFluidHandler(exportFluids, true, recipe.getFluidOutputs()) &&
        recipe.matches(true, importInventory, importFluids);
}
 
Example 2
Source File: AbstractRecipeLogic.java    From GregTech with GNU Lesser General Public License v3.0 5 votes vote down vote up
protected void completeRecipe() {
    MetaTileEntity.addItemsToItemHandler(getOutputInventory(), false, itemOutputs);
    MetaTileEntity.addFluidsToFluidHandler(getOutputTank(), false, fluidOutputs);
    this.progressTime = 0;
    setMaxProgress(0);
    this.recipeEUt = 0;
    this.fluidOutputs = null;
    this.itemOutputs = null;
    this.hasNotEnoughEnergy = false;
    this.wasActiveAndNeedsUpdate = true;
    //force recipe recheck because inputs could have changed since last time
    //we checked them before starting our recipe, especially if recipe took long time
    this.forceRecipeRecheck = true;
}