Skip to content

smartHandDig Incorrect tool condition inverted #860

Backlog

Description

@vivelle2underscore

Describe

smarthand.dig() function throws INCORRECT_TOOL in situations where the tool is correct due to tool.getItem().canAttackBlock() call being inverted, only allowing the method to proceed if the block cannot be attacked and thus should not be able to be broken
I.e. since no tool normally disallows attacking blocks (a notable exception are swords, as they disallow attacking blocks in creative mode), the tool.getItem().canAttackBlock() call almost always returns true, disallowing breaking almost any block even if the correct tool is used

Steps to reproduce

  1. get a set of smart glasses and smart chestplate
  2. place a block of choice (e.g. oak log) above you
  3. ensure creative game mode
  4. run the following script
local one = smartglasses.wrapSmartHand(1)
one.setPos({x=0,y=0.5,z=0})
one.exportItem()
one.importItem({name="minecraft:netherite_sword"})
print(one.dig())
  1. observe the block breaking partially and lack of incorrect tool error
  2. switch to survival game mode
  3. rerun the script
  4. observe the error appearing as in survival Item#canAttackBlock returns true

Equivalent tests are applicable for any block that does not require a tool for drops (i.e. dirt, leaves, grass, etc.)

Multiplayer?

No

Version

1.21.1-0.8.2a (Latest 1.21.1)

Minecraft, Forge and maybe other related mods versions

Neoforge 21.1.264 Minecraft 1.21.1

Screenshots or Videos

No response

Crashlog/log

No response

Activity

  1. added
    bug
    needs review
    on Nov 26, 2026
  2. removed
    needs review
    on Nov 26, 2026
  3. added a commit that references this issue on Nov 26, 2026
    cace8d8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Fixed/Added in devbug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions