[Feature Request] Checking if an enchantment can be applied by ToolType
blockgoblin31 opened this issue ยท 3 comments
Describe the feature you'd like
I'd like to be able to do something like MCEnchantment.canApply(IItemStack) but for ToolTypes. This would allow me to make an associative array of tool types to lists of enchantments so I can get it easily by the type of tool I have
Describe alternatives you've considered
I could use a specific tool of each type for my associative array and check against that
Additional context
Specifically trying to clean up my villager trades script, I feel like this would be a great way to start. I already have a list of all tooltypes from /ct dump, and then I can easily iterate through enchantments to add them
Minecraft version
1.16
Modloader
Forge
Hey, I was looking into adding this but I am not sure if it makes sense. Forge's ToolType system is for describing the types of actions an item can do and has no connection to the enchanting system. Minecraft does have an EnchantmentType system however that allows you to categorize things along similar lines, for example ARMOR, DIGGER, WEAPON, BREAKABLE, etc. I recently submitted a PR that makes this system more accessible to scripts and added some general helper methods I think you may find useful. The PR has already been merged and the update is available on curseforge. #1686
As Darkhax said, the idea does not really make sense, his PR should help you out regardless though.