Skip to content

Conversation

@screret
Copy link
Contributor

@screret screret commented Jan 5, 2026

What

The primary purpose of this PR is to unhardcode the enchantment checks in ToolEventHandler.onHarvestDrops and BlockMixin, as data packs can remove enchantments, which would make GTM crash.

I also:

  • fixed the hammer & large miner drop conversion logic only ever checking the first recipe it came across and failing entirely if it's invalid (instead of checking all discovered recipes).
    • I don't believe this has been an issue so far, but it's better to fix now than to leave unfixed, right?
  • cached the loot functions after they're created and made the hammer/large miner drops be deterministic based on the world seed (as they would be if the loot wasn't queried separately).
  • elected to remove the SUPPLIER_ prefix from ToolHelper.POWER_UNIT_LV & co.
    • I'll add a copy of the fields with the old names and a deprecation warning if requested.
  • removed any duplicated @NotNull/@Nullable annotations I came across.
  • removed copies of vanilla break speed code in IGTTool.
  • cleaned up a lot of the related code by using guard clauses instead of nested if statements.
  • removed the two uses of the terminally deprecated bus property in @EventBusSubscriber.

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 for that. Currently, it only contains silk touch.

Outcome

  • No more hardcoded enchantment checks
  • Cleaner tool handling code
  • Less warnings

Potential Compatibility Issues

Only compatibility issue is the rename of ToolHelper.POWER_UNIT_LV, _MV, etc., but that can be resolved easily enough.

@screret screret requested a review from a team as a code owner January 5, 2026 15:26
@github-actions github-actions bot added the 1.21 label Jan 5, 2026
@Reabstraction
Copy link
Contributor

This PR touches many parts of the codebase and implements multiple separate changes. To make sure code is review-able, please extract individual changes out to either separate commits on this branch that are individually review-able, or separate PRs.

@Reabstraction Reabstraction added the Do Not Merge DO NOT MERGE THIS PR YET! label Jan 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

1.21 Do Not Merge DO NOT MERGE THIS PR YET!

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants