-
Notifications
You must be signed in to change notification settings - Fork 30
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
Merged
Merged
Changes from 22 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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,103 @@ | ||
| package mezz.jei.config; | ||
|
|
||
| import com.google.gson.Gson; | ||
| import com.google.gson.GsonBuilder; | ||
| import com.google.gson.reflect.TypeToken; | ||
| import mezz.jei.util.Log; | ||
|
|
||
| import javax.annotation.Nullable; | ||
| import java.io.*; | ||
| import java.lang.reflect.Type; | ||
| import java.nio.charset.StandardCharsets; | ||
| import java.util.ArrayList; | ||
| import java.util.List; | ||
|
|
||
| /** | ||
| * Manages custom collapsible groups persistence as JSON. | ||
| * File: config/jei/customCollapsibleGroups.json | ||
| */ | ||
| public class CustomGroupsConfig { | ||
| private static final Gson GSON = new GsonBuilder().setPrettyPrinting().create(); | ||
| private static final Type GROUP_LIST_TYPE = new TypeToken<List<CustomGroup>>() {}.getType(); | ||
|
|
||
| private final File configFile; | ||
| private List<CustomGroup> customGroups = new ArrayList<>(); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe better to use a
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
|
|
||
| public CustomGroupsConfig(File configDir) { | ||
| this.configFile = new File(configDir, "customCollapsibleGroups.json"); | ||
| } | ||
|
|
||
| public void load() { | ||
| if (!configFile.exists()) { | ||
| customGroups = new ArrayList<>(); | ||
| return; | ||
| } | ||
| try (Reader reader = new InputStreamReader(new FileInputStream(configFile), StandardCharsets.UTF_8)) { | ||
| List<CustomGroup> loaded = GSON.fromJson(reader, GROUP_LIST_TYPE); | ||
| customGroups = loaded != null ? loaded : new ArrayList<>(); | ||
| } catch (Exception e) { | ||
| Log.get().error("Failed to load custom collapsible groups from {}", configFile, e); | ||
| customGroups = new ArrayList<>(); | ||
| } | ||
| } | ||
|
|
||
| public void save() { | ||
| try (Writer writer = new OutputStreamWriter(new FileOutputStream(configFile), StandardCharsets.UTF_8)) { | ||
| GSON.toJson(customGroups, GROUP_LIST_TYPE, writer); | ||
| } catch (Exception e) { | ||
| Log.get().error("Failed to save custom collapsible groups to {}", configFile, e); | ||
| } | ||
| } | ||
|
|
||
| public List<CustomGroup> getCustomGroups() { | ||
| return customGroups; | ||
| } | ||
|
|
||
| public void addGroup(CustomGroup group) { | ||
| customGroups.add(group); | ||
| save(); | ||
|
Rsslone marked this conversation as resolved.
Outdated
|
||
| } | ||
|
|
||
| public void removeGroup(String id) { | ||
| customGroups.removeIf(g -> g.id.equals(id)); | ||
|
Rsslone marked this conversation as resolved.
Outdated
|
||
| save(); | ||
| } | ||
|
|
||
| public void updateGroup(CustomGroup updated) { | ||
| for (int i = 0; i < customGroups.size(); i++) { | ||
| if (customGroups.get(i).id.equals(updated.id)) { | ||
| customGroups.set(i, updated); | ||
| save(); | ||
| return; | ||
| } | ||
| } | ||
| // Not found — add as new | ||
| addGroup(updated); | ||
|
Rsslone marked this conversation as resolved.
Outdated
|
||
| } | ||
|
|
||
| /** | ||
| * A user-defined collapsible group stored as JSON. | ||
| * Items are identified by their unique identifier string from StackHelper. | ||
| */ | ||
| public static class CustomGroup { | ||
| public String id; | ||
| public String displayName; | ||
| public List<String> itemUids; | ||
|
|
||
| public CustomGroup() { | ||
| this.id = ""; | ||
| this.displayName = ""; | ||
| this.itemUids = new ArrayList<>(); | ||
| } | ||
|
|
||
| public CustomGroup(String id, String displayName, List<String> itemUids) { | ||
| this.id = id; | ||
| this.displayName = displayName; | ||
| this.itemUids = new ArrayList<>(itemUids); | ||
| } | ||
|
|
||
| public CustomGroup copy() { | ||
| return new CustomGroup(id, displayName, new ArrayList<>(itemUids)); | ||
| } | ||
| } | ||
| } | ||
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.