Having issues with adding custom potion ingredients/some questions about the system
Not-February opened this issue ยท 6 comments
I saw in the changelog that the potions config was worked on a bit, so I gave it another crack for the first time in ages - I've always thought it'd be cool to add custom stuff to Reliquary's potion system, but since it never worked for me before, I always assumed I was horribly misinterpreting the formatting and gave up to work on other stuff instead.
I seem to have run into another roadblock this time, however, even though it initially seemed to work... and after putting my custom entries back in one at a time, I think I might have determined the cause of my problem.
As soon as I added the following into the config, it began to crash before getting to the main menu(here's the crash for the record! https://gist.github.com/Febilian/2ce19f23d45cd1523eeef08b31347cd2 ):
mknutils:foodmisc|3=saturation|0|0;water_breathing|1|0;extraalchemy:effect.sinking|1|0 mknutils:foodmisc|6=poison|1|0;nausea|0|0
It worked fine until that second line there was added. The one that's the same item but uses different metadata. At first I thought I had a typo in the item name or the names of the potion effects, but I checked at least three times and either I'm completely missing it, or that isn't the issue. I removed/changed the potion effects to no avail. The only thing that's remained unchanged is the item's metadata.
So, there it is: I think my problem has to do with adding the same item to the list more than once, but with a different metadata. Which seems to only affect things that are new to the ingredient list, since things like coal and charcoal(which also use the same item name but different metadata) are up there in the config working just fine and dandy.
On another note, since I'm already here about the potion system... I would like to express my current understanding of the formatting used in the config file; it isn't terribly well documented so I had to do a lot of guesswork based on existing entries and the wiki. Would you mind elaborating on whether I am correct in my assumptions on how it works or not?
For example, a working entry I have in my config looks like this(it shows up in JEI in-game as a usable mortar ingredient, at least, so I assume it will work when actually used as well):
aether_legacy:blue_berry|0=health_boost|1|0;instant_health|0|0
I think it goes something like this as far as formatting goes...
modname:item_name|metadata=potion_effect_id|duration_modifier|potency_modifier;other_potion_effect_id|duration|potency
If adding a potion effect from another mod(or anything not vanilla Minecraft), the potion effect id looks more like the initial item entry, with the mod name in front of the effect:
modname:potion_effect
For example, in the default config, you've got xreliquary:cure_potion
as an entry several times for different ingredients - it appears so far that adding effects from other mods is functional the same way as well. I used CraftTweaker 2 to dump the usable potion IDs in my game for use in this. Seems to have worked fine thus far.
From what I can see, at its base state the duration modifier seems to be a multiplier of 15 seconds or so. If the entry where I believe 'duration' is relevant is set to 1, and then combined with another ingredient which has the same duration/potency listed for that effect, the effect is around 15 seconds baseline. If it's 2, it bumps it up to 30 seconds. 3 becomes 45 seconds, and so on.
This duration seems to change depending on the 'potency' modifier I have listed there - if it's anything higher than 0, anyways. I don't know the exact numbers just by eyeballing it, but the higher the potency, the more diminished the duration seems to become overall. Is this the case?
Going by how I remember vanilla MC working, potion levels start at 0 internally. A basic instant health potion is a level 0 effect, while instant health II is a level 1 effect. Is that how it works here too?
And I also am under the impression that 'instant' potion effects are handled a little differently from most others. What happens if, for example, instant health is given a duration number other than 0? Does it keep repeating the potion effect constantly for that multiple of 15 seconds, or just flat out not work?
Just a few more things. Is there a limit to the potency an effect's ingredient should have? A hard limit, a suggested limit for things to work as intended, anything at all?
Lastly, for a potion effect to become active in a potion essence, does it require the exact same duration/potency as another ingredient? Could level 0 and level 1 effects, for example, combine in the essence? Or does it only work if both ingredients have the effect potency as either 0 or 1?
Thanks for your time!
I am adding a check in Reliquary that makes sure that the format provided matches what's expected and if not it logs the line in log with some explanation of what the line should look like. (I have plans to convert this to a JSON file that will be much easier to maintain in the future, but for now this will do).
That said I tried running with those two lines you have above with no problem and I don't see why they wouldn't work. There must have been something else in your config that made Reliquary or Forge parse them incorrectly. Anyway with the logging it should show you what exactly it gets from config.
Regarding your other questions:
Duration multiplier - yes this is used to multiply 15 seconds of duration on the ingredient, but resulting duration is additive and at the end it removes 20% from the total for 2 ingredients and additional 10% for 3.
Amplifier - yes works the same as vanilla - so two potion ingredients with amplifier 0 combine into level 1 potion essence, when combining higher level ones the amplifiers get added together and are then used as the resulting amplifier (0 and 1 = level 2 potion, 1 and 2 = level 4 potion)
Also glowstone / redstone in cauldron affect change the resulting potion, but you can pretty easily check that in JEI (will need to turn on the option in reliquary config).
Instant potions just ignore the duration you have set in the config because they are a one time thing.
Potency has a hardcoded limit of amplifier 4 that is level 5 potion.
What's important for potion effect to be active is just that at least 2 ingredients have the effect on them they don't need to be the same duration or potency.
In case that you have any additional questions or suggestions let me know.
Also if you would like to rewrite this mess of my answers into something a human (modpack maker) can understand I would really love that as I would like people to use the potion system more and they need to understand it.
I'd want to do some more testing with this new information in mind before I try to write up anything for other people to learn from, and I'm not sure how soon I could do that, but I will keep this in mind as something to do later. I would also be happy to see more people utilize this system, as it's quite interesting and it's unfortunate that the lack of human-readable documentation is mostly what's prevented it.
I finally decided to take another crack at this(real life issues are bleh), and the logging system that has been added since I last tried this is at least telling me where it's having issues, but... I'm still confused about why some entries will work and others won't.
Not all of my added entries seem to be erroring, and I feel like I'm fumbling around in the dark trying to determine exactly what's wrong in my entries...
This is a gist for the entire config section regarding potion entries(most are default but some are modified and most of my additions are near the end of the list): https://gist.github.com/Febilian/afc6080ea51fedf1af6f01b2fd3c59d2
This is the section of my log which mentions Reliquary potion issues: https://gist.github.com/Febilian/c1cd10aaa54d23bd36b9f5a1d013873d
I'd really appreciate it if someone could tell me why those specific entries aren't working. I can't seem to find the common factor, and if they're typos, one is often blind to one's own mistakes in that regard.
If it helps, I used a mod called TellMe to dump all the potion IDs in my instance, and this is the file/information it gave me: https://gist.github.com/Febilian/68825378079d979d5fb85cee67dd4b66
Thanks for your time.
Okay, new development... I tried removing specifically those erroring lines, and the log didn't say anything more about that, but Minecraft still crashed before getting to the main menu.
https://gist.github.com/Febilian/74efec855d61e85b4279bbfc2e19c1ae
It seems to be specifically referencing ingredients trying to combine or something, and something going wrong while it's trying to figure out the different available combinations. I feel you would have a better idea than I do about the limitations of the system. Could it be that I'm putting too many different effects on some items? Or maybe some effects don't work well when put together on an ingredient?
From what I can gather there's a potion effect that doesn't have an associated potion that crashes this logic. However would be better to debug this to know more. Also as part of that I can add more logging of what went wrong where.
I wanted to try downloading mods to test your config, but for example I can't find 1.12 build of grimoire of gaia anywhere. Have you got this as a modpack somewhere where I can grab it?
The version of Grimoire of Gaia 3 for 1.12 that I'm using is an alpha from the forums, let me grab the post that had it:
Usually my modpacks are for a small private community, and I'm reluctant to post a download link for something from it publicly, but if you don't mind communicating through Discord, that may make it easier to figure this out, and I wouldn't be averse to sharing my configs/mods/etc through that.