You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
get a set of smart glasses and smart chestplate
place a block of choice (e.g. oak log) above you
ensure creative game mode
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())
observe the block breaking partially and lack of incorrect tool error
switch to survival game mode
rerun the script
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
Activity
fix inversed canAttackBlock check