Merged
Conversation
…ull for some times)
# Conflicts: # pom.xml
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR optimizes the recipe GUI by hashing and caching player state to avoid unnecessary redraws, and centralizes event routing.
- Introduces
InventoryFingerprint,IngredientFingerprint, andRecipeCacheKeyto fingerprint inventory, ingredients, and build cache keys - Refactors
RecipeGui.reloadRecipesto early‐exit when inventory/level/money/page/queue state is unchanged and reuses cachedCalculatedRecipe - Adds
RecipeGuiEventRouterand enhancesProfessionGuiRegistryto manage the active recipe GUIs in a single registry
Reviewed Changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| src/main/java/.../RecipeGuiEventRouter.java | New listener that forwards inventory and player events to the active RecipeGui |
| src/main/java/.../RecipeCacheKey.java | Defines a cache key combining recipe ID, inventory hash, player level/money |
| src/main/java/.../InventoryFingerprint.java | Computes an MD5 (or fallback) fingerprint of a player’s inventory |
| src/main/java/.../IngredientFingerprint.java | Immutable fingerprint matching item similarity for ingredient lookups |
| src/main/java/.../RecipeGui.java | Overhauled reload logic with hashing, caching, early bail-out, removed dupes |
| src/main/java/.../ProfessionGuiRegistry.java | Added latestRecipeGui map and clear method for tracking open recipe GUIs |
| src/main/java/.../CalculatedRecipe.java | Now uses IngredientFingerprint in create; cleaned up equals/hashCode |
| src/main/java/.../InventoryPattern.java | Switched from ItemBuilder to RecipeItem.fromConfig for pattern items |
| src/main/java/.../FusionPlayer.java | Removed GUI cache; updated queue key to include category name |
| src/main/java/.../CommandMechanics.java | Clears GUI registry and recipe cache on plugin reload |
| src/main/java/.../ProfessionMigration.java | Added but unused import |
| src/main/java/.../FusionAPI.java | Added defaulting getters for managers |
| src/main/java/.../Fusion.java | Registered the new RecipeGuiEventRouter on enable |
Comments suppressed due to low confidence (1)
src/main/java/studio/magemonkey/fusion/data/player/FusionPlayer.java:52
- [nitpick] Changing the cache key to include
category.getName()may break existing persisted queue lookups for callers expecting only the profession key. Verify downstream code to ensure compatibility or migrate existing entries.
cachedQueues.put(profession + "." + category.getName(), new CraftingQueue(getPlayer(), profession, category));
src/main/java/studio/magemonkey/fusion/gui/recipe/RecipeGuiEventRouter.java
Outdated
Show resolved
Hide resolved
src/main/java/studio/magemonkey/fusion/gui/recipe/InventoryFingerprint.java
Outdated
Show resolved
Hide resolved
src/main/java/studio/magemonkey/fusion/cfg/migrations/ProfessionMigration.java
Outdated
Show resolved
Hide resolved
src/main/java/studio/magemonkey/fusion/data/recipes/CalculatedRecipe.java
Show resolved
Hide resolved
…gerprint.java Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Contributor
Author
|
I will still put that one on draft for now due to the problem of crafting times being bypassed/skipped on relogging |
…ine=true` (offline updates still dont work, but online time works now)
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Some reworking regarding the recipe gui. It was continously updated and caused many lags in past.
This approach uses hashing to stop the gui from reloading when not required.