CraftTweaker

CraftTweaker

151M Downloads

Issue when iterating through oredict

kriNon opened this issue ยท 9 comments

commented

Intro:

I am running this fairly simple script and I am running into unexpected behavior:
https://pastebin.com/V1MeuJPb

What happens:

The script works as expected for vanilla wood, biomes o plenty wood, primal core wood, and the betweenlands wood. However it does not do anything to affect quark wood, project:vibrant journeys wood, and traverse wood.

What you expected to happen:

I would expect all the types of wood to be added to the oredict ore:myMat.

Script used

https://pastebin.com/V1MeuJPb (Here's a simplified version of the part that doesn't work)
https://pastebin.com/f2sqrAv3 (Here is the full version that includes unnecessary information)

crafttweaker.log file

https://pastebin.com/zx3zNrJE


Affected Versions (Do not use "latest"):

  • Minecraft: 1.12.2
  • Forge: 14.23.5.2768
  • Crafttweaker: 1.12-4.1.13
  • Using a server: No

Your most recent log file where the issue was present:

https://paste.ee/p/YfLOV (Minecraft log yeah?)

commented

It is very well possible that by the time CrT runs, those mods have not yet registered their Ore Dictionary entries

commented

Hmm, is there any way of dealing with this? Is it possible to delay the running of the script to prevent this issue?

Maybe I'm going about it the wrong way, but I've got a recipe where I want to have a component that can be any ingot + wood + stone (really a bunch of stuff), and so I have a map that contains the oredict names of all these materials. I was planning on iterating through all of them and adding all these materials to a new oredict entry, and then using this entry for the recipe.

commented

No, it is not possible to delay the running of a script.

You can just OR the OreDictEntries together like

recipes.addShapeless("someName", <output>, [<ore:oredictA> | <ore:oredictB> | <someItem>, <otherItem>], null, null);

All items merged with | are ORed, i.e. they occupy one slot in the recipe and you can use any item matching any of the ingredients

commented

ah awesome, that helps a lot! Not sure if I should close the issue since it may be useful to other people, but I personally can get around it by ORing the OreDictEntries.

commented

Would it help to rename CraftTweaker to a name starting with Z? A few MC versions back, I remember some load-order problems got fixed that way.

commented

What you are talking about is the order in which scripta are executed (though you'll use the #priority preprocessor now)

This issue is due to the order in which greater logic happens. Logic like (ModA item creation, recipe registration, CrT Recipe Event, OreDict additions, ...)

commented

Is this issue still actual or can it be closed?

commented

That's what I asked about earlier. I don't personally need the issue fixed anymore, and honestly I suspect that it would not be possible to fix the issue. I suspect that some mods are adding items to oredictionary after crafttweaker, which prevents crafttweaker from being able to iterate through them.

It doesn't matter to me if this is fixed or not, but I thought to keep the issue open and see what you decide to do with it.

commented

We can't iterate things that don't exist, in an ideal world forge would make an event for oredict, but unfortunately this isn't an ideal world, so modders register their oredict whenever they want, sometimes after scripts load.