aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gregtech/api/interfaces/tileentity/RecipeMapWorkable.java
blob: 7d4db4396c7f8122fcb52f0cc0ebb9e8913a2f87 (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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
package gregtech.api.interfaces.tileentity;

import java.util.Collection;
import java.util.Collections;

import javax.annotation.Nonnull;

import net.minecraft.item.ItemStack;

import gregtech.api.recipe.RecipeMap;

/**
 * Machines implementing this interface are capable of executing certain recipes provided by {@link RecipeMap}.
 * They will also be automatically registered as NEI recipe catalyst for the corresponding recipemaps.
 */
public interface RecipeMapWorkable {

    /**
     * @return RecipeMap this machine currently can execute. In general, it's allowed to be null.
     */
    RecipeMap<?> getRecipeMap();

    /**
     * @return ItemStack form of this machine.
     */
    ItemStack getStackForm(long amount);

    /**
     * If the machine supports multiple recipemaps by switching mode, override this method so that it will be displayed
     * as NEI recipe catalyst on all the supported recipemaps.
     *
     * @return List of possible {@link RecipeMap}s this machine can execute. Must not contain null element.
     */
    @Nonnull
    default Collection<RecipeMap<?>> getAvailableRecipeMaps() {
        RecipeMap<?> recipeMap = getRecipeMap();
        if (recipeMap != null) {
            return Collections.singletonList(recipeMap);
        }
        return Collections.emptyList();
    }

    /**
     * @return Priority for NEI recipe catalyst. Higher priority comes first.
     */
    default int getRecipeCatalystPriority() {
        return 0;
    }
}