Nomifactory / ExtendedCrafting

Adds some new ways to craft items, as well as extra crafting items and utilities.
MIT License
2 stars 5 forks source link

OreDict item in ingredient invisible in JEI #3

Closed Krutoy242 closed 3 years ago

Krutoy242 commented 3 years ago

Recipe was unchanged before i update from old Extended Crafting. Now <ore:blockAethium> is invisible as ingredient, but item still craftable if i put right items in empty slots:

I check and this item is OreDicted normally

Recipe

    var blockAethium = <ore:blockAethium>;
    recipes.remove(<environmentaltech:void_ore_miner_cont_6>);
    mods.extendedcrafting.TableCrafting.addShaped(0, <environmentaltech:void_ore_miner_cont_6>, 
    [[blockAethium, <ic2:iridium_reflector>, blockAethium], 
    [<ic2:nuclear:10>, <environmentaltech:void_ore_miner_cont_5>, <ic2:nuclear:10>], 
    [blockAethium, <ic2:iridium_reflector>, blockAethium]]);  
Exaxxion commented 3 years ago

I'd like to get some more information to focus in on the underlying problem.

First, what version of CraftTweaker and the accompanying *Tweaker addons are you using?

Second, let's establish some context: Are any other items registered under blockAethium in the ore dictionary? Does this still happen if you specify the Aethium Block item directly rather than the ore dictionary bracket handler? Does this occur just with Aethium recipes or is it reproducible with other recipes using oredict bracket handlers? Does the recipe function properly if you use the vanilla crafting table shaped recipe function rather than the ExC one?

eutro commented 3 years ago

The issue is that Environmental Tech (and other mods apparently) register their items to the oredict after CraftTweaker scripts have run.

As the following script shows, <ore:blockAethium> does not contain any items when the script is run:

var blockAethium = <ore:blockAethium>;

blockAethium.add(<minecraft:cobblestone>); // test item

print("Printing <ore:blockAethium> items...");

for stack in blockAethium.items {
    print(stack.commandString);
}

print("Finished printing items.");

appears in the log with:

[INITIALIZATION][CLIENT][INFO] Adding Cobblestone to ore dictionary entry blockAethium
[INITIALIZATION][CLIENT][INFO] Printing <ore:blockAethium> items...
[INITIALIZATION][CLIENT][INFO] <minecraft:cobblestone>
[INITIALIZATION][CLIENT][INFO] Finished printing items.

This caused issues because matching items were resolved when the ingredient was constructed.

The solution was to use the overlooked CraftTweakerMC#getIngredient which does everything necessary.

Krutoy242 commented 3 years ago

Yeah, probably working fine now! Thanks!