Skip to content

Conversation

@MEGATREX4
Copy link
Owner

Enhancements

  • Introduced ItemCategory enum to centralize and streamline category handling.
    • Provides access to base weight directly from the enum.
    • Supports conversion from string to category enum for easier parsing.

Bug Fixes

  • Fixed an issue where reduced player attack damage was not restored properly after certain effects expired.

@MEGATREX4 MEGATREX4 requested a review from Copilot June 24, 2025 11:33
Copy link

Copilot AI left a 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) {

@MEGATREX4 MEGATREX4 merged commit 573c810 into main Jun 24, 2025
0 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants