Adds IC2 machine recipes to GT machines, needs testing
This commit is contained in:
parent
8cb644066b
commit
5c5aad4522
2 changed files with 59 additions and 11 deletions
|
@ -55,7 +55,6 @@ import org.apache.commons.lang3.StringUtils;
|
|||
|
||||
import java.io.*;
|
||||
import java.util.*;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
|
@ -557,6 +556,13 @@ public class GT_Mod implements IGT_Mod {
|
|||
GT_ModHandler.removeRecipe(new ItemStack[]{new ItemStack(Blocks.wooden_slab, 1, 0), new ItemStack(Blocks.wooden_slab, 1, 1), new ItemStack(Blocks.wooden_slab, 1, 2)});
|
||||
GT_ModHandler.addCraftingRecipe(new ItemStack(Blocks.wooden_slab, 6, 0), GT_ModHandler.RecipeBits.NOT_REMOVABLE, new Object[]{"WWW", 'W', new ItemStack(Blocks.planks, 1, 0)});
|
||||
|
||||
//Save a copy of these list before activateOreDictHandler(), then loop over them.
|
||||
Map<IRecipeInput, RecipeOutput> aMaceratorRecipeList = GT_ModHandler.getMaceratorRecipeList();
|
||||
Map<IRecipeInput, RecipeOutput> aCompressorRecipeList = GT_ModHandler.getCompressorRecipeList();
|
||||
Map<IRecipeInput, RecipeOutput> aExtractorRecipeList = GT_ModHandler.getExtractorRecipeList();
|
||||
Map<IRecipeInput, RecipeOutput> aOreWashingRecipeList = GT_ModHandler.getOreWashingRecipeList();
|
||||
Map<IRecipeInput, RecipeOutput> aThermalCentrifugeRecipeList = GT_ModHandler.getThermalCentrifugeRecipeList();
|
||||
|
||||
GT_Log.out.println("GT_Mod: Activating OreDictionary Handler, this can take some time, as it scans the whole OreDictionary");
|
||||
FMLLog.info("If your Log stops here, you were too impatient. Wait a bit more next time, before killing Minecraft with the Task Manager.", new Object[0]);
|
||||
gregtechproxy.activateOreDictHandler();
|
||||
|
@ -565,6 +571,14 @@ public class GT_Mod implements IGT_Mod {
|
|||
GT_Log.out.println("GT_Mod: Vanilla Recipe List -> Outputs null or stackSize <=0: " + GT_ModHandler.sVanillaRecipeList_warntOutput.toString());
|
||||
GT_Log.out.println("GT_Mod: Single Non Block Damagable Recipe List -> Outputs null or stackSize <=0: " + GT_ModHandler.sSingleNonBlockDamagableRecipeList_warntOutput.toString());
|
||||
//GT_Log.out.println("GT_Mod: sRodMaterialList cycles: " + GT_RecipeRegistrator.sRodMaterialList_cycles);
|
||||
|
||||
//Add default IC2 recipe to GT
|
||||
GT_ModHandler.addIC2RecipesToGT(aMaceratorRecipeList, GT_Recipe.GT_Recipe_Map.sMaceratorRecipes, true, true, true);
|
||||
GT_ModHandler.addIC2RecipesToGT(aCompressorRecipeList, GT_Recipe.GT_Recipe_Map.sCompressorRecipes, true, true, true);
|
||||
GT_ModHandler.addIC2RecipesToGT(aExtractorRecipeList, GT_Recipe.GT_Recipe_Map.sExtractorRecipes, true, true, true);
|
||||
GT_ModHandler.addIC2RecipesToGT(aOreWashingRecipeList, GT_Recipe.GT_Recipe_Map.sOreWasherRecipes, false, true, true);
|
||||
GT_ModHandler.addIC2RecipesToGT(aThermalCentrifugeRecipeList, GT_Recipe.GT_Recipe_Map.sThermalCentrifugeRecipes, true, true, true);
|
||||
|
||||
if (GT_Values.D1) {
|
||||
IRecipe tRecipe;
|
||||
for (Iterator i$ = GT_ModHandler.sSingleNonBlockDamagableRecipeList.iterator(); i$.hasNext(); GT_Log.out.println("=> " + tRecipe.getRecipeOutput().getDisplayName())) {
|
||||
|
@ -779,16 +793,6 @@ public class GT_Mod implements IGT_Mod {
|
|||
GT_Recipe.GT_Recipe_Map.sRockBreakerFakeRecipes.addFakeRecipe(false, new ItemStack[]{ItemList.Display_ITS_FREE.getWithName(0L, "Place Lava on Side", new Object[0])}, new ItemStack[]{new ItemStack(Blocks.cobblestone, 1)}, null, null, null, 16, 32, 0);
|
||||
GT_Recipe.GT_Recipe_Map.sRockBreakerFakeRecipes.addFakeRecipe(false, new ItemStack[]{ItemList.Display_ITS_FREE.getWithName(0L, "Place Lava on Top", new Object[0])}, new ItemStack[]{new ItemStack(Blocks.stone, 1)}, null, null, null, 16, 32, 0);
|
||||
GT_Recipe.GT_Recipe_Map.sRockBreakerFakeRecipes.addFakeRecipe(false, new ItemStack[]{GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Redstone, 1L)}, new ItemStack[]{new ItemStack(Blocks.obsidian, 1)}, null, null, null, 128, 32, 0);
|
||||
for (Iterator i$ = GT_ModHandler.getMaceratorRecipeList().entrySet().iterator(); i$.hasNext(); ) {
|
||||
Entry tRecipe = (Map.Entry) i$.next();
|
||||
if (((RecipeOutput) tRecipe.getValue()).items.size() > 0) {
|
||||
for (ItemStack tStack : ((IRecipeInput) tRecipe.getKey()).getInputs()) {
|
||||
if (GT_Utility.isStackValid(tStack)) {
|
||||
GT_Recipe.GT_Recipe_Map.sMaceratorRecipes.addFakeRecipe(true, new ItemStack[]{GT_Utility.copyAmount(((IRecipeInput) tRecipe.getKey()).getAmount(), new Object[]{tStack})}, new ItemStack[]{(ItemStack) ((RecipeOutput) tRecipe.getValue()).items.get(0)}, null, null, null, null, 400, 2, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(GregTech_API.mOutputRF||GregTech_API.mInputRF){
|
||||
GT_Utility.checkAvailabilities();
|
||||
|
@ -815,6 +819,12 @@ public class GT_Mod implements IGT_Mod {
|
|||
}
|
||||
} catch (Throwable e) {e.printStackTrace(GT_Log.err);}
|
||||
gregtechproxy.onServerStarting();
|
||||
//Check for more IC2 recipes on ServerStart to also catch MineTweaker additions
|
||||
GT_ModHandler.addIC2RecipesToGT(GT_ModHandler.getMaceratorRecipeList(), GT_Recipe.GT_Recipe_Map.sMaceratorRecipes, true, true, true);
|
||||
GT_ModHandler.addIC2RecipesToGT(GT_ModHandler.getCompressorRecipeList(), GT_Recipe.GT_Recipe_Map.sCompressorRecipes, true, true, true);
|
||||
GT_ModHandler.addIC2RecipesToGT(GT_ModHandler.getExtractorRecipeList(), GT_Recipe.GT_Recipe_Map.sExtractorRecipes, true, true, true);
|
||||
GT_ModHandler.addIC2RecipesToGT(GT_ModHandler.getOreWashingRecipeList(), GT_Recipe.GT_Recipe_Map.sOreWasherRecipes, false, true, true);
|
||||
GT_ModHandler.addIC2RecipesToGT(GT_ModHandler.getThermalCentrifugeRecipeList(), GT_Recipe.GT_Recipe_Map.sThermalCentrifugeRecipes, true, true, true);
|
||||
GT_Log.out.println("GT_Mod: Unificating outputs of all known Recipe Types.");
|
||||
ArrayList<ItemStack> tStacks = new ArrayList(10000);
|
||||
GT_Log.out.println("GT_Mod: IC2 Machines");
|
||||
|
|
|
@ -671,6 +671,44 @@ public class GT_ModHandler {
|
|||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds GT versions of the IC2 recipes from the supplied IC2RecipeList.
|
||||
*/
|
||||
public static void addIC2RecipesToGT(Map<IRecipeInput, RecipeOutput> aIC2RecipeList, GT_Recipe.GT_Recipe_Map aGTRecipeMap, boolean aAddGTRecipe, boolean aRemoveIC2Recipe, boolean aExcludeGTIC2Items) {
|
||||
Map<ItemStack, ItemStack> aRecipesToRemove = new HashMap<>();
|
||||
for (Iterator i$ = aIC2RecipeList.entrySet().iterator(); i$.hasNext(); ) {
|
||||
Entry tRecipe = (Map.Entry) i$.next();
|
||||
if (((RecipeOutput) tRecipe.getValue()).items.size() > 0) {
|
||||
for (ItemStack tStack : ((IRecipeInput) tRecipe.getKey()).getInputs()) {
|
||||
if (GT_Utility.isStackValid(tStack)) {
|
||||
if (aAddGTRecipe && (aGTRecipeMap.findRecipe(null, false, Long.MAX_VALUE, null, tStack) == null)) {
|
||||
if (aExcludeGTIC2Items && ((tStack.getUnlocalizedName().contains("gt.metaitem.01") || tStack.getUnlocalizedName().contains("gt.blockores") || tStack.getUnlocalizedName().contains("ic2.itemCrushed") || tStack.getUnlocalizedName().contains("ic2.itemPurifiedCrushed")))) continue;
|
||||
switch (aGTRecipeMap.mUnlocalizedName) {
|
||||
case "gt.recipe.macerator":
|
||||
aGTRecipeMap.addRecipe(true, new ItemStack[]{GT_Utility.copyAmount(((IRecipeInput) tRecipe.getKey()).getAmount(), tStack)}, (ItemStack[]) ((RecipeOutput) tRecipe.getValue()).items.toArray(), null, null, null, null, 400, 2, 0);
|
||||
break;
|
||||
case "gt.recipe.compressor":
|
||||
aGTRecipeMap.addRecipe(true, new ItemStack[]{GT_Utility.copyAmount(((IRecipeInput) tRecipe.getKey()).getAmount(), tStack)}, (ItemStack[]) ((RecipeOutput) tRecipe.getValue()).items.toArray(), null, null, null, null, 400, 2, 0);
|
||||
break;
|
||||
case "gt.recipe.extractor":
|
||||
aGTRecipeMap.addRecipe(true, new ItemStack[]{GT_Utility.copyAmount(((IRecipeInput) tRecipe.getKey()).getAmount(), tStack)}, (ItemStack[]) ((RecipeOutput) tRecipe.getValue()).items.toArray(), null, null, null, null, 100, 32, 0);
|
||||
break;
|
||||
case "gt.recipe.thermalcentrifuge":
|
||||
aGTRecipeMap.addRecipe(true, new ItemStack[]{GT_Utility.copyAmount(((IRecipeInput) tRecipe.getKey()).getAmount(), tStack)}, (ItemStack[]) ((RecipeOutput) tRecipe.getValue()).items.toArray(), null, null, null, null, 400, 48, 0);
|
||||
break;
|
||||
}
|
||||
//System.out.println("#####Processed IC2 " + aGTRecipeMap.mUnlocalizedName + " Recipe: In(" + tStack.getUnlocalizedName() + ") - Out(" + ((RecipeOutput) tRecipe.getValue()).items.get(0).getUnlocalizedName() + ")");
|
||||
}
|
||||
if (aRemoveIC2Recipe) aRecipesToRemove.put(tStack, ((RecipeOutput) tRecipe.getValue()).items.get(0));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
for (Entry<ItemStack, ItemStack> aEntry : aRecipesToRemove.entrySet()) {
|
||||
GT_Utility.removeSimpleIC2MachineRecipe(aEntry.getKey(), aIC2RecipeList, aEntry.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
public static Map<IRecipeInput, RecipeOutput> getExtractorRecipeList() {
|
||||
try {
|
||||
return ic2.api.recipe.Recipes.extractor.getRecipes();
|
||||
|
|
Loading…
Reference in a new issue