/
IGuiIngredient.java
46 lines (40 loc) · 1.49 KB
/
IGuiIngredient.java
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
package mezz.jei.api.gui;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.awt.*;
import java.util.Collection;
import java.util.List;
import mezz.jei.api.recipe.IFocus;
import mezz.jei.api.recipe.transfer.IRecipeTransferHandler;
import mezz.jei.api.recipe.transfer.IRecipeTransferHandlerHelper;
import net.minecraft.client.Minecraft;
/**
* Represents one drawn ingredient that is part of a recipe.
* Useful for implementing {@link IRecipeTransferHandler} and some other advanced cases.
* Get these from {@link IGuiIngredientGroup#getGuiIngredients()}.
*/
public interface IGuiIngredient<T> {
/**
* The ingredient variation that is shown at this moment.
* For ingredients that rotate through several values, this will change over time.
*/
@Nullable
IFocus<T> getCurrentlyDisplayed();
/**
* All ingredient variations that can be shown.
* For ingredients that rotate through several values, this will have them all even if a focus is set.
*/
@Nonnull
List<T> getAllIngredients();
/**
* Returns true if this ingredient is an input for the recipe, otherwise it is an output.
*/
boolean isInput();
/**
* Draws a highlight on background of this ingredient.
* This is used by recipe transfer errors to turn missing ingredient backgrounds to red, but can be used for other purposes.
*
* @see IRecipeTransferHandlerHelper#createUserErrorForSlots(String, Collection).
*/
void drawHighlight(@Nonnull Minecraft minecraft, Color color, int xOffset, int yOffset);
}