
The Recipe Stages "setPackageStage" doesn't work
Atricos opened this issue · 9 comments
Description
I would like every staged recipe to be craftable in the AE2 Terminal, no matter if the player has the stage or not. The guide says this is a fix for it:
import mods.recipestages.Recipes;
val allStages as string[] = [
"base_ingots",
"thermal",
"overworld",
... ];
# etc. there are a lot more stages
mods.recipestages.Recipes.setPackageStage("appeng", allStages);
However it did nothing, the staged recipes I added still aren't craftable in the Crafting Terminal.
Importantly, all recipes are added twice:
Once as a Staged Recipe, e.g. mods.recipestages.Recipes.addShapeless
Once as a hidden recipe, e.g. recipes.addHiddenShapeless
This way each recipe is hidden at the start, but once the player crafts one, it gets revealed (by RecipeStages).
Now the problem is, even though every recipe is craftable in a Crafting Table, they aren't craftable in a Terminal:
Interestingly, it shows the output amount, but the item can't be pulled out of the output slot.
To Reproduce
- Add the following mods to a pack: AE2 Unofficial Extended Life, JEI, CraftTweaker, Game Stages, Item Stages, Recipe Stages.
- Add the following CraftTweaker script to the scripts folder:
import mods.recipestages.Recipes;
recipes.remove(<minecraft:torch>);
recipes.addHiddenShapeless("torch", <minecraft:torch>, [<minecraft:diamond>,<minecraft:stick>]);
mods.recipestages.Recipes.addShapeless("examplestage", <minecraft:torch>, [<minecraft:diamond>,<minecraft:stick>], null, function(out, cInfo, player) { player.addGameStage("examplestage"); });
- Also add the following script:
import mods.recipestages.Recipes;
mods.recipestages.Recipes.setPackageStage("appeng", ["examplestage"]);
- Launch the game.
- Build a basic ME System.
- Try to craft a torch with a piece of Diamond and a Stick in a Crafting Table: It works.
- Try to craft a torch with a piece of Diamond and a Stick in a Crafting Terminal: It doesn't work.
Expected behavior
In Step 7, the craft should work in the Crafting Terminal.
Additional context
In Step 3, I have also tried lots of other commands, none of which have worked:
mods.recipestages.Recipes.setPackageStage("appeng.container.ContainerNull", allStages);
mods.recipestages.Recipes.setPackageStage("appeng.container.Container", allStages);
mods.recipestages.Recipes.setPackageStage("appeng.container.AEBaseContainer", allStages);
mods.recipestages.Recipes.setPackageStage("appeng.container.ContainerOpenContext", allStages);
mods.recipestages.Recipes.setPackageStage("appeng.container.ContainerCraftingTerm", allStages);
mods.recipestages.Recipes.setPackageStage("appeng.container.ContainerPatternTerm", allStages);
Somehow AE2 always only recognizes the Staged recipe, and it ignores the Hidden Recipe.
Environment
- Minecraft Version: 1.12.2
- AE2 Version: rv6-stable-7-extended_life_v0.55.19
- Forge Version: 14.23.5.2860
- CraftTweaker version: 1.12-4.1.20.960
- Game Stages version: 1.12-2.0.123
- Item Stages version: 1.12.2-2.0.49
- Recipe Stages version: 1.1.3.8
I do, but it's about 4500 lines, and I don't want you to look through all of it. So something between my example and my actual implementation must have gone wrong...
Right now I'm trying to set up a minimal example where my issue still occurs.
I have managed to recreate the issue with a slightly longer script:
Script 1:
#priority 250
import mods.recipestages.Recipes;
val allStages as string[] = [
"example_stage"
];
mods.recipestages.Recipes.setPrintContainers(true);
mods.recipestages.Recipes.setPackageStage("appeng", allStages);
Script 2:
import mods.recipestages.Recipes;
import crafttweaker.item.IItemStack;
import crafttweaker.item.IIngredient;
import mods.ItemStages.addItemStage;
recipes.remove(<minecraft:torch>);
mods.ItemStages.addItemStage("examplestage", <minecraft:torch>);
recipes.addHiddenShapeless("examplrecipe", minecraft:torch> * 2, [<minecraft:diamond>,<minecraft:stick>], null,
function(out, cInfo, player) {
player.addGameStage("examplestage");
});
mods.recipestages.Recipes.addShapeless("examplestage", minecraft:torch> * 2, [<minecraft:diamond>,<minecraft:stick>]);
The difference between a working script and a non-working script is the addition of the line
mods.ItemStages.addItemStage("examplestage", <minecraft:torch>);
If the item is added to an item stage, AE2 cannot craft the item, although it's still craftable in a regular crafting table.
However I do want to add the items to an item stage in order for them to be hidden in JEI, and to be revealed in JEI once the player unlocks a given stage.
Related issue: If a recipe is added both as a hidden recipe and a staged recipe, then the Crafting Terminal recognizes both at the same time, and the output amount will look weird:
On the left, there are actually two 2's inside one another, a small one and a large one:
So a solution that would fix both of the problems is:
- if the input recipe exists as a Hidden Recipe, output the item no matter what, and don't even check if a Staged recipe exists
- if the input recipe doesn't exists as a Hidden Recipe, then go ahead and check if it exists as a Staged recipe, and change the output accordingly.
does this error also occure when you try working with a loading priority?
btw your function inside the recipe does not work.
Which part should I load with a priority? The mods.recipestages.Recipes.setPackageStage("appeng", ["examplestage"]);
part?
Also, the function function(out, cInfo, player) { player.addGameStage("examplestage"); }
definitely works. I have over 400 recipes that do this and all of them work correctly.
I gave mods.recipestages.Recipes.setPackageStage("appeng", ["examplestage"]);
the highest priority in my scripts, and it didn't change anything.
do you have a zip of you scripts already set up ? i tried your reproduction steps and it works correctly
Pretty sure allStages
is populated by default. No need to create an array for it. When I originally tested the mod in ProjectTowny in the configuration I specified in the README, it worked correctly.
Since this commit it should be working properly. It was my mistake to block crafting if item's stage is not unlocked - the default implementation doesn't do that.