aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gregtech/common/tileentities/machines/IRecipeProcessingAwareHatch.java
blob: d78400b30e27f347978b397073e10783adba1e31 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package gregtech.common.tileentities.machines;

import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase;
import gregtech.api.recipe.check.CheckRecipeResult;
import gregtech.api.recipe.check.CheckRecipeResultRegistry;

public interface IRecipeProcessingAwareHatch {

    /**
     * Called when multiblock controller starts processing.
     * {@link #endRecipeProcessing(GT_MetaTileEntity_MultiBlockBase)} is called on the same tick.
     */
    default void startRecipeProcessing() {}

    /**
     * Called when multiblock controller ends processing. {@link #startRecipeProcessing()} is called on the same tick.
     *
     * @param controller Caller of this method.
     * @return Result of the process of this method. {@code !wasSuccessful()} means the returned result should
     *         overwrite the result calculated on multiblock whatever the reason is.
     */
    default CheckRecipeResult endRecipeProcessing(GT_MetaTileEntity_MultiBlockBase controller) {
        endRecipeProcessing();
        return CheckRecipeResultRegistry.SUCCESSFUL;
    }

    /**
     * Simple version of {@link #endRecipeProcessing(GT_MetaTileEntity_MultiBlockBase)}. Maybe use it instead.
     */
    default void endRecipeProcessing() {}
}