-
Notifications
You must be signed in to change notification settings - Fork 26
Implement Collapsible Groups #175
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Rsslone
wants to merge
48
commits into
CleanroomMC:cleanroom
Choose a base branch
from
Rsslone:cleanroom
base: cleanroom
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
48 commits
Select commit
Hold shift + click to select a range
5a2c15e
Implement collapsible groups
Rsslone e7fe24c
Fix options, minor changes.
Rsslone 6ba8779
Implement collapsible group settings
Rsslone fa64f47
Configuration Cleanup
Rsslone ce91f61
Fix hide ingredients mode.
Rsslone ce72aef
Fix Enchanted Book Groups
Rsslone 1f66391
Searchable "Enchanted Book"
Rsslone c95b249
Update GuiCollapsibleGroups.java
Rsslone 00ffcb6
Implement collapsed icon preview
Rsslone f68ec93
Implement Drag Selection
Rsslone 9a448f9
Fix back button alignment
Rsslone 3b67b1f
Implement scrolling preview lists
Rsslone e4d3f71
Searchable Group Names
Rsslone 7c0e3be
Don't save group on new group.
Rsslone 20791b2
Fancy group preview icons.
Rsslone 23bf17c
Collapsed group lighting
Rsslone c7c930f
Cached baked models
Rsslone 0ee24b9
Fix tooltip min size to hint width
Rsslone 5468ca0
Implement Collapse on Close and Default Action
Rsslone b983d54
Translations
Rsslone cd1183c
Implement Alt+Click toggle HEI config menu
Rsslone cf984a6
Implement fluidstacks & 1 item groups as itemstack
Rsslone 7fc95fa
Merge CollapsedStack and CollapsibleEntry.
Rsslone 740c473
CollpasedStack use native Renderer
Rsslone 1ee068f
Implement item selector wildcard & feedback
Rsslone 271af0e
Fix single collapsedstack
Rsslone c4949f7
Item Selector Promote / Decompose
Rsslone f036d80
Fix Alignments and thin buttons
Rsslone 89e87a1
Fixed client lag spikes on collapse/expand.
Rsslone b3156a2
Improved search latency
Rsslone 0800495
Item selector QoL and delete prompts.
Rsslone 57d486f
Bump Version
Rsslone 5b8688b
Group membership cache
Rsslone 5c17aa8
Fix api hidden items being shown
Rsslone 3c4e3d9
Reload cache on show hidden in creative toggle.
Rsslone 572f332
Implement ICollapsibleGroupRegistry API
Rsslone d62d714
Collapsible Stack API change & Manage Group merge
Rsslone ee6c907
Update ICollapsibleGroupRegistry Javadoc.
Rsslone 5049bb0
Change ICollapsibleGroupRegistry to take lang key
Rsslone d59cf57
ICollapsibleGroup Builder.
Rsslone 7a76170
Fix config imports
Rsslone 96d82f8
ArrayList -> LinkedHashMap
Rsslone b86323c
CollapsedStack implements IIngredientListElement
Rsslone 2e388d9
Fixed code regression
Rsslone 14e0e3e
Revert enchanted book search fix
Rsslone 3058e23
Corrected a comment.
Rsslone b617607
Changed JEI lang keys to HEI prefix.
Rsslone b1167af
Cleanup
Rsslone File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -27,4 +27,4 @@ changelog.html | |
| \.classpath | ||
| \.project | ||
| \.settings/ | ||
| *.launch | ||
| *.launch | ||
Rongmario marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
110 changes: 110 additions & 0 deletions
110
src/api/java/mezz/jei/api/ICollapsibleGroupRegistry.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,110 @@ | ||
| package mezz.jei.api; | ||
|
|
||
| import mezz.jei.api.ingredients.IIngredientRegistry; | ||
| import mezz.jei.api.recipe.IIngredientType; | ||
|
|
||
| import java.util.function.Predicate; | ||
|
|
||
| /** | ||
| * Registry for mods to define collapsible groups in the HEI ingredient list. | ||
| * They can be toggled on/off by the user but cannot be edited or deleted. | ||
| * | ||
| * Obtain an instance via {@link IModPlugin#registerCollapsibleGroups(ICollapsibleGroupRegistry)}. | ||
| * | ||
| * EXAMPLE 1 — Group with filtered items: | ||
| * | ||
| * @Override | ||
| * public void registerCollapsibleGroups(ICollapsibleGroupRegistry registry) { | ||
| * registry.newGroup("matteroverdrive:colored_floor_tile", "tile.decorative.floor_tile.name") | ||
| * .addAny(VanillaTypes.ITEM, | ||
| * stack -> Block.getBlockFromItem(stack.getItem()) == MatterOverdrive.BLOCKS.decorative_floor_tile); | ||
| * } | ||
| * | ||
| * | ||
| * EXAMPLE 2 — Group mixing exact items, fluids, and all of a type: | ||
| * | ||
| * @Override | ||
| * public void registerCollapsibleGroups(ICollapsibleGroupRegistry registry) { | ||
| * registry.newGroup("mymod:my_group", "group.mymod.my_group") | ||
| * .add(new ItemStack(MyMod.Items.PICKAXE)) // add one exact item | ||
| * .add(new ItemStack(MyMod.Blocks.MY_BLOCK, 1, 1)) // add a specific block variant (meta=1) | ||
| * .add(FluidRegistry.getFluidStack("water", 1000)) // add an exact fluid | ||
| * .addAllOf(MyMod.CUSTOM_INGREDIENT_TYPE); // add every ingredient of a custom type | ||
| * } | ||
| * | ||
| * | ||
| * EXAMPLE 3 — Multiple groups from one plugin: | ||
| * | ||
| * @Override | ||
| * public void registerCollapsibleGroups(ICollapsibleGroupRegistry registry) { | ||
| * registry.newGroup("mymod:ores", "group.mymod.ores") | ||
| * .addAny(VanillaTypes.ITEM, stack -> isOre(stack)); | ||
| * | ||
| * registry.newGroup("mymod:gems", "group.mymod.gems") | ||
| * .addAny(VanillaTypes.ITEM, stack -> isGem(stack)); | ||
| * } | ||
| * | ||
| * | ||
| * @since HEI 4.30.0 | ||
| */ | ||
| public interface ICollapsibleGroupRegistry { | ||
|
|
||
| /** | ||
| * Creates (or retrieves) a mod collapsible group builder. | ||
| * | ||
| * Multiple calls with the same {@code id} return a builder for the same logical group. | ||
| * | ||
| * @param id Unique group ID, should be namespaced with your mod ID. | ||
| * @param langKey Unlocalized translation key for the group name (e.g. {@code "tile.mymod.name"}). | ||
| */ | ||
| CollapsibleGroupBuilder newGroup(String id, String langKey); | ||
|
|
||
| interface CollapsibleGroupBuilder { | ||
| /** | ||
| * Add one exact ingredient to the group. | ||
| * | ||
| * The backend resolves this ingredient to its unique id and matches by id. | ||
| * Works with ItemStacks, FluidStacks, or any registered ingredient type. | ||
| * | ||
| * @param ingredient the ingredient to add (e.g. new ItemStack(Items.APPLE)) | ||
| * @return this builder for chaining | ||
| */ | ||
| CollapsibleGroupBuilder add(Object ingredient); | ||
|
|
||
| /** | ||
| * Add multiple exact ingredients to the group. Equivalent to calling {@link #add(Object)} | ||
| * for each element in order. | ||
| * | ||
| * @param ingredients varargs list of ingredients to add | ||
| * @return this builder for chaining | ||
| */ | ||
| CollapsibleGroupBuilder add(Object... ingredients); | ||
|
|
||
| /** | ||
| * Add every ingredient of the given type(s) to the group — no filtering applied. | ||
| * | ||
| * Use this for custom ingredient types where you want to collapse all registered | ||
| * instances into one group. Third-party ingredient types registered via | ||
| * {@link IIngredientRegistry} are supported. | ||
| * | ||
| * <p>Note: passing {@code VanillaTypes.ITEM} or {@code VanillaTypes.FLUID} will match | ||
| * <em>every</em> item or fluid in the game. Prefer {@link #addAny} with a predicate | ||
| * when you only want a subset. | ||
| * | ||
| * @param types the ingredient type(s) whose every instance should be included | ||
| * @return this builder for chaining | ||
| */ | ||
| CollapsibleGroupBuilder addAllOf(IIngredientType<?>... types); | ||
|
|
||
| /** | ||
| * Add any ingredient of a given type that matches the provided predicate filter. | ||
| * | ||
| * Use this when you need to match items by condition (e.g. "all tools", "all ores", etc). | ||
| * | ||
| * @param type The ingredient type (e.g. {@code VanillaTypes.ITEM}). | ||
| * @param filter Predicate receiving a fully-typed {@code V} — no casting needed. | ||
| * @return this builder for chaining | ||
| */ | ||
| <V> CollapsibleGroupBuilder addAny(IIngredientType<V> type, Predicate<V> filter); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.