TheCodex6824 / ThaumcraftFix

GNU General Public License v3.0
8 stars 4 forks source link

Relevant Thaumcraft Beta / API repository issues #8

Closed xJon closed 3 months ago

xJon commented 3 months ago

Quite a fundamental issue, as currently a lot of modpacks have basic items with missing aspects:

Herba is missing for some of them like Wooden Shovel (specifically), Stick, Bowl, Ladder...

For example, this is reproducible with just IC2 Classic added (alongside Thaumcraft).

This issue was already troubleshooted by tterrag1098 who found out the cause, but a solution was never integrated into a proper mod.


Another fundamental issue, as Thaumic JEI is widely used for ease of use and this breaks its way of controlling recipe visibility, making almost all modpacks ship with B:hideRecipesIfMissingResearch=false (which in my eyes hinders immersion).

TheCodex6824 commented 3 months ago

The first issue does seem like a major problem, I'll work on that one. The second should already be fixed in theory, although I need to do a more formal test to make sure I actually fixed it.

TheCodex6824 commented 3 months ago

For example, this is reproducible with just IC2 Classic added (alongside Thaumcraft).

Do you have an example of an item affected by this issue? Please include what aspects you are expecting the item to have if it wasn't affected by the bug.

xJon commented 3 months ago

@TheCodex6824 Yes, I included it in the original issue:

Herba is missing for some of them like Wooden Shovel (specifically), Stick, Bowl, Ladder...

TheCodex6824 commented 3 months ago

Seems like there is a big mess here - other than both tterag's and my fixes not fixing your issue, I get multiple things like this:

