Fabric API

Fabric API

108M Downloads

Dynamic attribute tools that extend a vanilla tool class but aren't tagged don't work

Juuxel opened this issue ยท 2 comments

commented

Warning: heavy tool attribute API stuff ahead.

This bug is mostly theoretical (the only example of this I've seen is in the tool attribute testmod...), but it's still a low-priority bug that could be fixed.

If a tool:

  • Extends a vanilla tool class (only tested with SwordItem, but probably affects the other ones too)
  • Implements DynamicAttributeTool
  • Is not tagged with #fabric:whatever_tool (such as #fabric:swords),

mines a block that uses the legacy way of declaring mining levels via block settings, the tool is not effective when it should be. This is because of how the tool attribute API structures its handlers. The relevant ones would be:

  • ModdedToolsModdedBlocksToolHandler: technically the one that is supposed to apply, but doesn't since it's only registered for tagged DynamicAttributeTools
  • VanillaToolsModdedBlocksToolHandler: does not help either since the tool implements DynamicAttributeTool, so this handler is skipped

(The other handler types aren't relevant here at all.)

commented

Not sure what should even be done about this tbh, if you implement DynamicAttributeTool you opt into specifying tool tags explicitly.

commented

Not a problem anymore since the tool attribute API was removed in 1.18.2.