#Dynamically set Enchantment properties

3 messages · Page 1 of 1 (latest)

tardy mural
#

Since Minecraft 1.21 Enchantments have become data driven. This means, I have to define its properties statically. So what if I want to have its availability in trades be configurable for the player? Previously I would just override the isAvailableForEnchantedBookOffer method in my enchantment class, but now that behavior is controlled by the minecraft:tradeable tag instead, which afaik I would have to specify statically in a json file in my mod resources.

So I guess what I'm asking is, how can I change resources dynamically, or maybe generate them during mod startup?

#

Also I'm doing this in a multiplatform project, so a solution that also works on NeoForge would be best :)

safe mantle
#

you can see where EnchantmentTags.TRADEABLE is used and mixin there