rarmenia / Anvil-Enchantments

Minecraft Mod that adds the ability to craft Enchanted Books in the Anvil [No longer updated (made redundant by datapacks)]
GNU General Public License v3.0
3 stars 1 forks source link

[Mod Support] a config file table to add enchants from other mods #16

Closed Lothrazar closed 6 years ago

Lothrazar commented 7 years ago

I'm looking into coding a way to add recipes from other mods.

Assuming we can lookup an enchantment by its resource name, we could have a config table that looks like this

modid:enchantname-levels-minecraft:item-quantity

so a real example would be something like

cyclicmagic:launch-17-minecraft:soulsand-5

so 17 levels and 5 soulsand gives this enchantment . supports modded items and modded enchants

What do you think @lazerzes ?

Lothrazar commented 7 years ago

I wrote up some code really quick for how this would be done. Using the Post Init FML event it waits for other mods to load their things.

Still needs some polish and testing, but if you think this is a good addition to the mod ill finish it up tonight or tomorrow and make a pull request.

rarmenia commented 7 years ago

Nice idea, Dynamically loading content like this can be slow. But it works.

After looking at JEI's plugin system. I am interested in possibly moving towards an annotation based Plugin system -- see issue #15

Lothrazar commented 7 years ago

So lazerlib would be a JEI plugin? Or it would just be a plugin listener, and anvil enchantments would be one of potentially many plugins of your lib.

Makes sense, sounds like you have a good vision of what you want to be . I wouldn't know where to start with something like that

rarmenia commented 7 years ago

LazerLib would be a plugin listener, pretty much. Anvil Enchantment would still be a separate mod, but instead of handling everything itself, it would instead be a dependent plugin of LazerLib. This would allow mod developers to access the functionality completely separate from the idea of crafting Enchanted Books. In other words. If a developer wanted to add anvil recipes, but did not want to write the code from scratch they could instead use LazerLib as a dependent, and LazerLib would handle all of the logic.

I referenced JEI as a model for implementation. If you would like to work on this project with me, I would gladly accept the help. I would happily continue collaborating with you. If not, I understand.

Lothrazar commented 7 years ago

That makes sense. the JEI plugins are easy to use. But people sometimes try to avoid extra dependencies or apis or plugins.

Im just thinking about what might be easier for other devs and other modpack makers. Suppose we're in the future, and If im a player not a dev, putting together a pack of mods, and mods A, B, and C have enchantments, but only mod A loads in this plugin two of them dont. Well, if its a config system , it just takes me a few seconds to add those recipes. With a plugin, i have to make a feature/bug ticket with mod authors of B and C, hope they read it, and respond, and are willing to spend time coding to a plugin. Mod dev of B might be just busy, and mod dev C might say 'i dont care about that, its fine like it is, just use craft tweaker if you want more recipes'. in JEI people end up writing plugins, partly because its everywhere, and partly because i dont know how you would add a config file to link in a GUI and item slots and all that.

Im not saying its wrong or right, or trying to lay down the law or anything like that i just know what players and modders often do in the past.

Once you have this system started im sure it will work great, and i plan to use it for the enchants in Cyclic. and i might have time to contribute to it as well.

rarmenia commented 7 years ago

That is a a fair point, and I think that there is room for both. I just like the idea of separating the functionality from the content.

I think we could have a system with LazerLib or possibly still within AnvilEnchantments that adds this functionality. I would just like to separate the logic from the content if that makes sense. Mainly so it isn't completely necessary to rewrite the logic every single time I would like to add an Anvil Recipe.

rarmenia commented 6 years ago

Functionality achieved in 2.0 Rework 049e2cc6e240f27db1cee935b18d3c253c493075