[ThaumicJEI Aspect Cache/INFO] [STDERR]: [thaumcraft.common.lib.crafting.ThaumcraftCraftingManager:generateTagsFromCraftingRecipes:529]: java.lang.ArrayIndexOutOfBoundsException: -4
[ThaumicJEI Aspect Cache/INFO] [STDERR]: [thaumcraft.common.lib.crafting.ThaumcraftCraftingManager:generateTagsFromCraftingRecipes:529]:    at ic2.core.item.recipe.AdvRecipe.getRemainingItems(AdvRecipe.java:400)
[ThaumicJEI Aspect Cache/INFO] [STDERR]: [thaumcraft.common.lib.crafting.ThaumcraftCraftingManager:generateTagsFromCraftingRecipes:529]:    at thaumcraft.common.lib.crafting.ThaumcraftCraftingManager.getAspectsFromIngredients(ThaumcraftCraftingManager.java:550)
[ThaumicJEI Aspect Cache/INFO] [STDERR]: [thaumcraft.common.lib.crafting.ThaumcraftCraftingManager:generateTagsFromCraftingRecipes:529]:    at thaumcraft.common.lib.crafting.ThaumcraftCraftingManager.generateTagsFromCraftingRecipes(ThaumcraftCraftingManager.java:514)
[ThaumicJEI Aspect Cache/INFO] [STDERR]: [thaumcraft.common.lib.crafting.ThaumcraftCraftingManager:generateTagsFromCraftingRecipes:529]:    at thaumcraft.common.lib.crafting.ThaumcraftCraftingManager.generateTagsFromRecipes(ThaumcraftCraftingManager.java:604)
[ThaumicJEI Aspect Cache/INFO] [STDERR]: [thaumcraft.common.lib.crafting.ThaumcraftCraftingManager:generateTagsFromCraftingRecipes:529]:    at thaumcraft.common.lib.crafting.ThaumcraftCraftingManager.generateTags(ThaumcraftCraftingManager.java:425)
[ThaumicJEI Aspect Cache/INFO] [STDERR]: [thaumcraft.common.lib.crafting.ThaumcraftCraftingManager:generateTagsFromCraftingRecipes:529]:    at thaumcraft.common.lib.crafting.ThaumcraftCraftingManager.getObjectTags(ThaumcraftCraftingManager.java:179)
[ThaumicJEI Aspect Cache/INFO] [STDERR]: [thaumcraft.common.lib.crafting.ThaumcraftCraftingManager:generateTagsFromCraftingRecipes:529]:    at thaumcraft.common.lib.crafting.ThaumcraftCraftingManager.getAspectsFromIngredients(ThaumcraftCraftingManager.java:558)
[ThaumicJEI Aspect Cache/INFO] [STDERR]: [thaumcraft.common.lib.crafting.ThaumcraftCraftingManager:generateTagsFromCraftingRecipes:529]:    at thaumcraft.common.lib.crafting.ThaumcraftCraftingManager.generateTagsFromCraftingRecipes(ThaumcraftCraftingManager.java:514)
[ThaumicJEI Aspect Cache/INFO] [STDERR]: [thaumcraft.common.lib.crafting.ThaumcraftCraftingManager:generateTagsFromCraftingRecipes:529]:    at thaumcraft.common.lib.crafting.ThaumcraftCraftingManager.generateTagsFromRecipes(ThaumcraftCraftingManager.java:604)
[ThaumicJEI Aspect Cache/INFO] [STDERR]: [thaumcraft.common.lib.crafting.ThaumcraftCraftingManager:generateTagsFromCraftingRecipes:529]:    at thaumcraft.common.lib.crafting.ThaumcraftCraftingManager.generateTags(ThaumcraftCraftingManager.java:425)
[ThaumicJEI Aspect Cache/INFO] [STDERR]: [thaumcraft.common.lib.crafting.ThaumcraftCraftingManager:generateTagsFromCraftingRecipes:529]:    at thaumcraft.common.lib.crafting.ThaumcraftCraftingManager.getObjectTags(ThaumcraftCraftingManager.java:179)
[ThaumicJEI Aspect Cache/INFO] [STDERR]: [thaumcraft.common.lib.crafting.ThaumcraftCraftingManager:generateTagsFromCraftingRecipes:529]:    at thaumcraft.common.lib.crafting.ThaumcraftCraftingManager.getObjectTags(ThaumcraftCraftingManager.java:143)
[ThaumicJEI Aspect Cache/INFO] [STDERR]: [thaumcraft.common.lib.crafting.ThaumcraftCraftingManager:generateTagsFromCraftingRecipes:529]:    at thaumcraft.common.lib.InternalMethodHandler.getObjectAspects(InternalMethodHandler.java:86)
[ThaumicJEI Aspect Cache/INFO] [STDERR]: [thaumcraft.common.lib.crafting.ThaumcraftCraftingManager:generateTagsFromCraftingRecipes:529]:    at thaumcraft.api.aspects.AspectHelper.getObjectAspects(AspectHelper.java:69)
[ThaumicJEI Aspect Cache/INFO] [STDERR]: [thaumcraft.common.lib.crafting.ThaumcraftCraftingManager:generateTagsFromCraftingRecipes:529]:    at thaumcraft.api.aspects.AspectList.<init>(AspectList.java:21)
[ThaumicJEI Aspect Cache/INFO] [STDERR]: [thaumcraft.common.lib.crafting.ThaumcraftCraftingManager:generateTagsFromCraftingRecipes:529]:    at com.buuz135.thaumicjei.ThaumcraftJEIPlugin.createAspectsFile(ThaumcraftJEIPlugin.java:224)
[ThaumicJEI Aspect Cache/INFO] [STDERR]: [thaumcraft.common.lib.crafting.ThaumcraftCraftingManager:generateTagsFromCraftingRecipes:529]:    at com.buuz135.thaumicjei.ThaumcraftJEIPlugin.lambda$register$3(ThaumcraftJEIPlugin.java:134)
[ThaumicJEI Aspect Cache/INFO] [STDERR]: [thaumcraft.common.lib.crafting.ThaumcraftCraftingManager:generateTagsFromCraftingRecipes:529]:    at java.lang.Thread.run(Thread.java:750)

Regardless of that exception spam, I'm not sure if the missing stick etc aspects are the linked bug - something seems to think that vanilla oak planks should have 1 herba as their aspect. I noticed there is a recipe that creates 64 planks from 8 oak logs + a blade. If you do the math, 8 logs is 160 herba, which gets multiplied by 0.75 as the recipe penalty. Divide that (120) by 64 planks and you get 1.875 herba per plank, which gets truncated down to 1*. Then, when you use planks to make sticks, 2 planks = 2 herba, which when multiplied by 0.75 and divided by 4 sticks, results in 0.375 truncated down to 0 herba.

So I'm going to keep looking into this, but for your usecase you might need to just explicitly set the herba count of planks to the normal value (not sure if crafttweaker etc exposes both of these, but you want to set the objectTag and not the complexObjectTag).

[*] There is a single exception to this rule - if the number is greater than 0.75 but less than 1.0, it is set to 1 instead of truncating to 0. It doesn't apply here, though.

xJon commented 3 months ago

@TheCodex6824 That is a mess, I understand why you are suggesting a manual override for a modpack using IC2 Classic. Thaumcraft Fix could hardcode Planks' Herba universally but I'd understand if you don't like this approach.

My question is, why does Thaumcraft override vanilla recipes' calculations with modded recipes? Is it possible to make Thaumcraft "prefer" vanilla recipes' calculations over modded ones?

