From f12c906de61d340cfe537f4f166aa20c4bdc52a1 Mon Sep 17 00:00:00 2001 From: shedaniel Date: Wed, 22 Jun 2022 23:01:35 +0800 Subject: Finish Collapsible Entries Visuals --- .../registry/entry/CollapsibleEntryRegistry.java | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) (limited to 'api') diff --git a/api/src/main/java/me/shedaniel/rei/api/client/registry/entry/CollapsibleEntryRegistry.java b/api/src/main/java/me/shedaniel/rei/api/client/registry/entry/CollapsibleEntryRegistry.java index a85054848..c24ca5e2a 100644 --- a/api/src/main/java/me/shedaniel/rei/api/client/registry/entry/CollapsibleEntryRegistry.java +++ b/api/src/main/java/me/shedaniel/rei/api/client/registry/entry/CollapsibleEntryRegistry.java @@ -28,6 +28,8 @@ import me.shedaniel.rei.api.common.entry.EntryStack; import me.shedaniel.rei.api.common.entry.type.EntryType; import me.shedaniel.rei.api.common.plugins.PluginManager; import me.shedaniel.rei.api.common.registry.Reloadable; +import net.minecraft.network.chat.Component; +import net.minecraft.resources.ResourceLocation; import net.minecraft.tags.TagKey; import org.jetbrains.annotations.ApiStatus; @@ -53,38 +55,46 @@ public interface CollapsibleEntryRegistry extends Reloadable { /** * Groups the given {@link EntryStack}s into a single entry in the entry panel. * + * @param id the identifier of the group + * @param name the name of the group * @param stacks the stacks to group * @param the type of the stacks */ - void group(List> stacks); + void group(ResourceLocation id, Component name, List> stacks); /** * Groups the given {@link EntryStack}s into a single entry in the entry panel. * + * @param id the identifier of the group + * @param name the name of the group * @param stacks the stacks to group * @param the type of the stacks */ - default void group(EntryStack... stacks) { - group(Arrays.asList(stacks)); + default void group(ResourceLocation id, Component name, EntryStack... stacks) { + group(id, name, Arrays.asList(stacks)); } /** * Groups the matching {@link EntryStack}s via the given predicate into * a single entry in the entry panel. * + * @param id the identifier of the group + * @param name the name of the group * @param predicate the predicate to match the stacks */ - void group(Predicate> predicate); + void group(ResourceLocation id, Component name, Predicate> predicate); /** * Groups the matching {@link EntryStack}s via the given predicate into * a single entry in the entry panel. * + * @param id the identifier of the group + * @param name the name of the group * @param type the entry type to match * @param predicate the predicate to match the stacks * @param the type of the stacks */ - default void group(EntryType type, Predicate> predicate) { - group(stack -> stack.getType() == type && predicate.test(stack.cast())); + default void group(ResourceLocation id, Component name, EntryType type, Predicate> predicate) { + group(id, name, stack -> stack.getType() == type && predicate.test(stack.cast())); } } -- cgit