More processing fixed

This commit is contained in:
TheDarkDnKTv 2021-03-09 04:29:41 +02:00
parent 17fe25bef7
commit 7bd0df87a1
4 changed files with 105 additions and 56 deletions

View file

@ -950,7 +950,7 @@ public class GT_ModHandler {
* @param aOutput The output of the Recipe. * @param aOutput The output of the Recipe.
* @return if it has removed at least one Recipe. * @return if it has removed at least one Recipe.
*/ */
public static synchronized boolean removeRecipeByOutput(ItemStack aOutput) { public static boolean removeRecipeByOutput(ItemStack aOutput) {
if (aOutput == null) return false; if (aOutput == null) return false;
boolean rReturn = false; boolean rReturn = false;
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")

View file

@ -1,5 +1,9 @@
package gregtechmod.loaders.oreprocessing; package gregtechmod.loaders.oreprocessing;
import java.util.List;
import cpw.mods.fml.common.registry.GameRegistry;
import gregtechmod.api.GregTech_API; import gregtechmod.api.GregTech_API;
import gregtechmod.api.enums.GT_ConfigCategories; import gregtechmod.api.enums.GT_ConfigCategories;
import gregtechmod.api.enums.GT_Items; import gregtechmod.api.enums.GT_Items;
@ -7,31 +11,67 @@ import gregtechmod.api.enums.GT_OreDictNames;
import gregtechmod.api.enums.Materials; import gregtechmod.api.enums.Materials;
import gregtechmod.api.enums.OrePrefixes; import gregtechmod.api.enums.OrePrefixes;
import gregtechmod.api.interfaces.IOreRecipeRegistrator; import gregtechmod.api.interfaces.IOreRecipeRegistrator;
import gregtechmod.api.util.GT_ModHandler; import gregtechmod.api.util.GT_Shaped_Recipe;
import gregtechmod.api.util.GT_Utility; import gregtechmod.api.util.OreDictEntry;
public class ProcessingCircuit implements IOreRecipeRegistrator { public class ProcessingCircuit implements IOreRecipeRegistrator {
public ProcessingCircuit() { public ProcessingCircuit() {
OrePrefixes.circuit.add((IOreRecipeRegistrator)this); OrePrefixes.circuit.add(this);
} }
public void registerOre(OrePrefixes aPrefix, List<OreDictEntry> dictEntry) { // FIXME removing all circuits crafing recipe, then register new
switch(aMaterial) { public void registerOre(OrePrefixes aPrefix, List<OreDictEntry> dictEntry) {
case Basic: for (OreDictEntry entry : dictEntry) {
if(!GT_Utility.areStacksEqual(aStack, GT_Items.Circuit_Integrated.getWildcard(1L, new Object[0]))) { Materials aMaterial = this.getMaterial(aPrefix, entry);
GT_ModHandler.removeRecipeByOutput(aStack); if (this.isExecutable(aPrefix, aMaterial)) {
GT_ModHandler.addCraftingRecipe(GT_Items.Circuit_Basic.get(1L, new Object[0]), new Object[]{"CCC", "SRS", "CCC", Character.valueOf('C'), GT_OreDictNames.craftingWireCopper, Character.valueOf('R'), OrePrefixes.plate.get(Materials.Iron), Character.valueOf('S'), GregTech_API.sRecipeFile.get(GT_ConfigCategories.Recipes.harderrecipes, "circuitRedAlloy", true)?OrePrefixes.plate.get(Materials.RedAlloy):OrePrefixes.dust.get(Materials.Redstone)}); switch (aMaterial) {
GT_ModHandler.addCraftingRecipe(GT_Items.Circuit_Basic.get(1L, new Object[0]), new Object[]{"CSC", "CRC", "CSC", Character.valueOf('C'), GT_OreDictNames.craftingWireCopper, Character.valueOf('R'), OrePrefixes.plate.get(Materials.Iron), Character.valueOf('S'), GregTech_API.sRecipeFile.get(GT_ConfigCategories.Recipes.harderrecipes, "circuitRedAlloy", true)?OrePrefixes.plate.get(Materials.RedAlloy):OrePrefixes.dust.get(Materials.Redstone)}); case Basic:
} GameRegistry.addRecipe(new GT_Shaped_Recipe(GT_Items.Circuit_Basic.get(1), new Object[] { "CCC", "SRS", "CCC",
break; 'C', GT_OreDictNames.craftingWireCopper.toString(),
case Advanced: 'R', OrePrefixes.plate.get(Materials.Iron),
GT_ModHandler.removeRecipeByOutput(aStack); 'S', GregTech_API.sRecipeFile.get(GT_ConfigCategories.Recipes.harderrecipes, "circuitRedAlloy", true) ? OrePrefixes.plate.get(Materials.RedAlloy) : OrePrefixes.dust.get(Materials.Redstone)
GT_ModHandler.addCraftingRecipe(GT_Items.Circuit_Advanced.get(1L, new Object[0]), new Object[]{"SGS", "LCL", "SGS", Character.valueOf('C'), OrePrefixes.circuit.get(Materials.Basic), Character.valueOf('S'), GregTech_API.sRecipeFile.get(GT_ConfigCategories.Recipes.harderrecipes, "circuitRedAlloy", true)?OrePrefixes.plate.get(Materials.RedAlloy):OrePrefixes.dust.get(Materials.Redstone), Character.valueOf('G'), OrePrefixes.dust.get(Materials.Glowstone), Character.valueOf('L'), OrePrefixes.dust.get(Materials.Lazurite)}); }));
GT_ModHandler.addCraftingRecipe(GT_Items.Circuit_Advanced.get(1L, new Object[0]), new Object[]{"SLS", "GCG", "SLS", Character.valueOf('C'), OrePrefixes.circuit.get(Materials.Basic), Character.valueOf('S'), GregTech_API.sRecipeFile.get(GT_ConfigCategories.Recipes.harderrecipes, "circuitRedAlloy", true)?OrePrefixes.plate.get(Materials.RedAlloy):OrePrefixes.dust.get(Materials.Redstone), Character.valueOf('G'), OrePrefixes.dust.get(Materials.Glowstone), Character.valueOf('L'), OrePrefixes.dust.get(Materials.Lazurite)}); GameRegistry.addRecipe(new GT_Shaped_Recipe(GT_Items.Circuit_Basic.get(1), new Object[] { "CSC", "CRC", "CSC",
GT_ModHandler.addCraftingRecipe(GT_Items.Circuit_Advanced.get(1L, new Object[0]), new Object[]{"SGS", "LCL", "SGS", Character.valueOf('C'), OrePrefixes.circuit.get(Materials.Basic), Character.valueOf('S'), GregTech_API.sRecipeFile.get(GT_ConfigCategories.Recipes.harderrecipes, "circuitRedAlloy", true)?OrePrefixes.plate.get(Materials.RedAlloy):OrePrefixes.dust.get(Materials.Redstone), Character.valueOf('G'), OrePrefixes.dust.get(Materials.Glowstone), Character.valueOf('L'), OrePrefixes.dust.get(Materials.Lapis)}); 'C', GT_OreDictNames.craftingWireCopper.toString(),
GT_ModHandler.addCraftingRecipe(GT_Items.Circuit_Advanced.get(1L, new Object[0]), new Object[]{"SLS", "GCG", "SLS", Character.valueOf('C'), OrePrefixes.circuit.get(Materials.Basic), Character.valueOf('S'), GregTech_API.sRecipeFile.get(GT_ConfigCategories.Recipes.harderrecipes, "circuitRedAlloy", true)?OrePrefixes.plate.get(Materials.RedAlloy):OrePrefixes.dust.get(Materials.Redstone), Character.valueOf('G'), OrePrefixes.dust.get(Materials.Glowstone), Character.valueOf('L'), OrePrefixes.dust.get(Materials.Lapis)}); 'R', OrePrefixes.plate.get(Materials.Iron),
default: break; 'S', GregTech_API.sRecipeFile.get(GT_ConfigCategories.Recipes.harderrecipes, "circuitRedAlloy", true) ? OrePrefixes.plate.get(Materials.RedAlloy) : OrePrefixes.dust.get(Materials.Redstone)
} }));
}
// for (ItemStack aStack : entry.ores) {
// if (!GT_Utility.areStacksEqual(aStack, GT_Items.Circuit_Integrated.getWildcard(1))) {
//
// }
// }
break;
case Advanced:
GameRegistry.addRecipe(new GT_Shaped_Recipe(GT_Items.Circuit_Advanced.get(1), new Object[] { "SGS", "LCL", "SGS",
'C', OrePrefixes.circuit.get(Materials.Basic),
'S', GregTech_API.sRecipeFile.get(GT_ConfigCategories.Recipes.harderrecipes, "circuitRedAlloy", true) ? OrePrefixes.plate.get(Materials.RedAlloy) : OrePrefixes.dust.get(Materials.Redstone),
'G', OrePrefixes.dust.get(Materials.Glowstone),
'L', OrePrefixes.dust.get(Materials.Lazurite) }));
GameRegistry.addRecipe(new GT_Shaped_Recipe(GT_Items.Circuit_Advanced.get(1), new Object[] { "SLS", "GCG", "SLS",
'C', OrePrefixes.circuit.get(Materials.Basic),
'S', GregTech_API.sRecipeFile.get(GT_ConfigCategories.Recipes.harderrecipes, "circuitRedAlloy", true) ? OrePrefixes.plate.get(Materials.RedAlloy) : OrePrefixes.dust.get(Materials.Redstone),
'G', OrePrefixes.dust.get(Materials.Glowstone),
'L', OrePrefixes.dust.get(Materials.Lazurite) }));
GameRegistry.addRecipe(new GT_Shaped_Recipe(GT_Items.Circuit_Advanced.get(1), new Object[] { "SGS", "LCL", "SGS",
'C', OrePrefixes.circuit.get(Materials.Basic),
'S', GregTech_API.sRecipeFile.get(GT_ConfigCategories.Recipes.harderrecipes, "circuitRedAlloy", true) ? OrePrefixes.plate.get(Materials.RedAlloy) : OrePrefixes.dust.get(Materials.Redstone),
'G', OrePrefixes.dust.get(Materials.Glowstone),
'L', OrePrefixes.dust.get(Materials.Lapis) }));
GameRegistry.addRecipe(new GT_Shaped_Recipe(GT_Items.Circuit_Advanced.get(1), new Object[] { "SLS", "GCG", "SLS",
'C', OrePrefixes.circuit.get(Materials.Basic),
'S', GregTech_API.sRecipeFile.get(GT_ConfigCategories.Recipes.harderrecipes, "circuitRedAlloy", true) ? OrePrefixes.plate.get(Materials.RedAlloy) : OrePrefixes.dust.get(Materials.Redstone),
'G', OrePrefixes.dust.get(Materials.Glowstone),
'L', OrePrefixes.dust.get(Materials.Lapis) }));
// for (ItemStack aStack : entry.ores) {
//
// }
break;
default: break;
}
}
}
}
} }

View file

@ -1,5 +1,8 @@
package gregtechmod.loaders.oreprocessing; package gregtechmod.loaders.oreprocessing;
import java.util.List;
import java.util.stream.Collectors;
import gregtechmod.api.GregTech_API; import gregtechmod.api.GregTech_API;
import gregtechmod.api.enums.GT_Items; import gregtechmod.api.enums.GT_Items;
import gregtechmod.api.enums.GT_OreDictNames; import gregtechmod.api.enums.GT_OreDictNames;
@ -7,40 +10,46 @@ import gregtechmod.api.enums.Materials;
import gregtechmod.api.enums.OrePrefixes; import gregtechmod.api.enums.OrePrefixes;
import gregtechmod.api.interfaces.IOreRecipeRegistrator; import gregtechmod.api.interfaces.IOreRecipeRegistrator;
import gregtechmod.api.util.GT_ModHandler; import gregtechmod.api.util.GT_ModHandler;
import gregtechmod.api.util.GT_OreDictUnificator; import gregtechmod.api.util.OreDictEntry;
import gregtechmod.api.util.GT_Utility;
import gregtechmod.common.recipe.RecipeEntry;
import gregtechmod.common.recipe.RecipeEntry.Match;
import gregtechmod.common.recipe.RecipeMaps;
import net.minecraft.init.Blocks; import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
public class ProcessingCrafting implements IOreRecipeRegistrator { public class ProcessingCrafting implements IOreRecipeRegistrator {
public ProcessingCrafting() { public ProcessingCrafting() {
OrePrefixes.crafting.add((IOreRecipeRegistrator)this); OrePrefixes.crafting.add(this);
} }
public void registerOre(OrePrefixes aPrefix, List<OreDictEntry> dictEntry) { public void registerOre(OrePrefixes aPrefix, List<OreDictEntry> dictEntry) {
if(aOreDictName.equals(GT_OreDictNames.craftingRedstoneTorch.toString())) { for (OreDictEntry entry : dictEntry) {
GregTech_API.sRecipeAdder.addAssemblerRecipe(GT_Utility.copyAmount(1L, aStack), GT_OreDictUnificator.get(OrePrefixes.plate, (Object)Materials.Iron, 1L), GregTech_API.getGregTechComponent(30, 1), 800, 16); if (this.isExecutable(aPrefix, this.getMaterial(aPrefix, entry))) {
GregTech_API.sRecipeAdder.addAssemblerRecipe(GT_Utility.copyAmount(1L, aStack), GT_OreDictUnificator.get(OrePrefixes.plate, (Object)Materials.Aluminium, 1L), GregTech_API.getGregTechComponent(87, 1), 800, 16); if (entry.oreDictName.equals(GT_OreDictNames.craftingRedstoneTorch.toString())) {
} else if(aOreDictName.equals(GT_OreDictNames.craftingRawMachineTier01.toString())) { RecipeMaps.ASSEMBLING.factory().EUt(16).duration(800).input(RecipeEntry.fromStacks(entry.ores, Match.DAMAGE)).input(OrePrefixes.plate, Materials.Iron, 1).output(GregTech_API.getGregTechComponent(30, 1)).buildAndRegister();
GregTech_API.sRecipeAdder.addAssemblerRecipe(GT_Utility.copyAmount(1L, aStack), new ItemStack(Blocks.noteblock, 4, 32767), new ItemStack(GregTech_API.sBlockList[1], 1, 66), 800, 1); RecipeMaps.ASSEMBLING.factory().EUt(16).duration(800).input(RecipeEntry.fromStacks(entry.ores, Match.DAMAGE)).input(OrePrefixes.plate, Materials.Aluminium, 1).output(GregTech_API.getGregTechComponent(87, 1)).buildAndRegister();
GregTech_API.sRecipeAdder.addAssemblerRecipe(GT_Utility.copyAmount(1L, aStack), new ItemStack(Blocks.stone_button, 16, 32767), new ItemStack(GregTech_API.sBlockList[1], 1, 67), 800, 1); } else if (entry.oreDictName.equals(GT_OreDictNames.craftingRawMachineTier01.toString())) {
if(!GT_Utility.areStacksEqual(new ItemStack(GregTech_API.sBlockList[1], 1, 79), aStack)) { RecipeMaps.ASSEMBLING.factory().EUt(1).duration(800).input(RecipeEntry.fromStacks(entry.ores, Match.DAMAGE)).input(new ItemStack(Blocks.noteblock, 1, GregTech_API.ITEM_WILDCARD_DAMAGE)).output(new ItemStack(GregTech_API.sBlockList[1], 1, 66)).buildAndRegister();
GregTech_API.sRecipeAdder.addAssemblerRecipe(GT_Utility.copyAmount(1L, aStack), GregTech_API.getGregTechComponent(22, 1), new ItemStack(GregTech_API.sBlockList[1], 1, 79), 1600, 2); RecipeMaps.ASSEMBLING.factory().EUt(1).duration(800).input(RecipeEntry.fromStacks(entry.ores, Match.DAMAGE)).input(new ItemStack(Blocks.stone_button, 1, GregTech_API.ITEM_WILDCARD_DAMAGE)).output(new ItemStack(GregTech_API.sBlockList[1], 1, 67)).buildAndRegister();
} RecipeMaps.ASSEMBLING.factory().EUt(2).duration(1600).input(RecipeEntry.fromStacks(entry.ores, Match.DAMAGE)).input(GregTech_API.getGregTechComponent(7, 1)).output(GT_ModHandler.getIC2Item("solarPanel", 1)).buildAndRegister();
ItemStack machineBlock = new ItemStack(GregTech_API.sBlockList[1], 1, 79);
GregTech_API.sRecipeAdder.addAssemblerRecipe(GT_Utility.copyAmount(1L, aStack), GregTech_API.getGregTechComponent(7, 1), GT_ModHandler.getIC2Item("solarPanel", 1L), 1600, 2); List<ItemStack> filtered = entry.ores.stream().filter(s -> !s.isItemEqual(machineBlock)).collect(Collectors.toList());
} else if(aOreDictName.equals(GT_OreDictNames.craftingGenerator.toString())) { RecipeMaps.ASSEMBLING.factory().EUt(2).duration(1600).input(RecipeEntry.fromStacks(filtered, Match.DAMAGE)).input(GregTech_API.getGregTechComponent(22, 1)).output(new ItemStack(GregTech_API.sBlockList[1], 1, 79)).buildAndRegister();
GregTech_API.sRecipeAdder.addAssemblerRecipe(GT_Utility.copyAmount(1L, aStack), GT_OreDictUnificator.get(OrePrefixes.gearGt, (Object)Materials.Steel, 1L), GregTech_API.getGregTechComponent(25, 1), 3200, 4); } else if (entry.oreDictName.equals(GT_OreDictNames.craftingGenerator.toString())) {
GregTech_API.sRecipeAdder.addAssemblerRecipe(GT_Utility.copyAmount(1L, aStack), GT_OreDictUnificator.get(OrePrefixes.gearGt, (Object)Materials.StainlessSteel, 1L), GregTech_API.getGregTechComponent(25, 1), 3200, 4); RecipeMaps.ASSEMBLING.factory().EUt(4).duration(3200).input(RecipeEntry.fromStacks(entry.ores, Match.DAMAGE)).input(OrePrefixes.gearGt, Materials.Steel, 1).output(GregTech_API.getGregTechComponent(25, 1)).buildAndRegister();
} else if(aOreDictName.equals(GT_OreDictNames.craftingWireCopper.toString())) { RecipeMaps.ASSEMBLING.factory().EUt(4).duration(3200).input(RecipeEntry.fromStacks(entry.ores, Match.DAMAGE)).input(OrePrefixes.gearGt, Materials.StainlessSteel, 1).output(GregTech_API.getGregTechComponent(25, 1)).buildAndRegister();
GregTech_API.sRecipeAdder.addAssemblerRecipe(GT_Utility.copyAmount(2L, aStack), GT_OreDictUnificator.get(OrePrefixes.plate, (Object)Materials.BatteryAlloy, 6L), GT_Items.Battery_Hull_MV.get(1L, new Object[0]), 1600, 2); } else if (entry.oreDictName.equals(GT_OreDictNames.craftingWireCopper.toString())) {
GregTech_API.sRecipeAdder.addAssemblerRecipe(GT_Items.Circuit_Board_Basic.get(1L, new Object[0]), GT_Utility.copyAmount(3L, aStack), GT_Items.Circuit_Basic.get(1L, new Object[0]), 800, 1); RecipeMaps.ASSEMBLING.factory().EUt(2).duration(1600).input(RecipeEntry.fromStacks(2, entry.ores, Match.DAMAGE)).input(OrePrefixes.plate, Materials.BatteryAlloy, 6).output(GT_Items.Battery_Hull_MV.get(1)).buildAndRegister();
GregTech_API.sRecipeAdder.addAssemblerRecipe(GT_Items.Circuit_Basic.get(1L, new Object[0]), GT_Utility.copyAmount(1L, aStack), GT_ModHandler.getIC2Item("frequencyTransmitter", 1L), 800, 1); RecipeMaps.ASSEMBLING.factory().EUt(1).duration(800).input(RecipeEntry.fromStacks(3, entry.ores, Match.DAMAGE)).input(GT_Items.Circuit_Board_Basic.get(1)).output(GT_Items.Circuit_Basic.get(1)).buildAndRegister();
} else if(aOreDictName.equals(GT_OreDictNames.craftingWireTin.toString())) { RecipeMaps.ASSEMBLING.factory().EUt(1).duration(800).input(RecipeEntry.fromStacks(entry.ores, Match.DAMAGE)).input(GT_Items.Circuit_Basic.get(1)).output(GT_ModHandler.getIC2Item("frequencyTransmitter", 1L)).buildAndRegister();
GregTech_API.sRecipeAdder.addAssemblerRecipe(GT_Utility.copyAmount(1L, aStack), GT_OreDictUnificator.get(OrePrefixes.plate, (Object)Materials.BatteryAlloy, 2L), GT_Items.Battery_Hull_LV.get(1L, new Object[0]), 800, 1); } else if (entry.oreDictName.equals(GT_OreDictNames.craftingWireTin.toString())) {
GregTech_API.sRecipeAdder.addAssemblerRecipe(GT_Items.Circuit_Basic.get(1L, new Object[0]), GT_Utility.copyAmount(1L, aStack), GT_ModHandler.getIC2Item("frequencyTransmitter", 1L), 800, 1); RecipeMaps.ASSEMBLING.factory().EUt(1).duration(800).input(RecipeEntry.fromStacks(entry.ores, Match.DAMAGE)).input(OrePrefixes.plate, Materials.BatteryAlloy, 2).output(GT_Items.Battery_Hull_LV.get(1)).buildAndRegister();
} RecipeMaps.ASSEMBLING.factory().EUt(1).duration(800).input(RecipeEntry.fromStacks(entry.ores, Match.DAMAGE)).input(GT_Items.Circuit_Basic.get(1)).output(GT_ModHandler.getIC2Item("frequencyTransmitter", 1L)).buildAndRegister();
}
} }
}
}
} }

View file

@ -70,8 +70,8 @@ public class GT_OreProcessingLoader implements Runnable {
new ProcessingBolt(); new ProcessingBolt();
new ProcessingCell(); new ProcessingCell();
new ProcessingCellPlasma(); new ProcessingCellPlasma();
// new ProcessingCircuit(); new ProcessingCircuit();
// new ProcessingCrafting(); new ProcessingCrafting();
// new ProcessingCrushed(); // new ProcessingCrushed();
// new ProcessingCrushedPurified(); // new ProcessingCrushedPurified();
// new ProcessingCrushedCentrifuged(); // new ProcessingCrushedCentrifuged();