TheCodex6824 commented 3 months ago

My question is, why does Thaumcraft override vanilla recipes' calculations with modded recipes? Is it possible to make Thaumcraft "prefer" vanilla recipes' calculations over modded ones?

From some quick looking, it seems like Thaumcraft will always pick the recipe that results in the least sum of total aspects on the item. Unfortunately, as long as those recipes exist, Thaumcraft will always determine that a plank has 1 herba.

As you guessed, I don't want to start hardcoding aspects to work around mod-specific issues. Additionally, this would create situations where certain recipes will give outputs that have a greater aspect total than their ingredients. As an example, if this recipe were to give planks with 3 herba each as normal, the resulting planks would have 64 3 = 192 herba, which makes no sense since the logs only have 20 8 = 160 herba.

xJon commented 3 months ago

From some quick looking, it seems like Thaumcraft will always pick the recipe that results in the least sum of total aspects on the item.

Do you have any thoughts about changing that behaviour, possibly to the inverse, or to prioritise Vanilla recipes?

IcarussOne commented 3 months ago

It's been awhile since I played older versions than 1.12.2 but has this ever occurred in Thaumcraft 3, 4, or 5? Could be worth checking on what those versions did.

TheCodex6824 commented 3 months ago

From some quick looking, it seems like Thaumcraft will always pick the recipe that results in the least sum of total aspects on the item.

Do you have any thoughts about changing that behaviour, possibly to the inverse, or to prioritise Vanilla recipes?

I'm against inverting the behavior in the general case - this would probably change aspects on tons of items which could break existing modpacks, and will probably create situations where some items have way more essentia than they are supposed to. I'd maybe be more open to prioritizing vanilla recipes to make aspects on vanilla items more consistent, but I could see how this might not be desired in modpacks that drastically change the normal gameplay like skyblock packs. Is there a reason you can't just change the aspects for your pack? If you fix planks, the fixed aspects should propagate to the rest of the affected items.

It's been awhile since I played older versions than 1.12.2 but has this ever occurred in Thaumcraft 3, 4, or 5? Could be worth checking on what those versions did.

Thaumcraft 4 seems to have the same recipe selection behavior, except that the 0.75 < x < 1.0 exception doesn't exist and there are some extra checks to exclude any recipes involving the EE transmutation stone.

xJon commented 3 months ago

Is there a reason you can't just change the aspects for your pack?

Not at all, I was just trying to think of an elegant universal solution instead of manual fixes per-pack. Maybe prioritising vanilla recipes as a config toggle would be good, but either way I understand the concerns.

TheCodex6824 commented 3 months ago

So both of the original issues here are fixed now (I tested the Thaumic JEI thing). At some point I can look into adding convenience config options for modifying how some features like the aspect calculation work, but I think continuing adding bugfixes should happen first.

xJon commented 2 months ago

@TheCodex6824 I'm not sure what was the end goal of https://github.com/TheCodex6824/ThaumcraftFix/commit/cc4fa64eb70585cf0150f24343b881eebff64fdf, but I still have items with no aspects whatsoever when playing alongside IC2 Classic (e.g. Sticks, Ladders).

Also about this:

for your usecase you might need to just explicitly set the herba count of planks to the normal value

I tried it, and for some reason it doesn't fix everything - even though I manually override all of the 6 vanilla plank types to have 3 Herba, the Bowl item is still missing it, which makes it seem that every item will need to be manually checked and corrected somehow.

TheCodex6824 commented 2 months ago

I'm not sure what was the end goal of https://github.com/TheCodex6824/ThaumcraftFix/commit/cc4fa64eb70585cf0150f24343b881eebff64fdf, but I still have items with no aspects whatsoever when playing alongside IC2 Classic (e.g. Sticks, Ladders).

That is expected - that commit just fixes the original issue that was linked (with gelum not being on snow). Your issue is different and other than adding config options, I can't think of a way to solve that without breaking things for everyone else.

Also about this:

I'll look into this - it sounds like the aspect registration might be happening after recipes are scanned, which would be a problem. I'm not sure, though.

xJon commented 2 months ago

I'll look into this - it sounds like the aspect registration might be happening after recipes are scanned, which would be a problem. I'm not sure, though.

It's strange though as manually setting planks as 3 Herba does change the Herba aspect of other wooden items (e.g. Sticks, Ladders), but not Bowls.

xJon commented 1 month ago

@TheCodex6824 By the way, when using the /tc research all command, the sync issue with Thaumic JEI is still present, although it's really not a proper issue as it's a creative-mode edge-case.