A display holds information and ingredients for Categories to setup for.
<aside> 💡 It is also important to read Categories at the same time!
</aside>
getInputEntries()
returns List<EntryIngredient>
.
This is used to resolve the relationships between stacks, and not necessarily how the category must render the display as.
Each EntryIngredient
is a list of possible variants of the ingredient. For example, if this method returns an oak plank, and a list of logs, it means that it requires one oak plank and any logs.getInputEntries(MenuSerializationContext, MenuInfo, boolean)
returns List<InputIngredient<EntryStack<?>>>
.
This is used to resolve the list of inputs for this display, aligned for the menu.
Each ingredient is provided with the corresponding slot-index, and the order of the list does not matter.
This method is optional to override, learn more about display transfer here.getOutputEntries()
returns List<EntryIngredient>
.
This is used to resolve the relationships between stacks, and not necessarily how the category must render the display as.
Each EntryIngredient
is a list of possible variants of the ingredient. For example, if this method returns an oak plank, and a list of logs, it means that it returns one oak plank and any logs.getRequiredEntries()
returns List<EntryIngredient>
.
By default, this method returns the same list as getInputEntries()
, but this method only affects the craftable filter, as the required items to have in the inventory to satisfy the display.getCategoryIndentifier()
returns CategoryIndentifier<?>
.
This should return the identifier of the category, read Categories for more information.getDisplayLocation()
returns Optional<ResourceLocation>
(Mojmap) / Optional<Identifier>
.
If the backend of this display is a recipe, you should return the recipe identifier so REI knows the recipe id to allow users to copy the recipe identifier.Extend Display
and override the methods.
Extend BasicDisplay
, in the constructor return the list of inputs, outputs and the possible display location.
For example, this is the stonecutting display:
public DefaultStoneCuttingDisplay(StonecutterRecipe recipe) {
this(EntryIngredients.ofIngredients(recipe.getIngredients()), Collections.singletonList(EntryIngredients.of(recipe.getResultItem())),
Optional.ofNullable(recipe.getId()));
}
public DefaultStoneCuttingDisplay(List<EntryIngredient> inputs, List<EntryIngredient> outputs, Optional<ResourceLocation> location) {
super(inputs, outputs, location);
}
With BasicDisplay, it is super easy to create a DisplaySerializer
.
BasicDisplay.Serializer.ofSimple(DefaultStoneCuttingDisplay::new)
More complex setup for BasicDisplay