Skip to content

Commit 155e954

Browse files
committed
fix IMM Obsidian Tile recipe conflicts
1 parent 969ff00 commit 155e954

File tree

2 files changed

+53
-4
lines changed

2 files changed

+53
-4
lines changed

src/main/java/com/Nxer/TwistSpaceTechnology/recipe/machineRecipe/expanded/IndustrialMagicMatrixRecipePool.java

Lines changed: 32 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,20 @@
1010

1111
import java.util.ArrayList;
1212
import java.util.Collection;
13+
import java.util.HashMap;
1314
import java.util.HashSet;
15+
import java.util.Map;
1416
import java.util.Set;
1517

1618
import net.minecraft.item.Item;
1719
import net.minecraft.item.ItemStack;
20+
import net.minecraft.nbt.NBTTagCompound;
1821

1922
import com.Nxer.TwistSpaceTechnology.common.api.ModBlocksHandler;
2023
import com.Nxer.TwistSpaceTechnology.common.recipeMap.GTCMRecipe;
2124
import com.Nxer.TwistSpaceTechnology.common.recipeMap.metadata.IndustrialMagicMatrixRecipeIndexKey;
2225
import com.Nxer.TwistSpaceTechnology.system.Thaumcraft.TCRecipeTools;
26+
import com.Nxer.TwistSpaceTechnology.util.TSTArrayUtils;
2327
import com.Nxer.TwistSpaceTechnology.util.TextEnums;
2428
import com.Nxer.TwistSpaceTechnology.util.rewrites.TST_ItemID;
2529

@@ -30,19 +34,23 @@
3034
import gregtech.api.interfaces.IRecipeMap;
3135
import gregtech.api.recipe.RecipeMaps;
3236
import gregtech.api.util.GTOreDictUnificator;
33-
import thaumcraft.common.items.ItemEssence;
37+
import gregtech.api.util.GTUtility;
38+
import thaumcraft.api.aspects.AspectList;
3439

3540
public 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
}

src/main/java/com/Nxer/TwistSpaceTechnology/util/rewrites/TST_ItemID.java

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import java.util.Objects;
44

5+
import net.minecraft.block.Block;
56
import net.minecraft.item.Item;
67
import net.minecraft.item.ItemStack;
78
import net.minecraft.nbt.NBTTagCompound;
@@ -48,6 +49,26 @@ public static TST_ItemID create(ItemStack itemStack) {
4849
return new TST_ItemID(itemStack.getItem(), itemStack.getItemDamage(), itemStack.getTagCompound());
4950
}
5051

52+
public static TST_ItemID create(Item item) {
53+
if (null == item) return NULL;
54+
return new TST_ItemID(item, 0);
55+
}
56+
57+
public static TST_ItemID create(Item item, int metaData) {
58+
if (null == item) return NULL;
59+
return new TST_ItemID(item, metaData);
60+
}
61+
62+
public static TST_ItemID create(Block block) {
63+
if (null == block) return NULL;
64+
return create(new ItemStack(block));
65+
}
66+
67+
public static TST_ItemID create(Block block, int metaData) {
68+
if (null == block) return NULL;
69+
return create(new ItemStack(block, 1, metaData));
70+
}
71+
5172
public static TST_ItemID createNoNBT(ItemStack itemStack) {
5273
if (null == itemStack) return NULL;
5374
return new TST_ItemID(itemStack.getItem(), itemStack.getItemDamage());

0 commit comments

Comments
 (0)