How about merely denying a replacement of a tool the first time the player tries to pick-block, but if the player persists trying replacing the tool with a block again, it is overridden and replaced. No unnecessary checks for enchantments or hot-bar space. This affects more than enchanted tools, any customized item like a renamed item or written/published book that's not easier to replace or duplicate than picking it out of the creative menu
How about merely denying a replacement of a tool the first time the player tries to pick-block, but if the player persists trying replacing the tool with a block again, it is overridden and replaced. No unnecessary checks for enchantments or hot-bar space.
This affects more than enchanted tools, any customized item like a renamed item or written/published book that's not easier to replace or duplicate than picking it out of the creative menu