/
IGuiIngredientGroup.java
106 lines (94 loc) · 3.65 KB
/
IGuiIngredientGroup.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
package mezz.jei.api.gui;
import javax.annotation.Nullable;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import mezz.jei.api.ingredients.IIngredientRenderer;
import mezz.jei.api.ingredients.IIngredients;
import mezz.jei.api.ingredients.IModIngredientRegistration;
import mezz.jei.api.recipe.IFocus;
import mezz.jei.api.recipe.IRecipeCategory;
import mezz.jei.api.recipe.IRecipeWrapper;
/**
* IGuiIngredientGroup displays recipe ingredients in a gui.
* <p>
* If multiple ingredients are set for one index, they will be displayed in rotation.
* <p>
* Get an instance from {@link IRecipeLayout}.
*
* @see IGuiItemStackGroup
* @see IGuiFluidStackGroup
*/
public interface IGuiIngredientGroup<T> {
/**
* Set all the ingredients in the group, based on the {@link IIngredients}
* passed to {@link IRecipeCategory#setRecipe(IRecipeLayout, IRecipeWrapper, IIngredients)}.
*
* @since JEI 3.11.0
*/
void set(IIngredients ingredients);
/**
* Set the ingredient at slotIndex to a rotating collection of ingredients.
*
* @since JEI 3.11.0
*/
void set(int slotIndex, @Nullable List<T> ingredients);
/**
* Set the ingredient at slotIndex to a specific ingredient.
*/
void set(int slotIndex, @Nullable T ingredient);
/**
* Add a callback to alter the tooltip for these ingredients.
*/
void addTooltipCallback(ITooltipCallback<T> tooltipCallback);
/**
* Get the ingredients after they have been set.
* Used by recipe transfer handlers.
*/
Map<Integer, ? extends IGuiIngredient<T>> getGuiIngredients();
/**
* Initialize a custom guiIngredient for the given slot.
* For ItemStacks and FluidStacks, use the much simpler methods in {@link IGuiItemStackGroup} and {@link IGuiFluidStackGroup}.
* This is for handling mod ingredients registered with {@link IModIngredientRegistration}.
*
* @param slotIndex the slot index of this ingredient
* @param input whether this slot is an input
* @param ingredientRenderer the ingredient renderer for this ingredient
* @param xPosition x position relative to the recipe background
* @param yPosition y position relative to the recipe background
* @param width width of this ingredient
* @param height height of this ingredient
* @param xPadding the extra x padding added to each side when drawing the ingredient
* @param yPadding the extra y padding added to each side when drawing the ingredient
* @see IGuiItemStackGroup#init(int, boolean, int, int)
* @see IGuiFluidStackGroup#init(int, boolean, int, int, int, int, int, boolean, IDrawable)
*/
void init(int slotIndex, boolean input,
IIngredientRenderer<T> ingredientRenderer,
int xPosition, int yPosition,
int width, int height,
int xPadding, int yPadding);
/**
* The current search focus. Set by the player when they look up the recipe. The object being looked up is the focus.
*
* @deprecated since JEI 3.11.0. Use {@link IRecipeLayout#getFocus()}
*/
@Deprecated
IFocus<T> getFocus();
/**
* Set the ingredient at slotIndex to a rotating collection of ingredients.
*
* @deprecated since JEI 3.11.0. Use {@link #set(int, List)}
*/
@Deprecated
void set(int slotIndex, Collection<T> ingredients);
/*
* Force this ingredient group to display a different focus.
* This must be set before any ingredients are set.
*
* Useful for recipes that display things in a custom way depending on what the overall recipe focus is.
*
* @since JEI 3.13.6
*/
void setOverrideDisplayFocus(IFocus<T> focus);
}