diff options
author | bartimaeusnek <33183715+bartimaeusnek@users.noreply.github.com> | 2019-09-05 10:11:23 +0200 |
---|---|---|
committer | bartimaeusnek <33183715+bartimaeusnek@users.noreply.github.com> | 2019-09-05 10:11:23 +0200 |
commit | a8e54c336b8a5bc8509d173ea438af59f7acf909 (patch) | |
tree | 52f172d705c9f2eac2e1af365f0e1161e096043f /src/main/java | |
parent | 2616ba28c946150a3d802c6414fbd403a8a412ed (diff) | |
download | GT5-Unofficial-a8e54c336b8a5bc8509d173ea438af59f7acf909.tar.gz GT5-Unofficial-a8e54c336b8a5bc8509d173ea438af59f7acf909.tar.bz2 GT5-Unofficial-a8e54c336b8a5bc8509d173ea438af59f7acf909.zip |
began on PlatinumOverhaul
Palladium and Platinum recipes are done
Signed-off-by: bartimaeusnek <33183715+bartimaeusnek@users.noreply.github.com>
Former-commit-id: b7cbc2e2b799c3bc2a2e6ef31395d14bda5f6ef0
Diffstat (limited to 'src/main/java')
9 files changed, 579 insertions, 53 deletions
diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/MainMod.java b/src/main/java/com/github/bartimaeusnek/bartworks/MainMod.java index 9a5e86b39c..b3cd4aca0c 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/MainMod.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/MainMod.java @@ -43,6 +43,7 @@ import com.github.bartimaeusnek.bartworks.system.material.CircuitGeneration.Circ import com.github.bartimaeusnek.bartworks.system.material.ThreadedLoader; import com.github.bartimaeusnek.bartworks.system.material.Werkstoff; import com.github.bartimaeusnek.bartworks.system.material.processingLoaders.DownTierLoader; +import com.github.bartimaeusnek.bartworks.system.material.processingLoaders.PlatinumSludgeOverHaul; import com.github.bartimaeusnek.bartworks.system.oredict.OreDictHandler; import com.github.bartimaeusnek.bartworks.util.BWRecipes; import com.github.bartimaeusnek.bartworks.util.BW_Util; @@ -200,7 +201,7 @@ public final class MainMod { HashSet<ItemStack> noGas = MainMod.getNoGasItems(toChange); MainMod.editRecipes(toChange, noGas); } - + PlatinumSludgeOverHaul.replacePureElements(); new CircuitImprintLoader().run(); if (classicMode) new DownTierLoader().run(); diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/system/material/Werkstoff.java b/src/main/java/com/github/bartimaeusnek/bartworks/system/material/Werkstoff.java index 5d73dba279..0f0d9d3c5e 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/system/material/Werkstoff.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/system/material/Werkstoff.java @@ -194,6 +194,14 @@ public class Werkstoff implements IColorModulationContainer, ISubTagContainer { return this.type; } + public boolean containsStuff(ISubTagContainer stuff){ + for (Pair<ISubTagContainer, Integer> pair : this.contents){ + if (pair.getKey().equals(stuff)) + return true; + } + return false; + } + public Pair<Integer, LinkedHashSet<Pair<ISubTagContainer, Integer>>> getContents() { int ret = 0; switch (this.type) { diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/system/material/WerkstoffLoader.java b/src/main/java/com/github/bartimaeusnek/bartworks/system/material/WerkstoffLoader.java index bf3ae4bb9e..269a258809 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/system/material/WerkstoffLoader.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/system/material/WerkstoffLoader.java @@ -33,6 +33,7 @@ import com.github.bartimaeusnek.bartworks.system.oredict.OreDictAdder; import com.github.bartimaeusnek.bartworks.system.oredict.OreDictHandler; import com.github.bartimaeusnek.bartworks.util.BWRecipes; import com.github.bartimaeusnek.bartworks.util.BW_ColorUtil; +import com.github.bartimaeusnek.bartworks.util.BW_Util; import com.github.bartimaeusnek.bartworks.util.Pair; import com.github.bartimaeusnek.crossmod.thaumcraft.util.ThaumcraftHandler; import cpw.mods.fml.client.registry.RenderingRegistry; @@ -659,6 +660,245 @@ public class WerkstoffLoader implements Runnable { new Pair<>(WerkstoffLoader.Neon,1), new Pair<>(Materials.Potassium,1) ); + public static final Werkstoff PTConcentrate = new Werkstoff( + Materials.Platinum.getRGBA(), + "Platin Concentrate", + "", + new Werkstoff.Stats(), + Werkstoff.Types.MIXTURE, + new Werkstoff.GenerationFeatures().disable().addCells(), + 44, + TextureSet.SET_FLUID + //No Byproducts + //No Ingredients + ); + public static final Werkstoff PTSaltCrude = new Werkstoff( + Materials.Platinum.getRGBA(), + "Platin Salt", + "", + new Werkstoff.Stats(), + Werkstoff.Types.MIXTURE, + new Werkstoff.GenerationFeatures().disable().onlyDust(), + 45, + TextureSet.SET_DULL + //No Byproducts + //No Ingredients + ); + public static final Werkstoff PTSaltRefined = new Werkstoff( + Materials.Platinum.getRGBA(), + "Refined Platin Salt", + "", + new Werkstoff.Stats(), + Werkstoff.Types.MIXTURE, + new Werkstoff.GenerationFeatures().disable().onlyDust(), + 46, + TextureSet.SET_METALLIC + //No Byproducts + //No Ingredients + ); + public static final Werkstoff PTMetallicPowder = new Werkstoff( + Materials.Platinum.getRGBA(), + "Platin Metallic Powder", + "", + new Werkstoff.Stats(), + Werkstoff.Types.MIXTURE, + new Werkstoff.GenerationFeatures().disable().onlyDust(), + 47, + TextureSet.SET_METALLIC + //No Byproducts + //No Ingredients + ); + public static final Werkstoff AquaRegia = new Werkstoff( + new short[]{0xff,0xb1,0x32}, + "AquaRegia", + new Werkstoff.Stats(), + Werkstoff.Types.MIXTURE, + new Werkstoff.GenerationFeatures().disable().addCells(), + 48, + TextureSet.SET_FLUID, + //No Byproducts + new Pair<>(Materials.DilutedSulfuricAcid,1), + new Pair<>(Materials.NitricAcid,1) + ); + public static final Werkstoff PTResidue = new Werkstoff( + Materials.Platinum.getRGBA(), + "Platinum Residue", + new Werkstoff.Stats(), + Werkstoff.Types.MIXTURE, + new Werkstoff.GenerationFeatures().disable().onlyDust(), + 49, + TextureSet.SET_ROUGH + //No Byproducts + ); + public static final Werkstoff AmmoniumCloride = new Werkstoff( + new short[]{0xff,0xff,0xff}, + "Ammonium Cloride", + subscriptNumbers("NH4Cl"), + new Werkstoff.Stats(), + Werkstoff.Types.COMPOUND, + new Werkstoff.GenerationFeatures().disable().addCells(), + 50, + TextureSet.SET_FLUID, + //No Byproducts + new Pair<>(Materials.Ammonium,1), + new Pair<>(Materials.HydrochloricAcid,1) + ); + public static final Werkstoff PTRawPowder = new Werkstoff( + Materials.Platinum.getRGBA(), + "Reprecipated Platin", + "PtCl", + new Werkstoff.Stats(), + Werkstoff.Types.MIXTURE, + new Werkstoff.GenerationFeatures().disable().onlyDust(), + 51, + TextureSet.SET_METALLIC + //No Byproducts + //No Ingredients + ); + public static final Werkstoff PDAmmonia = new Werkstoff( + Materials.Palladium.getRGBA(), + "Palladium enriched Ammonia", + new Werkstoff.Stats(), + Werkstoff.Types.MIXTURE, + new Werkstoff.GenerationFeatures().disable().addCells(), + 52, + TextureSet.SET_FLUID, + //No Byproducts + new Pair<>(Materials.Ammonium,1), + new Pair<>(Materials.Palladium,1) + ); + public static final Werkstoff PDMetallicPowder = new Werkstoff( + Materials.Palladium.getRGBA(), + "Palladium Metallic Powder", + "", + new Werkstoff.Stats(), + Werkstoff.Types.MIXTURE, + new Werkstoff.GenerationFeatures().disable().onlyDust(), + 53, + TextureSet.SET_METALLIC + //No Byproducts + //No Ingredients + ); + public static final Werkstoff PDRawPowder = new Werkstoff( + Materials.Palladium.getRGBA(), + "Reprecipated Palladium", + subscriptNumbers("Pd2NH4"), + new Werkstoff.Stats(), + Werkstoff.Types.MIXTURE, + new Werkstoff.GenerationFeatures().disable().onlyDust(), + 54, + TextureSet.SET_METALLIC + //No Byproducts + //No Ingredients + ); + public static final Werkstoff PDSalt = new Werkstoff( + Materials.Palladium.getRGBA(), + "Palladium Salt", + "", + new Werkstoff.Stats(), + Werkstoff.Types.MIXTURE, + new Werkstoff.GenerationFeatures().disable().onlyDust(), + 55, + TextureSet.SET_METALLIC + //No Byproducts + //No Ingredients + ); + public static final Werkstoff Sodiumformate = new Werkstoff( + new short[]{0xff,0xaa,0xaa}, + "Sodium formate", + "HCOONa", + new Werkstoff.Stats(), + Werkstoff.Types.COMPOUND, + new Werkstoff.GenerationFeatures().disable().addCells(), + 56, + TextureSet.SET_FLUID, + //No Byproducts + new Pair<>(Materials.SodiumHydroxide,1), + new Pair<>(Materials.CarbonMonoxide,1) + ); + public static final Werkstoff Sodiumsulfate = new Werkstoff( + new short[]{0xff,0xff,0xff}, + "Sodium sulfate", + new Werkstoff.Stats().setElektrolysis(true), + Werkstoff.Types.COMPOUND, + new Werkstoff.GenerationFeatures().disable().onlyDust(), + 57, + TextureSet.SET_FLUID, + //No Byproducts + new Pair<>(Materials.Sodium,2), + new Pair<>(Materials.Sulfur,1), + new Pair<>(Materials.Oxygen,4) + ); + public static final Werkstoff FormicAcid = new Werkstoff( + new short[]{0xff,0xaa,0x77}, + "Formic Acid", + subscriptNumbers("CH2O2"), + new Werkstoff.Stats().setElektrolysis(true), + Werkstoff.Types.COMPOUND, + new Werkstoff.GenerationFeatures().disable().addCells(), + 58, + TextureSet.SET_FLUID, + //No Byproducts + new Pair<>(Materials.Carbon,1), + new Pair<>(Materials.Hydrogen,2), + new Pair<>(Materials.Oxygen,2) + ); + public static final Werkstoff PotassiumDisulfate = new Werkstoff( + new short[]{0xfb,0xbb,0x66}, + "PotassiumDisulfate", + new Werkstoff.Stats().setElektrolysis(true), + Werkstoff.Types.COMPOUND, + new Werkstoff.GenerationFeatures().disable().onlyDust().addChemicalRecipes(), + 59, + TextureSet.SET_DULL, + //No Byproducts + new Pair<>(Materials.Potassium,2), + new Pair<>(Materials.Sulfur,2), + new Pair<>(Materials.Oxygen,7) + ); + public static final Werkstoff PHLESSResidue = new Werkstoff( + Materials.Platinum.getRGBA(), + "Leach Residue", + new Werkstoff.Stats(), + Werkstoff.Types.MIXTURE, + new Werkstoff.GenerationFeatures().disable().onlyDust(), + 60, + TextureSet.SET_ROUGH + //No Byproducts + ); + public static final Werkstoff RHSulfate = new Werkstoff( + new short[]{0xee,0xaa,0x55}, + "Rh Sulfate", + new Werkstoff.Stats().setGas(true), + Werkstoff.Types.COMPOUND, + new Werkstoff.GenerationFeatures().disable().addCells(), + 61, + TextureSet.SET_ROUGH + //No Byproducts + ); + public static final Werkstoff RHSulfateSolution = new Werkstoff( + new short[]{0xff,0xbb,0x66}, + "Rh Sulfate Solution", + new Werkstoff.Stats(), + Werkstoff.Types.MIXTURE, + new Werkstoff.GenerationFeatures().disable().addCells(), + 62, + TextureSet.SET_ROUGH + //No Byproducts + ); + public static final Werkstoff CalciumChloride = new Werkstoff( + new short[]{0xff,0xff,0xff}, + "Calcium chloride", + new Werkstoff.Stats().setElektrolysis(true), + Werkstoff.Types.COMPOUND, + new Werkstoff.GenerationFeatures().disable().onlyDust(), + 63, + TextureSet.SET_DULL, + new Pair<>(Materials.Calcium,1), + new Pair<>(Materials.Chlorine,2) + //No Byproducts + ); + public static HashMap<OrePrefixes, BW_MetaGenerated_Items> items = new HashMap<>(); public static HashMap<Werkstoff, Fluid> fluids = new HashMap<>(); @@ -1136,8 +1376,8 @@ public class WerkstoffLoader implements Runnable { ItemStack scannerOutput = ItemList.Tool_DataOrb.get(1L); Behaviour_DataOrb.setDataTitle(scannerOutput,"Elemental-Scan"); Behaviour_DataOrb.setDataName(scannerOutput,werkstoff.getToolTip()); - GT_Recipe.GT_Recipe_Map.sScannerFakeRecipes.add(new BWRecipes.DynamicGTRecipe(false, new ItemStack[]{werkstoff.get(dust)}, new ItemStack[]{scannerOutput}, ItemList.Tool_DataOrb.get(1L), null, null, null, (int) (werkstoffBridgeMaterial.getMass()* 8192L),30,0)); - GT_Recipe.GT_Recipe_Map.sReplicatorFakeRecipes.add(new BWRecipes.DynamicGTRecipe(false, null,new ItemStack[]{werkstoff.get(dust)}, scannerOutput, null, new FluidStack[]{Materials.UUMatter.getFluid(werkstoffBridgeMaterial.getMass())}, null, (int) (werkstoffBridgeMaterial.getMass() * 512L),30,0)); + GT_Recipe.GT_Recipe_Map.sScannerFakeRecipes.addFakeRecipe(false,new BWRecipes.DynamicGTRecipe(false, new ItemStack[]{werkstoff.get(dust)}, new ItemStack[]{scannerOutput}, ItemList.Tool_DataOrb.get(1L), null, null, null, (int) (werkstoffBridgeMaterial.getMass()* 8192L),30,0)); + GT_Recipe.GT_Recipe_Map.sReplicatorFakeRecipes.addFakeRecipe(false,new BWRecipes.DynamicGTRecipe(false, null,new ItemStack[]{werkstoff.get(dust)}, scannerOutput, null, new FluidStack[]{Materials.UUMatter.getFluid(werkstoffBridgeMaterial.getMass())}, null, (int) (werkstoffBridgeMaterial.getMass() * 512L),30,0)); } } } @@ -1220,6 +1460,69 @@ public class WerkstoffLoader implements Runnable { if ((werkstoff.getGenerationFeatures().toGenerate & 0b10000) == 0) return; + if (werkstoff.getStats().isElektrolysis() || werkstoff.getStats().isCentrifuge() || werkstoff.getGenerationFeatures().hasChemicalRecipes()) { + List<FluidStack> flOutputs = new ArrayList<>(); + List<ItemStack> stOutputs = new ArrayList<>(); + HashMap<ISubTagContainer, Pair<Integer, Integer>> tracker = new HashMap<>(); + int cells = 0; + for (Pair<ISubTagContainer, Integer> container : werkstoff.getContents().getValue().toArray(new Pair[0])) { + if (container.getKey() instanceof Materials) { + if (((Materials) container.getKey()).hasCorrespondingGas() || ((Materials) container.getKey()).hasCorrespondingFluid() || ((Materials) container.getKey()).mIconSet == TextureSet.SET_FLUID) { + FluidStack tmpFl = ((Materials) container.getKey()).getGas(1000 * container.getValue()); + if (tmpFl == null || tmpFl.getFluid() == null) { + tmpFl = ((Materials) container.getKey()).getFluid(1000 * container.getValue()); + } + flOutputs.add(tmpFl); + if (flOutputs.size() > 1) { + if (!tracker.containsKey(container.getKey())) { + stOutputs.add(((Materials) container.getKey()).getCells(container.getValue())); + tracker.put(container.getKey(), new Pair<>(container.getValue(), stOutputs.size() - 1)); + } else { + stOutputs.add(((Materials) container.getKey()).getCells(tracker.get(container.getKey()).getKey() + container.getValue())); + stOutputs.remove(tracker.get(container.getKey()).getValue() + 1); + } + cells += container.getValue(); + } + } + } else if (container.getKey() instanceof Werkstoff) { + if (((Werkstoff) container.getKey()).getStats().isGas() || ((Werkstoff) container.getKey()).getGenerationFeatures().hasCells()) { + FluidStack tmpFl = ((Werkstoff) container.getKey()).getFluidOrGas(1000 * container.getValue()); + if (tmpFl == null || tmpFl.getFluid() == null) { + tmpFl = ((Werkstoff) container.getKey()).getFluidOrGas(1000 * container.getValue()); + } + flOutputs.add(tmpFl); + if (flOutputs.size() > 1) { + if (!tracker.containsKey(container.getKey())) { + stOutputs.add(((Werkstoff) container.getKey()).get(cell, container.getValue())); + tracker.put(container.getKey(), new Pair<>(container.getValue(), stOutputs.size() - 1)); + } else { + stOutputs.add(((Werkstoff) container.getKey()).get(cell, tracker.get(container.getKey()).getKey() + container.getValue())); + stOutputs.remove(tracker.get(container.getKey()).getValue() + 1); + } + cells += container.getValue(); + } + } + } + } + ItemStack input = werkstoff.get(cell); + input.stackSize = werkstoff.getContents().getKey(); + stOutputs.add(Materials.Empty.getCells(cells)); + if (werkstoff.getStats().isElektrolysis()) + GT_Recipe.GT_Recipe_Map.sElectrolyzerRecipes.addRecipe(true, new ItemStack[]{input, cells > 0 ? Materials.Empty.getCells(cells) : null}, stOutputs.toArray(new ItemStack[0]), null, null, new FluidStack[]{null}, new FluidStack[]{flOutputs.size() > 0 ? flOutputs.get(0) : null}, (int) Math.max(1L, Math.abs(werkstoff.getStats().protons * werkstoff.getContents().getValue().size())), Math.min(4, werkstoff.getContents().getValue().size()) * 30, 0); + if (werkstoff.getStats().isCentrifuge()) + GT_Recipe.GT_Recipe_Map.sCentrifugeRecipes.addRecipe(true, new ItemStack[]{input, cells > 0 ? Materials.Empty.getCells(cells) : null}, stOutputs.toArray(new ItemStack[0]), null, null, new FluidStack[]{null}, new FluidStack[]{flOutputs.size() > 0 ? flOutputs.get(0) : null}, (int) Math.max(1L, Math.abs(werkstoff.getStats().mass * werkstoff.getContents().getValue().size())), Math.min(4, werkstoff.getContents().getValue().size()) * 5, 0); + if (werkstoff.getGenerationFeatures().hasChemicalRecipes()) { + if (cells > 0) + stOutputs.add(Materials.Empty.getCells(cells)); + GT_Recipe.GT_Recipe_Map.sChemicalRecipes.addRecipe(true, stOutputs.toArray(new ItemStack[0]),new ItemStack[]{input},null,null,new FluidStack[]{flOutputs.size() > 0 ? flOutputs.get(0) : null},null,(int) Math.max(1L, Math.abs(werkstoff.getStats().protons * werkstoff.getContents().getValue().size())), Math.min(4, werkstoff.getContents().getValue().size()) * 30,0); + } + if (werkstoff.getGenerationFeatures().hasMixerRecipes()) { + if (cells > 0) + stOutputs.add(Materials.Empty.getCells(cells)); + GT_Recipe.GT_Recipe_Map.sMixerRecipes.addRecipe(true, stOutputs.toArray(new ItemStack[0]),new ItemStack[]{input},null,null,new FluidStack[]{flOutputs.size() > 0 ? flOutputs.get(0) : null},null,(int) Math.max(1L, Math.abs(werkstoff.getStats().mass * werkstoff.getContents().getValue().size())), Math.min(4, werkstoff.getContents().getValue().size()) * 5,0); + } + } + //Tank "Recipe" GT_Utility.addFluidContainerData(new FluidContainerRegistry.FluidContainerData(new FluidStack(WerkstoffLoader.fluids.get(werkstoff), 1000),werkstoff.get(cell),Materials.Empty.getCells(1))); @@ -1253,8 +1556,8 @@ public class WerkstoffLoader implements Runnable { ItemStack scannerOutput = ItemList.Tool_DataOrb.get(1L); Behaviour_DataOrb.setDataTitle(scannerOutput,"Elemental-Scan"); Behaviour_DataOrb.setDataName(scannerOutput,werkstoff.getToolTip()); - GT_Recipe.GT_Recipe_Map.sScannerFakeRecipes.add(new BWRecipes.DynamicGTRecipe(false, new ItemStack[]{werkstoff.get(cell)}, new ItemStack[]{scannerOutput}, ItemList.Tool_DataOrb.get(1L), null, null, null, (int) (werkstoffBridgeMaterial.getMass()* 8192L),30,0)); - GT_Recipe.GT_Recipe_Map.sReplicatorFakeRecipes.add(new BWRecipes.DynamicGTRecipe(false,new ItemStack[]{Materials.Empty.getCells(1)} ,new ItemStack[]{werkstoff.get(cell)}, scannerOutput, null, new FluidStack[]{Materials.UUMatter.getFluid(werkstoffBridgeMaterial.getMass())}, null, (int) (werkstoffBridgeMaterial.getMass() * 512L),30,0)); + GT_Recipe.GT_Recipe_Map.sScannerFakeRecipes.addFakeRecipe(false,new BWRecipes.DynamicGTRecipe(false, new ItemStack[]{werkstoff.get(cell)}, new ItemStack[]{scannerOutput}, ItemList.Tool_DataOrb.get(1L), null, null, null, (int) (werkstoffBridgeMaterial.getMass()* 8192L),30,0)); + GT_Recipe.GT_Recipe_Map.sReplicatorFakeRecipes.addFakeRecipe(false,new BWRecipes.DynamicGTRecipe(false,new ItemStack[]{Materials.Empty.getCells(1)} ,new ItemStack[]{werkstoff.get(cell)}, scannerOutput, null, new FluidStack[]{Materials.UUMatter.getFluid(werkstoffBridgeMaterial.getMass())}, null, (int) (werkstoffBridgeMaterial.getMass() * 512L),30,0)); } } private void addMoltenRecipes(Werkstoff werkstoff) { diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/system/material/processingLoaders/AdditionalRecipes.java b/src/main/java/com/github/bartimaeusnek/bartworks/system/material/processingLoaders/AdditionalRecipes.java index 0acd99df2d..f829306575 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/system/material/processingLoaders/AdditionalRecipes.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/system/material/processingLoaders/AdditionalRecipes.java @@ -116,36 +116,39 @@ public class AdditionalRecipes implements Runnable { Materials.SolderingAlloy.getMolten((i+1)*144) },null,(i+1)*1500, BW_Util.getMachineVoltageFromTier(i+1),CLEANROOM)); } + oldGThelperMethod(); + } - //manual override for older GT - Werkstoff werkstoff = WerkstoffLoader.Oganesson; - Materials werkstoffBridgeMaterial = null; - boolean aElementSet = false; - for (Element e : Element.values()){ - if (e.toString().equals("Uuo")){ - werkstoffBridgeMaterial = new Materials(-1,werkstoff.getTexSet(),0,0,0,false,werkstoff.getDefaultName(),werkstoff.getDefaultName()); - werkstoffBridgeMaterial.mElement = e; - e.mLinkedMaterials.add(werkstoffBridgeMaterial); - aElementSet = true; - break; - } - } - if (!aElementSet) - return; + private static void oldGThelperMethod(){ + //manual override for older GT + Werkstoff werkstoff = WerkstoffLoader.Oganesson; + Materials werkstoffBridgeMaterial = null; + boolean aElementSet = false; + for (Element e : Element.values()){ + if (e.toString().equals("Uuo")){ + werkstoffBridgeMaterial = new Materials(-1,werkstoff.getTexSet(),0,0,0,false,werkstoff.getDefaultName(),werkstoff.getDefaultName()); + werkstoffBridgeMaterial.mElement = e; + e.mLinkedMaterials.add(werkstoffBridgeMaterial); + aElementSet = true; + break; + } + } + if (!aElementSet) + return; - GT_OreDictUnificator.addAssociation(cell,werkstoffBridgeMaterial, werkstoff.get(cell),true); - try { - Field f = Materials.class.getDeclaredField("MATERIALS_MAP"); - f.setAccessible(true); - Map<String, Materials> MATERIALS_MAP = (Map<String, Materials>) f.get(null); - MATERIALS_MAP.remove(werkstoffBridgeMaterial.mName); - } catch (NoSuchFieldException | IllegalAccessException | ClassCastException e) { - e.printStackTrace(); - } - ItemStack scannerOutput = ItemList.Tool_DataOrb.get(1L); - Behaviour_DataOrb.setDataTitle(scannerOutput,"Elemental-Scan"); - Behaviour_DataOrb.setDataName(scannerOutput, werkstoff.getToolTip()); - GT_Recipe.GT_Recipe_Map.sScannerFakeRecipes.add(new BWRecipes.DynamicGTRecipe(false, new ItemStack[]{werkstoff.get(cell)}, new ItemStack[]{scannerOutput}, ItemList.Tool_DataOrb.get(1L), null, null, null, (int) (werkstoffBridgeMaterial.getMass()* 8192L),30,0)); - GT_Recipe.GT_Recipe_Map.sReplicatorFakeRecipes.add(new BWRecipes.DynamicGTRecipe(false,new ItemStack[]{Materials.Empty.getCells(1)} ,new ItemStack[]{werkstoff.get(cell)}, scannerOutput, null, new FluidStack[]{Materials.UUMatter.getFluid(werkstoffBridgeMaterial.getMass())}, null, (int) (werkstoffBridgeMaterial.getMass() * 512L),30,0)); + GT_OreDictUnificator.addAssociation(cell,werkstoffBridgeMaterial, werkstoff.get(cell),true); + try { + Field f = Materials.class.getDeclaredField("MATERIALS_MAP"); + f.setAccessible(true); + Map<String, Materials> MATERIALS_MAP = (Map<String, Materials>) f.get(null); + MATERIALS_MAP.remove(werkstoffBridgeMaterial.mName); + } catch (NoSuchFieldException | IllegalAccessException | ClassCastException e) { + e.printStackTrace(); + } + ItemStack scannerOutput = ItemList.Tool_DataOrb.get(1L); + Behaviour_DataOrb.setDataTitle(scannerOutput,"Elemental-Scan"); + Behaviour_DataOrb.setDataName(scannerOutput, werkstoff.getToolTip()); + GT_Recipe.GT_Recipe_Map.sScannerFakeRecipes.addFakeRecipe(false,new BWRecipes.DynamicGTRecipe(false, new ItemStack[]{werkstoff.get(cell)}, new ItemStack[]{scannerOutput}, ItemList.Tool_DataOrb.get(1L), null, null, null, (int) (werkstoffBridgeMaterial.getMass()* 8192L),30,0)); + GT_Recipe.GT_Recipe_Map.sReplicatorFakeRecipes.addFakeRecipe(false,new BWRecipes.DynamicGTRecipe(false,new ItemStack[]{Materials.Empty.getCells(1)} ,new ItemStack[]{werkstoff.get(cell)}, scannerOutput, null, new FluidStack[]{Materials.UUMatter.getFluid(werkstoffBridgeMaterial.getMass())}, null, (int) (werkstoffBridgeMaterial.getMass() * 512L),30,0)); } }
\ No newline at end of file diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/system/material/processingLoaders/PlatinumSludgeOverHaul.java b/src/main/java/com/github/bartimaeusnek/bartworks/system/material/processingLoaders/PlatinumSludgeOverHaul.java new file mode 100644 index 0000000000..67bf92e8de --- /dev/null +++ b/src/main/java/com/github/bartimaeusnek/bartworks/system/material/processingLoaders/PlatinumSludgeOverHaul.java @@ -0,0 +1,171 @@ +/* + * Copyright (c) 2019 bartimaeusnek + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +package com.github.bartimaeusnek.bartworks.system.material.processingLoaders; + +import com.github.bartimaeusnek.bartworks.system.material.Werkstoff; + +import com.github.bartimaeusnek.bartworks.util.BW_Util; +import cpw.mods.fml.common.registry.GameRegistry; +import gregtech.api.enums.GT_Values; +import gregtech.api.enums.Materials; +import gregtech.api.enums.OrePrefixes; +import gregtech.api.interfaces.ISubTagContainer; +import gregtech.api.objects.MaterialStack; +import gregtech.api.util.GT_OreDictUnificator; +import gregtech.api.util.GT_Recipe; +import gregtech.api.util.GT_Utility; +import net.minecraft.item.ItemStack; +import net.minecraft.item.crafting.FurnaceRecipes; +import net.minecraftforge.fluids.FluidStack; + +import java.util.Map; + +import static com.github.bartimaeusnek.bartworks.system.material.WerkstoffLoader.*; +import static gregtech.api.enums.OrePrefixes.*; + +public class PlatinumSludgeOverHaul { + private PlatinumSludgeOverHaul(){} + + public static void runHelperrecipes(){ + //FormicAcid + GT_Values.RA.addChemicalRecipe(Sodiumformate.get(cell,2), GT_Utility.getIntegratedCircuit(21), Materials.SulfuricAcid.getFluid(1000),null,FormicAcid.get(cell,2),Sodiumsulfate.get(dust),15); + GT_Values.RA.addChemicalRecipe(Materials.SulfuricAcid.getCells(2), GT_Utility.getIntegratedCircuit(21), Sodiumformate.getFluidOrGas(1000),FormicAcid.getFluidOrGas(2000),Materials.Empty.getCells(2),Sodiumsulfate.get(dust),15); + //AquaRegia + GT_Values.RA.addMixerRecipe(Materials.DilutedSulfuricAcid.getCells(1),Materials.NitricAcid.getCells(1),GT_Utility.getIntegratedCircuit(1),null,null,null, AquaRegia.get(cell,2),30,30); + //AmmoniumCloride + GT_Values.RA.addChemicalRecipe(Materials.Ammonia.getCells(1), GT_Utility.getIntegratedCircuit(11), Materials.HydrochloricAcid.getFluid(1000),null,AmmoniumCloride.get(cell,1),null,15); + GT_Values.RA.addChemicalRecipe(Materials.HydrochloricAcid.getCells(1), GT_Utility.getIntegratedCircuit(11), Materials.Ammonia.getGas(1000),AmmoniumCloride.getFluidOrGas(1000),Materials.Empty.getCells(1),null,15); + + for (Werkstoff w :Werkstoff.werkstoffHashMap.values()) + if (w.containsStuff(Materials.Sulfur)&&(w.containsStuff(Materials.Copper)||w.containsStuff(Materials.Nickel))) { + GT_Values.RA.addChemicalRecipe(w.get(crushedPurified), GT_Utility.getIntegratedCircuit(11), AquaRegia.getFluidOrGas(150), PTConcentrate.getFluidOrGas(150), null, 250); + GT_Values.RA.addChemicalRecipe(w.get(crushedPurified), PTMetallicPowder.get(dust), AquaRegia.getFluidOrGas(1150), PTConcentrate.getFluidOrGas(1150), PTResidue.get(dust), 250); + } + for (Materials m : Materials.values()) + if (materialsContains(m,Materials.Sulfur)&&(materialsContains(m,Materials.Copper)||materialsContains(m,Materials.Nickel))){ + GT_Values.RA.addChemicalRecipe(GT_OreDictUnificator.get(crushedPurified,m,1), GT_Utility.getIntegratedCircuit(11), AquaRegia.getFluidOrGas(150), PTConcentrate.getFluidOrGas(150), null, 250); + GT_Values.RA.addChemicalRecipe(GT_OreDictUnificator.get(crushedPurified,m,1), PTMetallicPowder.get(dust), AquaRegia.getFluidOrGas(1150), PTConcentrate.getFluidOrGas(1150), PTResidue.get(dust), 250); + } + GT_Values.RA.addChemicalRecipe(PTMetallicPowder.get(dust), GT_Utility.getIntegratedCircuit(11), AquaRegia.getFluidOrGas(1000), PTConcentrate.getFluidOrGas(1000), PTResidue.get(dust), 250); + GT_Values.RA.addMultiblockChemicalRecipe(new ItemStack[]{},new FluidStack[]{PTConcentrate.getFluidOrGas(1000),AmmoniumCloride.getFluidOrGas(1000)},new FluidStack[]{PDAmmonia.getFluidOrGas(1000)},new ItemStack[]{PTSaltCrude.get(dustTiny,8),PTRawPowder.get(dustTiny)},600,30); + GT_Values.RA.addSifterRecipe(PTSaltCrude.get(dust),new ItemStack[]{ + PTSaltRefined.get(dustTiny), + PTSaltRefined.get(dustTiny), + PTSaltRefined.get(dustTiny), + PTSaltRefined.get(dustTiny), + PTSaltRefined.get(dustTiny), + PTSaltRefined.get(dustTiny), + PTSaltRefined.get(dustTiny), + PTSaltRefined.get(dustTiny), + PTSaltRefined.get(dustTiny), + },new int[]{ + 1000,1000,1000,1000,1000,1000,1000,1000,500, + },600,30); + GT_Values.RA.addBlastRecipe(PTSaltRefined.get(dust),null,null,null,PTMetallicPowder.get(dust),null,200,120,900); + GT_Values.RA.addChemicalRecipe(PTRawPowder.get(dust,2),Materials.Calcium.getDust(1),null,null,Materials.Platinum.getDust(2),CalciumChloride.get(dust),30); + GT_Values.RA.addChemicalRecipe(PDMetallicPowder.get(dust), GT_Utility.getIntegratedCircuit(11), PDAmmonia.getFluidOrGas(1000), null,PDSalt.get(dustTiny,16),PDRawPowder.get(dustTiny,2), 250); + GT_Values.RA.addChemicalRecipe(GT_Utility.getIntegratedCircuit(10),null,PDAmmonia.getFluidOrGas(1000), null, PDSalt.get(dustTiny,9), 250); + GT_Values.RA.addSifterRecipe(PDSalt.get(dust),new ItemStack[]{ + PDMetallicPowder.get(dustTiny), + PDMetallicPowder.get(dustTiny), + PDMetallicPowder.get(dustTiny), + PDMetallicPowder.get(dustTiny), + PDMetallicPowder.get(dustTiny), + PDMetallicPowder.get(dustTiny), + PDMetallicPowder.get(dustTiny), + PDMetallicPowder.get(dustTiny), + PDMetallicPowder.get(dustTiny), + },new int[]{ + 1000,1000,1000,1000,1000,1000,1000,1000,500, + },600,30); + GT_Values.RA.addChemicalRecipe(PDRawPowder.get(dust,2), GT_Utility.getIntegratedCircuit(11), FormicAcid.getFluidOrGas(4000), Materials.Ammonium.getGas(2000),Materials.Palladium.getDust(2),Materials.Ethylene.getDust(1), 250); + + + } + + + private static boolean materialsContains(Materials one, ISubTagContainer other){ + if (one == null || one.mMaterialList == null || one.mMaterialList.isEmpty()) + return false; + for (MaterialStack stack : one.mMaterialList) + if (stack.mMaterial.equals(other)) + return true; + return false; + } + + + public static void replacePureElements(){ + for (Object entry : FurnaceRecipes.smelting().getSmeltingList().entrySet()){ + Map.Entry realEntry = (Map.Entry) entry; + if (GT_Utility.isStackValid(realEntry.getKey()) && BW_Util.checkStackAndPrefix((ItemStack) realEntry.getKey())) + if (!GT_OreDictUnificator.getAssociation((ItemStack) realEntry.getKey()).mPrefix.equals(dust) && !GT_OreDictUnificator.getAssociation((ItemStack) realEntry.getKey()).mPrefix.equals(dustTiny)) + if (GT_Utility.isStackValid(realEntry.getValue()) && BW_Util.checkStackAndPrefix((ItemStack) realEntry.getValue())) + if (GT_OreDictUnificator.getAssociation((ItemStack) realEntry.getValue()).mMaterial.mMaterial.equals(Materials.Platinum)) + realEntry.setValue(PTMetallicPowder.get(dust)); + else if (GT_OreDictUnificator.getAssociation((ItemStack) realEntry.getValue()).mMaterial.mMaterial.equals(Materials.Palladium)) + realEntry.setValue(PDMetallicPowder.get(dust)); + } + + maploop: for (GT_Recipe.GT_Recipe_Map map : GT_Recipe.GT_Recipe_Map.sMappings) { + for (GT_Recipe recipe : map.mRecipeList) { + if (recipe.mFakeRecipe) + continue maploop; + for (int i = 0; i < recipe.mOutputs.length; i++) { + if (!BW_Util.checkStackAndPrefix(recipe.mOutputs[i])) + continue; + if (GT_OreDictUnificator.getAssociation(recipe.mOutputs[i]).mMaterial.mMaterial.equals(Materials.Platinum)) { + if (GT_OreDictUnificator.getAssociation(recipe.mOutputs[i]).mPrefix.equals(crushed) || GT_OreDictUnificator.getAssociation(recipe.mOutputs[i]).mPrefix.equals(crushedCentrifuged) || GT_OreDictUnificator.getAssociation(recipe.mOutputs[i]).mPrefix.equals(crushedPurified)) { + int amount = recipe.mOutputs[i].stackSize; + recipe.mOutputs[i] = PTMetallicPowder.get(dustTiny).splitStack(amount * 11); + } else if (GT_OreDictUnificator.getAssociation(recipe.mOutputs[i]).mPrefix.equals(dust) || GT_OreDictUnificator.getAssociation(recipe.mOutputs[i]).mPrefix.equals(dustImpure) || GT_OreDictUnificator.getAssociation(recipe.mOutputs[i]).mPrefix.equals(dustPure)) { + int amount = recipe.mOutputs[i].stackSize; + recipe.mOutputs[i] = PTMetallicPowder.get(dust).splitStack(amount); + } else if (GT_OreDictUnificator.getAssociation(recipe.mOutputs[i]).mPrefix.equals(dustSmall)) { + int amount = recipe.mOutputs[i].stackSize; + recipe.mOutputs[i] = PTMetallicPowder.get(dustSmall).splitStack(amount); + } else if (GT_OreDictUnificator.getAssociation(recipe.mOutputs[i]).mPrefix.equals(dustTiny)) { + int amount = recipe.mOutputs[i].stackSize; + recipe.mOutputs[i] = PTMetallicPowder.get(dustTiny).splitStack(amount); + } + } else if (GT_OreDictUnificator.getAssociation(recipe.mOutputs[i]).mMaterial.mMaterial.equals(Materials.Palladium)) { + if (GT_OreDictUnificator.getAssociation(recipe.mOutputs[i]).mPrefix.equals(crushed) || GT_OreDictUnificator.getAssociation(recipe.mOutputs[i]).mPrefix.equals(crushedCentrifuged) || GT_OreDictUnificator.getAssociation(recipe.mOutputs[i]).mPrefix.equals(crushedPurified)) { + int amount = recipe.mOutputs[i].stackSize; + recipe.mOutputs[i] = PDMetallicPowder.get(dustTiny).splitStack(amount * 11); + } else if (GT_OreDictUnificator.getAssociation(recipe.mOutputs[i]).mPrefix.equals(dust) || GT_OreDictUnificator.getAssociation(recipe.mOutputs[i]).mPrefix.equals(dustImpure) || GT_OreDictUnificator.getAssociation(recipe.mOutputs[i]).mPrefix.equals(dustPure)) { + int amount = recipe.mOutputs[i].stackSize; + recipe.mOutputs[i] = PDMetallicPowder.get(dust).splitStack(amount); + } else if (GT_OreDictUnificator.getAssociation(recipe.mOutputs[i]).mPrefix.equals(dustSmall)) { + int amount = recipe.mOutputs[i].stackSize; + recipe.mOutputs[i] = PDMetallicPowder.get(dustSmall).splitStack(amount); + } else if (GT_OreDictUnificator.getAssociation(recipe.mOutputs[i]).mPrefix.equals(dustTiny)) { + int amount = recipe.mOutputs[i].stackSize; + recipe.mOutputs[i] = PDMetallicPowder.get(dustTiny).splitStack(amount); + } + } + } + } + } + PlatinumSludgeOverHaul.runHelperrecipes(); + } + +}
\ No newline at end of file diff --git a/src/main/java/com/github/bartimaeusnek/crossmod/BartWorksCrossmod.java b/src/main/java/com/github/bartimaeusnek/crossmod/BartWorksCrossmod.java index 49f2b22365..eaaac8cbd6 100644 --- a/src/main/java/com/github/bartimaeusnek/crossmod/BartWorksCrossmod.java +++ b/src/main/java/com/github/bartimaeusnek/crossmod/BartWorksCrossmod.java @@ -25,20 +25,19 @@ package com.github.bartimaeusnek.crossmod; import com.github.bartimaeusnek.bartworks.common.commands.ChangeConfig; import com.github.bartimaeusnek.bartworks.common.commands.SummonRuin; import com.github.bartimaeusnek.crossmod.GTpp.loader.RadioHatchCompat; +import com.github.bartimaeusnek.crossmod.emt.recipe.TCRecipeHandler; import com.github.bartimaeusnek.crossmod.galacticraft.GalacticraftProxy; import com.github.bartimaeusnek.crossmod.thaumcraft.CustomAspects; import cpw.mods.fml.common.Loader; import cpw.mods.fml.common.Mod; -import cpw.mods.fml.common.event.FMLInitializationEvent; -import cpw.mods.fml.common.event.FMLPostInitializationEvent; -import cpw.mods.fml.common.event.FMLPreInitializationEvent; -import cpw.mods.fml.common.event.FMLServerStartingEvent; +import cpw.mods.fml.common.event.*; import net.minecraft.util.StringTranslate; import org.apache.commons.io.input.ReaderInputStream; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import java.io.StringReader; +import java.lang.reflect.InvocationTargetException; @Mod( modid = BartWorksCrossmod.MOD_ID, name = BartWorksCrossmod.NAME, version = BartWorksCrossmod.VERSION, @@ -98,7 +97,6 @@ public class BartWorksCrossmod { // } catch (IllegalAccessException | InvocationTargetException e) { // e.printStackTrace(); // } -// // } // } diff --git a/src/main/java/com/github/bartimaeusnek/crossmod/emt/recipe/TCRecipeHandler.java b/src/main/java/com/github/bartimaeusnek/crossmod/emt/recipe/TCRecipeHandler.java index e6e500987c..3b9a70b89d 100644 --- a/src/main/java/com/github/bartimaeusnek/crossmod/emt/recipe/TCRecipeHandler.java +++ b/src/main/java/com/github/bartimaeusnek/crossmod/emt/recipe/TCRecipeHandler.java @@ -48,7 +48,7 @@ import java.util.HashSet; import static com.github.bartimaeusnek.crossmod.thaumcraft.util.ThaumcraftHandler.AspectAdder; public class TCRecipeHandler { - public static final GT_Recipe.GT_Recipe_Map alchemicalConstructHandler = new TCRecipeHandler.TCRecipeMap(new HashSet<>(), + public static final GT_Recipe.GT_Recipe_Map alchemicalConstructHandler = new TCRecipeHandler.TCRecipeMap(new HashSet<>(15000), "bwcm.recipe.alchemicalConstruct", "Industrical Alchemical Construct", null, diff --git a/src/main/java/com/github/bartimaeusnek/crossmod/emt/tileentities/multi/GT_Industrial_Alchemic_Furnace.java b/src/main/java/com/github/bartimaeusnek/crossmod/emt/tileentities/multi/GT_Industrial_Alchemic_Construct.java index b8192f742e..c67674ae25 100644 --- a/src/main/java/com/github/bartimaeusnek/crossmod/emt/tileentities/multi/GT_Industrial_Alchemic_Furnace.java +++ b/src/main/java/com/github/bartimaeusnek/crossmod/emt/tileentities/multi/GT_Industrial_Alchemic_Construct.java @@ -35,14 +35,14 @@ import gregtech.api.util.GT_Utility; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; +import net.minecraftforge.fluids.FluidStack; import java.lang.reflect.InvocationTargetException; -import java.util.ArrayList; -import java.util.List; +import java.util.*; import static gregtech.api.enums.GT_Values.V; -public class GT_Industrial_Alchemic_Furnace extends GT_MetaTileEntity_MultiBlockBase { +public class GT_Industrial_Alchemic_Construct extends GT_MetaTileEntity_MultiBlockBase { List<Object> mEssentiaHatches = new ArrayList<>(); @@ -68,11 +68,11 @@ public class GT_Industrial_Alchemic_Furnace extends GT_MetaTileEntity_MultiBlock } } - public GT_Industrial_Alchemic_Furnace(int aID, String aName, String aNameRegional) { + public GT_Industrial_Alchemic_Construct(int aID, String aName, String aNameRegional) { super(aID, aName, aNameRegional); } - public GT_Industrial_Alchemic_Furnace(String aName) { + public GT_Industrial_Alchemic_Construct(String aName) { super(aName); } @@ -84,9 +84,10 @@ public class GT_Industrial_Alchemic_Furnace extends GT_MetaTileEntity_MultiBlock @Override public boolean checkRecipe(ItemStack itemStack) { ItemStack stack = new ItemStack(Items.feather); + String owner = this.getBaseMetaTileEntity().getOwnerName(); + Object allAspects = null; try { - String owner = this.getBaseMetaTileEntity().getOwnerName(); - Object allAspects = ThaumcraftHandler.AspectAdder.mAspectListClass.newInstance(); + allAspects = ThaumcraftHandler.AspectAdder.mAspectListClass.newInstance(); for (Object o : this.mEssentiaHatches) { Object aspectList = EMTHandler.aAspectField.get(o); ThaumcraftHandler.AspectAdder.add.invoke(allAspects,aspectList); @@ -98,13 +99,49 @@ public class GT_Industrial_Alchemic_Furnace extends GT_MetaTileEntity_MultiBlock return false; } ItemStack[] tInputs = this.getStoredInputs().toArray(new ItemStack[0]); - ArrayList<ItemStack> outputItems = new ArrayList<ItemStack>(); + ItemStack outputItems = null; long tVoltage = this.getMaxInputVoltage(); byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage)); - GT_Recipe tRecipe = TCRecipeHandler.alchemicalConstructHandler.findRecipe(this.getBaseMetaTileEntity(),null,false, false, V[tTier], null, stack,tInputs); - - return false; + GT_Recipe tRecipe = TCRecipeHandler.alchemicalConstructHandler.findRecipe(this.getBaseMetaTileEntity(),null,false, false, V[tTier], null, stack, tInputs); + ItemStack helper = (ItemStack) tRecipe.mSpecialItems; + NBTTagCompound tagCompound = helper.getTagCompound(); + String research = tagCompound.getCompoundTag("display").getString("Name"); + Object aspectList = null; + try { + aspectList = ThaumcraftHandler.AspectAdder.mAspectListClass.newInstance(); + ThaumcraftHandler.AspectAdder.readAspectListFromNBT.invoke(aspectList,tagCompound); + } catch (IllegalAccessException | InvocationTargetException | InstantiationException e) { + e.printStackTrace(); + return false; + } + boolean complete = false; + try { + complete = (boolean) ThaumcraftHandler.AspectAdder.isResearchComplete.invoke(null,owner,research); + } catch (IllegalAccessException | InvocationTargetException e) { + e.printStackTrace(); + } + if (!complete) + return false; + if (!tRecipe.isRecipeInputEqual(true,new FluidStack[0],tInputs)) + return false; + LinkedHashMap<Object,Integer> list = null; + LinkedHashMap<Object,Integer> needed = null; + try { + list = (LinkedHashMap) ThaumcraftHandler.AspectAdder.linkedAspektList.get(allAspects); + needed = (LinkedHashMap) ThaumcraftHandler.AspectAdder.linkedAspektList.get(aspectList); + } catch (IllegalAccessException e) { + e.printStackTrace(); + return false; + } + assert list != null; + assert needed != null; + for (Map.Entry<Object,Integer> toTake : needed.entrySet()){ + list.replace(toTake.getKey(),list.get(toTake.getKey())-toTake.getValue()); + } + this.addOutput(tRecipe.mOutputs[0]); + this.updateSlots(); + return true; } @Override @@ -134,7 +171,7 @@ public class GT_Industrial_Alchemic_Furnace extends GT_MetaTileEntity_MultiBlock @Override public IMetaTileEntity newMetaEntity(IGregTechTileEntity iGregTechTileEntity) { - return new GT_Industrial_Alchemic_Furnace(mName); + return new GT_Industrial_Alchemic_Construct(mName); } @Override diff --git a/src/main/java/com/github/bartimaeusnek/crossmod/thaumcraft/util/ThaumcraftHandler.java b/src/main/java/com/github/bartimaeusnek/crossmod/thaumcraft/util/ThaumcraftHandler.java index b753f61a4c..353f656e4e 100644 --- a/src/main/java/com/github/bartimaeusnek/crossmod/thaumcraft/util/ThaumcraftHandler.java +++ b/src/main/java/com/github/bartimaeusnek/crossmod/thaumcraft/util/ThaumcraftHandler.java @@ -32,6 +32,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.world.biome.BiomeGenBase; +import java.lang.reflect.Field; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; @@ -95,6 +96,8 @@ public class ThaumcraftHandler { public static Method add; public static Method getAmount; public static Method getAspects; + public static Method isResearchComplete; + public static Field linkedAspektList; static { try { @@ -108,7 +111,9 @@ public class ThaumcraftHandler { ThaumcraftHandler.AspectAdder.getAmount = ThaumcraftHandler.AspectAdder.mAspectListClass.getMethod("getAmount", ThaumcraftHandler.AspectAdder.mAspectClass); ThaumcraftHandler.AspectAdder.getAspects = ThaumcraftHandler.AspectAdder.mAspectListClass.getMethod("getAspects"); ThaumcraftHandler.AspectAdder.readAspectListFromNBT = ThaumcraftHandler.AspectAdder.mAspectListClass.getMethod("readFromNBT", NBTTagCompound.class); - } catch (ClassNotFoundException | NoSuchMethodException e) { + ThaumcraftHandler.AspectAdder.isResearchComplete = Class.forName("thaumcraft.common.lib.research.ResearchManager").getMethod("isResearchComplete",String.class,String.class); + ThaumcraftHandler.AspectAdder.linkedAspektList = ThaumcraftHandler.AspectAdder.mAspectListClass.getField("aspects"); + } catch (ClassNotFoundException | NoSuchMethodException | NoSuchFieldException e) { e.printStackTrace(); } } |