Skip to content

Use enchantment tags for tool enchantment checks#4494

Open
screret wants to merge 8 commits intoGregTechCEu:1.21from
screret:sc/use-tags-for-tool-enchantment-checks
Open

Use enchantment tags for tool enchantment checks#4494
screret wants to merge 8 commits intoGregTechCEu:1.21from
screret:sc/use-tags-for-tool-enchantment-checks

Conversation

@screret
Copy link
Contributor

@screret screret commented Jan 24, 2026

What

This PR makes the enchantment checks in ToolEventHandler.onHarvestDrops and BlockMixin use enchantment tags instead of hardcoding the specific enchantment they test for.
As they are, they can cause crashes because data packs can remove enchantments.

Implementation Details

For all the applicable cases, I used the same utility function vanilla uses for silk touch: EnchantmentHelper.hasTag.
A tag for enchants that block hammer drop conversion was added. Currently, it only contains silk touch.

Outcome

Fixes a possible bug with enchantment checking, and allows mod- and datapack developers to change what enchantments fill the described conditions

Additional Information

This pull request depends on changes done in #4492, so that should be merged first.

@screret screret requested a review from a team as a code owner January 24, 2026 14:58
@github-actions github-actions bot added the 1.21 label Jan 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant