1010
1111import java .util .ArrayList ;
1212import java .util .Collection ;
13+ import java .util .HashMap ;
1314import java .util .HashSet ;
15+ import java .util .Map ;
1416import java .util .Set ;
1517
1618import net .minecraft .item .Item ;
1719import net .minecraft .item .ItemStack ;
20+ import net .minecraft .nbt .NBTTagCompound ;
1821
1922import com .Nxer .TwistSpaceTechnology .common .api .ModBlocksHandler ;
2023import com .Nxer .TwistSpaceTechnology .common .recipeMap .GTCMRecipe ;
2124import com .Nxer .TwistSpaceTechnology .common .recipeMap .metadata .IndustrialMagicMatrixRecipeIndexKey ;
2225import com .Nxer .TwistSpaceTechnology .system .Thaumcraft .TCRecipeTools ;
26+ import com .Nxer .TwistSpaceTechnology .util .TSTArrayUtils ;
2327import com .Nxer .TwistSpaceTechnology .util .TextEnums ;
2428import com .Nxer .TwistSpaceTechnology .util .rewrites .TST_ItemID ;
2529
3034import gregtech .api .interfaces .IRecipeMap ;
3135import gregtech .api .recipe .RecipeMaps ;
3236import gregtech .api .util .GTOreDictUnificator ;
33- import thaumcraft .common .items .ItemEssence ;
37+ import gregtech .api .util .GTUtility ;
38+ import thaumcraft .api .aspects .AspectList ;
3439
3540public class IndustrialMagicMatrixRecipePool {
3641
3742 protected Collection <TST_ItemID > itemsUnconsumed = new HashSet <>();
43+ protected Map <TST_ItemID , Integer > recipeSeparationMap = new HashMap <>();
3844
3945 protected void prepare () {
4046 itemsUnconsumed .add (TST_ItemID .create (new ItemStack (bigPearl )));
47+
48+ recipeSeparationMap .put (TST_ItemID .create (blockCosmeticSolid ), 11 );
4149 }
4250
4351 /**
4452 * Turn input item list to correct items for IMM recipe.
45- *
53+ *
4654 * @param origin Itemstacks from TC Infusion Matrix recipe.
4755 * @return Items for IMM recipes.
4856 */
@@ -106,13 +114,14 @@ public void loadRecipes() {
106114 // # Recipe required Essentia
107115 // #zh_CN 配方所需源质
108116 Essence .setStackDisplayName (TextEnums .tr ("IndustrialMagicMatrixRecipeInputAspects" ));
109- new ItemEssence ().setAspects (Essence , Recipe .getInputAspects ());
117+ setAspects (Essence , Recipe .getInputAspects ());
118+
110119 GTValues .RA .stdBuilder ()
111120 .ignoreCollision ()
112121 .clearInvalid ()
113122 .special (Essence )
114123 .metadata (IndustrialMagicMatrixRecipeIndexKey .INSTANCE , i )
115- .itemInputs (checkInputSpecial (Recipe .getInputItem ()))
124+ .itemInputs (lateCheck ( TST_ItemID . create ( Recipe . getOutput ()), checkInputSpecial (Recipe .getInputItem () )))
116125 .itemOutputs ((Recipe .getOutput ()))
117126 .fluidInputs ()
118127 .fluidOutputs ()
@@ -131,4 +140,23 @@ public void loadRecipes() {
131140 .addTo (RecipeMaps .assemblerRecipes );
132141 }
133142
143+ public ItemStack [] lateCheck (TST_ItemID output , ItemStack ... inputs ) {
144+ if (recipeSeparationMap .containsKey (output )) {
145+ int tag = recipeSeparationMap .get (output );
146+
147+ return TSTArrayUtils .concatToLast (ItemStack .class , inputs , GTUtility .getIntegratedCircuit (tag ));
148+
149+ }
150+
151+ return inputs ;
152+ }
153+
154+ public void setAspects (ItemStack itemstack , AspectList aspects ) {
155+ if (!itemstack .hasTagCompound ()) {
156+ itemstack .setTagCompound (new NBTTagCompound ());
157+ }
158+
159+ aspects .writeToNBT (itemstack .getTagCompound ());
160+ }
161+
134162}
0 commit comments