CraftTweaker doesn't remove recipes
Terrails opened this issue · 32 comments
MC Version: 1.12.2
Forge: 14.23.4.2750
Mod Version: 26.3.210
CraftTweaker Version: 4.1.9
I'm trying to make all mods I've got in my modpack use ingots from one mod. I'm having quite a bit of trouble with Futurepack when I try to remove a recipe from any machine. It just doesn't remove the recipe, whilst adding recipes works without problem. The recipes I try to remove still work and show up in JEI.
Here's what I've got in my script:
import mods.futurepack.industrial;
import mods.futurepack.neonindustrial;
import crafttweaker.item.IItemStack;
// Removes the bauxite ore to aluminum recipe.
industrial.remove([<fp:erze:3> * 2]); // Tried using ([<fp:erze:3>, <fp:erze:3>]);
neonindustrial.remove([<fp:erze:3>]);
If I put bauxite ore in the industrial or neon industrial furnace the recipe still works. I have also tried it without any additional mods but its still the same.
I dont know how the syntax of crafttweaker works, but It needs a IItemStack array of length 2 with bauxit as Item (in index 0 and 1). are there any exceptions or ZenError in the log while executing ?
No errors at all. It loads the script without any errors. Like I said adding recipes works but I just can't remove them.
[INITIALIZATION][CLIENT][INFO] CraftTweaker: Building registry
[INITIALIZATION][CLIENT][INFO] CraftTweaker: Successfully built item registry
[INITIALIZATION][CLIENT][INFO] Loading scripts
[INITIALIZATION][CLIENT][INFO] [crafttweaker | SIDE_CLIENT]: Loading Script: {[0:crafttweaker]: futurepack.zs}
[INITIALIZATION][CLIENT][INFO] Completed script loading in: 257ms
Yeah thread switching would be nasty, There should be a version with the dependencies soon.
Edit: 26.3.301
This is really weird. I could've sworn this would've fixed the problem, since crafttweaker requires mods to do all their recipes in init phase (which futurepack does) and you even added before:crafttweaker;
in dependecies. I'm now really interested in this issue, is it possible for me to get the access to the source code so I can debug it? Gitlab username: Terrails
Please try this version: 26.3.300 I added some log output to better see whats going on.
Yeah looks like it can't find the recipes with those items
https://gist.github.com/Terrails/e964e2b6fd3349a1443eba054fb0f916#file-fp-latest-log-L12-L13
In log line 82 & 83 itz tries to remove the recipes, but in line 166 and following the recipes get loaded. The script runs to early to work.
Can you please try adding before:crafttweaker
to the dependencies so the init phase runs before crafttweaker. Because I'm pretty sure to I can't delay the script loading.
at somepoint you could run scripts on world load and also midgame is this nolonger possible ?
There are events in crafttweaker. I could probably use onPlayerLoggedIn (From what I know there isn't a server start event or something like that), but the problem is to it will fire every time a player joins. It would be great if that was added to dependencies
Just tried it with the event and it worked. But there's a problem with JEI now
https://gist.github.com/Terrails/ee37775db76d8284d38574c68fdd7221
Just checked gitlab, I can't see the code. I tried cloning it on my PC but I don't have access. Looks like the Guest role cannot do that
Any idea why the InputStreams are null? Because I can't even start the game, am I missing some JVM arguments?
This is only one error, if I try to disable the world gen in ProxyBase there's another one in ResearchLoader
Caused by: java.lang.NullPointerException: InputStream is null! in StructureLoader
at futurepack.common.dim.structures.StructureLoader.getFromStream(StructureLoader.java:211)
at futurepack.common.dim.structures.StructureManagerDungeon.get(StructureManagerDungeon.java:116)
at futurepack.common.WorldGenTecDungeon.<init>(WorldGenTecDungeon.java:42)
at futurepack.common.ProxyBase.load(ProxyBase.java:314)
at futurepack.common.ProxyClient.load(ProxyClient.java:147)
at futurepack.common.FPMain.load(FPMain.java:195)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
thats a good question, how did you start tghe game and what is inside the futurepack.common.dim.structures.dungeon package ?
Just like normally. Cloned the repository, setupDecompWorkspace and after that genIntellijRuns. There's a bunch of json files in that package
EDIT: I'm going to try it with runClient gradle task
I am not sure but maybe it needs also setupDevWorkspace and if this also does not work then I blame InteliJ (I use eclipse and never had this problem before, it seems like these files are not in the classpath in InteliJ)
Yeah looks like runClient works... first time I had a problem with intellij like that
weird, but I am glad it works at least. futurepack.extensions.minetweaker & futurepack.common.crafting are the packages you should alook at for the recipes & crafttweaker support.
From the debugging I've done, it looks like crafttweaker does its recipes between preInit and init. I'm still looking into it but I'm not sure why they change the recipes so early
maybe because of the crafting recipes, I dont know when they get loaded, but as far as I know the timewindow to edit them is pretty small. we could ask jaraed (crafttweaker author). The best solution I can come up with for now is store all chanages in a list before they get applied, and check if the futurepack init was already done. so we cann apply them later (before init) or 'now' after init.
We should ask jared just in case, so you don't have to work on that solution. I'm pretty sure its something simple
EDIT: Never mind I found something in ModTweaker... looks like you'll have to have some lists
well I had already something similar: #440
ok, If so you can use ´futurepack.extensions.minetweaker.CLassRegistry´ as Helper/utility method. Try to avoid hard hard dependencies (this will make porting easier ^^).