-
Notifications
You must be signed in to change notification settings - Fork 1
Fixes #7
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
Conversation
…-add-auxiliary-functions Refactor with item category enum
…for-attack-damage Fix attack damage not restored after overload
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This pull request refactors item category handling by introducing the ItemCategory enum and updates various components to use it, while also addressing a bug related to player attack damage restoration.
- Refactored code to use the new ItemCategory enum instead of string literals.
- Added overloaded methods for weight calculations and configuration updates accepting ItemCategory.
- Fixed the bug by replacing the removal of modifiers from GENERIC_ARMOR with GENERIC_ATTACK_DAMAGE.
Reviewed Changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/main/java/com/megatrex4/util/ItemWeights.java | Refactored weight retrieval and static item checks to use ItemCategory. |
| src/main/java/com/megatrex4/util/ItemWeightCalculator.java | Updated method signatures and switch cases to work with ItemCategory. |
| src/main/java/com/megatrex4/util/ItemCategory.java | Added a new enum for item categories with conversion and base weight support. |
| src/main/java/com/megatrex4/util/BlockWeightCalculator.java | Modified block weight calculation to use ItemCategory with cleaner syntax. |
| src/main/java/com/megatrex4/util/BackpackWeightCalculator.java | Removed redundant local variable declarations now handled via ItemCategory. |
| src/main/java/com/megatrex4/data/PlayerDataHandler.java | Updated item categorization logic to return an ItemCategory instead of a string. |
| src/main/java/com/megatrex4/config/ItemWeightConfigItems.java | Adjusted static item checking to use the ItemCategory conversion. |
| src/main/java/com/megatrex4/compat/InventoryWeightConfigScreen.java | Replaced string parameters with ItemCategory in config screen entries. |
| src/main/java/com/megatrex4/commands/CommandRegistry.java | Updated command feedback to use the new ItemCategory getter for display. |
| src/main/java/com/megatrex4/InventoryWeightHandler.java | Fixed bug affecting attack damage restoration by switching modifier removal to attack damage. |
| gradle.properties | Updated mod version to reflect the new release. |
Comments suppressed due to low confidence (2)
src/main/java/com/megatrex4/InventoryWeightHandler.java:87
- The change from removing modifiers on GENERIC_ARMOR to GENERIC_ATTACK_DAMAGE fixes the attack damage restoration bug. Consider adding an inline comment clarifying this change to aid future maintainers.
player.getAttributes().getCustomInstance(EntityAttributes.GENERIC_ATTACK_DAMAGE)
src/main/java/com/megatrex4/data/PlayerDataHandler.java:74
- [nitpick] Document the rationale behind the heuristic substring matching for item IDs in determining the item category. This will improve maintainability and clarity for future developments.
public static ItemCategoryInfo getItemCategoryInfo(ItemStack stack) {
Enhancements
ItemCategoryenum to centralize and streamline category handling.Bug Fixes