<aside> 🚧 Experimental Feature! CollapsibleEntryRegistry was introduced in REI 8.3!
</aside>
To avoid having a lot of useless entries in the entry list, it is useful to group and collapse lesser used entries together.
For example, AE2 Facades, where there are facades for each block in the game.
In a client plugin (Constructing Plugins), override registerCollapsibleEntries
.
With the CollapsibleEntryRegistry
, you may create groups of entries.
First, you will need an identifier for the group, this is used internally to handle the grouping, so make sure this is unique and contains the correct modid for the namespace.
Then, the method expects the name of the group, this is displayed in the collapsed stack tooltip.
Lastly, we are to find the stacks for grouping.
The easiest way is to group the entries by tags. You can use EntryIngredients.ofItemTag
or EntryIngredients.ofFluidTag
.
You can also conditionally add stacks to the group using a predicate. This predicate is evaluated on collapsing the entries, so it is tested on all entries. Make sure this predicate is performant.
The method expects a list of EntryStacks, which you can manually supply.
<aside> 💡 Take use of EntryIngredient! It is in itself an immutable list of EntryStacks.
</aside>