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.
* @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;
boolean rReturn = false;
@SuppressWarnings("unchecked")

View file

@ -1,5 +1,9 @@
package gregtechmod.loaders.oreprocessing;
import java.util.List;
import cpw.mods.fml.common.registry.GameRegistry;
import gregtechmod.api.GregTech_API;
import gregtechmod.api.enums.GT_ConfigCategories;
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.OrePrefixes;
import gregtechmod.api.interfaces.IOreRecipeRegistrator;
import gregtechmod.api.util.GT_ModHandler;
import gregtechmod.api.util.GT_Utility;
import gregtechmod.api.util.GT_Shaped_Recipe;
import gregtechmod.api.util.OreDictEntry;
public class ProcessingCircuit implements IOreRecipeRegistrator {
public ProcessingCircuit() {
OrePrefixes.circuit.add((IOreRecipeRegistrator)this);
}
public ProcessingCircuit() {
OrePrefixes.circuit.add(this);
}
public void registerOre(OrePrefixes aPrefix, List<OreDictEntry> dictEntry) {
switch(aMaterial) {
case Basic:
if(!GT_Utility.areStacksEqual(aStack, GT_Items.Circuit_Integrated.getWildcard(1L, new Object[0]))) {
GT_ModHandler.removeRecipeByOutput(aStack);
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)});
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)});
}
break;
case Advanced:
GT_ModHandler.removeRecipeByOutput(aStack);
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)});
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)});
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)});
default: break;
}
}
// FIXME removing all circuits crafing recipe, then register new
public void registerOre(OrePrefixes aPrefix, List<OreDictEntry> dictEntry) {
for (OreDictEntry entry : dictEntry) {
Materials aMaterial = this.getMaterial(aPrefix, entry);
if (this.isExecutable(aPrefix, aMaterial)) {
switch (aMaterial) {
case Basic:
GameRegistry.addRecipe(new GT_Shaped_Recipe(GT_Items.Circuit_Basic.get(1), new Object[] { "CCC", "SRS", "CCC",
'C', GT_OreDictNames.craftingWireCopper.toString(),
'R', OrePrefixes.plate.get(Materials.Iron),
'S', GregTech_API.sRecipeFile.get(GT_ConfigCategories.Recipes.harderrecipes, "circuitRedAlloy", true) ? OrePrefixes.plate.get(Materials.RedAlloy) : OrePrefixes.dust.get(Materials.Redstone)
}));
GameRegistry.addRecipe(new GT_Shaped_Recipe(GT_Items.Circuit_Basic.get(1), new Object[] { "CSC", "CRC", "CSC",
'C', GT_OreDictNames.craftingWireCopper.toString(),
'R', OrePrefixes.plate.get(Materials.Iron),
'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;
import java.util.List;
import java.util.stream.Collectors;
import gregtechmod.api.GregTech_API;
import gregtechmod.api.enums.GT_Items;
import gregtechmod.api.enums.GT_OreDictNames;
@ -7,40 +10,46 @@ import gregtechmod.api.enums.Materials;
import gregtechmod.api.enums.OrePrefixes;
import gregtechmod.api.interfaces.IOreRecipeRegistrator;
import gregtechmod.api.util.GT_ModHandler;
import gregtechmod.api.util.GT_OreDictUnificator;
import gregtechmod.api.util.GT_Utility;
import gregtechmod.api.util.OreDictEntry;
import gregtechmod.common.recipe.RecipeEntry;
import gregtechmod.common.recipe.RecipeEntry.Match;
import gregtechmod.common.recipe.RecipeMaps;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
public class ProcessingCrafting implements IOreRecipeRegistrator {
public ProcessingCrafting() {
OrePrefixes.crafting.add((IOreRecipeRegistrator)this);
}
public ProcessingCrafting() {
OrePrefixes.crafting.add(this);
}
public void registerOre(OrePrefixes aPrefix, List<OreDictEntry> dictEntry) {
if(aOreDictName.equals(GT_OreDictNames.craftingRedstoneTorch.toString())) {
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);
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);
} else if(aOreDictName.equals(GT_OreDictNames.craftingRawMachineTier01.toString())) {
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);
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);
if(!GT_Utility.areStacksEqual(new ItemStack(GregTech_API.sBlockList[1], 1, 79), aStack)) {
GregTech_API.sRecipeAdder.addAssemblerRecipe(GT_Utility.copyAmount(1L, aStack), GregTech_API.getGregTechComponent(22, 1), new ItemStack(GregTech_API.sBlockList[1], 1, 79), 1600, 2);
}
GregTech_API.sRecipeAdder.addAssemblerRecipe(GT_Utility.copyAmount(1L, aStack), GregTech_API.getGregTechComponent(7, 1), GT_ModHandler.getIC2Item("solarPanel", 1L), 1600, 2);
} else if(aOreDictName.equals(GT_OreDictNames.craftingGenerator.toString())) {
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);
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);
} else if(aOreDictName.equals(GT_OreDictNames.craftingWireCopper.toString())) {
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);
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);
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);
} else if(aOreDictName.equals(GT_OreDictNames.craftingWireTin.toString())) {
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);
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);
}
}
public void registerOre(OrePrefixes aPrefix, List<OreDictEntry> dictEntry) {
for (OreDictEntry entry : dictEntry) {
if (this.isExecutable(aPrefix, this.getMaterial(aPrefix, entry))) {
if (entry.oreDictName.equals(GT_OreDictNames.craftingRedstoneTorch.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();
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();
} else if (entry.oreDictName.equals(GT_OreDictNames.craftingRawMachineTier01.toString())) {
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();
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);
List<ItemStack> filtered = entry.ores.stream().filter(s -> !s.isItemEqual(machineBlock)).collect(Collectors.toList());
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();
} else if (entry.oreDictName.equals(GT_OreDictNames.craftingGenerator.toString())) {
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();
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();
} else if (entry.oreDictName.equals(GT_OreDictNames.craftingWireCopper.toString())) {
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();
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();
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();
} else if (entry.oreDictName.equals(GT_OreDictNames.craftingWireTin.toString())) {
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 ProcessingCell();
new ProcessingCellPlasma();
// new ProcessingCircuit();
// new ProcessingCrafting();
new ProcessingCircuit();
new ProcessingCrafting();
// new ProcessingCrushed();
// new ProcessingCrushedPurified();
// new ProcessingCrushedCentrifuged();