Modify harvest level / required tool type of block
copygirl opened this issue ยท 7 comments
I've personally had to change the harvest level of an existing block (zinc ore) and unfortunately could not find a way to do so with KubeJS. Thankfully it was only a single block and did not care about world generation, so I simply made my own block to replace it. A friend now wants to do the same, with multiple ores that are generated in-world, to make them require a higher tool level.
I'm not sure why this was left out in the initial implementation, if there was a reason, or whether it was simple oversight. Essentially, it would be nice to have a harvestTool(tool, level)
method like we have with the block.registry
event, but instead on the block.modification
event.
This is now possible in 1.18.2+ as harvest tool types and levels are controlled by tags!
Tool type tags have the format minecraft:mineable/tool
, like minecraft:mineable/shovel
Tier tags have the format minecraft:needs_tier_tool
, like minecraft:needs_diamond_tool
. Note forge also has forge:needs_netherite_tool
.
hey, by any chance do u know how to enforce the right tool to be required for the block to drop an item? Like how stone will only drop itself if mined with a pickaxe, even if its a wooden one (harvest level 0). I know its not KubejS related but this is the best place I found for asking this specific thing
I looked into this recently because I wanted a tool to be required for cutting trees, and if I'm correct, that's still hardcoded into the block class and can't be changed using tags or KubeJS.
This is definitely the wrong issue but you can just do block.requiresTool = true
in a block modify event. No need for an extra loaded mod.
I wanted to do the same thing lol, how did u proceed then? and thanks for the fast answer
Personally, I just gave up on modpack creation again. ๐
But the alternative would be a mod, such as No Tree Punching (Forge + Fabric) or No Tree Punching (No Additional Features) (Forge only) that does it for you. You could use KubeJS to disable recipes and hide any items which you don't want from the mod you choose. I might be missing some alternatives, but these two mods come to mind and appear to be updated to recent Minecraft versions.