diff options
Diffstat (limited to 'src/main/java/bartworks/system/material')
49 files changed, 12529 insertions, 0 deletions
diff --git a/src/main/java/bartworks/system/material/BWGTMaterialReference.java b/src/main/java/bartworks/system/material/BWGTMaterialReference.java new file mode 100644 index 0000000000..50665464f4 --- /dev/null +++ b/src/main/java/bartworks/system/material/BWGTMaterialReference.java @@ -0,0 +1,523 @@ +/* + * Copyright (c) 2018-2020 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 bartworks.system.material; + +import bartworks.MainMod; +import gregtech.api.enums.Materials; + +public class BWGTMaterialReference { + + private static final Werkstoff.GenerationFeatures ADD_CASINGS_ONLY = new Werkstoff.GenerationFeatures().disable() + .addCasings(); + + public static Werkstoff Aluminium = new Werkstoff( + Materials.Aluminium, + ADD_CASINGS_ONLY, + Werkstoff.Types.ELEMENT, + 31_766 + 19); + public static Werkstoff Americium = new Werkstoff( + Materials.Americium, + ADD_CASINGS_ONLY, + Werkstoff.Types.ELEMENT, + 31_766 + 103); + public static Werkstoff Antimony = new Werkstoff( + Materials.Antimony, + ADD_CASINGS_ONLY, + Werkstoff.Types.ELEMENT, + 31_766 + 58); + public static Werkstoff Arsenic = new Werkstoff( + Materials.Arsenic, + ADD_CASINGS_ONLY, + Werkstoff.Types.ELEMENT, + 31_766 + 39); + public static Werkstoff Barium = new Werkstoff( + Materials.Barium, + ADD_CASINGS_ONLY, + Werkstoff.Types.ELEMENT, + 31_766 + 63); + public static Werkstoff Beryllium = new Werkstoff( + Materials.Beryllium, + ADD_CASINGS_ONLY, + Werkstoff.Types.ELEMENT, + 31_766 + 8); + public static Werkstoff Bismuth = new Werkstoff( + Materials.Bismuth, + ADD_CASINGS_ONLY, + Werkstoff.Types.ELEMENT, + 31_766 + 90); + public static Werkstoff Boron = new Werkstoff( + Materials.Boron, + ADD_CASINGS_ONLY, + Werkstoff.Types.ELEMENT, + 31_766 + 9); + public static Werkstoff Caesium = new Werkstoff( + Materials.Caesium, + ADD_CASINGS_ONLY, + Werkstoff.Types.ELEMENT, + 31_766 + 62); + public static Werkstoff Carbon = new Werkstoff( + Materials.Carbon, + ADD_CASINGS_ONLY, + Werkstoff.Types.ELEMENT, + 31_766 + 10); + public static Werkstoff Cadmium = new Werkstoff( + Materials.Cadmium, + ADD_CASINGS_ONLY, + Werkstoff.Types.ELEMENT, + 31_766 + 55); + public static Werkstoff Cerium = new Werkstoff( + Materials.Cerium, + ADD_CASINGS_ONLY, + Werkstoff.Types.ELEMENT, + 31_766 + 65); + public static Werkstoff Chrome = new Werkstoff( + Materials.Chrome, + ADD_CASINGS_ONLY, + Werkstoff.Types.ELEMENT, + 31_766 + 30); + public static Werkstoff Cobalt = new Werkstoff( + Materials.Cobalt, + ADD_CASINGS_ONLY, + Werkstoff.Types.ELEMENT, + 31_766 + 33); + public static Werkstoff Copper = new Werkstoff( + Materials.Copper, + ADD_CASINGS_ONLY, + Werkstoff.Types.ELEMENT, + 31_766 + 35); + public static Werkstoff Dysprosium = new Werkstoff( + Materials.Dysprosium, + ADD_CASINGS_ONLY, + Werkstoff.Types.ELEMENT, + 31_766 + 73); + public static Werkstoff Erbium = new Werkstoff( + Materials.Erbium, + ADD_CASINGS_ONLY, + Werkstoff.Types.ELEMENT, + 31_766 + 75); + public static Werkstoff Europium = new Werkstoff( + Materials.Europium, + ADD_CASINGS_ONLY, + Werkstoff.Types.ELEMENT, + 31_766 + 70); + public static Werkstoff Gadolinium = new Werkstoff( + Materials.Gadolinium, + ADD_CASINGS_ONLY, + Werkstoff.Types.ELEMENT, + 31_766 + 71); + public static Werkstoff Gallium = new Werkstoff( + Materials.Gallium, + ADD_CASINGS_ONLY, + Werkstoff.Types.ELEMENT, + 31_766 + 37); + public static Werkstoff Gold = new Werkstoff( + Materials.Gold, + ADD_CASINGS_ONLY, + Werkstoff.Types.ELEMENT, + 31_766 + 86); + public static Werkstoff Holmium = new Werkstoff( + Materials.Holmium, + ADD_CASINGS_ONLY, + Werkstoff.Types.ELEMENT, + 31_766 + 74); + public static Werkstoff Indium = new Werkstoff( + Materials.Indium, + ADD_CASINGS_ONLY, + Werkstoff.Types.ELEMENT, + 31_766 + 56); + public static Werkstoff Iridium = new Werkstoff( + Materials.Iridium, + ADD_CASINGS_ONLY, + Werkstoff.Types.ELEMENT, + 31_766 + 84); + public static Werkstoff Iron = new Werkstoff( + Materials.Iron, + ADD_CASINGS_ONLY, + Werkstoff.Types.ELEMENT, + 31_766 + 32); + public static Werkstoff Lanthanum = new Werkstoff( + Materials.Lanthanum, + ADD_CASINGS_ONLY, + Werkstoff.Types.ELEMENT, + 31_766 + 64); + public static Werkstoff Lead = new Werkstoff( + Materials.Lead, + ADD_CASINGS_ONLY, + Werkstoff.Types.ELEMENT, + 31_766 + 89); + public static Werkstoff Lithium = new Werkstoff( + Materials.Lithium, + ADD_CASINGS_ONLY, + Werkstoff.Types.ELEMENT, + 31_766 + 6); + public static Werkstoff Lutetium = new Werkstoff( + Materials.Lutetium, + ADD_CASINGS_ONLY, + Werkstoff.Types.ELEMENT, + 31_766 + 78); + public static Werkstoff Magnesium = new Werkstoff( + Materials.Magnesium, + ADD_CASINGS_ONLY, + Werkstoff.Types.ELEMENT, + 31_766 + 18); + public static Werkstoff Manganese = new Werkstoff( + Materials.Manganese, + ADD_CASINGS_ONLY, + Werkstoff.Types.ELEMENT, + 31_766 + 31); + public static Werkstoff Molybdenum = new Werkstoff( + Materials.Molybdenum, + ADD_CASINGS_ONLY, + Werkstoff.Types.ELEMENT, + 31_766 + 48); + public static Werkstoff Neodymium = new Werkstoff( + Materials.Neodymium, + ADD_CASINGS_ONLY, + Werkstoff.Types.ELEMENT, + 31_766 + 67); + public static Werkstoff Neutronium = new Werkstoff( + Materials.Neutronium, + ADD_CASINGS_ONLY, + Werkstoff.Types.ELEMENT, + 31_766 + 129); + public static Werkstoff Nickel = new Werkstoff( + Materials.Nickel, + ADD_CASINGS_ONLY, + Werkstoff.Types.ELEMENT, + 31_766 + 34); + public static Werkstoff Niobium = new Werkstoff( + Materials.Niobium, + ADD_CASINGS_ONLY, + Werkstoff.Types.ELEMENT, + 31_766 + 47); + public static Werkstoff Osmium = new Werkstoff( + Materials.Osmium, + ADD_CASINGS_ONLY, + Werkstoff.Types.ELEMENT, + 31_766 + 83); + public static Werkstoff Palladium = new Werkstoff( + Materials.Palladium, + ADD_CASINGS_ONLY, + Werkstoff.Types.ELEMENT, + 31_766 + 52); + public static Werkstoff Phosphorus = new Werkstoff( + Materials.Phosphorus, + ADD_CASINGS_ONLY, + Werkstoff.Types.ELEMENT, + 31_766 + 21); + public static Werkstoff Platinum = new Werkstoff( + Materials.Platinum, + ADD_CASINGS_ONLY, + Werkstoff.Types.ELEMENT, + 31_766 + 85); + public static Werkstoff Plutonium241 = new Werkstoff( + Materials.Plutonium241, + ADD_CASINGS_ONLY, + Werkstoff.Types.ISOTOPE, + 31_766 + 101); + public static Werkstoff Potassium = new Werkstoff( + Materials.Potassium, + ADD_CASINGS_ONLY, + Werkstoff.Types.ELEMENT, + 31_766 + 25); + public static Werkstoff Praseodymium = new Werkstoff( + Materials.Praseodymium, + ADD_CASINGS_ONLY, + Werkstoff.Types.ELEMENT, + 31_766 + 66); + public static Werkstoff Promethium = new Werkstoff( + Materials.Promethium, + ADD_CASINGS_ONLY, + Werkstoff.Types.ELEMENT, + 31_766 + 68); + public static Werkstoff Rubidium = new Werkstoff( + Materials.Rubidium, + ADD_CASINGS_ONLY, + Werkstoff.Types.ELEMENT, + 31_766 + 43); + public static Werkstoff Samarium = new Werkstoff( + Materials.Samarium, + ADD_CASINGS_ONLY, + Werkstoff.Types.ELEMENT, + 31_766 + 69); + public static Werkstoff Scandium = new Werkstoff( + Materials.Scandium, + ADD_CASINGS_ONLY, + Werkstoff.Types.ELEMENT, + 31_766 + 27); + public static Werkstoff Silicon = new Werkstoff( + Materials.Silicon, + ADD_CASINGS_ONLY, + Werkstoff.Types.ELEMENT, + 31_766 + 20); + public static Werkstoff Silver = new Werkstoff( + Materials.Silver, + ADD_CASINGS_ONLY, + Werkstoff.Types.ELEMENT, + 31_766 + 54); + public static Werkstoff Sodium = new Werkstoff( + Materials.Sodium, + ADD_CASINGS_ONLY, + Werkstoff.Types.ELEMENT, + 31_766 + 17); + public static Werkstoff Strontium = new Werkstoff( + Materials.Strontium, + ADD_CASINGS_ONLY, + Werkstoff.Types.ELEMENT, + 31_766 + 44); + public static Werkstoff Sulfur = new Werkstoff( + Materials.Sulfur, + ADD_CASINGS_ONLY, + Werkstoff.Types.ELEMENT, + 31_766 + 22); + public static Werkstoff Tantalum = new Werkstoff( + Materials.Tantalum, + ADD_CASINGS_ONLY, + Werkstoff.Types.ELEMENT, + 31_766 + 80); + public static Werkstoff Terbium = new Werkstoff( + Materials.Terbium, + ADD_CASINGS_ONLY, + Werkstoff.Types.ELEMENT, + 31_766 + 72); + public static Werkstoff Thorium = new Werkstoff( + Materials.Thorium, + ADD_CASINGS_ONLY, + Werkstoff.Types.ELEMENT, + 31_766 + 96); + public static Werkstoff Thulium = new Werkstoff( + Materials.Thulium, + ADD_CASINGS_ONLY, + Werkstoff.Types.ELEMENT, + 31_766 + 76); + public static Werkstoff Tin = new Werkstoff(Materials.Tin, ADD_CASINGS_ONLY, Werkstoff.Types.ELEMENT, 31_766 + 57); + public static Werkstoff Titanium = new Werkstoff( + Materials.Titanium, + ADD_CASINGS_ONLY, + Werkstoff.Types.ELEMENT, + 31_766 + 28); + public static Werkstoff Tritanium = new Werkstoff( + Materials.Tritanium, + ADD_CASINGS_ONLY, + Werkstoff.Types.ELEMENT, + 31_766 + 329); + public static Werkstoff Tritium = new Werkstoff( + Materials.Tritium, + ADD_CASINGS_ONLY, + Werkstoff.Types.ELEMENT, + 31_766 + 3); + public static Werkstoff Tungsten = new Werkstoff( + Materials.Tungsten, + ADD_CASINGS_ONLY, + Werkstoff.Types.ELEMENT, + 31_766 + 81); + public static Werkstoff Uranium = new Werkstoff( + Materials.Uranium, + ADD_CASINGS_ONLY, + Werkstoff.Types.ELEMENT, + 31_766 + 98); + public static Werkstoff Uranium235 = new Werkstoff( + Materials.Uranium235, + ADD_CASINGS_ONLY, + Werkstoff.Types.ISOTOPE, + 31_766 + 97); + public static Werkstoff Vanadium = new Werkstoff( + Materials.Vanadium, + ADD_CASINGS_ONLY, + Werkstoff.Types.ELEMENT, + 31_766 + 29); + public static Werkstoff Ytterbium = new Werkstoff( + Materials.Ytterbium, + ADD_CASINGS_ONLY, + Werkstoff.Types.ELEMENT, + 31_766 + 77); + public static Werkstoff Yttrium = new Werkstoff( + Materials.Yttrium, + ADD_CASINGS_ONLY, + Werkstoff.Types.ELEMENT, + 31_766 + 45); + public static Werkstoff Zinc = new Werkstoff( + Materials.Zinc, + ADD_CASINGS_ONLY, + Werkstoff.Types.ELEMENT, + 31_766 + 36); + public static Werkstoff Ardite = new Werkstoff( + Materials.Ardite, + ADD_CASINGS_ONLY, + Werkstoff.Types.ELEMENT, + 31_766 + 382); + public static Werkstoff Naquadah = new Werkstoff( + Materials.Naquadah, + ADD_CASINGS_ONLY, + Werkstoff.Types.ELEMENT, + 31_766 + 324); + public static Werkstoff NaquadahAlloy = new Werkstoff( + Materials.NaquadahAlloy, + ADD_CASINGS_ONLY, + Werkstoff.Types.COMPOUND, + 31_766 + 325); + public static Werkstoff NaquadahEnriched = new Werkstoff( + Materials.NaquadahEnriched, + ADD_CASINGS_ONLY, + Werkstoff.Types.ISOTOPE, + 31_766 + 326); + public static Werkstoff Naquadria = new Werkstoff( + Materials.Naquadria, + ADD_CASINGS_ONLY, + Werkstoff.Types.ELEMENT, + 31_766 + 327); + public static Werkstoff WroughtIron = new Werkstoff( + Materials.WroughtIron, + ADD_CASINGS_ONLY, + Werkstoff.Types.ISOTOPE, + 31_766 + 304); + public static Werkstoff AnnealedCopper = new Werkstoff( + Materials.AnnealedCopper, + ADD_CASINGS_ONLY, + Werkstoff.Types.ISOTOPE, + 31_766 + 345); + + public static Werkstoff Osmiridium = new Werkstoff( + Materials.Osmiridium, + ADD_CASINGS_ONLY, + Werkstoff.Types.MIXTURE, + 31_766 + 317); + public static Werkstoff SterlingSilver = new Werkstoff( + Materials.SterlingSilver, + ADD_CASINGS_ONLY, + Werkstoff.Types.MIXTURE, + 31_766 + 350); + public static Werkstoff RoseGold = new Werkstoff( + Materials.RoseGold, + ADD_CASINGS_ONLY, + Werkstoff.Types.MIXTURE, + 31_766 + 351); + public static Werkstoff BlackBronze = new Werkstoff( + Materials.BlackBronze, + ADD_CASINGS_ONLY, + Werkstoff.Types.MIXTURE, + 31_766 + 352); + public static Werkstoff BismuthBronze = new Werkstoff( + Materials.BismuthBronze, + ADD_CASINGS_ONLY, + Werkstoff.Types.MIXTURE, + 31_766 + 353); + public static Werkstoff BlackSteel = new Werkstoff( + Materials.BlackSteel, + ADD_CASINGS_ONLY, + Werkstoff.Types.MIXTURE, + 31_766 + 334); + public static Werkstoff RedSteel = new Werkstoff( + Materials.RedSteel, + ADD_CASINGS_ONLY, + Werkstoff.Types.MIXTURE, + 31_766 + 348); + public static Werkstoff BlueSteel = new Werkstoff( + Materials.BlueSteel, + ADD_CASINGS_ONLY, + Werkstoff.Types.MIXTURE, + 31_766 + 349); + public static Werkstoff DamascusSteel = new Werkstoff( + Materials.DamascusSteel, + ADD_CASINGS_ONLY, + Werkstoff.Types.MIXTURE, + 31_766 + 335); + public static Werkstoff TungstenSteel = new Werkstoff( + Materials.TungstenSteel, + ADD_CASINGS_ONLY, + Werkstoff.Types.MIXTURE, + 31_766 + 316); + public static Werkstoff Ultimet = new Werkstoff( + Materials.Ultimet, + ADD_CASINGS_ONLY, + Werkstoff.Types.MIXTURE, + 31_766 + 344); + public static Werkstoff TungstenCarbide = new Werkstoff( + Materials.TungstenCarbide, + ADD_CASINGS_ONLY, + Werkstoff.Types.MIXTURE, + 31_766 + 370); + public static Werkstoff VanadiumSteel = new Werkstoff( + Materials.VanadiumSteel, + ADD_CASINGS_ONLY, + Werkstoff.Types.MIXTURE, + 31_766 + 371); + public static Werkstoff HSSG = new Werkstoff( + Materials.HSSG, + ADD_CASINGS_ONLY, + Werkstoff.Types.MIXTURE, + 31_766 + 372); + public static Werkstoff HSSE = new Werkstoff( + Materials.HSSE, + ADD_CASINGS_ONLY, + Werkstoff.Types.MIXTURE, + 31_766 + 373); + public static Werkstoff HSSS = new Werkstoff( + Materials.HSSS, + ADD_CASINGS_ONLY, + Werkstoff.Types.MIXTURE, + 31_766 + 374); + public static Werkstoff StainlessSteel = new Werkstoff( + Materials.StainlessSteel, + ADD_CASINGS_ONLY, + Werkstoff.Types.MIXTURE, + 31_766 + 306); + public static Werkstoff Brass = new Werkstoff( + Materials.Brass, + ADD_CASINGS_ONLY, + Werkstoff.Types.MIXTURE, + 31_766 + 301); + public static Werkstoff Bronze = new Werkstoff( + Materials.Bronze, + ADD_CASINGS_ONLY, + Werkstoff.Types.MIXTURE, + 31_766 + 300); + + public static Werkstoff Wood = new Werkstoff( + Materials.Wood, + ADD_CASINGS_ONLY, + Werkstoff.Types.BIOLOGICAL, + 31_766 + 809); + + public static Werkstoff Steel = new Werkstoff( + Materials.Steel, + ADD_CASINGS_ONLY, + Werkstoff.Types.COMPOUND, + 31_766 + 305); + public static Werkstoff Polytetrafluoroethylene = new Werkstoff( + Materials.Polytetrafluoroethylene, + ADD_CASINGS_ONLY, + Werkstoff.Types.COMPOUND, + 31_766 + 473); + public static Werkstoff Plastic = new Werkstoff( + Materials.Plastic, + ADD_CASINGS_ONLY, + Werkstoff.Types.COMPOUND, + 31_766 + 874); + public static Werkstoff Epoxid = new Werkstoff( + Materials.Epoxid, + ADD_CASINGS_ONLY, + Werkstoff.Types.COMPOUND, + 31_766 + 470); + public static Werkstoff Magnesia = new Werkstoff( + Materials.Magnesia, + new Werkstoff.GenerationFeatures().disable() + .addMetalItems() + .addMolten(), + Werkstoff.Types.COMPOUND, + 31_766 + 471); + + public static void init() { + MainMod.LOGGER.info("Load Elements from GT"); + } +} diff --git a/src/main/java/bartworks/system/material/BWItemMetaGeneratedBlock.java b/src/main/java/bartworks/system/material/BWItemMetaGeneratedBlock.java new file mode 100644 index 0000000000..671b21e92b --- /dev/null +++ b/src/main/java/bartworks/system/material/BWItemMetaGeneratedBlock.java @@ -0,0 +1,94 @@ +/* + * Copyright (c) 2018-2020 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 bartworks.system.material; + +import java.util.ArrayList; +import java.util.List; + +import net.minecraft.block.Block; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.world.World; + +import bartworks.common.items.BWItemBlocks; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import gregtech.api.util.GTLanguageManager; +import gregtech.api.util.GTUtility; + +public class BWItemMetaGeneratedBlock extends BWItemBlocks { + + public BWItemMetaGeneratedBlock(Block par1) { + super(par1); + } + + @Override + public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, + float hitX, float hitY, float hitZ) { + return false; + } + + @Override + public String getUnlocalizedName(ItemStack aStack) { + return this.field_150939_a.getUnlocalizedName() + "." + this.getDamage(aStack); + } + + @Override + public String getItemStackDisplayName(ItemStack aStack) { + Block block = Block.getBlockFromItem(aStack.getItem()); + if (block instanceof BWMetaGeneratedBlocks metaBlock) { + int aMetaData = aStack.getItemDamage(); + Werkstoff werkstoff = Werkstoff.werkstoffHashMap.get((short) aMetaData); + if (werkstoff == null) werkstoff = Werkstoff.default_null_Werkstoff; + return metaBlock.blockTypeLocalizedName.replace("%material", werkstoff.getLocalizedName()); + } + return GTLanguageManager.getTranslation(this.getUnlocalizedName(aStack) + ".name"); + } + + @Override + @SideOnly(Side.CLIENT) + public void addInformation(ItemStack aStack, EntityPlayer aPlayer, List<String> aList, boolean aF3_H) { + if (!GTUtility.isStackValid(aStack) || aPlayer == null || aStack.getItemDamage() <= 0) { + return; + } + if (aList == null) { + aList = new ArrayList<>(); + } + Werkstoff werkstoff = Werkstoff.werkstoffHashMap.get((short) aStack.getItemDamage()); + if (werkstoff != null) { + String tooltip = werkstoff.getLocalizedToolTip(); + if (!tooltip.isEmpty()) { + aList.add(tooltip); + } + } + } + + @Override + public boolean placeBlockAt(ItemStack aStack, EntityPlayer aPlayer, World aWorld, int aX, int aY, int aZ, int side, + float hitX, float hitY, float hitZ, int aMeta) { + short tDamage = (short) this.getDamage(aStack); + if (tDamage > 0) { + if (!aWorld.setBlock(aX, aY, aZ, this.field_150939_a, tDamage, 3)) { + return false; + } + TileEntityMetaGeneratedBlock tTileEntity = (TileEntityMetaGeneratedBlock) aWorld.getTileEntity(aX, aY, aZ); + tTileEntity.mMetaData = tDamage; + } else if (!aWorld.setBlock(aX, aY, aZ, this.field_150939_a, 0, 3)) return false; + if (aWorld.getBlock(aX, aY, aZ) == this.field_150939_a) { + this.field_150939_a.onBlockPlacedBy(aWorld, aX, aY, aZ, aPlayer, aStack); + this.field_150939_a.onPostBlockPlaced(aWorld, aX, aY, aZ, tDamage); + } + return true; + } +} diff --git a/src/main/java/bartworks/system/material/BWMetaGeneratedBlocks.java b/src/main/java/bartworks/system/material/BWMetaGeneratedBlocks.java new file mode 100644 index 0000000000..db838d059a --- /dev/null +++ b/src/main/java/bartworks/system/material/BWMetaGeneratedBlocks.java @@ -0,0 +1,130 @@ +/* + * Copyright (c) 2018-2020 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 bartworks.system.material; + +import static bartworks.system.material.BWMetaGeneratedItems.metaTab; + +import java.util.ArrayList; + +import net.minecraft.block.Block; +import net.minecraft.block.ITileEntityProvider; +import net.minecraft.block.material.Material; +import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.World; + +import bartworks.client.renderer.BWBlockOreRenderer; +import bartworks.common.blocks.BWTileEntityContainer; +import bartworks.util.BWUtil; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import gregtech.api.enums.OrePrefixes; +import gregtech.api.util.GTLanguageManager; + +public abstract class BWMetaGeneratedBlocks extends BWTileEntityContainer { + + public static ThreadLocal<TileEntityMetaGeneratedBlock> mTemporaryTileEntity = new ThreadLocal<>(); + protected OrePrefixes _prefixes; + protected String blockTypeLocalizedName; + + public BWMetaGeneratedBlocks(Material p_i45386_1_, Class<? extends TileEntity> tileEntity, String blockName) { + this(p_i45386_1_, tileEntity, blockName, null); + } + + public BWMetaGeneratedBlocks(Material p_i45386_1_, Class<? extends TileEntity> tileEntity, String blockName, + OrePrefixes types) { + super(p_i45386_1_, tileEntity, blockName); + this.setHardness(5.0F); + this.setResistance(5.0F); + this.setBlockTextureName("stone"); + this.setCreativeTab(metaTab); + this._prefixes = types; + if (this._prefixes != null) { + this.blockTypeLocalizedName = GTLanguageManager.addStringLocalization( + "bw.blocktype." + this._prefixes, + this._prefixes.mLocalizedMaterialPre + "%material" + this._prefixes.mLocalizedMaterialPost); + } + Werkstoff.werkstoffHashSet.forEach(this::doRegistrationStuff); + } + + @Override + public void onBlockAdded(World aWorld, int aX, int aY, int aZ) { + super.onBlockAdded(aWorld, aX, aY, aZ); + // Waste some time to allow the TE to be set, do not use thread sleep here, it doesnt allow for nanoseconds. + // This will just waste a few cpu cycles to allow the TE to be set + BWUtil.shortSleep(0); + } + + @SideOnly(Side.CLIENT) + public final TileEntityMetaGeneratedBlock getProperTileEntityForRendering() { + return (TileEntityMetaGeneratedBlock) this.createNewTileEntity(null, 0); + } + + protected abstract void doRegistrationStuff(Werkstoff w); + + @Override + public String getHarvestTool(int metadata) { + return "pickaxe"; + } + + @Override + protected boolean canSilkHarvest() { + return false; + } + + @Override + public int getRenderType() { + if (BWBlockOreRenderer.INSTANCE == null) return super.getRenderType(); + return BWBlockOreRenderer.INSTANCE.renderID; + } + + @Override + public int getDamageValue(World aWorld, int aX, int aY, int aZ) { + TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); + if (tTileEntity instanceof TileEntityMetaGeneratedBlock metaTE) { + return metaTE.mMetaData; + } + return 0; + } + + @Override + public TileEntity createTileEntity(World world, int metadata) { + return ((ITileEntityProvider) this).createNewTileEntity(world, metadata); + } + + @Override + public boolean hasTileEntity(int metadata) { + return true; + } + + @Override + public void breakBlock(World world, int x, int y, int z, Block block, int meta) { + TileEntity tTileEntity = world.getTileEntity(x, y, z); + if (tTileEntity instanceof TileEntityMetaGeneratedBlock metaTE) { + mTemporaryTileEntity.set(metaTE); + } + super.breakBlock(world, x, y, z, block, meta); + } + + @Override + public ArrayList<ItemStack> getDrops(World aWorld, int aX, int aY, int aZ, int aMeta, int aFortune) { + TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); + if (tTileEntity instanceof TileEntityMetaGeneratedBlock metaTE) { + return metaTE.getDrops(aFortune); + } + return mTemporaryTileEntity.get() == null ? new ArrayList<>() + : mTemporaryTileEntity.get() + .getDrops(aFortune); + } +} diff --git a/src/main/java/bartworks/system/material/BWMetaGeneratedBlocksCasing.java b/src/main/java/bartworks/system/material/BWMetaGeneratedBlocksCasing.java new file mode 100644 index 0000000000..f8ed670092 --- /dev/null +++ b/src/main/java/bartworks/system/material/BWMetaGeneratedBlocksCasing.java @@ -0,0 +1,121 @@ +/* + * Copyright (c) 2018-2020 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 bartworks.system.material; + +import java.util.List; +import java.util.Optional; + +import net.minecraft.block.Block; +import net.minecraft.block.material.Material; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.Entity; +import net.minecraft.init.Blocks; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.World; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import gregtech.api.GregTechAPI; +import gregtech.api.enums.OrePrefixes; + +public class BWMetaGeneratedBlocksCasing extends BWMetaGeneratedBlocks + implements com.gtnewhorizon.structurelib.structure.ICustomBlockSetting { + + public BWMetaGeneratedBlocksCasing(Material p_i45386_1_, Class<? extends TileEntity> tileEntity, String blockName, + OrePrefixes prefixes) { + super(p_i45386_1_, tileEntity, blockName, prefixes); + } + + @Override + public String getHarvestTool(int aMeta) { + return "wrench"; + } + + @Override + public int getHarvestLevel(int aMeta) { + return 2; + } + + @Override + public float getBlockHardness(World aWorld, int aX, int aY, int aZ) { + return Blocks.iron_block.getBlockHardness(aWorld, aX, aY, aZ); + } + + @Override + public float getExplosionResistance(Entity aTNT) { + return Blocks.iron_block.getExplosionResistance(aTNT); + } + + @Override + protected boolean canSilkHarvest() { + return false; + } + + @Override + public void breakBlock(World aWorld, int aX, int aY, int aZ, Block aBlock, int aMetaData) { + GregTechAPI.causeMachineUpdate(aWorld, aX, aY, aZ); + super.breakBlock(aWorld, aX, aY, aZ, aBlock, aMetaData); + } + + @Override + public void onBlockAdded(World aWorld, int aX, int aY, int aZ) { + super.onBlockAdded(aWorld, aX, aY, aZ); + GregTechAPI.causeMachineUpdate(aWorld, aX, aY, aZ); + } + + @Override + protected void doRegistrationStuff(Werkstoff tMaterial) { + GregTechAPI.registerMachineBlock(this, -1); + } + + @Override + public String getUnlocalizedName() { + if (this._prefixes == OrePrefixes.blockCasing) return "bw.werkstoffblockscasing.01"; + if (this._prefixes == OrePrefixes.blockCasingAdvanced) return "bw.werkstoffblockscasingadvanced.01"; + return ""; + } + + @Override + @SideOnly(Side.CLIENT) + public void getSubBlocks(Item aItem, CreativeTabs aTab, List<ItemStack> aList) { + Werkstoff.werkstoffHashSet.stream() + .filter( + pMaterial -> Werkstoff.Types.BIOLOGICAL.equals(pMaterial.getType()) + && pMaterial.hasGenerationFeature(OrePrefixes.blockCasing) + || pMaterial.doesOreDictedItemExists(OrePrefixes.plate) + && pMaterial.doesOreDictedItemExists(OrePrefixes.screw) + && pMaterial.doesOreDictedItemExists(OrePrefixes.plateDouble) + && pMaterial.doesOreDictedItemExists(OrePrefixes.gearGt) + && pMaterial.doesOreDictedItemExists(OrePrefixes.gearGtSmall)) + .map(pMaterial -> new ItemStack(aItem, 1, pMaterial.getmID())) + .forEach(aList::add); + } + + /** + * ICustomBlockSetting setBlock override + */ + public void setBlock(World world, int x, int y, int z, int meta) { + world.setBlock(x, y, z, this, meta, 2); + try { + Thread.sleep(1); + // Fucking Minecraft TE settings. + } catch (InterruptedException ignored) {} + Optional.ofNullable(world.getTileEntity(x, y, z)) + .filter(te -> te instanceof TileEntityMetaGeneratedBlock) + .map(te -> (TileEntityMetaGeneratedBlock) te) + .ifPresent(te -> te.mMetaData = (short) meta); + } +} diff --git a/src/main/java/bartworks/system/material/BWMetaGeneratedFrames.java b/src/main/java/bartworks/system/material/BWMetaGeneratedFrames.java new file mode 100644 index 0000000000..092ccf038b --- /dev/null +++ b/src/main/java/bartworks/system/material/BWMetaGeneratedFrames.java @@ -0,0 +1,144 @@ +/* + * Copyright (c) 2018-2020 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 bartworks.system.material; + +import static gregtech.api.enums.GTValues.RA; +import static gregtech.api.recipe.RecipeMaps.assemblerRecipes; +import static gregtech.api.util.GTRecipeBuilder.SECONDS; +import static gregtech.api.util.GTRecipeBuilder.TICKS; + +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraftforge.common.util.ForgeDirection; + +import gregtech.api.enums.Dyes; +import gregtech.api.enums.ItemList; +import gregtech.api.enums.OrePrefixes; +import gregtech.api.interfaces.ITexture; +import gregtech.api.interfaces.metatileentity.IMetaTileEntity; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.metatileentity.MetaPipeEntity; +import gregtech.api.render.TextureFactory; +import gregtech.api.util.GTModHandler; +import gregtech.api.util.GTModHandler.RecipeBits; +import gregtech.api.util.GTOreDictUnificator; + +public class BWMetaGeneratedFrames extends MetaPipeEntity { + + public final Werkstoff mMaterial; + + public BWMetaGeneratedFrames(int aID, String aName, String aNameRegional, Werkstoff aMaterial) { + super(aID, aName, aNameRegional, 0); + this.mMaterial = aMaterial; + + GTOreDictUnificator.registerOre(OrePrefixes.frameGt, aMaterial, this.getStackForm(1)); + GTModHandler.addCraftingRecipe( + this.getStackForm(2), + RecipeBits.NOT_REMOVABLE | GTModHandler.RecipeBits.BUFFERED, + new Object[] { "SSS", "SwS", "SSS", 'S', this.mMaterial.get(OrePrefixes.stick) }); + + RA.stdBuilder() + .itemInputs( + GTOreDictUnificator.get(OrePrefixes.stick, aMaterial.getVarName(), 4), + ItemList.Circuit_Integrated.getWithDamage(0, 4)) + .itemOutputs(getStackForm(1)) + .duration(3 * SECONDS + 4 * TICKS) + .eut(8) + .addTo(assemblerRecipes); + } + + private BWMetaGeneratedFrames(String aName, Werkstoff aMaterial) { + super(aName, 0); + this.mMaterial = aMaterial; + } + + @Override + public byte getTileEntityBaseType() { + return 4; + } + + @Override + public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + return new BWMetaGeneratedFrames(this.mName, this.mMaterial); + } + + public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, ForgeDirection side, byte aConnections, + int aColorIndex, boolean aConnected, boolean aRedstone) { + return new ITexture[] { TextureFactory.of( + this.mMaterial.getTexSet().mTextures[OrePrefixes.frameGt.mTextureIndex], + Dyes.getModulation(aColorIndex, this.mMaterial.getRGBA())) }; + } + + @Override + public String[] getDescription() { + return new String[] { "Just something you can put a Cover or CFoam on." }; + } + + @Override + public final boolean isSimpleMachine() { + return true; + } + + @Override + public final boolean isFacingValid(ForgeDirection facing) { + return false; + } + + @Override + public final boolean isValidSlot(int aIndex) { + return false; + } + + @Override + public final boolean renderInside(ForgeDirection side) { + return true; + } + + @Override + public final float getThickNess() { + return 1.0F; + } + + @Override + public final void saveNBTData(NBTTagCompound aNBT) { + /* Do nothing */ + } + + @Override + public final void loadNBTData(NBTTagCompound aNBT) { + /* Do nothing */ + } + + @Override + public final boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, ForgeDirection side, + ItemStack aStack) { + return false; + } + + @Override + public final boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, ForgeDirection side, + ItemStack aStack) { + return false; + } + + @Override + public int connect(ForgeDirection side) { + return 0; + } + + @Override + public void disconnect(ForgeDirection side) { + /* Do nothing */ + } +} diff --git a/src/main/java/bartworks/system/material/BWMetaGeneratedItems.java b/src/main/java/bartworks/system/material/BWMetaGeneratedItems.java new file mode 100644 index 0000000000..bdeab62cfd --- /dev/null +++ b/src/main/java/bartworks/system/material/BWMetaGeneratedItems.java @@ -0,0 +1,258 @@ +/* + * Copyright (c) 2018-2020 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 bartworks.system.material; + +import java.util.List; + +import net.minecraft.block.Block; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.item.EntityItem; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.potion.Potion; +import net.minecraft.potion.PotionEffect; +import net.minecraft.util.IIcon; +import net.minecraft.util.MathHelper; +import net.minecraft.world.World; + +import bartworks.API.IRadMaterial; +import bartworks.API.SideReference; +import bartworks.client.textures.PrefixTextureLinker; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import gregtech.api.enums.Materials; +import gregtech.api.enums.OrePrefixes; +import gregtech.api.interfaces.IIconContainer; +import gregtech.api.items.MetaGeneratedItem; +import gregtech.api.util.GTLanguageManager; +import gregtech.api.util.GTOreDictUnificator; +import gregtech.api.util.GTUtility; +import ic2.core.IC2Potion; + +public class BWMetaGeneratedItems extends MetaGeneratedItem implements IRadMaterial { + + public static final CreativeTabs metaTab = new CreativeTabs("bartworksMetaMaterials") { + + @Override + public Item getTabIconItem() { + return new ItemStack(Blocks.iron_ore).getItem(); + } + }; + + protected final OrePrefixes orePrefixes; + protected final String itemTypeLocalizedName; + + public BWMetaGeneratedItems(OrePrefixes orePrefixes, Object unused) { + super("bwMetaGeneratedGTEnhancement" + orePrefixes.name(), (short) 32766, (short) 0); + this.orePrefixes = orePrefixes; + this.itemTypeLocalizedName = GTLanguageManager.addStringLocalization( + "bw.itemtype." + orePrefixes, + orePrefixes.mLocalizedMaterialPre + "%material" + orePrefixes.mLocalizedMaterialPost); + } + + public BWMetaGeneratedItems(OrePrefixes orePrefixes) { + super("bwMetaGenerated" + orePrefixes.name(), (short) 32766, (short) 0); + this.orePrefixes = orePrefixes; + this.itemTypeLocalizedName = GTLanguageManager.addStringLocalization( + "bw.itemtype." + orePrefixes, + orePrefixes.mLocalizedMaterialPre + "%material" + orePrefixes.mLocalizedMaterialPost); + this.setCreativeTab(BWMetaGeneratedItems.metaTab); + for (Werkstoff w : Werkstoff.werkstoffHashSet) { + ItemStack tStack = new ItemStack(this, 1, w.getmID()); + if (!w.hasItemType(this.orePrefixes)) continue; + GTOreDictUnificator.registerOre(this.orePrefixes.name() + w.getVarName(), tStack); + } + } + + @Override + public boolean onEntityItemUpdate(EntityItem aItemEntity) { + if (this.orePrefixes == OrePrefixes.dustImpure || this.orePrefixes == OrePrefixes.dustPure + || this.orePrefixes == OrePrefixes.crushed) { + int aDamage = aItemEntity.getEntityItem() + .getItemDamage(); + if (aDamage >= 0 && !aItemEntity.worldObj.isRemote) { + Werkstoff aMaterial = Werkstoff.werkstoffHashMap.get((short) aDamage); + if (aMaterial != null && aMaterial != Werkstoff.default_null_Werkstoff) { + int tX = MathHelper.floor_double(aItemEntity.posX); + int tY = MathHelper.floor_double(aItemEntity.posY); + int tZ = MathHelper.floor_double(aItemEntity.posZ); + Block tBlock = aItemEntity.worldObj.getBlock(tX, tY, tZ); + byte tMetaData = (byte) aItemEntity.worldObj.getBlockMetadata(tX, tY, tZ); + if (tBlock == Blocks.cauldron && tMetaData > 0) { + if (this.orePrefixes == OrePrefixes.dustImpure || this.orePrefixes == OrePrefixes.dustPure) { + aItemEntity.setEntityItemStack( + WerkstoffLoader.getCorrespondingItemStack( + OrePrefixes.dust, + aMaterial, + aItemEntity.getEntityItem().stackSize)); + aItemEntity.worldObj.setBlockMetadataWithNotify(tX, tY, tZ, tMetaData - 1, 3); + return true; + } else { + aItemEntity.setEntityItemStack( + WerkstoffLoader.getCorrespondingItemStack( + OrePrefixes.crushedPurified, + aMaterial, + aItemEntity.getEntityItem().stackSize)); + aItemEntity.worldObj.setBlockMetadataWithNotify(tX, tY, tZ, tMetaData - 1, 3); + return true; + } + } + } + } + } + return false; + } + + @Override + protected void addAdditionalToolTips(List<String> aList, ItemStack aStack, EntityPlayer aPlayer) { + if (this.orePrefixes == OrePrefixes.dustImpure || this.orePrefixes == OrePrefixes.dustPure) { + aList.add(GTLanguageManager.getTranslation("metaitem.01.tooltip.purify")); + } + if (this.orePrefixes == OrePrefixes.crushed) + aList.add(GTLanguageManager.getTranslation("metaitem.01.tooltip.purify.2")); + + if (aStack != null && aStack.getItem() instanceof BWMetaGeneratedItems + && aStack.getItemDamage() == WerkstoffLoader.Tiberium.getmID()) + aList.add(GTLanguageManager.getTranslation("metaitem.01.tooltip.nqgen")); + + Werkstoff werkstoff = Werkstoff.werkstoffHashMap.get((short) this.getDamage(aStack)); + if (werkstoff != null) { + String tooltip = werkstoff.getLocalizedToolTip(); + if (!tooltip.isEmpty()) { + aList.add(tooltip); + } + } + } + + @Override + public String getItemStackDisplayName(ItemStack aStack) { + int aMetaData = aStack.getItemDamage(); + Werkstoff werkstoff = Werkstoff.werkstoffHashMap.get((short) aMetaData); + if (werkstoff == null) werkstoff = Werkstoff.default_null_Werkstoff; + return this.itemTypeLocalizedName.replace("%material", werkstoff.getLocalizedName()); + } + + @Override + public IIconContainer getIconContainer(int aMetaData) { + if (Werkstoff.werkstoffHashMap.get((short) aMetaData) == null) return null; + if (this.orePrefixes.mTextureIndex == -1) return this.getIconContainerBartWorks(aMetaData); + return Werkstoff.werkstoffHashMap.get((short) aMetaData) + .getTexSet().mTextures[this.orePrefixes.mTextureIndex]; + } + + protected IIconContainer getIconContainerBartWorks(int aMetaData) { + if (SideReference.Side.Client) return PrefixTextureLinker.texMap.get(this.orePrefixes) + .get( + Werkstoff.werkstoffHashMap.get((short) aMetaData) + .getTexSet()); + return null; + } + + @Override + @SideOnly(Side.CLIENT) + public void getSubItems(Item var1, CreativeTabs aCreativeTab, List<ItemStack> aList) { + for (Werkstoff werkstoff : Werkstoff.werkstoffHashSet) { + if (werkstoff != null && werkstoff.hasItemType(this.orePrefixes)) { + ItemStack tStack = new ItemStack(this, 1, werkstoff.getmID()); + aList.add(tStack); + } + } + // super.getSubItems(var1, aCreativeTab, aList); + } + + @Override + public short[] getRGBa(ItemStack aStack) { + Werkstoff werkstoff = Werkstoff.werkstoffHashMap.get((short) this.getDamage(aStack)); + return werkstoff == null ? Materials._NULL.mRGBa : werkstoff.getRGBA(); + } + + @Override + public void onUpdate(ItemStack aStack, World aWorld, Entity aPlayer, int aTimer, boolean aIsInHand) { + super.onUpdate(aStack, aWorld, aPlayer, aTimer, aIsInHand); + if (aStack == null || aStack.getItem() == null || !(aPlayer instanceof EntityLivingBase)) return; + + EntityLivingBase bPlayer = (EntityPlayer) aPlayer; + Werkstoff w = Werkstoff.werkstoffHashMap.get((short) aStack.getItemDamage()); + if (w == null || w.getStats() == null) return; + + if (w.getStats() + .isToxic() && !GTUtility.isWearingFullBioHazmat(bPlayer)) { + bPlayer.addPotionEffect(new PotionEffect(Potion.poison.getId(), 80, 4)); + } + + if (w.getStats() + .isRadioactive() && !GTUtility.isWearingFullRadioHazmat(bPlayer)) { + bPlayer.addPotionEffect(new PotionEffect(IC2Potion.radiation.id, 80, 4)); + } + } + + @Override + public IIcon getIconFromDamage(int aMetaData) { + if (aMetaData < 0) return null; + Werkstoff tMaterial = Werkstoff.werkstoffHashMap.get((short) aMetaData); + if (tMaterial == null) return null; + IIconContainer tIcon = this.getIconContainer(aMetaData); + if (tIcon != null) return tIcon.getIcon(); + return null; + } + + @Override + public int getItemStackLimit(ItemStack aStack) { + return this.orePrefixes.mDefaultStackSize; + } + + @Override + public int getRadiationLevel(ItemStack aStack) { + Werkstoff w = Werkstoff.werkstoffHashMap.get((short) aStack.getItemDamage()); + return w.getStats() + .isRadioactive() + ? (int) w.getStats() + .getProtons() + : 0; + } + + @Override + public byte getAmountOfMaterial(ItemStack aStack) { + return (byte) (this.orePrefixes == OrePrefixes.stick ? 1 : this.orePrefixes == OrePrefixes.stickLong ? 2 : 0); + } + + @Override + public short[] getColorForGUI(ItemStack aStack) { + Werkstoff w = Werkstoff.werkstoffHashMap.get((short) aStack.getItemDamage()); + return w.getRGBA(); + } + + @Override + public String getNameForGUI(ItemStack aStack) { + Werkstoff w = Werkstoff.werkstoffHashMap.get((short) aStack.getItemDamage()); + return w.getDefaultName(); + } + + @Override + public int getCapacity(ItemStack aStack) { + return this.orePrefixes == OrePrefixes.capsule || this.orePrefixes == OrePrefixes.cell + || this.orePrefixes == OrePrefixes.cellPlasma ? 1000 + : this.orePrefixes == OrePrefixes.cellMolten || this.orePrefixes == OrePrefixes.capsuleMolten ? 144 : 0; + } + + @Override + public ItemStack getContainerItem(ItemStack aStack) { + return this.orePrefixes == OrePrefixes.cell || this.orePrefixes == OrePrefixes.cellPlasma + || this.orePrefixes == OrePrefixes.cellMolten ? Materials.Empty.getCells(1) : null; + } +} diff --git a/src/main/java/bartworks/system/material/BWMetaGeneratedOres.java b/src/main/java/bartworks/system/material/BWMetaGeneratedOres.java new file mode 100644 index 0000000000..c74c3f01cb --- /dev/null +++ b/src/main/java/bartworks/system/material/BWMetaGeneratedOres.java @@ -0,0 +1,133 @@ +/* + * Copyright (c) 2018-2020 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 bartworks.system.material; + +import java.util.Arrays; +import java.util.List; + +import net.minecraft.block.Block; +import net.minecraft.block.material.Material; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.enchantment.EnchantmentHelper; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.IIcon; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; +import net.minecraftforge.common.util.FakePlayer; + +import bartworks.util.MathUtils; +import gregtech.api.enums.OrePrefixes; +import gregtech.api.util.GTLanguageManager; +import gregtech.api.util.GTModHandler; + +public class BWMetaGeneratedOres extends BWMetaGeneratedBlocks { + + public BWMetaGeneratedOres(Material p_i45386_1_, Class<? extends TileEntity> tileEntity, String blockName) { + super(p_i45386_1_, tileEntity, blockName); + this.blockTypeLocalizedName = GTLanguageManager.addStringLocalization( + "bw.blocktype." + OrePrefixes.ore, + OrePrefixes.ore.mLocalizedMaterialPre + "%material" + OrePrefixes.ore.mLocalizedMaterialPost); + } + + @Override + protected void doRegistrationStuff(Werkstoff w) { + if (w != null) { + if (!w.hasItemType(OrePrefixes.ore) || (w.getGenerationFeatures().blacklist & 0b1000) != 0) return; + GTModHandler.addValuableOre(this, w.getmID(), 1); + } + } + + public static boolean setOreBlock(World aWorld, int aX, int aY, int aZ, int aMetaData, boolean air, Block block, + int[] aBlockMeta) { + if (!air) { + aY = MathUtils.clamp(aY, 1, aWorld.getActualHeight()); + } + + Block tBlock = aWorld.getBlock(aX, aY, aZ); + Block tOreBlock = WerkstoffLoader.BWOres; + if (aMetaData < 0 || tBlock == Blocks.air && !air + || Block.getIdFromBlock(tBlock) != Block.getIdFromBlock(block)) { + return false; + } + final int aaY = aY; + if (Arrays.stream(aBlockMeta) + .noneMatch(e -> e == aWorld.getBlockMetadata(aX, aaY, aZ))) { + return false; + } + + aWorld.setBlock(aX, aY, aZ, tOreBlock, aMetaData, 0); + TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); + if (tTileEntity instanceof BWTileEntityMetaGeneratedOre metaTE) { + metaTE.mMetaData = (short) aMetaData; + metaTE.mNatural = true; + } + + return true; + } + + @Override + public IIcon getIcon(int side, int meta) { + return Blocks.stone.getIcon(0, 0); + } + + @Override + public IIcon getIcon(IBlockAccess worldIn, int x, int y, int z, int side) { + return Blocks.stone.getIcon(0, 0); + } + + @Override + public int getHarvestLevel(int metadata) { + return 3; + } + + @Override + public String getUnlocalizedName() { + return "bw.blockores.01"; + } + + @Override + public void getSubBlocks(Item aItem, CreativeTabs aTab, List<ItemStack> aList) { + for (Werkstoff tMaterial : Werkstoff.werkstoffHashSet) { + if (tMaterial != null && tMaterial.hasItemType(OrePrefixes.ore) + && (tMaterial.getGenerationFeatures().blacklist & 0x8) == 0) { + aList.add(new ItemStack(aItem, 1, tMaterial.getmID())); + } + } + } + + @Override + public void harvestBlock(World worldIn, EntityPlayer player, int x, int y, int z, int meta) { + if (EnchantmentHelper.getSilkTouchModifier(player)) { + BWTileEntityMetaGeneratedOre.shouldSilkTouch = true; + super.harvestBlock(worldIn, player, x, y, z, meta); + + if (BWTileEntityMetaGeneratedOre.shouldSilkTouch) { + BWTileEntityMetaGeneratedOre.shouldSilkTouch = false; + } + return; + } + + if (!(player instanceof FakePlayer)) { + BWTileEntityMetaGeneratedOre.shouldFortune = true; + } + super.harvestBlock(worldIn, player, x, y, z, meta); + if (BWTileEntityMetaGeneratedOre.shouldFortune) { + BWTileEntityMetaGeneratedOre.shouldFortune = false; + } + } +} diff --git a/src/main/java/bartworks/system/material/BWMetaGeneratedSmallOres.java b/src/main/java/bartworks/system/material/BWMetaGeneratedSmallOres.java new file mode 100644 index 0000000000..5025f4ac77 --- /dev/null +++ b/src/main/java/bartworks/system/material/BWMetaGeneratedSmallOres.java @@ -0,0 +1,76 @@ +/* + * Copyright (c) 2018-2020 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 bartworks.system.material; + +import java.util.Arrays; + +import net.minecraft.block.Block; +import net.minecraft.block.material.Material; +import net.minecraft.init.Blocks; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.World; + +import gregtech.api.enums.OrePrefixes; +import gregtech.api.util.GTLanguageManager; +import gregtech.api.util.GTModHandler; + +public class BWMetaGeneratedSmallOres extends BWMetaGeneratedOres { + + public BWMetaGeneratedSmallOres(Material p_i45386_1_, Class<? extends TileEntity> tileEntity, String blockName) { + super(p_i45386_1_, tileEntity, blockName); + this.blockTypeLocalizedName = GTLanguageManager.addStringLocalization( + "bw.blocktype." + OrePrefixes.oreSmall, + OrePrefixes.oreSmall.mLocalizedMaterialPre + "%material" + OrePrefixes.oreSmall.mLocalizedMaterialPost); + } + + @Override + protected void doRegistrationStuff(Werkstoff w) { + if (w != null) { + if (!w.hasItemType(OrePrefixes.ore) || (w.getGenerationFeatures().blacklist & 0b1000) != 0) return; + GTModHandler.addValuableOre(this, w.getmID(), 1); + } + } + + @Override + public String getUnlocalizedName() { + return "bw.blockores.02"; + } + + public static boolean setOreBlock(World aWorld, int aX, int aY, int aZ, int aMetaData, boolean air, Block block, + int[] aBlockMeta) { + if (!air) { + aY = Math.min(aWorld.getActualHeight(), Math.max(aY, 1)); + } + + Block tBlock = aWorld.getBlock(aX, aY, aZ); + Block tOreBlock = WerkstoffLoader.BWSmallOres; + if (aMetaData < 0 || tBlock == Blocks.air && !air + || Block.getIdFromBlock(tBlock) != Block.getIdFromBlock(block)) { + return false; + } + final int aaY = aY; + if (Arrays.stream(aBlockMeta) + .noneMatch(e -> e == aWorld.getBlockMetadata(aX, aaY, aZ))) { + return false; + } + + aWorld.setBlock(aX, aY, aZ, tOreBlock, aMetaData, 0); + TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); + if (tTileEntity instanceof BWTileEntityMetaGeneratedOre metaTE) { + metaTE.mMetaData = (short) aMetaData; + } + + return true; + } +} diff --git a/src/main/java/bartworks/system/material/BWMetaGeneratedWerkstoffBlocks.java b/src/main/java/bartworks/system/material/BWMetaGeneratedWerkstoffBlocks.java new file mode 100644 index 0000000000..b7c1e73927 --- /dev/null +++ b/src/main/java/bartworks/system/material/BWMetaGeneratedWerkstoffBlocks.java @@ -0,0 +1,65 @@ +/* + * Copyright (c) 2018-2020 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 bartworks.system.material; + +import java.util.List; + +import net.minecraft.block.material.Material; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.init.Blocks; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.IIcon; +import net.minecraft.world.IBlockAccess; + +import gregtech.api.enums.OrePrefixes; +import gregtech.api.util.GTLanguageManager; + +public class BWMetaGeneratedWerkstoffBlocks extends BWMetaGeneratedBlocks { + + public BWMetaGeneratedWerkstoffBlocks(Material p_i45386_1_, Class<? extends TileEntity> tileEntity, + String blockName) { + super(p_i45386_1_, tileEntity, blockName); + this.blockTypeLocalizedName = GTLanguageManager.addStringLocalization( + "bw.blocktype." + OrePrefixes.block, + OrePrefixes.block.mLocalizedMaterialPre + "%material" + OrePrefixes.block.mLocalizedMaterialPost); + } + + @Override + protected void doRegistrationStuff(Werkstoff tMaterial) {} + + @Override + public String getUnlocalizedName() { + return "bw.werkstoffblocks.01"; + } + + @Override + public IIcon getIcon(int side, int meta) { + return Blocks.iron_block.getIcon(0, 0); + } + + @Override + public IIcon getIcon(IBlockAccess worldIn, int x, int y, int z, int side) { + return Blocks.iron_block.getIcon(0, 0); + } + + @Override + public void getSubBlocks(Item aItem, CreativeTabs tab, List<ItemStack> aList) { + Werkstoff.werkstoffHashSet.stream() + .filter(tMaterial -> tMaterial.hasItemType(OrePrefixes.gem) || tMaterial.hasItemType(OrePrefixes.ingot)) + .map(tMaterial -> new ItemStack(aItem, 1, tMaterial.getmID())) + .forEach(aList::add); + } +} diff --git a/src/main/java/bartworks/system/material/BWNonMetaMaterialItems.java b/src/main/java/bartworks/system/material/BWNonMetaMaterialItems.java new file mode 100644 index 0000000000..a8ddb5a3bf --- /dev/null +++ b/src/main/java/bartworks/system/material/BWNonMetaMaterialItems.java @@ -0,0 +1,167 @@ +/* + * Copyright (c) 2018-2020 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 bartworks.system.material; + +import static gregtech.api.enums.GTValues.W; + +import net.minecraft.block.Block; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; + +import gregtech.api.interfaces.IItemContainer; +import gregtech.api.util.GTModHandler; +import gregtech.api.util.GTOreDictUnificator; +import gregtech.api.util.GTUtility; + +public enum BWNonMetaMaterialItems implements IItemContainer { + + Depleted_Tiberium_1, + Depleted_Tiberium_2, + Depleted_Tiberium_4, + TiberiumCell_1, + TiberiumCell_2, + TiberiumCell_4, + TheCoreCell, + Depleted_TheCoreCell; + + private ItemStack mStack; + private boolean mHasNotBeenSet = true; + + @Override + public IItemContainer set(Item aItem) { + this.mHasNotBeenSet = false; + if (aItem == null) return this; + ItemStack aStack = new ItemStack(aItem, 1, 0); + this.mStack = GTUtility.copyAmount(1, aStack); + return this; + } + + @Override + public IItemContainer set(ItemStack aStack) { + this.mHasNotBeenSet = false; + this.mStack = GTUtility.copyAmount(1, aStack); + return this; + } + + @Override + public IItemContainer hidden() { + codechicken.nei.api.API.hideItem(get(1L)); + return this; + } + + @Override + public Item getItem() { + if (this.mHasNotBeenSet) + throw new IllegalAccessError("The Enum '" + this.name() + "' has not been set to an Item at this time!"); + if (GTUtility.isStackInvalid(this.mStack)) return null; + return this.mStack.getItem(); + } + + @Override + public Block getBlock() { + if (this.mHasNotBeenSet) + throw new IllegalAccessError("The Enum '" + this.name() + "' has not been set to an Item at this time!"); + return GTUtility.getBlockFromItem(this.getItem()); + } + + @Override + public final boolean hasBeenSet() { + return !this.mHasNotBeenSet; + } + + @Override + public boolean isStackEqual(Object aStack) { + return this.isStackEqual(aStack, false, false); + } + + @Override + public boolean isStackEqual(Object aStack, boolean aWildcard, boolean aIgnoreNBT) { + if (GTUtility.isStackInvalid(aStack)) return false; + return GTUtility + .areUnificationsEqual((ItemStack) aStack, aWildcard ? this.getWildcard(1) : this.get(1), aIgnoreNBT); + } + + @Override + public ItemStack get(long aAmount, Object... aReplacements) { + if (this.mHasNotBeenSet) + throw new IllegalAccessError("The Enum '" + this.name() + "' has not been set to an Item at this time!"); + if (GTUtility.isStackInvalid(this.mStack)) return GTUtility.copyAmount(aAmount, aReplacements); + return GTUtility.copyAmount(aAmount, GTOreDictUnificator.get(this.mStack)); + } + + @Override + public ItemStack getWildcard(long aAmount, Object... aReplacements) { + if (this.mHasNotBeenSet) + throw new IllegalAccessError("The Enum '" + this.name() + "' has not been set to an Item at this time!"); + if (GTUtility.isStackInvalid(this.mStack)) return GTUtility.copyAmount(aAmount, aReplacements); + return GTUtility.copyAmountAndMetaData(aAmount, W, GTOreDictUnificator.get(this.mStack)); + } + + @Override + public ItemStack getUndamaged(long aAmount, Object... aReplacements) { + if (this.mHasNotBeenSet) + throw new IllegalAccessError("The Enum '" + this.name() + "' has not been set to an Item at this time!"); + if (GTUtility.isStackInvalid(this.mStack)) return GTUtility.copyAmount(aAmount, aReplacements); + return GTUtility.copyAmountAndMetaData(aAmount, 0, GTOreDictUnificator.get(this.mStack)); + } + + @Override + public ItemStack getAlmostBroken(long aAmount, Object... aReplacements) { + if (this.mHasNotBeenSet) + throw new IllegalAccessError("The Enum '" + this.name() + "' has not been set to an Item at this time!"); + if (GTUtility.isStackInvalid(this.mStack)) return GTUtility.copyAmount(aAmount, aReplacements); + return GTUtility + .copyAmountAndMetaData(aAmount, this.mStack.getMaxDamage() - 1, GTOreDictUnificator.get(this.mStack)); + } + + @Override + public ItemStack getWithName(long aAmount, String aDisplayName, Object... aReplacements) { + ItemStack rStack = this.get(1, aReplacements); + if (GTUtility.isStackInvalid(rStack)) return null; + rStack.setStackDisplayName(aDisplayName); + return GTUtility.copyAmount(aAmount, rStack); + } + + @Override + public ItemStack getWithCharge(long aAmount, int aEnergy, Object... aReplacements) { + ItemStack rStack = this.get(1, aReplacements); + if (GTUtility.isStackInvalid(rStack)) return null; + GTModHandler.chargeElectricItem(rStack, aEnergy, Integer.MAX_VALUE, true, false); + return GTUtility.copyAmount(aAmount, rStack); + } + + @Override + public ItemStack getWithDamage(long aAmount, long aMetaValue, Object... aReplacements) { + if (this.mHasNotBeenSet) + throw new IllegalAccessError("The Enum '" + this.name() + "' has not been set to an Item at this time!"); + if (GTUtility.isStackInvalid(this.mStack)) return GTUtility.copyAmount(aAmount, aReplacements); + return GTUtility.copyAmountAndMetaData(aAmount, aMetaValue, GTOreDictUnificator.get(this.mStack)); + } + + @Override + public IItemContainer registerOre(Object... aOreNames) { + if (this.mHasNotBeenSet) + throw new IllegalAccessError("The Enum '" + this.name() + "' has not been set to an Item at this time!"); + for (Object tOreName : aOreNames) GTOreDictUnificator.registerOre(tOreName, this.get(1)); + return this; + } + + @Override + public IItemContainer registerWildcardAsOre(Object... aOreNames) { + if (this.mHasNotBeenSet) + throw new IllegalAccessError("The Enum '" + this.name() + "' has not been set to an Item at this time!"); + for (Object tOreName : aOreNames) GTOreDictUnificator.registerOre(tOreName, this.getWildcard(1)); + return this; + } +} diff --git a/src/main/java/bartworks/system/material/BWTileEntityMetaGeneratedBlocksCasing.java b/src/main/java/bartworks/system/material/BWTileEntityMetaGeneratedBlocksCasing.java new file mode 100644 index 0000000000..536bdccf60 --- /dev/null +++ b/src/main/java/bartworks/system/material/BWTileEntityMetaGeneratedBlocksCasing.java @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2018-2020 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 bartworks.system.material; + +import net.minecraft.block.Block; +import net.minecraft.init.Blocks; +import net.minecraftforge.common.util.ForgeDirection; + +import bartworks.API.SideReference; +import bartworks.client.textures.PrefixTextureLinker; +import gregtech.api.enums.OrePrefixes; +import gregtech.api.enums.TextureSet; +import gregtech.api.interfaces.ITexture; +import gregtech.api.render.TextureFactory; + +public class BWTileEntityMetaGeneratedBlocksCasing extends TileEntityMetaGeneratedBlock { + + @Override + protected Block GetProperBlock() { + return WerkstoffLoader.BWBlockCasings; + } + + @Override + public ITexture[] getTexture(Block aBlock, ForgeDirection side) { + if (SideReference.Side.Client) { + Werkstoff aMaterial = Werkstoff.werkstoffHashMap.get(this.mMetaData); + if (aMaterial != null) { + TextureSet set = aMaterial.getTexSet(); + ITexture aIconSet = TextureFactory.of( + PrefixTextureLinker.texMapBlocks.get(OrePrefixes.blockCasing) + .getOrDefault(set, TextureSet.SET_NONE.mTextures[OrePrefixes.block.mTextureIndex]), + aMaterial.getRGBA()); + return new ITexture[] { TextureFactory.of(Blocks.iron_block), aIconSet }; + } + } + return new ITexture[] { TextureFactory.of(Blocks.iron_block), + TextureFactory.of(gregtech.api.enums.TextureSet.SET_NONE.mTextures[OrePrefixes.block.mTextureIndex]) }; + } +} diff --git a/src/main/java/bartworks/system/material/BWTileEntityMetaGeneratedBlocksCasingAdvanced.java b/src/main/java/bartworks/system/material/BWTileEntityMetaGeneratedBlocksCasingAdvanced.java new file mode 100644 index 0000000000..57399a8f87 --- /dev/null +++ b/src/main/java/bartworks/system/material/BWTileEntityMetaGeneratedBlocksCasingAdvanced.java @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2018-2020 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 bartworks.system.material; + +import net.minecraft.block.Block; +import net.minecraft.init.Blocks; +import net.minecraftforge.common.util.ForgeDirection; + +import bartworks.API.SideReference; +import bartworks.client.textures.PrefixTextureLinker; +import gregtech.api.enums.OrePrefixes; +import gregtech.api.enums.TextureSet; +import gregtech.api.interfaces.ITexture; +import gregtech.api.render.TextureFactory; + +public class BWTileEntityMetaGeneratedBlocksCasingAdvanced extends TileEntityMetaGeneratedBlock { + + @Override + protected Block GetProperBlock() { + return WerkstoffLoader.BWBlockCasingsAdvanced; + } + + @Override + public ITexture[] getTexture(Block aBlock, ForgeDirection side) { + if (SideReference.Side.Client) { + Werkstoff aMaterial = Werkstoff.werkstoffHashMap.get(this.mMetaData); + if (aMaterial != null) { + TextureSet set = aMaterial.getTexSet(); + ITexture aIconSet = TextureFactory.of( + PrefixTextureLinker.texMapBlocks.get(OrePrefixes.blockCasingAdvanced) + .getOrDefault(set, TextureSet.SET_NONE.mTextures[OrePrefixes.block.mTextureIndex]), + aMaterial.getRGBA()); + return new ITexture[] { TextureFactory.of(Blocks.iron_block), aIconSet }; + } + } + return new ITexture[] { TextureFactory.of(Blocks.iron_block), + TextureFactory.of(gregtech.api.enums.TextureSet.SET_NONE.mTextures[OrePrefixes.block.mTextureIndex]) }; + } +} diff --git a/src/main/java/bartworks/system/material/BWTileEntityMetaGeneratedOre.java b/src/main/java/bartworks/system/material/BWTileEntityMetaGeneratedOre.java new file mode 100644 index 0000000000..7f7d0716f5 --- /dev/null +++ b/src/main/java/bartworks/system/material/BWTileEntityMetaGeneratedOre.java @@ -0,0 +1,116 @@ +/* + * Copyright (c) 2018-2020 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 bartworks.system.material; + +import java.util.ArrayList; +import java.util.Random; + +import net.minecraft.block.Block; +import net.minecraft.init.Blocks; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraftforge.common.util.ForgeDirection; + +import gregtech.GTMod; +import gregtech.api.enums.Materials; +import gregtech.api.enums.OrePrefixes; +import gregtech.api.interfaces.ITexture; +import gregtech.api.render.TextureFactory; +import gregtech.api.util.GTOreDictUnificator; + +public class BWTileEntityMetaGeneratedOre extends TileEntityMetaGeneratedBlock { + + protected static boolean shouldFortune = false; + protected static boolean shouldSilkTouch = false; + public boolean mNatural = false; + + @Override + public void readFromNBT(NBTTagCompound aNBT) { + super.readFromNBT(aNBT); + this.mNatural = aNBT.getBoolean("n"); + } + + @Override + public void writeToNBT(NBTTagCompound aNBT) { + super.writeToNBT(aNBT); + aNBT.setBoolean("n", this.mNatural); + } + + @Override + public ITexture[] getTexture(Block aBlock, ForgeDirection side) { + Werkstoff aMaterial = Werkstoff.werkstoffHashMap.get(this.mMetaData); + if (aMaterial != null) { + ITexture aIconSet = TextureFactory + .of(aMaterial.getTexSet().mTextures[OrePrefixes.ore.mTextureIndex], aMaterial.getRGBA()); + return new ITexture[] { TextureFactory.of(Blocks.stone), aIconSet }; + } + return new ITexture[] { TextureFactory.of(Blocks.stone), + TextureFactory.of(gregtech.api.enums.TextureSet.SET_NONE.mTextures[OrePrefixes.ore.mTextureIndex]) }; + } + + @Override + protected Block GetProperBlock() { + return WerkstoffLoader.BWOres; + } + + @Override + public ArrayList<ItemStack> getDrops(int aFortune) { + ArrayList<ItemStack> rList = new ArrayList<>(); + if (this.mMetaData <= 0) { + rList.add(new ItemStack(Blocks.cobblestone, 1, 0)); + return rList; + } + Materials aOreMaterial = Werkstoff.werkstoffHashMap.get(this.mMetaData) + .getBridgeMaterial(); + if (shouldSilkTouch) { + rList.add(new ItemStack(this.GetProperBlock(), 1, this.mMetaData)); + } else { + switch (GTMod.gregtechproxy.oreDropSystem) { + case Item -> { + rList.add(GTOreDictUnificator.get(OrePrefixes.rawOre, aOreMaterial, 1)); + } + case FortuneItem -> { + // if shouldFortune and isNatural then get fortune drops + // if not shouldFortune or not isNatural then get normal drops + // if not shouldFortune and isNatural then get normal drops + // if shouldFortune and not isNatural then get normal drops + if (shouldFortune && this.mNatural && aFortune > 0) { + int aMinAmount = 1; + // Max applicable fortune + if (aFortune > 3) aFortune = 3; + long amount = (long) new Random().nextInt(aFortune) + aMinAmount; + for (int i = 0; i < amount; i++) { + rList.add(GTOreDictUnificator.get(OrePrefixes.rawOre, aOreMaterial, 1)); + } + } else { + rList.add(GTOreDictUnificator.get(OrePrefixes.rawOre, aOreMaterial, 1)); + } + } + case UnifiedBlock -> { + // Unified ore + rList.add(new ItemStack(this.GetProperBlock(), 1, this.mMetaData)); + } + case PerDimBlock -> { + // Per Dimension ore + rList.add(new ItemStack(this.GetProperBlock(), 1, this.mMetaData)); + } + case Block -> { + // Regular ore + rList.add(new ItemStack(this.GetProperBlock(), 1, this.mMetaData)); + } + } + } + return rList; + } +} diff --git a/src/main/java/bartworks/system/material/BWTileEntityMetaGeneratedSmallOre.java b/src/main/java/bartworks/system/material/BWTileEntityMetaGeneratedSmallOre.java new file mode 100644 index 0000000000..8764c7891e --- /dev/null +++ b/src/main/java/bartworks/system/material/BWTileEntityMetaGeneratedSmallOre.java @@ -0,0 +1,125 @@ +/* + * Copyright (c) 2018-2020 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 bartworks.system.material; + +import java.util.ArrayList; +import java.util.Random; + +import net.minecraft.block.Block; +import net.minecraft.init.Blocks; +import net.minecraft.item.ItemStack; +import net.minecraftforge.common.util.ForgeDirection; + +import gregtech.api.enums.Materials; +import gregtech.api.enums.OrePrefixes; +import gregtech.api.interfaces.ITexture; +import gregtech.api.objects.XSTR; +import gregtech.api.render.TextureFactory; +import gregtech.api.util.GTOreDictUnificator; +import gregtech.api.util.GTUtility; + +public class BWTileEntityMetaGeneratedSmallOre extends BWTileEntityMetaGeneratedOre { + + @Override + public ArrayList<ItemStack> getDrops(int aFortune) { + ArrayList<ItemStack> rList = new ArrayList<>(); + Materials aMaterial = Werkstoff.werkstoffHashMap.get(this.mMetaData) + .getBridgeMaterial(); + + if (aMaterial != null) { + Random tRandom = new XSTR(this.xCoord ^ this.yCoord ^ this.zCoord); + ArrayList<ItemStack> tSelector = new ArrayList<>(); + + ItemStack tStack = GTOreDictUnificator + .get(OrePrefixes.gemExquisite, aMaterial, GTOreDictUnificator.get(OrePrefixes.gem, aMaterial, 1L), 1L); + if (tStack != null) { + for (int i = 0; i < 1; i++) { + tSelector.add(tStack); + } + } + tStack = GTOreDictUnificator + .get(OrePrefixes.gemFlawless, aMaterial, GTOreDictUnificator.get(OrePrefixes.gem, aMaterial, 1L), 1L); + if (tStack != null) { + for (int i = 0; i < 2; i++) { + tSelector.add(tStack); + } + } + tStack = GTOreDictUnificator.get(OrePrefixes.gem, aMaterial, 1L); + if (tStack != null) { + for (int i = 0; i < 12; i++) { + tSelector.add(tStack); + } + } + tStack = GTOreDictUnificator + .get(OrePrefixes.gemFlawed, aMaterial, GTOreDictUnificator.get(OrePrefixes.crushed, aMaterial, 1L), 1L); + if (tStack != null) { + for (int i = 0; i < 5; i++) { + tSelector.add(tStack); + } + } + tStack = GTOreDictUnificator.get(OrePrefixes.crushed, aMaterial, 1L); + if (tStack != null) { + for (int i = 0; i < 10; i++) { + tSelector.add(tStack); + } + } + tStack = GTOreDictUnificator.get( + OrePrefixes.gemChipped, + aMaterial, + GTOreDictUnificator.get(OrePrefixes.dustImpure, aMaterial, 1L), + 1L); + if (tStack != null) { + for (int i = 0; i < 5; i++) { + tSelector.add(tStack); + } + } + tStack = GTOreDictUnificator.get(OrePrefixes.dustImpure, aMaterial, 1L); + if (tStack != null) { + for (int i = 0; i < 10; i++) { + tSelector.add(tStack); + } + } + if (tSelector.size() > 0) { + int i = 0; + + for (int j = Math.max(1, aFortune > 0 ? tRandom.nextInt(1 + aFortune) : 0); i < j; ++i) { + rList.add(GTUtility.copyAmount(1L, tSelector.get(tRandom.nextInt(tSelector.size())))); + } + } + if (tRandom.nextInt(3 + aFortune) > 1) { + rList.add( + GTOreDictUnificator + .get(tRandom.nextInt(3) > 0 ? OrePrefixes.dustImpure : OrePrefixes.dust, Materials.Stone, 1L)); + } + } + return rList; + } + + @Override + public ITexture[] getTexture(Block aBlock, ForgeDirection side) { + Werkstoff aMaterial = Werkstoff.werkstoffHashMap.get(this.mMetaData); + if (aMaterial != null) { + ITexture aIconSet = TextureFactory + .of(aMaterial.getTexSet().mTextures[OrePrefixes.oreSmall.mTextureIndex], aMaterial.getRGBA()); + return new ITexture[] { TextureFactory.of(Blocks.stone), aIconSet }; + } + return new ITexture[] { TextureFactory.of(Blocks.stone), + TextureFactory.of(gregtech.api.enums.TextureSet.SET_NONE.mTextures[OrePrefixes.oreSmall.mTextureIndex]) }; + } + + @Override + protected Block GetProperBlock() { + return WerkstoffLoader.BWSmallOres; + } +} diff --git a/src/main/java/bartworks/system/material/BWTileEntityMetaGeneratedWerkstoffBlock.java b/src/main/java/bartworks/system/material/BWTileEntityMetaGeneratedWerkstoffBlock.java new file mode 100644 index 0000000000..f1fd978909 --- /dev/null +++ b/src/main/java/bartworks/system/material/BWTileEntityMetaGeneratedWerkstoffBlock.java @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2018-2020 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 bartworks.system.material; + +import net.minecraft.block.Block; +import net.minecraft.init.Blocks; +import net.minecraftforge.common.util.ForgeDirection; + +import bartworks.API.SideReference; +import bartworks.client.textures.PrefixTextureLinker; +import gregtech.api.enums.OrePrefixes; +import gregtech.api.enums.TextureSet; +import gregtech.api.interfaces.ITexture; +import gregtech.api.render.TextureFactory; + +public class BWTileEntityMetaGeneratedWerkstoffBlock extends TileEntityMetaGeneratedBlock { + + @Override + public ITexture[] getTexture(Block aBlock, ForgeDirection side) { + if (SideReference.Side.Client) { + Werkstoff aMaterial = Werkstoff.werkstoffHashMap.get(this.mMetaData); + if (aMaterial != null) { + TextureSet set = aMaterial.getTexSet(); + ITexture aIconSet = TextureFactory.of( + set.mTextures[PrefixTextureLinker.blockTexMap.getOrDefault(set, OrePrefixes.block.mTextureIndex)], + aMaterial.getRGBA()); + return new ITexture[] { TextureFactory.of(Blocks.iron_block), aIconSet }; + } + } + return new ITexture[] { TextureFactory.of(Blocks.iron_block), + TextureFactory.of(gregtech.api.enums.TextureSet.SET_NONE.mTextures[OrePrefixes.block.mTextureIndex]) }; + } + + @Override + protected Block GetProperBlock() { + return WerkstoffLoader.BWBlocks; + } +} diff --git a/src/main/java/bartworks/system/material/CircuitGeneration/BWCircuitsLoader.java b/src/main/java/bartworks/system/material/CircuitGeneration/BWCircuitsLoader.java new file mode 100644 index 0000000000..55b42a662d --- /dev/null +++ b/src/main/java/bartworks/system/material/CircuitGeneration/BWCircuitsLoader.java @@ -0,0 +1,25 @@ +/* + * Copyright (c) 2018-2020 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 bartworks.system.material.CircuitGeneration; + +public class BWCircuitsLoader { + + private static final BWMetaItems NEW_CIRCUITS = new BWMetaItems(); + + private BWCircuitsLoader() {} + + public static void initNewCircuits() { + + } +} diff --git a/src/main/java/bartworks/system/material/CircuitGeneration/BWMetaItems.java b/src/main/java/bartworks/system/material/CircuitGeneration/BWMetaItems.java new file mode 100644 index 0000000000..bafecfa0cd --- /dev/null +++ b/src/main/java/bartworks/system/material/CircuitGeneration/BWMetaItems.java @@ -0,0 +1,327 @@ +/* + * Copyright (c) 2018-2020 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 bartworks.system.material.CircuitGeneration; + +import static gregtech.api.recipe.RecipeMaps.formingPressRecipes; +import static gregtech.api.util.GTRecipeBuilder.SECONDS; + +import java.util.ArrayList; +import java.util.BitSet; +import java.util.HashSet; +import java.util.List; +import java.util.Objects; + +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.IIcon; +import net.minecraftforge.fluids.FluidStack; + +import bartworks.MainMod; +import bartworks.common.loaders.ItemRegistry; +import bartworks.system.material.WerkstoffLoader; +import bartworks.util.BWUtil; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import gregtech.api.GregTechAPI; +import gregtech.api.enums.GTValues; +import gregtech.api.enums.Materials; +import gregtech.api.enums.OrePrefixes; +import gregtech.api.enums.SubTag; +import gregtech.api.enums.TCAspects; +import gregtech.api.enums.TierEU; +import gregtech.api.interfaces.IItemBehaviour; +import gregtech.api.interfaces.IItemContainer; +import gregtech.api.items.MetaBaseItem; +import gregtech.api.objects.ItemData; +import gregtech.api.recipe.RecipeMaps; +import gregtech.api.util.GTLanguageManager; +import gregtech.api.util.GTOreDictUnificator; +import gregtech.api.util.GTRecipe; +import gregtech.api.util.GTUtility; + +public class BWMetaItems { + + public static BWMetaItems.BW_GT_MetaGenCircuits getCircuitParts() { + return BWMetaItems.NEW_CIRCUIT_PARTS; + } + + private static final BWMetaItems.BW_GT_MetaGenCircuits NEW_CIRCUIT_PARTS = new BWMetaItems.BW_GT_MetaGenCircuits(); + + static { + BWMetaItems.NEW_CIRCUIT_PARTS.addItem(0, "Circuit Imprint", "", SubTag.NO_UNIFICATION, SubTag.NO_RECYCLING); + BWMetaItems.NEW_CIRCUIT_PARTS.addItem(1, "Sliced Circuit", "", SubTag.NO_UNIFICATION, SubTag.NO_RECYCLING); + BWMetaItems.NEW_CIRCUIT_PARTS + .addItem(2, "Raw Imprint supporting Board", "A Raw Board needed for Circuit Imprints"); + BWMetaItems.NEW_CIRCUIT_PARTS.addItem(3, "Imprint supporting Board", "A Board needed for Circuit Imprints"); + + GTValues.RA.stdBuilder() + .itemInputs( + WerkstoffLoader.MagnetoResonaticDust.get(OrePrefixes.dust, 1), + WerkstoffLoader.ArInGaPhoBiBoTe.get(OrePrefixes.dust, 4)) + .itemOutputs(BWMetaItems.NEW_CIRCUIT_PARTS.getStack(2)) + .duration(15 * SECONDS) + .eut(TierEU.RECIPE_HV) + .addTo(formingPressRecipes); + + RecipeMaps.autoclaveRecipes.add( + new GTRecipe( + false, + new ItemStack[] { BWMetaItems.NEW_CIRCUIT_PARTS.getStack(2) }, + new ItemStack[] { BWMetaItems.NEW_CIRCUIT_PARTS.getStack(3) }, + null, + new int[] { 7500 }, + new FluidStack[] { Materials.SolderingAlloy.getMolten(576) }, + null, + 300, + (int) TierEU.RECIPE_EV, + BWUtil.CLEANROOM)); + } + + public static class BW_GT_MetaGenCircuits extends BWMetaItems.BW_GT_MetaGen_Item_Hook { + + public BW_GT_MetaGenCircuits() { + super("bwMetaGeneratedItem0"); + } + + public final ItemStack getStack(int meta) { + return getStack(meta, 1); + } + + public final ItemStack getStack(int meta, int stackSize) { + return new ItemStack(this, stackSize, meta); + } + + public final ItemStack getStackWithNBT(NBTTagCompound tag, int meta, int stackSize) { + ItemStack itemStack = getStack(meta, stackSize); + itemStack.setTagCompound(tag); + return itemStack; + } + + @Override + public void getSubItems(Item var1, CreativeTabs aCreativeTab, List<ItemStack> aList) { + if (aCreativeTab == this.getCreativeTab()) + for (NBTTagCompound tag : CircuitImprintLoader.recipeTagMap.keySet()) { + ItemStack stack = new ItemStack(BWMetaItems.NEW_CIRCUIT_PARTS, 1, 0); + stack.setTagCompound(tag); + aList.add(stack); + } + super.getSubItems(var1, aCreativeTab, aList); + } + + @Override + @SideOnly(Side.CLIENT) + public final void registerIcons(IIconRegister aIconRegister) { + + for (short i = 0; i < CircuitImprintLoader.reverseIDs; ++i) { + if (this.mEnabledItems.get(i)) { + BWUtil.set2DCoordTo1DArray( + i, + 0, + 2, + aIconRegister.registerIcon("gregtech:" + this.getUnlocalizedName() + "/" + i), + this.mIconList); + } + } + + for (short i = CircuitImprintLoader.reverseIDs; i < Short.MAX_VALUE; i++) { + if (this.mEnabledItems.get(i)) { + BWUtil.set2DCoordTo1DArray( + i, + 0, + 2, + Objects.requireNonNull(CircuitImprintLoader.circuitIIconRefs.get(i)) + .get(1) + .getIconIndex(), + this.mIconList); + BWUtil.set2DCoordTo1DArray( + i, + 1, + 2, + aIconRegister.registerIcon(MainMod.MOD_ID + ":WrapOverlay"), + this.mIconList); + } + } + } + + @Override + protected void addAdditionalToolTips(List<String> aList, ItemStack aStack, EntityPlayer aPlayer) { + if (aStack.getTagCompound() != null) { + ItemStack tagStack = CircuitImprintLoader.getStackFromTag(aStack.getTagCompound()); + String itemName = tagStack != null + ? GTLanguageManager.getTranslation(GTLanguageManager.getTranslateableItemStackName(tagStack)) + : "a circuit"; + + if (aStack.getItemDamage() == 0) { + aList.add("An imprint for: " + itemName); + } else if (aStack.getItemDamage() == 1) { + aList.add("A sliced " + itemName); + } + } else { + if (aStack.getItemDamage() == 0) { + aList.add("An imprint for a Circuit"); + } else if (aStack.getItemDamage() == 1) { + aList.add("A sliced Circuit"); + } + } + + super.addAdditionalToolTips(aList, aStack, aPlayer); + } + + } + + public static class BW_GT_MetaGen_Item_Hook extends MetaBaseItem { + + public static final HashSet<BWMetaItems.BW_GT_MetaGen_Item_Hook> sInstances = new HashSet<>(); + public final IIcon[] mIconList; + public final BitSet mEnabledItems; + + { + this.mIconList = new IIcon[Short.MAX_VALUE * 2]; + this.mEnabledItems = new BitSet(Short.MAX_VALUE); + } + + private BW_GT_MetaGen_Item_Hook(String aUnlocalized) { + super(aUnlocalized); + + this.setCreativeTab(new CreativeTabs("bw.MetaItems.0") { + + @Override + public Item getTabIconItem() { + return ItemRegistry.TAB; + } + }); + this.setHasSubtypes(true); + this.setMaxDamage(0); + BWMetaItems.BW_GT_MetaGen_Item_Hook.sInstances.add(this); + } + + @Override + public Long[] getElectricStats(ItemStack itemStack) { + return null; + } + + @Override + public Long[] getFluidContainerStats(ItemStack itemStack) { + return null; + } + + @SuppressWarnings({ "unchecked", "rawtypes" }) + public final ItemStack addItem(int aID, String aEnglish, String aToolTip, Object... aRandomData) { + if (aToolTip == null) { + aToolTip = ""; + } + ItemStack rStack = new ItemStack(this, 1, aID); + GTLanguageManager.addStringLocalization(this.getUnlocalizedName(rStack) + ".name", aEnglish); + GTLanguageManager.addStringLocalization(this.getUnlocalizedName(rStack) + ".tooltip", aToolTip); + List<TCAspects.TC_AspectStack> tAspects = new ArrayList<>(); + this.mEnabledItems.set(aID); + Object[] var7 = aRandomData; + int var8 = aRandomData.length; + + int var9; + Object tRandomData; + for (var9 = 0; var9 < var8; ++var9) { + tRandomData = var7[var9]; + if (tRandomData instanceof SubTag && tRandomData == SubTag.NO_UNIFICATION) { + GTOreDictUnificator.addToBlacklist(rStack); + } + } + + var7 = aRandomData; + var8 = aRandomData.length; + + for (var9 = 0; var9 < var8; ++var9) { + tRandomData = var7[var9]; + if (tRandomData != null) { + boolean tUseOreDict = true; + + if (tRandomData instanceof IItemBehaviour) { + this.addItemBehavior(aID, (IItemBehaviour) tRandomData); + tUseOreDict = false; + } + + if (tRandomData instanceof IItemContainer) { + ((IItemContainer) tRandomData).set(rStack); + tUseOreDict = false; + } + + if (!(tRandomData instanceof SubTag)) { + if (tRandomData instanceof TCAspects.TC_AspectStack) { + ((TCAspects.TC_AspectStack) tRandomData).addToAspectList(tAspects); + } else if (tRandomData instanceof ItemData) { + if (GTUtility.isStringValid(tRandomData)) { + GTOreDictUnificator.registerOre(tRandomData, rStack); + } else { + GTOreDictUnificator.addItemData(rStack, (ItemData) tRandomData); + } + } else if (tUseOreDict) { + GTOreDictUnificator.registerOre(tRandomData, rStack); + } + } + } + } + + if (GregTechAPI.sThaumcraftCompat != null) { + GregTechAPI.sThaumcraftCompat.registerThaumcraftAspectsToItem(rStack, tAspects, false); + } + + return rStack; + } + + @Override + @SideOnly(Side.CLIENT) + public void getSubItems(Item var1, CreativeTabs aCreativeTab, List<ItemStack> aList) { + int j = this.mEnabledItems.length(); + + for (int i = 0; i < j; ++i) { + if (this.mEnabledItems.get(i)) { + ItemStack tStack = new ItemStack(this, 1, i); + this.isItemStackUsable(tStack); + aList.add(tStack); + } + } + } + + @Override + protected void addAdditionalToolTips(List<String> aList, ItemStack aStack, EntityPlayer aPlayer) { + super.addAdditionalToolTips(aList, aStack, aPlayer); + } + + @Override + public String getUnlocalizedName(ItemStack aStack) { + return this.getUnlocalizedName() + "." + aStack.getItemDamage(); + } + + @Override + public IIcon getIconFromDamage(int i) { + if (this.mEnabledItems.get(i)) return (IIcon) BWUtil.get2DCoordFrom1DArray(i, 0, 2, this.mIconList); + return null; + } + + @Override + public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, + int useRemaining) { + return this.getIconFromDamage(stack.getItemDamage()); + } + + @Override + public IIcon getIcon(ItemStack stack, int pass) { + return this.getIconFromDamage(stack.getItemDamage()); + } + } +} diff --git a/src/main/java/bartworks/system/material/CircuitGeneration/CircuitData.java b/src/main/java/bartworks/system/material/CircuitGeneration/CircuitData.java new file mode 100644 index 0000000000..fbf8600257 --- /dev/null +++ b/src/main/java/bartworks/system/material/CircuitGeneration/CircuitData.java @@ -0,0 +1,76 @@ +/* + * Copyright (c) 2018-2020 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 bartworks.system.material.CircuitGeneration; + +import java.nio.ByteBuffer; + +import bartworks.util.MurmurHash3; + +public class CircuitData { + + private long aVoltage; + private int aSpecial; + private byte aTier; + + public CircuitData(long aVoltage, int aSpecial, byte aTier) { + this.aVoltage = aVoltage; + this.aSpecial = aSpecial; + this.aTier = aTier; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (!(o instanceof CircuitData that)) return false; + if (this.getaVoltage() != that.getaVoltage() || this.getaSpecial() != that.getaSpecial()) return false; + return this.getaTier() == that.getaTier(); + } + + @Override + public int hashCode() { + return MurmurHash3.murmurhash3_x86_32( + ByteBuffer.allocate(13) + .put(this.aTier) + .putInt(this.aSpecial) + .putLong(this.aVoltage) + .array(), + 0, + 13, + 31); + } + + public long getaVoltage() { + return this.aVoltage; + } + + public void setaVoltage(long aVoltage) { + this.aVoltage = aVoltage; + } + + public int getaSpecial() { + return this.aSpecial; + } + + public void setaSpecial(int aSpecial) { + this.aSpecial = aSpecial; + } + + public byte getaTier() { + return this.aTier; + } + + public void setaTier(byte aTier) { + this.aTier = aTier; + } +} diff --git a/src/main/java/bartworks/system/material/CircuitGeneration/CircuitImprintLoader.java b/src/main/java/bartworks/system/material/CircuitGeneration/CircuitImprintLoader.java new file mode 100644 index 0000000000..c81f62e2ab --- /dev/null +++ b/src/main/java/bartworks/system/material/CircuitGeneration/CircuitImprintLoader.java @@ -0,0 +1,367 @@ +/* + * Copyright (c) 2018-2020 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 bartworks.system.material.CircuitGeneration; + +import java.util.Arrays; +import java.util.Collections; +import java.util.HashSet; +import java.util.List; + +import net.minecraft.item.ItemStack; +import net.minecraft.item.crafting.CraftingManager; +import net.minecraft.item.crafting.IRecipe; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraftforge.fluids.Fluid; +import net.minecraftforge.fluids.FluidRegistry; +import net.minecraftforge.fluids.FluidStack; +import net.minecraftforge.oredict.OreDictionary; +import net.minecraftforge.oredict.ShapedOreRecipe; + +import com.google.common.collect.ArrayListMultimap; +import com.google.common.collect.BiMap; +import com.google.common.collect.HashBiMap; + +import bartworks.API.recipe.BWNBTDependantCraftingRecipe; +import bartworks.API.recipe.BartWorksRecipeMaps; +import bartworks.ASM.BWCoreStaticReplacementMethodes; +import bartworks.common.configs.ConfigHandler; +import bartworks.system.material.WerkstoffLoader; +import bartworks.util.BWUtil; +import bartworks.util.Pair; +import cpw.mods.fml.common.registry.GameRegistry; +import gregtech.api.enums.ItemList; +import gregtech.api.enums.Materials; +import gregtech.api.enums.OrePrefixes; +import gregtech.api.recipe.RecipeMaps; +import gregtech.api.util.GTModHandler; +import gregtech.api.util.GTOreDictUnificator; +import gregtech.api.util.GTRecipe; +import gregtech.api.util.GTUtility; + +public class CircuitImprintLoader { + + public static short reverseIDs = Short.MAX_VALUE - 1; + + public static final ArrayListMultimap<NBTTagCompound, GTRecipe> recipeTagMap = ArrayListMultimap.create(); + public static final HashBiMap<Short, ItemList> circuitIIconRefs = HashBiMap.create(20); + public static final HashSet<ItemStack> blacklistSet = new HashSet<>(); + static final HashBiMap<CircuitData, ItemStack> bwCircuitTagMap = HashBiMap.create(20); + private static final HashSet<IRecipe> recipeWorldCache = new HashSet<>(); + private static final HashSet<GTRecipe> gtrecipeWorldCache = new HashSet<>(); + private static final HashSet<GTRecipe> ORIGINAL_CAL_RECIPES = new HashSet<>(); + private static final HashSet<GTRecipe> MODIFIED_CAL_RECIPES = new HashSet<>(); + + public static void run() { + HashSet<GTRecipe> toRem = new HashSet<>(); + HashSet<GTRecipe> toAdd = new HashSet<>(); + + deleteCALRecipesAndTags(); + rebuildCircuitAssemblerMap(toRem, toAdd); + exchangeRecipesInList(toRem, toAdd); + makeCircuitImprintRecipes(); + + toRem = null; + toAdd = null; + } + + private static void reAddOriginalRecipes() { + RecipeMaps.circuitAssemblerRecipes.getBackend() + .removeRecipes(MODIFIED_CAL_RECIPES); + ORIGINAL_CAL_RECIPES.forEach(RecipeMaps.circuitAssemblerRecipes::add); + ORIGINAL_CAL_RECIPES.clear(); + MODIFIED_CAL_RECIPES.clear(); + } + + private static void rebuildCircuitAssemblerMap(HashSet<GTRecipe> toRem, HashSet<GTRecipe> toAdd) { + reAddOriginalRecipes(); + RecipeMaps.circuitAssemblerRecipes.getAllRecipes() + .forEach(e -> CircuitImprintLoader.handleCircuitRecipeRebuilding(e, toRem, toAdd)); + } + + private static void handleCircuitRecipeRebuilding(GTRecipe circuitRecipe, HashSet<GTRecipe> toRem, + HashSet<GTRecipe> toAdd) { + ItemStack[] outputs = circuitRecipe.mOutputs; + boolean isOrePass = isCircuitOreDict(outputs[0]); + String unlocalizedName = outputs[0].getUnlocalizedName(); + if (isOrePass || unlocalizedName.contains("Circuit") || unlocalizedName.contains("circuit")) { + + CircuitImprintLoader.recipeTagMap + .put(CircuitImprintLoader.getTagFromStack(outputs[0]), circuitRecipe.copy()); + + Fluid solderIndalloy = FluidRegistry.getFluid("molten.indalloy140") != null + ? FluidRegistry.getFluid("molten.indalloy140") + : FluidRegistry.getFluid("molten.solderingalloy"); + + Fluid solderUEV = FluidRegistry.getFluid("molten.mutatedlivingsolder") != null + ? FluidRegistry.getFluid("molten.mutatedlivingsolder") + : FluidRegistry.getFluid("molten.solderingalloy"); + + if (circuitRecipe.mFluidInputs[0].isFluidEqual(Materials.SolderingAlloy.getMolten(0)) + || circuitRecipe.mFluidInputs[0].isFluidEqual(new FluidStack(solderIndalloy, 0)) + || circuitRecipe.mFluidInputs[0].isFluidEqual(new FluidStack(solderUEV, 0))) { + GTRecipe newRecipe = CircuitImprintLoader.reBuildRecipe(circuitRecipe); + if (newRecipe != null) BartWorksRecipeMaps.circuitAssemblyLineRecipes.addRecipe(newRecipe); + addCutoffRecipeToSets(toRem, toAdd, circuitRecipe); + } else if (circuitRecipe.mEUt > BWUtil.getTierVoltage(ConfigHandler.cutoffTier)) toRem.add(circuitRecipe); + } + } + + private static boolean isCircuitOreDict(ItemStack item) { + return BWUtil.isTieredCircuit(item) || BWUtil.getOreNames(item) + .stream() + .anyMatch(s -> "circuitPrimitiveArray".equals(s)); + } + + private static void exchangeRecipesInList(HashSet<GTRecipe> toRem, HashSet<GTRecipe> toAdd) { + toAdd.forEach(RecipeMaps.circuitAssemblerRecipes::add); + RecipeMaps.circuitAssemblerRecipes.getBackend() + .removeRecipes(toRem); + ORIGINAL_CAL_RECIPES.addAll(toRem); + MODIFIED_CAL_RECIPES.addAll(toAdd); + } + + private static void addCutoffRecipeToSets(HashSet<GTRecipe> toRem, HashSet<GTRecipe> toAdd, + GTRecipe circuitRecipe) { + if (circuitRecipe.mEUt > BWUtil.getTierVoltage(ConfigHandler.cutoffTier)) { + toRem.add(circuitRecipe); + toAdd.add(CircuitImprintLoader.makeMoreExpensive(circuitRecipe)); + } + } + + @SuppressWarnings("deprecation") + public static GTRecipe makeMoreExpensive(GTRecipe original) { + GTRecipe newRecipe = original.copy(); + for (ItemStack is : newRecipe.mInputs) { + if (!BWUtil.isTieredCircuit(is)) { + is.stackSize = Math.min(is.stackSize * 6, 64); + if (is.stackSize > is.getItem() + .getItemStackLimit() || is.stackSize > is.getMaxStackSize()) is.stackSize = is.getMaxStackSize(); + } + } + newRecipe.mFluidInputs[0].amount *= 4; + newRecipe.mDuration *= 4; + return newRecipe; + } + + public static GTRecipe reBuildRecipe(GTRecipe original) { + ItemStack[] in = new ItemStack[6]; + BiMap<ItemList, Short> inversed = CircuitImprintLoader.circuitIIconRefs.inverse(); + + for (int i = 0; i < 6; i++) { + try { + replaceCircuits(inversed, original, in, i); + replaceComponents(in, original, i); + } catch (ArrayIndexOutOfBoundsException e) { + break; + } catch (NullPointerException e) { + e.printStackTrace(); + } + } + + if (CircuitImprintLoader.checkForBlacklistedComponents(in)) { + return null; + } + + return new GTRecipe( + false, + in, + new ItemStack[] { getOutputMultiplied(original) }, + BWMetaItems.getCircuitParts() + .getStackWithNBT(CircuitImprintLoader.getTagFromStack(original.mOutputs[0]), 0, 0), + null, + original.mFluidInputs, + null, + original.mDuration * 12, + original.mEUt, + 0); + } + + private static ItemStack getOutputMultiplied(GTRecipe original) { + ItemStack out = original.copy() + .getOutput(0); + out.stackSize *= 16; + return out; + } + + private static void replaceCircuits(BiMap<ItemList, Short> inversed, GTRecipe original, ItemStack[] in, int index) { + for (ItemList il : inversed.keySet()) { + if (GTUtility.areStacksEqual(il.get(1), replaceCircuitParts(original.mInputs[index]))) { + in[index] = BWMetaItems.getCircuitParts() + .getStack(inversed.get(il), original.mInputs[index].stackSize); + } + } + } + + private static final List<Pair<ItemStack, ItemStack>> circuitPartsToReplace = Collections.unmodifiableList( + Arrays.asList( + new Pair<>(ItemList.Circuit_Parts_Resistor.get(1), ItemList.Circuit_Parts_ResistorSMD.get(1)), + new Pair<>(ItemList.Circuit_Parts_Diode.get(1), ItemList.Circuit_Parts_DiodeSMD.get(1)), + new Pair<>(ItemList.Circuit_Parts_Transistor.get(1), ItemList.Circuit_Parts_TransistorSMD.get(1)), + new Pair<>(ItemList.Circuit_Parts_Capacitor.get(1), ItemList.Circuit_Parts_CapacitorSMD.get(1)), + new Pair<>(ItemList.Circuit_Parts_Coil.get(1), ItemList.Circuit_Parts_InductorSMD.get(1)))); + + private static ItemStack replaceCircuitParts(ItemStack stack) { + for (Pair<ItemStack, ItemStack> pair : circuitPartsToReplace) { + if (GTUtility.areStacksEqual(pair.getKey(), stack)) { + ItemStack newStack = pair.getValue(); + newStack.stackSize = stack.stackSize; + return newStack; + } + } + return stack; + } + + @SuppressWarnings("deprecation") + private static void replaceComponents(ItemStack[] in, GTRecipe original, int index) + throws ArrayIndexOutOfBoundsException { + if (original.mInputs[index] != null && in[index] == null) { + // big wires + if (BWUtil.checkStackAndPrefix(original.mInputs[index]) + && GTOreDictUnificator.getAssociation(original.mInputs[index]).mPrefix == OrePrefixes.wireGt01) { + in[index] = GTOreDictUnificator.get( + OrePrefixes.wireGt16, + GTOreDictUnificator.getAssociation(original.mInputs[index]).mMaterial.mMaterial, + original.mInputs[index].stackSize); + // fine wires + } else if (BWUtil.checkStackAndPrefix(original.mInputs[index]) + && GTOreDictUnificator.getAssociation(original.mInputs[index]).mPrefix == OrePrefixes.wireFine) { + in[index] = GTOreDictUnificator.get( + OrePrefixes.wireGt04, + GTOreDictUnificator.getAssociation(original.mInputs[index]).mMaterial.mMaterial, + original.mInputs[index].stackSize); + if (in[index] == null) { + in[index] = GTOreDictUnificator.get( + OrePrefixes.wireFine, + GTOreDictUnificator.getAssociation(original.mInputs[index]).mMaterial.mMaterial, + original.mInputs[index].stackSize * 16); + } + // other components + } else { + in[index] = original.mInputs[index].copy(); + in[index].stackSize *= 16; + if (in[index].stackSize > in[index].getItem() + .getItemStackLimit() || in[index].stackSize > in[index].getMaxStackSize()) + in[index].stackSize = in[index].getMaxStackSize(); + } + } + } + + private static void makeCircuitImprintRecipes() { + removeOldRecipesFromRegistries(); + CircuitImprintLoader.recipeTagMap.keySet() + .forEach(e -> { + makeAndAddSlicingRecipe(e); + makeAndAddCraftingRecipes(e); + }); + } + + private static boolean checkForBlacklistedComponents(ItemStack[] itemStacks) { + for (ItemStack is : itemStacks) { + for (ItemStack is2 : CircuitImprintLoader.blacklistSet) { + if (GTUtility.areStacksEqual(is, is2)) return true; + } + } + return false; + } + + private static void removeOldRecipesFromRegistries() { + recipeWorldCache.forEach( + CraftingManager.getInstance() + .getRecipeList()::remove); + BWCoreStaticReplacementMethodes.clearRecentlyUsedRecipes(); + RecipeMaps.slicerRecipes.getBackend() + .removeRecipes(gtrecipeWorldCache); + recipeWorldCache.forEach(r -> { + try { + BWUtil.getGTBufferedRecipeList() + .remove(r); + } catch (Exception e) { + e.printStackTrace(); + } + }); + recipeWorldCache.clear(); + gtrecipeWorldCache.clear(); + } + + private static void makeAndAddSlicingRecipe(NBTTagCompound tag) { + ItemStack stack = CircuitImprintLoader.getStackFromTag(tag); + int eut = Integer.MAX_VALUE; + + for (GTRecipe recipe : CircuitImprintLoader.recipeTagMap.get(tag)) { + eut = Math.min(eut, recipe.mEUt); + } + + eut = Math.min( + eut, + BWUtil.getMachineVoltageFromTier( + BWUtil.getCircuitTierFromOreDictName( + OreDictionary.getOreName( + OreDictionary.getOreIDs(stack) != null && OreDictionary.getOreIDs(stack).length > 0 + ? OreDictionary.getOreIDs(stack)[0] + : -1)))); + GTRecipe slicingRecipe = new GTRecipe( + true, + new ItemStack[] { stack, ItemList.Shape_Slicer_Flat.get(0) }, + new ItemStack[] { BWMetaItems.getCircuitParts() + .getStackWithNBT(tag, 1, 1) }, + null, + null, + null, + null, + 300, + eut, + BWUtil.CLEANROOM); + gtrecipeWorldCache.add(slicingRecipe); + RecipeMaps.slicerRecipes.add(slicingRecipe); + } + + private static void makeAndAddCraftingRecipes(NBTTagCompound tag) { + ItemStack circuit = BWMetaItems.getCircuitParts() + .getStackWithNBT(tag, 0, 1); + Object[] imprintRecipe = { " X ", "GPG", " X ", 'P', BWMetaItems.getCircuitParts() + .getStackWithNBT(tag, 1, 1), 'G', WerkstoffLoader.Prasiolite.get(OrePrefixes.gemExquisite, 1), 'X', + BWMetaItems.getCircuitParts() + .getStack(3) }; + + IRecipe bwrecipe = new BWNBTDependantCraftingRecipe(circuit, imprintRecipe); + ShapedOreRecipe gtrecipe = BWUtil.createGTCraftingRecipe( + circuit, + GTModHandler.RecipeBits.DO_NOT_CHECK_FOR_COLLISIONS | GTModHandler.RecipeBits.KEEPNBT + | GTModHandler.RecipeBits.BUFFERED, + imprintRecipe); + + // Adds the actual recipe + recipeWorldCache.add(bwrecipe); + GameRegistry.addRecipe(bwrecipe); + // Adds the NEI visual recipe + recipeWorldCache.add(gtrecipe); + GameRegistry.addRecipe(gtrecipe); + } + + public static NBTTagCompound getTagFromStack(ItemStack stack) { + if (GTUtility.isStackValid(stack)) return BWUtil.setStackSize(stack.copy(), 1) + .writeToNBT(new NBTTagCompound()); + return new NBTTagCompound(); + } + + public static ItemStack getStackFromTag(NBTTagCompound tagCompound) { + return ItemStack.loadItemStackFromNBT(tagCompound); + } + + private static void deleteCALRecipesAndTags() { + BartWorksRecipeMaps.circuitAssemblyLineRecipes.getBackend() + .clearRecipes(); + recipeTagMap.clear(); + } +} diff --git a/src/main/java/bartworks/system/material/CircuitGeneration/CircuitPartLoader.java b/src/main/java/bartworks/system/material/CircuitGeneration/CircuitPartLoader.java new file mode 100644 index 0000000000..ea4d222cac --- /dev/null +++ b/src/main/java/bartworks/system/material/CircuitGeneration/CircuitPartLoader.java @@ -0,0 +1,265 @@ +/* + * Copyright (c) 2018-2020 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 bartworks.system.material.CircuitGeneration; + +import static gregtech.api.enums.ItemList.Circuit_Board_Advanced; +import static gregtech.api.enums.ItemList.Circuit_Board_Basic; +import static gregtech.api.enums.ItemList.Circuit_Board_Bio; +import static gregtech.api.enums.ItemList.Circuit_Board_Bio_Ultra; +import static gregtech.api.enums.ItemList.Circuit_Board_Coated; +import static gregtech.api.enums.ItemList.Circuit_Board_Coated_Basic; +import static gregtech.api.enums.ItemList.Circuit_Board_Elite; +import static gregtech.api.enums.ItemList.Circuit_Board_Epoxy; +import static gregtech.api.enums.ItemList.Circuit_Board_Epoxy_Advanced; +import static gregtech.api.enums.ItemList.Circuit_Board_Fiberglass; +import static gregtech.api.enums.ItemList.Circuit_Board_Fiberglass_Advanced; +import static gregtech.api.enums.ItemList.Circuit_Board_Multifiberglass; +import static gregtech.api.enums.ItemList.Circuit_Board_Multifiberglass_Elite; +import static gregtech.api.enums.ItemList.Circuit_Board_Optical; +import static gregtech.api.enums.ItemList.Circuit_Board_Phenolic; +import static gregtech.api.enums.ItemList.Circuit_Board_Phenolic_Good; +import static gregtech.api.enums.ItemList.Circuit_Board_Plastic; +import static gregtech.api.enums.ItemList.Circuit_Board_Plastic_Advanced; +import static gregtech.api.enums.ItemList.Circuit_Board_Wetware; +import static gregtech.api.enums.ItemList.Circuit_Board_Wetware_Extreme; +import static gregtech.api.enums.ItemList.Circuit_Chip_BioCPU; +import static gregtech.api.enums.ItemList.Circuit_Chip_Biocell; +import static gregtech.api.enums.ItemList.Circuit_Chip_CPU; +import static gregtech.api.enums.ItemList.Circuit_Chip_CrystalCPU; +import static gregtech.api.enums.ItemList.Circuit_Chip_CrystalSoC; +import static gregtech.api.enums.ItemList.Circuit_Chip_CrystalSoC2; +import static gregtech.api.enums.ItemList.Circuit_Chip_HPIC; +import static gregtech.api.enums.ItemList.Circuit_Chip_ILC; +import static gregtech.api.enums.ItemList.Circuit_Chip_LPIC; +import static gregtech.api.enums.ItemList.Circuit_Chip_NAND; +import static gregtech.api.enums.ItemList.Circuit_Chip_NOR; +import static gregtech.api.enums.ItemList.Circuit_Chip_NPIC; +import static gregtech.api.enums.ItemList.Circuit_Chip_NanoCPU; +import static gregtech.api.enums.ItemList.Circuit_Chip_NeuroCPU; +import static gregtech.api.enums.ItemList.Circuit_Chip_Optical; +import static gregtech.api.enums.ItemList.Circuit_Chip_PIC; +import static gregtech.api.enums.ItemList.Circuit_Chip_PPIC; +import static gregtech.api.enums.ItemList.Circuit_Chip_QPIC; +import static gregtech.api.enums.ItemList.Circuit_Chip_QuantumCPU; +import static gregtech.api.enums.ItemList.Circuit_Chip_Ram; +import static gregtech.api.enums.ItemList.Circuit_Chip_Simple_SoC; +import static gregtech.api.enums.ItemList.Circuit_Chip_SoC; +import static gregtech.api.enums.ItemList.Circuit_Chip_SoC2; +import static gregtech.api.enums.ItemList.Circuit_Chip_Stemcell; +import static gregtech.api.enums.ItemList.Circuit_Chip_UHPIC; +import static gregtech.api.enums.ItemList.Circuit_Chip_ULPIC; +import static gregtech.api.enums.ItemList.Circuit_Integrated; +import static gregtech.api.enums.ItemList.Circuit_Integrated_Good; +import static gregtech.api.enums.ItemList.Circuit_Parts_Advanced; +import static gregtech.api.enums.ItemList.Circuit_Parts_CapacitorASMD; +import static gregtech.api.enums.ItemList.Circuit_Parts_CapacitorSMD; +import static gregtech.api.enums.ItemList.Circuit_Parts_CapacitorXSMD; +import static gregtech.api.enums.ItemList.Circuit_Parts_Chip_Bioware; +import static gregtech.api.enums.ItemList.Circuit_Parts_Crystal_Chip_Elite; +import static gregtech.api.enums.ItemList.Circuit_Parts_Crystal_Chip_Master; +import static gregtech.api.enums.ItemList.Circuit_Parts_Crystal_Chip_Wetware; +import static gregtech.api.enums.ItemList.Circuit_Parts_DiodeASMD; +import static gregtech.api.enums.ItemList.Circuit_Parts_DiodeSMD; +import static gregtech.api.enums.ItemList.Circuit_Parts_DiodeXSMD; +import static gregtech.api.enums.ItemList.Circuit_Parts_GlassFiber; +import static gregtech.api.enums.ItemList.Circuit_Parts_InductorASMD; +import static gregtech.api.enums.ItemList.Circuit_Parts_InductorSMD; +import static gregtech.api.enums.ItemList.Circuit_Parts_InductorXSMD; +import static gregtech.api.enums.ItemList.Circuit_Parts_PetriDish; +import static gregtech.api.enums.ItemList.Circuit_Parts_ResistorASMD; +import static gregtech.api.enums.ItemList.Circuit_Parts_ResistorSMD; +import static gregtech.api.enums.ItemList.Circuit_Parts_ResistorXSMD; +import static gregtech.api.enums.ItemList.Circuit_Parts_TransistorASMD; +import static gregtech.api.enums.ItemList.Circuit_Parts_TransistorSMD; +import static gregtech.api.enums.ItemList.Circuit_Parts_TransistorXSMD; +import static gregtech.api.enums.ItemList.Circuit_Parts_Vacuum_Tube; +import static gregtech.api.enums.ItemList.Circuit_Parts_Wiring_Advanced; +import static gregtech.api.enums.ItemList.Circuit_Parts_Wiring_Basic; +import static gregtech.api.enums.ItemList.Circuit_Parts_Wiring_Elite; +import static gregtech.api.enums.ItemList.Optical_Cpu_Containment_Housing; +import static gregtech.api.enums.ItemList.Optically_Compatible_Memory; +import static gregtech.api.enums.ItemList.Optically_Perfected_CPU; +import static gregtech.api.enums.ItemList.values; +import static gregtech.api.recipe.RecipeMaps.assemblerRecipes; +import static gregtech.api.util.GTRecipeBuilder.SECONDS; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +import net.minecraft.item.ItemStack; + +import bartworks.client.renderer.BWItemRenderer; +import cpw.mods.fml.common.FMLCommonHandler; +import gregtech.api.enums.GTValues; +import gregtech.api.enums.ItemList; +import gregtech.api.enums.Materials; +import gregtech.api.enums.TierEU; +import gregtech.api.util.GTLanguageManager; +import gregtech.api.util.GTUtility; + +public class CircuitPartLoader implements Runnable { + + @Override + public void run() { + CircuitPartLoader.makeCircuitParts(); + if (FMLCommonHandler.instance() + .getEffectiveSide() + .isClient()) new BWItemRenderer(); + } + + public static void makeCircuitParts() { + ItemList[] itemLists = values(); + for (ItemList single : itemLists) { + if (!single.hasBeenSet()) continue; + if (single.toString() + .contains("Wafer") + || single.toString() + .contains("Circuit_Silicon_Ingot") + || single.toString() + .contains("Raw") + || single.toString() + .contains("raw") + || single.toString() + .contains("Glass_Tube") + || single == Circuit_Parts_GlassFiber + || single == Circuit_Parts_Advanced + || single == Circuit_Parts_Wiring_Advanced + || single == Circuit_Parts_Wiring_Elite + || single == Circuit_Parts_Wiring_Basic + || single == Circuit_Integrated + || single == Circuit_Parts_PetriDish + || single == Circuit_Parts_Vacuum_Tube + || single == Circuit_Integrated_Good) { + + CircuitImprintLoader.blacklistSet.add(single.get(1)); + } + } + + for (ItemList single : CIRCUIT_PARTS) { + if (!single.hasBeenSet()) continue; + ItemStack itemStack = single.get(1); + if (!GTUtility.isStackValid(itemStack)) continue; + ArrayList<String> toolTip = new ArrayList<>(); + if (FMLCommonHandler.instance() + .getEffectiveSide() + .isClient()) + single.getItem() + .addInformation( + single.get(1) + .copy(), + null, + toolTip, + true); + String tt = !toolTip.isEmpty() ? toolTip.get(0) : ""; + // tt += "Internal Name = "+single; + String localised = GTLanguageManager + .getTranslation(GTLanguageManager.getTranslateableItemStackName(itemStack)); + BWMetaItems.getCircuitParts() + .addItem(CircuitImprintLoader.reverseIDs, "Wrap of " + localised + "s", tt); + + GTValues.RA.stdBuilder() + .itemInputs( + single.get(16) + .copy(), + GTUtility.getIntegratedCircuit(16)) + .itemOutputs( + BWMetaItems.getCircuitParts() + .getStack(CircuitImprintLoader.reverseIDs)) + .fluidInputs(Materials.Plastic.getMolten(72)) + .duration(30 * SECONDS) + .eut(TierEU.RECIPE_LV) + .addTo(assemblerRecipes); + + CircuitImprintLoader.circuitIIconRefs.put(CircuitImprintLoader.reverseIDs, single); + CircuitImprintLoader.reverseIDs--; + } + } + + /** + * Contains all the circuit parts we want to generate wrapped version of. New entries MUST be placed at the END of + * this list, to prevent id shift. + */ + private static final List<ItemList> CIRCUIT_PARTS = Collections.unmodifiableList( + Arrays.asList( + Circuit_Board_Basic, + Circuit_Board_Advanced, + Circuit_Board_Elite, + Circuit_Parts_Crystal_Chip_Elite, + Circuit_Parts_Crystal_Chip_Master, + Circuit_Board_Coated, + Circuit_Board_Coated_Basic, + Circuit_Board_Phenolic, + Circuit_Board_Phenolic_Good, + Circuit_Board_Epoxy, + Circuit_Board_Epoxy_Advanced, + Circuit_Board_Fiberglass, + Circuit_Board_Fiberglass_Advanced, + Circuit_Board_Multifiberglass_Elite, + Circuit_Board_Multifiberglass, + Circuit_Board_Wetware, + Circuit_Board_Wetware_Extreme, + Circuit_Board_Plastic, + Circuit_Board_Plastic_Advanced, + Circuit_Board_Bio, + Circuit_Board_Bio_Ultra, + Circuit_Parts_ResistorSMD, + Circuit_Parts_InductorSMD, + Circuit_Parts_DiodeSMD, + Circuit_Parts_TransistorSMD, + Circuit_Parts_CapacitorSMD, + Circuit_Parts_ResistorASMD, + Circuit_Parts_DiodeASMD, + Circuit_Parts_TransistorASMD, + Circuit_Parts_CapacitorASMD, + Circuit_Chip_ILC, + Circuit_Chip_Ram, + Circuit_Chip_NAND, + Circuit_Chip_NOR, + Circuit_Chip_CPU, + Circuit_Chip_SoC, + Circuit_Chip_SoC2, + Circuit_Chip_PIC, + Circuit_Chip_Simple_SoC, + Circuit_Chip_HPIC, + Circuit_Chip_UHPIC, + Circuit_Chip_ULPIC, + Circuit_Chip_LPIC, + Circuit_Chip_NPIC, + Circuit_Chip_PPIC, + Circuit_Chip_QPIC, + Circuit_Chip_NanoCPU, + Circuit_Chip_QuantumCPU, + Circuit_Chip_CrystalCPU, + Circuit_Chip_CrystalSoC, + Circuit_Chip_CrystalSoC2, + Circuit_Chip_NeuroCPU, + Circuit_Chip_BioCPU, + Circuit_Chip_Stemcell, + Circuit_Chip_Biocell, + Circuit_Parts_ResistorXSMD, + Circuit_Parts_DiodeXSMD, + Circuit_Parts_TransistorXSMD, + Circuit_Parts_CapacitorXSMD, + Circuit_Parts_InductorASMD, + Circuit_Parts_InductorXSMD, + Circuit_Chip_Optical, + Circuit_Board_Optical, + Optically_Perfected_CPU, + Optical_Cpu_Containment_Housing, + Optically_Compatible_Memory, + Circuit_Parts_Crystal_Chip_Wetware, + Circuit_Parts_Chip_Bioware)); +} diff --git a/src/main/java/bartworks/system/material/TileEntityMetaGeneratedBlock.java b/src/main/java/bartworks/system/material/TileEntityMetaGeneratedBlock.java new file mode 100644 index 0000000000..c37613aa17 --- /dev/null +++ b/src/main/java/bartworks/system/material/TileEntityMetaGeneratedBlock.java @@ -0,0 +1,71 @@ +/* + * Copyright (c) 2018-2020 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 bartworks.system.material; + +import java.util.ArrayList; + +import net.minecraft.block.Block; +import net.minecraft.init.Blocks; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.network.Packet; +import net.minecraft.tileentity.TileEntity; + +import bartworks.MainMod; +import bartworks.common.net.MetaBlockPacket; +import gregtech.api.interfaces.tileentity.ITexturedTileEntity; + +public abstract class TileEntityMetaGeneratedBlock extends TileEntity implements ITexturedTileEntity { + + public short mMetaData; + + @Override + public boolean canUpdate() { + return false; + } + + @Override + public void readFromNBT(NBTTagCompound aNBT) { + super.readFromNBT(aNBT); + this.mMetaData = aNBT.getShort("m"); + } + + @Override + public void writeToNBT(NBTTagCompound aNBT) { + super.writeToNBT(aNBT); + aNBT.setShort("m", this.mMetaData); + } + + @Override + public Packet getDescriptionPacket() { + if (!this.worldObj.isRemote) MainMod.BW_Network_instance.sendPacketToAllPlayersInRange( + this.worldObj, + new MetaBlockPacket(this.xCoord, (short) this.yCoord, this.zCoord, this.mMetaData), + this.xCoord, + this.zCoord); + return null; + } + + protected abstract Block GetProperBlock(); + + public ArrayList<ItemStack> getDrops(int aFortune) { + ArrayList<ItemStack> rList = new ArrayList<>(); + if (this.mMetaData <= 0) { + rList.add(new ItemStack(Blocks.cobblestone, 1, 0)); + return rList; + } + rList.add(new ItemStack(this.GetProperBlock(), 1, this.mMetaData)); + return rList; + } +} diff --git a/src/main/java/bartworks/system/material/Werkstoff.java b/src/main/java/bartworks/system/material/Werkstoff.java new file mode 100644 index 0000000000..1c29d52a92 --- /dev/null +++ b/src/main/java/bartworks/system/material/Werkstoff.java @@ -0,0 +1,1263 @@ +/* + * Copyright (c) 2018-2020 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 bartworks.system.material; + +import static gregtech.api.enums.Mods.GalaxySpace; +import static net.minecraft.util.EnumChatFormatting.DARK_PURPLE; +import static net.minecraft.util.EnumChatFormatting.GREEN; + +import java.nio.ByteBuffer; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.HashMap; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Locale; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +import net.minecraft.item.ItemStack; +import net.minecraftforge.fluids.FluidStack; + +import bartworks.MainMod; +import bartworks.system.oredict.OreDictHandler; +import bartworks.util.BWColorUtil; +import bartworks.util.BWUtil; +import bartworks.util.MurmurHash3; +import bartworks.util.NonNullWrappedHashMap; +import bartworks.util.Pair; +import bwcrossmod.BartWorksCrossmod; +import bwcrossmod.tgregworks.MaterialsInjector; +import cpw.mods.fml.common.Loader; +import gregtech.api.GregTechAPI; +import gregtech.api.enums.FluidState; +import gregtech.api.enums.Materials; +import gregtech.api.enums.Mods; +import gregtech.api.enums.OrePrefixes; +import gregtech.api.enums.SubTag; +import gregtech.api.enums.TCAspects; +import gregtech.api.enums.TextureSet; +import gregtech.api.interfaces.IColorModulationContainer; +import gregtech.api.interfaces.ISubTagContainer; +import gregtech.api.util.GTLanguageManager; +import gregtech.api.util.GTOreDictUnificator; +import thaumcraft.api.aspects.Aspect; + +public class Werkstoff implements IColorModulationContainer, ISubTagContainer { + + public static final LinkedHashSet<Werkstoff> werkstoffHashSet = new LinkedHashSet<>(); + public static final LinkedHashMap<Short, Werkstoff> werkstoffHashMap = new LinkedHashMap<>(); + public static final LinkedHashMap<String, Werkstoff> werkstoffNameHashMap = new LinkedHashMap<>(); + + public static final Map<String, String> modNameOverrides = new HashMap<>() { + + private static final long serialVersionUID = 6399917619058898648L; + + { + this.put(GalaxySpace.ID, DARK_PURPLE + "GalaxySpace"); + } + }; + + private static final List<String> BWModNames = Arrays + .asList(MainMod.NAME, BartWorksCrossmod.NAME, MaterialsInjector.NAME); + + private static final HashSet<Short> idHashSet = new HashSet<>(); + + private static final Werkstoff.Stats DEFAULT_NULL_STATS = new Werkstoff.Stats(); + private static final Werkstoff.GenerationFeatures DEFAULT_NULL_GENERATION_FEATURES = new Werkstoff.GenerationFeatures() + .disable(); + public static Werkstoff default_null_Werkstoff; + + private final HashSet<String> ADDITIONAL_OREDICT = new HashSet<>(); + private final List<ISubTagContainer> mOreByProducts = new ArrayList<>(); + private final LinkedHashSet<Pair<ISubTagContainer, Integer>> CONTENTS = new LinkedHashSet<>(); + private final HashSet<SubTag> SUBTAGS = new HashSet<>(); + private byte[] rgb = new byte[3]; + private final String defaultName; + private String toolTip; + + private Werkstoff.Stats stats; + private final Werkstoff.Types type; + private final Werkstoff.GenerationFeatures generationFeatures; + private final short mID; + private final TextureSet texSet; + private Materials bridgeMaterial; + private final String owner; + + public Materials getBridgeMaterial() { + return this.bridgeMaterial; + } + + public void setBridgeMaterial(Materials bridgeMaterial) { + this.bridgeMaterial = bridgeMaterial; + } + + public static void init() { + Werkstoff.default_null_Werkstoff = new Werkstoff( + new short[3], + "_NULL", + "Default null Werkstoff", + Werkstoff.DEFAULT_NULL_STATS, + Werkstoff.Types.UNDEFINED, + Werkstoff.DEFAULT_NULL_GENERATION_FEATURES, + -1, + TextureSet.SET_NONE); + } + + /** + * GT Materials Bridge Constructor + * + * @param materials a GT Materials + * @param generationFeatures the new Types you want to add + * @param type - self explainatory + * @param mID > 31_766 && <= 32_767 + */ + public Werkstoff(Materials materials, Werkstoff.GenerationFeatures generationFeatures, Types type, int mID) { + this( + materials.mRGBa, + materials.mDefaultLocalName, + materials.getToolTip(), + type == null ? materials.mElement != null ? Types.ELEMENT : Types.UNDEFINED : type, + generationFeatures, + mID, + materials.mIconSet, + (List) materials.mOreByProducts, + new Pair<>(materials, 1)); + if (mID <= 31_766 || mID > 32_767) throw new IllegalArgumentException(); + this.stats.mass = materials.getMass(); + this.stats.protons = materials.getProtons(); + this.stats.meltingPoint = materials.mMeltingPoint; + this.stats.neutrons = materials.getNeutrons(); + this.stats.speedOverride = materials.mToolSpeed; + this.stats.durOverride = materials.mDurability; + this.stats.qualityOverride = materials.mToolQuality; + this.stats.setGas(materials.mHasGas); + this.stats.setRadioactive(materials.isRadioactive()); + this.stats.setBlastFurnace(materials.mBlastFurnaceRequired); + this.stats.setMeltingVoltage(120); + if (type == Types.COMPOUND) { + this.stats.setElektrolysis(true); + this.generationFeatures.addChemicalRecipes(); + } else if (type == Types.MIXTURE) { + this.stats.setCentrifuge(true); + this.generationFeatures.addMixerRecipes(); + } + } + + @SafeVarargs + public Werkstoff(short[] rgba, String defaultName, Werkstoff.Types type, int meltingpoint, + Werkstoff.GenerationFeatures generationFeatures, int mID, TextureSet texSet, + Pair<ISubTagContainer, Integer>... contents) { + this( + rgba, + defaultName, + Werkstoff.Types.getDefaultStatForType(type) + .setMeltingPoint(meltingpoint), + type, + generationFeatures, + mID, + texSet, + contents); + } + + @SafeVarargs + public Werkstoff(short[] rgba, String defaultName, Werkstoff.Types type, + Werkstoff.GenerationFeatures generationFeatures, int mID, TextureSet texSet, + Pair<ISubTagContainer, Integer>... contents) { + this( + rgba, + defaultName, + Werkstoff.Types.getDefaultStatForType(type), + type, + generationFeatures, + mID, + texSet, + contents); + } + + @SafeVarargs + public Werkstoff(short[] rgba, String defaultName, Werkstoff.Types type, int meltingpoint, + Werkstoff.GenerationFeatures generationFeatures, int mID, TextureSet texSet, + List<ISubTagContainer> oreByProduct, Pair<ISubTagContainer, Integer>... contents) { + this( + rgba, + defaultName, + Werkstoff.Types.getDefaultStatForType(type) + .setMeltingPoint(meltingpoint), + type, + generationFeatures, + mID, + texSet, + oreByProduct, + contents); + } + + @SafeVarargs + public Werkstoff(short[] rgba, String defaultName, Werkstoff.Types type, + Werkstoff.GenerationFeatures generationFeatures, int mID, TextureSet texSet, + List<ISubTagContainer> oreByProduct, Pair<ISubTagContainer, Integer>... contents) { + this( + rgba, + defaultName, + Werkstoff.Types.getDefaultStatForType(type), + type, + generationFeatures, + mID, + texSet, + oreByProduct, + contents); + } + + @SafeVarargs + public Werkstoff(short[] rgba, String toolTip, String defaultName, Werkstoff.Types type, + Werkstoff.GenerationFeatures generationFeatures, int mID, TextureSet texSet, + List<ISubTagContainer> oreByProduct, Pair<ISubTagContainer, Integer>... contents) { + this( + rgba, + toolTip, + defaultName, + Werkstoff.Types.getDefaultStatForType(type), + type, + generationFeatures, + mID, + texSet, + oreByProduct, + contents); + } + + @SafeVarargs + public Werkstoff(short[] rgba, String defaultName, Werkstoff.Stats stats, Werkstoff.Types type, + Werkstoff.GenerationFeatures generationFeatures, int mID, TextureSet texSet, + List<ISubTagContainer> oreByProduct, Pair<ISubTagContainer, Integer>... contents) { + this(rgba, defaultName, "", stats, type, generationFeatures, mID, texSet, contents); + this.mOreByProducts.clear(); + this.mOreByProducts.addAll(oreByProduct); + } + + @SafeVarargs + public Werkstoff(short[] rgba, String defaultName, Werkstoff.Stats stats, Werkstoff.Types type, + Werkstoff.GenerationFeatures generationFeatures, int mID, TextureSet texSet, + Pair<ISubTagContainer, Integer>... contents) { + this(rgba, defaultName, "", stats, type, generationFeatures, mID, texSet, contents); + } + + @SafeVarargs + public Werkstoff(short[] rgba, String defaultName, String toolTip, Werkstoff.Stats stats, Werkstoff.Types type, + Werkstoff.GenerationFeatures generationFeatures, int mID, TextureSet texSet, + List<ISubTagContainer> oreByProduct, Pair<ISubTagContainer, Integer>... contents) { + this(rgba, defaultName, toolTip, stats, type, generationFeatures, mID, texSet, contents); + this.mOreByProducts.clear(); + this.mOreByProducts.addAll(oreByProduct); + } + + @SafeVarargs + public Werkstoff(short[] rgba, String defaultName, String toolTip, Werkstoff.Stats stats, Werkstoff.Types type, + Werkstoff.GenerationFeatures generationFeatures, int mID, TextureSet texSet, + Pair<ISubTagContainer, Integer>... contents) { + + if (Werkstoff.idHashSet.contains((short) mID)) + throw new UnsupportedOperationException("ID (" + mID + ") is already in use!"); + Werkstoff.idHashSet.add((short) mID); + if (type == null) type = Werkstoff.Types.UNDEFINED; + + this.mID = (short) mID; + this.defaultName = defaultName; + // Ensure that localization key are written to the lang file + GregTechAPI.sAfterGTPreload.add(() -> { this.getLocalizedName(); }); + this.stats = stats; + this.type = type; + this.generationFeatures = generationFeatures; + this.setRgb(BWColorUtil.correctCorlorArray(rgba)); + this.CONTENTS.addAll(Arrays.asList(contents)); + this.toolTip = ""; + if (toolTip.isEmpty()) { + for (Pair<ISubTagContainer, Integer> p : contents) { + if (contents.length > 1) { + if (p.getKey() instanceof Materials) { + if (((Materials) p.getKey()).mMaterialList.size() > 1 && p.getValue() > 1) + this.toolTip += "(" + getFormula((Materials) p.getKey()) + + ")" + + BWUtil.subscriptNumber(p.getValue()); + else this.toolTip += getFormula((Materials) p.getKey()) + + (p.getValue() > 1 ? BWUtil.subscriptNumber(p.getValue()) : ""); + } + if (p.getKey() instanceof Werkstoff) { + if (((Werkstoff) p.getKey()).CONTENTS.size() > 1 && p.getValue() > 1) + this.toolTip += "(" + getFormula((Werkstoff) p.getKey()) + + ")" + + BWUtil.subscriptNumber(p.getValue()); + else this.toolTip += getFormula((Werkstoff) p.getKey()) + + (p.getValue() > 1 ? BWUtil.subscriptNumber(p.getValue()) : ""); + } + } else if (p.getKey() instanceof Materials) { + this.toolTip += getFormula((Materials) p.getKey()) + + (p.getValue() > 1 ? BWUtil.subscriptNumber(p.getValue()) : ""); + } else if (p.getKey() instanceof Werkstoff) this.toolTip += getFormula((Werkstoff) p.getKey()) + + (p.getValue() > 1 ? BWUtil.subscriptNumber(p.getValue()) : ""); + } + } else this.toolTip = toolTip; + + // if (this.toolTip.length() > 25) + // this.toolTip = "The formula is to long..."; + + // Ensure that localization key are written to the lang file + GregTechAPI.sAfterGTPreload.add(() -> { this.getLocalizedToolTip(); }); + + if (this.stats.protons == 0) { + long tmpprotons = 0; + for (Pair<ISubTagContainer, Integer> p : contents) { + if (p.getKey() instanceof Materials) { + tmpprotons += ((Materials) p.getKey()).getProtons() * p.getValue(); + } else if (p.getKey() instanceof Werkstoff) { + tmpprotons += ((Werkstoff) p.getKey()).getStats().protons * p.getValue(); + } + } + this.stats = stats.setProtons(tmpprotons); + } + if (this.stats.mass == 0) { + long tmpmass = 0; + int count = 0; + for (Pair<ISubTagContainer, Integer> p : contents) { + if (p.getKey() instanceof Materials) { + tmpmass += ((Materials) p.getKey()).getMass() * p.getValue(); + count += p.getValue(); + } else if (p.getKey() instanceof Werkstoff) { + tmpmass += ((Werkstoff) p.getKey()).getStats().mass * p.getValue(); + count += p.getValue(); + } + } + if (count > 0) this.stats = stats.setMass(tmpmass / count); + } + + if (this.stats.meltingPoint == 0) this.stats.meltingPoint = 1123; + + if (this.stats.meltingVoltage == 0) this.stats.meltingVoltage = 120; + + this.texSet = texSet; + + switch (this.mOreByProducts.size()) { + case 0: + this.mOreByProducts.add(this); + this.mOreByProducts.add(this); + this.mOreByProducts.add(this); + break; + case 1: + this.mOreByProducts.add(this); + this.mOreByProducts.add(this); + break; + case 2: + this.mOreByProducts.add(this); + break; + } + + Optional<Pair<ISubTagContainer, Integer>> firstContent; + if (this.CONTENTS.size() == 1 && (firstContent = this.CONTENTS.stream() + .findFirst()).isPresent()) { + ISubTagContainer firstContentSubTagContainer = firstContent.get() + .getKey(); + if (firstContent.get() + .getValue() == 1 && firstContentSubTagContainer instanceof Materials) this.getGenerationFeatures() + .setExtension(); + } + + Werkstoff.werkstoffHashSet.add(this); + Werkstoff.werkstoffHashMap.put(this.mID, this); + Werkstoff.werkstoffNameHashMap.put(this.defaultName, this); + + this.owner = this.getMaterialOwner(); + } + + private static String getFormula(Materials material) { + return material.mChemicalFormula.isEmpty() ? "?" : material.mChemicalFormula; + } + + private static String getFormula(Werkstoff material) { + return material.toolTip.isEmpty() ? "?" : material.toolTip; + } + + public Werkstoff addAdditionalOreDict(String s) { + this.ADDITIONAL_OREDICT.add(s); + return this; + } + + public HashSet<String> getADDITIONAL_OREDICT() { + return this.ADDITIONAL_OREDICT; + } + + public void setTCAspects(Pair<Object, Integer>... pAspectsArr) { + this.stats.mTC_Aspects = pAspectsArr; + } + + @SuppressWarnings("unchecked") + public Pair<Object, Integer>[] getTCAspects(int ratio) { + if (this.stats.mTC_Aspects == null) { + HashSet<TCAspects.TC_AspectStack> tc_aspectStacks = new HashSet<>(); + HashSet<Pair<Object, Integer>> set = new HashSet<>(); + for (Pair<?, ?> p : this.getContents() + .getValue()) { + if (p.getKey() instanceof Materials) tc_aspectStacks.addAll(((Materials) p.getKey()).mAspects); + if (p.getKey() instanceof Werkstoff) set.addAll(Arrays.asList(((Werkstoff) p.getKey()).getTCAspects())); + } + tc_aspectStacks.forEach( + tc_aspectStack -> set.add(new Pair<>(tc_aspectStack.mAspect.mAspect, (int) tc_aspectStack.mAmount))); + this.stats.mTC_Aspects = set.toArray(new Pair[0]); + } + Pair<Object, Integer>[] ret = this.stats.mTC_Aspects.clone(); + for (int i = 0; i < ret.length; i++) { + ret[i] = ret[i].copyWithNewValue(ret[i].getValue() * ratio); + } + return ret; + } + + public List<TCAspects.TC_AspectStack> getGTWrappedTCAspects() { + final List<TCAspects.TC_AspectStack> ret = new ArrayList<>(); + Arrays.stream(this.getTCAspects()) + .forEach(objectIntegerPair -> { + new TCAspects.TC_AspectStack( + TCAspects.valueOf( + ((Aspect) objectIntegerPair.getKey()).getName() + .toUpperCase(Locale.US)), + objectIntegerPair.getValue()).addToAspectList(ret); + }); + return ret; + } + + public Pair<Object, Integer>[] getTCAspects() { + return this.getTCAspects(1); + } + + public Werkstoff.Types getType() { + 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) { + case COMPOUND: + case MIXTURE: + case BIOLOGICAL: { + for (int i = 0; i < this.CONTENTS.toArray().length; i++) { + ret += (int) this.CONTENTS.toArray(new Pair[0])[i].getValue(); + } + break; + } + default: + ret = 1; + break; + } + return new Pair<>(ret, this.CONTENTS); + } + + public int getNoOfByProducts() { + return this.mOreByProducts.size(); + } + + public ISubTagContainer getOreByProductRaw(int aNumber) { + if (this.mOreByProducts.size() == 0) return null; + if (aNumber < 0) aNumber = this.mOreByProducts.size() + aNumber; + while (aNumber >= this.mOreByProducts.size()) aNumber--; + ISubTagContainer o = this.mOreByProducts.get(aNumber); + if (o == null || o.equals(Werkstoff.default_null_Werkstoff) || o.equals(Materials._NULL)) return this; + return o; + } + + public ItemStack getOreByProduct(int aNumber, OrePrefixes prefixes) { + if (this.mOreByProducts.size() == 0) return null; + if (aNumber < 0) aNumber = this.mOreByProducts.size() + aNumber; + while (aNumber >= this.mOreByProducts.size()) aNumber--; + Object o = this.mOreByProducts.get(aNumber); + if (o == null || o.equals(Werkstoff.default_null_Werkstoff) || o.equals(Materials._NULL)) + return this.get(prefixes); + if (o instanceof Werkstoff) return WerkstoffLoader.getCorrespondingItemStack(prefixes, (Werkstoff) o); + if (o instanceof Materials) return GTOreDictUnificator.get(prefixes, o, 1L); + return null; + } + + public String getDefaultName() { + return this.defaultName; + } + + public String getLocalizedName() { + return GTLanguageManager.addStringLocalization( + String.format("bw.werkstoff.%05d.name", this.mID), + this.defaultName, + !GregTechAPI.sPostloadFinished); + } + + public String getVarName() { + return this.defaultName.replace(" ", ""); + } + + public String getToolTip() { + return this.toolTip; + } + + public String getLocalizedToolTip() { + return GTLanguageManager.addStringLocalization( + String.format("bw.werkstoff.%05d.tooltip", this.mID), + this.toolTip, + !GregTechAPI.sPostloadFinished); + } + + public Werkstoff.Stats getStats() { + return this.stats; + } + + public short getmID() { + return this.mID; + } + + public short getMixCircuit() { + return this.getGenerationFeatures().mixCircuit; + } + + public Werkstoff.GenerationFeatures getGenerationFeatures() { + return this.generationFeatures; + } + + public TextureSet getTexSet() { + return this.texSet; + } + + public void setRgb(short[] rgb) { + this.rgb = new byte[] { (byte) (rgb[0] - 128), (byte) (rgb[1] - 128), (byte) (rgb[2] - 128) }; + } + + @Override + public short[] getRGBA() { + return new short[] { (short) (this.rgb[0] + 128), (short) (this.rgb[1] + 128), (short) (this.rgb[2] + 128), 0 }; + } + + @Override + public boolean contains(SubTag subTag) { + if (!subTag.equals(WerkstoffLoader.NOBLE_GAS) && !subTag.equals(WerkstoffLoader.ANAEROBE_GAS) + && !subTag.equals(WerkstoffLoader.NO_BLAST)) + for (Pair<ISubTagContainer, Integer> p : this.CONTENTS) if (p.getKey() + .contains(subTag)) return true; + return this.SUBTAGS.contains(subTag); + } + + @Override + public ISubTagContainer add(SubTag... subTags) { + this.SUBTAGS.addAll(Arrays.asList(subTags)); + return this; + } + + @Override + public boolean remove(SubTag subTag) { + return this.SUBTAGS.remove(subTag); + } + + public void getAndAddToCollection(OrePrefixes prefixes, int amount, Collection<ItemStack> stacks) { + stacks.add(this.get(prefixes, amount)); + } + + public ItemStack get(OrePrefixes prefixes) { + return WerkstoffLoader.getCorrespondingItemStack(prefixes, this); + } + + public FluidStack getFluidOrGas(int fluidAmount) { + return new FluidStack(Objects.requireNonNull(WerkstoffLoader.fluids.get(this)), fluidAmount); + } + + public FluidStack getMolten(int fluidAmount) { + return new FluidStack(Objects.requireNonNull(WerkstoffLoader.molten.get(this)), fluidAmount); + } + + public ItemStack get(OrePrefixes prefixes, int amount) { + return WerkstoffLoader.getCorrespondingItemStack(prefixes, this, amount); + } + + public byte getToolQuality() { + return this.stats.getQualityOverride() > 0 ? this.stats.getQualityOverride() + : (byte) (15f * (this.getStats() + .getProtons() / 188f + + this.getStats() + .getMeltingPoint() / 10801f) + / (float) this.getContents() + .getKey()); + } + + public float getToolSpeed() { + return this.stats.getSpeedOverride() > 0f ? this.stats.getSpeedOverride() + : Math.max( + 1f, + 2f * (-this.getStats() + .getMass() + 0.1f + * this.getStats() + .getMeltingPoint() + + this.getStats() + .getProtons()) + * 0.1f + / (float) this.getContents() + .getKey() + * 0.1f + * this.getToolQuality()); + } + + public int getDurability() { + return this.stats.getDurOverride() > 0 ? this.stats.getDurOverride() + : (int) (this.stats.durMod * (0.01f * this.getStats() + .getMeltingPoint() + * this.getStats() + .getMass() + / (float) this.getContents() + .getKey())); + } + + /** + * Checks if the generation feature is enabled and if its not in the blacklist + */ + public boolean hasItemType(OrePrefixes prefixes) { + int unpacked = Werkstoff.GenerationFeatures.getPrefixDataRaw(prefixes); + return (this.getGenerationFeatures().toGenerate & unpacked) != 0 + && (this.getGenerationFeatures().blacklist & unpacked) == 0; + } + + /** + * DOES NOT CHECK BLACKLIST! + */ + public boolean hasGenerationFeature(OrePrefixes prefixes) { + int unpacked = Werkstoff.GenerationFeatures.getPrefixDataRaw(prefixes); + return (this.getGenerationFeatures().toGenerate & unpacked) != 0; + } + + /** + * Checks if the Actual Stack exists in the OreDict + */ + public boolean doesOreDictedItemExists(OrePrefixes prefixes) { + return OreDictHandler.getItemStack(this.getDefaultName(), prefixes, 1) != null; + } + + public String getOwner() { + return this.owner; + } + + private String getMaterialOwner() { + String modName = Loader.instance() + .activeModContainer() + .getName(); + if (modNameOverrides.get(modName) != null) { + return modNameOverrides.get(modName); + } + if (BWModNames.contains(modName)) { + return null; + } + return GREEN + modName; + } + + public enum Types { + + MATERIAL, + COMPOUND, + MIXTURE, + BIOLOGICAL, + ELEMENT, + ISOTOPE, + UNDEFINED; + + public static Werkstoff.Stats getDefaultStatForType(Werkstoff.Types T) { + return switch (T) { + case COMPOUND, BIOLOGICAL -> new Werkstoff.Stats().setElektrolysis(true); + case MIXTURE -> new Werkstoff.Stats().setCentrifuge(true); + default -> new Werkstoff.Stats(); + }; + } + } + + public static class GenerationFeatures { + + public static final GenerationFeatures DISABLED = new GenerationFeatures().disable(); + long toGenerate = 0b0001001; + // logic gate shit + /* + * dust 1 metal 10 (ingot, nugget) gem 100 ore 1000 cell 10000 plasma 100000 molten 1000000 crafting metal + * 10000000 (sticks, plates) meta crafting metal 100000000 (gears, screws, bolts, springs) multiple ingotWorth + * stuff 1000000000 (double, triple, quadruple, ingot/plates) + */ + private boolean isExtension; + private static final NonNullWrappedHashMap<OrePrefixes, Integer> prefixLogic = new NonNullWrappedHashMap<>(0); + + public GenerationFeatures() {} + + public static void initPrefixLogic() { + Arrays.stream(OrePrefixes.values()) + .forEach(e -> prefixLogic.put(e, 0)); + Werkstoff.GenerationFeatures.prefixLogic.put(OrePrefixes.dust, 0b1); + Werkstoff.GenerationFeatures.prefixLogic.put(OrePrefixes.dustTiny, 0b1); + Werkstoff.GenerationFeatures.prefixLogic.put(OrePrefixes.dustSmall, 0b1); + + Werkstoff.GenerationFeatures.prefixLogic.put(OrePrefixes.ingot, 0b10); + Werkstoff.GenerationFeatures.prefixLogic.put(OrePrefixes.ingotHot, 0b10); + Werkstoff.GenerationFeatures.prefixLogic.put(OrePrefixes.nugget, 0b10); + + Werkstoff.GenerationFeatures.prefixLogic.put(OrePrefixes.gem, 0b100); + Werkstoff.GenerationFeatures.prefixLogic.put(OrePrefixes.gemFlawed, 0b100); + Werkstoff.GenerationFeatures.prefixLogic.put(OrePrefixes.gemExquisite, 0b100); + Werkstoff.GenerationFeatures.prefixLogic.put(OrePrefixes.gemChipped, 0b100); + Werkstoff.GenerationFeatures.prefixLogic.put(OrePrefixes.gemFlawless, 0b100); + Werkstoff.GenerationFeatures.prefixLogic.put(OrePrefixes.lens, 0b100); + + Werkstoff.GenerationFeatures.prefixLogic.put(OrePrefixes.block, 0b110); + + Werkstoff.GenerationFeatures.prefixLogic.put(OrePrefixes.ore, 0b1000); + Werkstoff.GenerationFeatures.prefixLogic.put(OrePrefixes.dustImpure, 0b1000); + Werkstoff.GenerationFeatures.prefixLogic.put(OrePrefixes.dustPure, 0b1000); + Werkstoff.GenerationFeatures.prefixLogic.put(OrePrefixes.crushed, 0b1000); + Werkstoff.GenerationFeatures.prefixLogic.put(OrePrefixes.crushedPurified, 0b1000); + Werkstoff.GenerationFeatures.prefixLogic.put(OrePrefixes.crushedCentrifuged, 0b1000); + Werkstoff.GenerationFeatures.prefixLogic.put(OrePrefixes.rawOre, 0b1000); + + Werkstoff.GenerationFeatures.prefixLogic.put(OrePrefixes.cell, 0b10000); + if (Mods.Forestry.isModLoaded()) { + Werkstoff.GenerationFeatures.prefixLogic.put(OrePrefixes.capsule, 0b10000); + Werkstoff.GenerationFeatures.prefixLogic.put(OrePrefixes.capsuleMolten, 0b1000000); + } + // Werkstoff.GenerationFeatures.prefixLogic.put(OrePrefixes.bottle,0b10000); + + Werkstoff.GenerationFeatures.prefixLogic.put(OrePrefixes.cellMolten, 0b1000000); + + Werkstoff.GenerationFeatures.prefixLogic.put(OrePrefixes.plate, 0b10000000); + Werkstoff.GenerationFeatures.prefixLogic.put(OrePrefixes.foil, 0b10000000); + Werkstoff.GenerationFeatures.prefixLogic.put(OrePrefixes.stick, 0b10000000); + Werkstoff.GenerationFeatures.prefixLogic.put(OrePrefixes.stickLong, 0b10000000); + Werkstoff.GenerationFeatures.prefixLogic.put(OrePrefixes.toolHeadHammer, 0b10000000); + Werkstoff.GenerationFeatures.prefixLogic.put(OrePrefixes.toolHeadWrench, 0b10000000); + Werkstoff.GenerationFeatures.prefixLogic.put(OrePrefixes.toolHeadSaw, 0b10000000); + Werkstoff.GenerationFeatures.prefixLogic.put(OrePrefixes.turbineBlade, 0b10000000); + + Werkstoff.GenerationFeatures.prefixLogic.put(OrePrefixes.screw, 0b100000000); + Werkstoff.GenerationFeatures.prefixLogic.put(OrePrefixes.gearGt, 0b100000000); + Werkstoff.GenerationFeatures.prefixLogic.put(OrePrefixes.gearGtSmall, 0b100000000); + Werkstoff.GenerationFeatures.prefixLogic.put(OrePrefixes.bolt, 0b100000000); + Werkstoff.GenerationFeatures.prefixLogic.put(OrePrefixes.ring, 0b100000000); + Werkstoff.GenerationFeatures.prefixLogic.put(OrePrefixes.spring, 0b100000000); + Werkstoff.GenerationFeatures.prefixLogic.put(OrePrefixes.springSmall, 0b100000000); + Werkstoff.GenerationFeatures.prefixLogic.put(OrePrefixes.rotor, 0b100000000); + Werkstoff.GenerationFeatures.prefixLogic.put(OrePrefixes.wireFine, 0b100000000); + + Werkstoff.GenerationFeatures.prefixLogic.put(OrePrefixes.plateDouble, 0x200); + Werkstoff.GenerationFeatures.prefixLogic.put(OrePrefixes.plateTriple, 0x200); + Werkstoff.GenerationFeatures.prefixLogic.put(OrePrefixes.plateQuadruple, 0x200); + Werkstoff.GenerationFeatures.prefixLogic.put(OrePrefixes.plateQuintuple, 0x200); + Werkstoff.GenerationFeatures.prefixLogic.put(OrePrefixes.plateDense, 0x200); + Werkstoff.GenerationFeatures.prefixLogic.put(OrePrefixes.ingotDouble, 0x200); + Werkstoff.GenerationFeatures.prefixLogic.put(OrePrefixes.ingotTriple, 0x200); + Werkstoff.GenerationFeatures.prefixLogic.put(OrePrefixes.ingotQuadruple, 0x200); + Werkstoff.GenerationFeatures.prefixLogic.put(OrePrefixes.ingotQuintuple, 0x200); + + Werkstoff.GenerationFeatures.prefixLogic.put(OrePrefixes.blockCasing, 0x380); + Werkstoff.GenerationFeatures.prefixLogic.put(OrePrefixes.blockCasingAdvanced, 0x380); + } + + public void setExtension() { + this.isExtension = !this.isExtension; + } + + public static int getPrefixDataRaw(OrePrefixes prefixes) { + if (prefixes == null) throw new IllegalArgumentException("OrePrefixes is NULL!"); + return GenerationFeatures.prefixLogic.get(prefixes); + } + + public boolean isExtension() { + return this.isExtension; + } + + // public byte toGenerateSecondary = 0b0000000; + public byte blacklist; + + public boolean enforceUnification; + + /* + * Auto add Chemical Recipes 1 Auto add mixer Recipes 10 Auto add Sifter Recipe 100 Auto add + * MetalWorking(sticks, plates) Recipe 1000 Auto add MetalWorking(crafting components) Recipe 10000 + */ + public byte extraRecipes; + + /* + * Here so that new recipes don't fuck with existing functionality Auto add Crafting Metal Solidifier recipes 1 + * Auto add Meta Crafting Metal Solidifier recipes 10 Auto add Multiple Ingot Metal Solidifier recipes 100 + * (Unused) + */ + public byte extraRecipes2; + + public short mixCircuit = -1; + + public Werkstoff.GenerationFeatures setBlacklist(OrePrefixes p) { + this.blacklist |= getPrefixDataRaw(p); + return this; + } + + @Deprecated + public boolean hasDusts() { + return (this.toGenerate & 0b1) != 0; + } + + @Deprecated + public boolean hasGems() { + return (this.toGenerate & 0b100) != 0; + } + + @Deprecated + public boolean hasOres() { + return (this.toGenerate & 0b1000) != 0; + } + + public Werkstoff.GenerationFeatures enforceUnification() { + this.enforceUnification = true; + return this; + } + + @Deprecated + public Werkstoff.GenerationFeatures removeGems() { + if (this.hasGems()) this.toGenerate = this.toGenerate ^ 0b100; + return this; + } + + @Deprecated + public Werkstoff.GenerationFeatures removeDusts() { + if (this.hasDusts()) this.toGenerate = this.toGenerate ^ 0b1; + return this; + } + + @Deprecated + public Werkstoff.GenerationFeatures removeOres() { + if (this.hasOres()) this.toGenerate = this.toGenerate ^ 0b1000; + return this; + } + + public Werkstoff.GenerationFeatures addChemicalRecipes() { + this.extraRecipes = (byte) (this.extraRecipes | 1); + return this; + } + + public boolean hasChemicalRecipes() { + return (this.extraRecipes & 1) != 0; + } + + public Werkstoff.GenerationFeatures addMetalCraftingSolidifierRecipes() { + this.extraRecipes2 = (byte) (this.extraRecipes2 | 1); + return this; + } + + public boolean hasMetalCraftingSolidifierRecipes() { + return (this.extraRecipes2 & 1) != 0; + } + + public Werkstoff.GenerationFeatures addMetaSolidifierRecipes() { + this.extraRecipes2 = (byte) (this.extraRecipes2 | 10); + return this; + } + + public boolean hasMetaSolidifierRecipes() { + return (this.extraRecipes2 & 10) != 0; + } + + public Werkstoff.GenerationFeatures addMultipleMetalSolidifierRecipes() { + this.extraRecipes2 = (byte) (this.extraRecipes2 | 100); + return this; + } + + public boolean hasMultipleMetalSolidifierRecipes() { + return (this.extraRecipes2 & 100) != 0; + } + + public Werkstoff.GenerationFeatures addMixerRecipes() { + this.extraRecipes = (byte) (this.extraRecipes | 10); + return this; + } + + public Werkstoff.GenerationFeatures addMixerRecipes(short aCircuit) { + this.extraRecipes = (byte) (this.extraRecipes | 10); + if (aCircuit >= 1 && aCircuit <= 24) this.mixCircuit = aCircuit; + return this; + } + + public boolean hasMixerRecipes() { + return (this.extraRecipes & 10) != 0; + } + + public Werkstoff.GenerationFeatures addSifterRecipes() { + this.extraRecipes = (byte) (this.extraRecipes | 100); + return this; + } + + public boolean hasSifterRecipes() { + return (this.extraRecipes & 100) != 0; + } + + public Werkstoff.GenerationFeatures onlyDust() { + this.toGenerate = 0b1; + return this; + } + + /** + * Automatically adds Simple Metal Working Items + */ + public Werkstoff.GenerationFeatures addMetalItems() { + this.toGenerate = this.addSimpleMetalWorkingItems().toGenerate | 0b10; + return this; + } + + public Werkstoff.GenerationFeatures disable() { + this.toGenerate = 0; + return this; + } + + public Werkstoff.GenerationFeatures addCells() { + this.toGenerate = this.toGenerate | 0b10000; + return this; + } + + @Deprecated + public boolean hasCells() { + return (this.toGenerate & 0b10000) != 0; + } + + @Deprecated + public boolean hasMolten() { + return (this.toGenerate & 0b1000000) != 0; + } + + public Werkstoff.GenerationFeatures addMolten() { + this.toGenerate = this.toGenerate | 0b1000000; + return this; + } + + /** + * Automatically adds Simple Metal Working Items + */ + public Werkstoff.GenerationFeatures addGems() { + this.toGenerate = this.addSimpleMetalWorkingItems().toGenerate | 0x4; + return this; + } + + public Werkstoff.GenerationFeatures addSimpleMetalWorkingItems() { + this.toGenerate = this.toGenerate | 0b10000000; + return this; + } + + public Werkstoff.GenerationFeatures addCasings() { + this.toGenerate = this.toGenerate | 0x382; + return this; + } + + @Deprecated + public boolean hasSimpleMetalWorkingItems() { + return (this.toGenerate & 0b10000000) != 0; + } + + public Werkstoff.GenerationFeatures addCraftingMetalWorkingItems() { + this.toGenerate = this.toGenerate | 0x100; + return this; + } + + public Werkstoff.GenerationFeatures addMultipleIngotMetalWorkingItems() { + this.toGenerate = this.toGenerate | 0x200; + return this; + } + + public Werkstoff.GenerationFeatures addPrefix(OrePrefixes prefixes) { + this.toGenerate = this.toGenerate | getPrefixDataRaw(prefixes); + return this; + } + + public Werkstoff.GenerationFeatures removePrefix(OrePrefixes prefixes) { + this.toGenerate = this.toGenerate ^ getPrefixDataRaw(prefixes); + return this; + } + } + + public static class Stats { + + public static final int NULL_KELVIN = 0; + + int boilingPoint; + + public int getBoilingPoint() { + return this.boilingPoint; + } + + public Werkstoff.Stats setBoilingPoint(int boilingPoint) { + this.boilingPoint = boilingPoint; + return this; + } + + public long getMass() { + return this.mass; + } + + public long getProtons() { + return this.protons; + } + + public int getMeltingPoint() { + return this.meltingPoint; + } + + public Werkstoff.Stats setMeltingPoint(int meltingPoint) { + this.meltingPoint = meltingPoint; + return this; + } + + public double getEbfGasRecipeTimeMultiplier() { + return this.ebfGasRecipeTimeMultiplier; + } + + /** + * The generated EBF recipes using this gas will have their duration multiplied by this number. If set to a + * negative value, the default proton count-based logic is used. See also + * {@link gregtech.api.util.BlastFurnaceGasStat} + */ + public Werkstoff.Stats setEbfGasRecipeTimeMultiplier(double timeMultiplier) { + this.ebfGasRecipeTimeMultiplier = timeMultiplier; + return this; + } + + public double getEbfGasRecipeConsumedAmountMultiplier() { + return this.ebfGasRecipeConsumedAmountMultiplier; + } + + /** + * The generated EBF recipes using this gas will have the amount of gas consumed multiplied by this number. See + * also {@link gregtech.api.util.BlastFurnaceGasStat} + */ + public Werkstoff.Stats setEbfGasRecipeConsumedAmountMultiplier(double amountMultiplier) { + this.ebfGasRecipeConsumedAmountMultiplier = amountMultiplier; + return this; + } + + public int getDurOverride() { + return this.durOverride; + } + + public Werkstoff.Stats setDurOverride(int durOverride) { + this.durOverride = durOverride; + return this; + } + + public float getSpeedOverride() { + return this.speedOverride; + } + + public Werkstoff.Stats setSpeedOverride(float speedOverride) { + this.speedOverride = speedOverride; + return this; + } + + public byte getQualityOverride() { + return this.qualityOverride; + } + + public Werkstoff.Stats setQualityOverride(byte qualityOverride) { + this.qualityOverride = qualityOverride; + return this; + } + + private byte qualityOverride; + private int durOverride; + private float speedOverride; + private int meltingPoint; + private int meltingVoltage; + private long protons; + private long neutrons; + private long electrons; + private long mass; + private double ebfGasRecipeTimeMultiplier = -1.0; + private double ebfGasRecipeConsumedAmountMultiplier = 1.0; + + float durMod = 1f; + + public float getDurMod() { + return this.durMod; + } + + public void setDurMod(float durMod) { + this.durMod = durMod; + } + + private Pair<Object, Integer>[] mTC_Aspects; + // logic gate shit + byte quality = ~0b1111111; + + public Werkstoff.Stats setmTC_AspectsArray(Pair<Object, Integer>[] mTC_Aspects) { + this.mTC_Aspects = mTC_Aspects; + return this; + } + + @SafeVarargs + public final Werkstoff.Stats setmTC_AspectsVarArg(Pair<Object, Integer>... mTC_Aspects) { + this.mTC_Aspects = mTC_Aspects; + return this; + } + + Pair<Object, Integer>[] getmTC_Aspects() { + return this.mTC_Aspects; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (!(o instanceof Werkstoff.Stats that)) return false; + + if (this.boilingPoint != that.boilingPoint || this.meltingPoint != that.meltingPoint + || this.mass != that.mass + || this.protons != that.protons) return false; + if (this.neutrons != that.neutrons) return false; + if (this.electrons != that.electrons) return false; + if (Math.abs(this.ebfGasRecipeTimeMultiplier - that.ebfGasRecipeTimeMultiplier) > 1.0e-6D) return false; + if (Math.abs(this.ebfGasRecipeConsumedAmountMultiplier - that.ebfGasRecipeConsumedAmountMultiplier) + > 1.0e-6D) return false; + return this.quality == that.quality; + } + + @Override + public int hashCode() { + return MurmurHash3.murmurhash3_x86_32( + ByteBuffer.allocate(49) + .put(this.quality) + .putInt(this.boilingPoint) + .putInt(this.meltingPoint) + .putLong(this.protons) + .putLong(this.neutrons) + .putLong(this.electrons) + .putLong(this.mass) + .putDouble(this.ebfGasRecipeTimeMultiplier) + .putDouble(this.ebfGasRecipeConsumedAmountMultiplier) + .array(), + 0, + 49, + 31); + } + + public Werkstoff.Stats setMass(long mass) { + this.mass = mass; + return this; + } + + public Werkstoff.Stats setProtons(long protons) { + this.protons = protons; + return this; + } + + public boolean isSublimation() { + return (this.quality & 0b1) != 0; + } + + public Werkstoff.Stats setSublimation(boolean sublimation) { + if (sublimation) this.quality = (byte) (this.quality | 0b000001); + else this.quality = (byte) (this.quality & 0b1111110); + return this; + } + + public boolean isToxic() { + return (this.quality & 0b10) != 0; + } + + public Werkstoff.Stats setToxic(boolean toxic) { + if (toxic) this.quality = (byte) (this.quality | 0b000010); + else this.quality = (byte) (this.quality & 0b1111101); + return this; + } + + byte enchantmentlvl = 3; + + public byte getEnchantmentlvl() { + return this.enchantmentlvl; + } + + public Werkstoff.Stats setEnchantmentlvl(byte enchantmentlvl) { + this.enchantmentlvl = enchantmentlvl; + return this; + } + + public boolean isRadioactive() { + return (this.quality & 0b100) != 0; + } + + public Werkstoff.Stats setRadioactive(boolean radioactive) { + if (radioactive) this.quality = (byte) (this.quality | 0b000100); + else this.quality = (byte) (this.quality & 0b1111011); + return this; + } + + public boolean isBlastFurnace() { + return (this.quality & 0b1000) != 0; + } + + public Werkstoff.Stats setBlastFurnace(boolean blastFurnace) { + if (blastFurnace) this.quality = (byte) (this.quality | 0b001000); + else this.quality = (byte) (this.quality & 0b1110111); + return this; + } + + public Werkstoff.Stats setMeltingVoltage(int meltingVoltage) { + this.meltingVoltage = meltingVoltage; + return this; + } + + public int getMeltingVoltage() { + return this.meltingVoltage; + } + + public boolean isElektrolysis() { + return (this.quality & 0x10) != 0; + } + + public Werkstoff.Stats setElektrolysis(boolean elektrolysis) { + if (elektrolysis) this.quality = (byte) (this.quality | 0x10); + else this.quality = (byte) (this.quality & 0b1101111); + return this; + } + + public boolean isCentrifuge() { + return (this.quality & 0x20) != 0; + } + + public Werkstoff.Stats setCentrifuge(boolean centrifuge) { + if (centrifuge) this.quality = (byte) (this.quality | 0x20); + else this.quality = (byte) (this.quality & 0b1011111); + return this; + } + + public boolean isGas() { + return (this.quality & 0x40) != 0; + } + + public FluidState getFluidState() { + if ((this.quality & 0x40) != 0) { + return FluidState.GAS; + } + return FluidState.LIQUID; + } + + public Werkstoff.Stats setGas(boolean gas) { + if (gas) this.quality = (byte) (this.quality | 0x40); + else this.quality = (byte) (this.quality & 0b0111111); + return this; + } + } +} diff --git a/src/main/java/bartworks/system/material/WerkstoffLoader.java b/src/main/java/bartworks/system/material/WerkstoffLoader.java new file mode 100644 index 0000000000..d5c9337a7c --- /dev/null +++ b/src/main/java/bartworks/system/material/WerkstoffLoader.java @@ -0,0 +1,2105 @@ +/* + * Copyright (c) 2018-2020 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 bartworks.system.material; + +import static bartworks.util.BWUtil.subscriptNumbers; +import static bartworks.util.BWUtil.superscriptNumbers; +import static gregtech.api.enums.Mods.BetterLoadingScreen; +import static gregtech.api.enums.Mods.Forestry; +import static gregtech.api.enums.OrePrefixes.block; +import static gregtech.api.enums.OrePrefixes.bolt; +import static gregtech.api.enums.OrePrefixes.bottle; +import static gregtech.api.enums.OrePrefixes.capsule; +import static gregtech.api.enums.OrePrefixes.cell; +import static gregtech.api.enums.OrePrefixes.cellPlasma; +import static gregtech.api.enums.OrePrefixes.crushed; +import static gregtech.api.enums.OrePrefixes.crushedCentrifuged; +import static gregtech.api.enums.OrePrefixes.crushedPurified; +import static gregtech.api.enums.OrePrefixes.dust; +import static gregtech.api.enums.OrePrefixes.dustImpure; +import static gregtech.api.enums.OrePrefixes.dustPure; +import static gregtech.api.enums.OrePrefixes.dustSmall; +import static gregtech.api.enums.OrePrefixes.dustTiny; +import static gregtech.api.enums.OrePrefixes.foil; +import static gregtech.api.enums.OrePrefixes.gearGt; +import static gregtech.api.enums.OrePrefixes.gearGtSmall; +import static gregtech.api.enums.OrePrefixes.gem; +import static gregtech.api.enums.OrePrefixes.gemChipped; +import static gregtech.api.enums.OrePrefixes.gemExquisite; +import static gregtech.api.enums.OrePrefixes.gemFlawed; +import static gregtech.api.enums.OrePrefixes.gemFlawless; +import static gregtech.api.enums.OrePrefixes.ingot; +import static gregtech.api.enums.OrePrefixes.ingotDouble; +import static gregtech.api.enums.OrePrefixes.ingotHot; +import static gregtech.api.enums.OrePrefixes.ingotQuadruple; +import static gregtech.api.enums.OrePrefixes.ingotQuintuple; +import static gregtech.api.enums.OrePrefixes.ingotTriple; +import static gregtech.api.enums.OrePrefixes.lens; +import static gregtech.api.enums.OrePrefixes.nugget; +import static gregtech.api.enums.OrePrefixes.ore; +import static gregtech.api.enums.OrePrefixes.oreSmall; +import static gregtech.api.enums.OrePrefixes.plate; +import static gregtech.api.enums.OrePrefixes.plateDense; +import static gregtech.api.enums.OrePrefixes.plateDouble; +import static gregtech.api.enums.OrePrefixes.plateQuadruple; +import static gregtech.api.enums.OrePrefixes.plateQuintuple; +import static gregtech.api.enums.OrePrefixes.plateTriple; +import static gregtech.api.enums.OrePrefixes.rawOre; +import static gregtech.api.enums.OrePrefixes.ring; +import static gregtech.api.enums.OrePrefixes.rotor; +import static gregtech.api.enums.OrePrefixes.screw; +import static gregtech.api.enums.OrePrefixes.spring; +import static gregtech.api.enums.OrePrefixes.springSmall; +import static gregtech.api.enums.OrePrefixes.stick; +import static gregtech.api.enums.OrePrefixes.stickLong; +import static gregtech.api.enums.OrePrefixes.toolHeadHammer; +import static gregtech.api.enums.OrePrefixes.toolHeadSaw; +import static gregtech.api.enums.OrePrefixes.toolHeadWrench; +import static gregtech.api.enums.OrePrefixes.turbineBlade; +import static gregtech.api.enums.OrePrefixes.values; +import static gregtech.api.enums.OrePrefixes.wireFine; +import static gregtech.api.util.GTRecipeBuilder.WILDCARD; + +import java.lang.reflect.Field; +import java.util.Arrays; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +import net.minecraft.block.Block; +import net.minecraft.block.material.Material; +import net.minecraft.item.ItemStack; +import net.minecraftforge.fluids.Fluid; +import net.minecraftforge.fluids.FluidRegistry; +import net.minecraftforge.oredict.OreDictionary; + +import org.apache.logging.log4j.Level; + +import com.google.common.collect.HashBiMap; + +import bartworks.API.SideReference; +import bartworks.API.WerkstoffAdderRegistry; +import bartworks.MainMod; +import bartworks.client.renderer.BWBlockOreRenderer; +import bartworks.common.configs.ConfigHandler; +import bartworks.system.material.CircuitGeneration.BWCircuitsLoader; +import bartworks.system.material.gtenhancement.GTMetaItemEnhancer; +import bartworks.system.material.processingLoaders.AdditionalRecipes; +import bartworks.system.material.werkstoff_loaders.IWerkstoffRunnable; +import bartworks.system.material.werkstoff_loaders.recipe.AspectLoader; +import bartworks.system.material.werkstoff_loaders.recipe.BlockLoader; +import bartworks.system.material.werkstoff_loaders.recipe.CasingLoader; +import bartworks.system.material.werkstoff_loaders.recipe.CellLoader; +import bartworks.system.material.werkstoff_loaders.recipe.CraftingMaterialLoader; +import bartworks.system.material.werkstoff_loaders.recipe.CrushedLoader; +import bartworks.system.material.werkstoff_loaders.recipe.DustLoader; +import bartworks.system.material.werkstoff_loaders.recipe.GemLoader; +import bartworks.system.material.werkstoff_loaders.recipe.MetalLoader; +import bartworks.system.material.werkstoff_loaders.recipe.MoltenCellLoader; +import bartworks.system.material.werkstoff_loaders.recipe.MultipleMetalLoader; +import bartworks.system.material.werkstoff_loaders.recipe.OreLoader; +import bartworks.system.material.werkstoff_loaders.recipe.RawOreLoader; +import bartworks.system.material.werkstoff_loaders.recipe.SimpleMetalLoader; +import bartworks.system.material.werkstoff_loaders.recipe.ToolLoader; +import bartworks.system.material.werkstoff_loaders.registration.AssociationLoader; +import bartworks.system.material.werkstoff_loaders.registration.BridgeMaterialsLoader; +import bartworks.system.material.werkstoff_loaders.registration.CasingRegistrator; +import bartworks.system.oredict.OreDictHandler; +import bartworks.util.BWColorUtil; +import bartworks.util.EnumUtils; +import bartworks.util.Pair; +import bartworks.util.log.DebugLog; +import bwcrossmod.cls.CLSCompat; +import codechicken.nei.api.API; +import cpw.mods.fml.common.ProgressManager; +import cpw.mods.fml.common.registry.GameRegistry; +import gregtech.api.enums.Element; +import gregtech.api.enums.FluidState; +import gregtech.api.enums.ItemList; +import gregtech.api.enums.Materials; +import gregtech.api.enums.OrePrefixes; +import gregtech.api.enums.SubTag; +import gregtech.api.enums.TextureSet; +import gregtech.api.fluid.GTFluidFactory; +import gregtech.api.interfaces.ISubTagContainer; +import gregtech.api.util.GTOreDictUnificator; +import ic2.api.recipe.IRecipeInput; +import ic2.api.recipe.RecipeInputOreDict; +import ic2.api.recipe.RecipeOutput; +import ic2.api.recipe.Recipes; + +@SuppressWarnings("deprecation") +public class WerkstoffLoader { + + private WerkstoffLoader() {} + + public static final SubTag NOBLE_GAS = SubTag.getNewSubTag("NobleGas"); + public static final SubTag ANAEROBE_GAS = SubTag.getNewSubTag("AnaerobeGas"); + public static final SubTag ANAEROBE_SMELTING = SubTag.getNewSubTag("AnaerobeSmelting"); + public static final SubTag NOBLE_GAS_SMELTING = SubTag.getNewSubTag("NobleGasSmelting"); + public static final SubTag NO_BLAST = SubTag.getNewSubTag("NoBlast"); + public static ItemList rotorMold; + public static ItemList rotorShape; + public static ItemList smallGearShape; + public static ItemList ringMold; + public static ItemList boltMold; + + public static void setUp() { + + OrePrefixes.cellMolten.mMaterialGenerationBits = 0b1000000; + OrePrefixes.capsuleMolten.mMaterialGenerationBits = 0b1000000; + + try { + WerkstoffLoader.rotorMold = Enum.valueOf(ItemList.class, "Shape_Mold_Rotor"); + WerkstoffLoader.rotorShape = Enum.valueOf(ItemList.class, "Shape_Extruder_Rotor"); + WerkstoffLoader.smallGearShape = Enum.valueOf(ItemList.class, "Shape_Extruder_Small_Gear"); + WerkstoffLoader.ringMold = Enum.valueOf(ItemList.class, "Shape_Mold_Ring"); + WerkstoffLoader.boltMold = Enum.valueOf(ItemList.class, "Shape_Mold_Bolt"); + } catch (NullPointerException | IllegalArgumentException ignored) {} + + // add tiberium + EnumUtils.createNewElement("Tr", 123L, 203L, 0L, -1L, null, "Tiberium", false); + + bottle.mDefaultStackSize = 1; + Werkstoff.GenerationFeatures.initPrefixLogic(); + BWGTMaterialReference.init(); + } + + // TODO: + // FREE ID RANGE: 12_000-28_998 + // bartimaeusnek reserved 0-10_000 + // GlodBlock reserved range 10_001-10_999 + // Elisis reserved range 11_000-11_499 + // glowredman reserved range 11_500-11_999 + // bot reserved range 29_899-29_999 + // Tec & basdxz reserved range 30_000-31_000 + // GT Material range reserved on 31_767-32_767 + public static final Werkstoff Bismutite = new Werkstoff( + new short[] { 255, 233, 0, 0 }, + "Bismutite", + Werkstoff.Types.COMPOUND, + new Werkstoff.GenerationFeatures().addGems(), + 1, + TextureSet.SET_FLINT, + Collections.singletonList(Materials.Bismuth), + new Pair<>(Materials.Bismuth, 2), + new Pair<>(Materials.Oxygen, 2), + new Pair<>(Materials.CarbonDioxide, 2)); + public static final Werkstoff Bismuthinit = new Werkstoff( + new short[] { 192, 192, 192, 0 }, + "Bismuthinite", + Werkstoff.Types.COMPOUND, + new Werkstoff.GenerationFeatures(), + 2, + TextureSet.SET_METALLIC, + Arrays.asList(Materials.Bismuth, Materials.Sulfur), + new Pair<>(Materials.Bismuth, 2), + new Pair<>(Materials.Sulfur, 3)); + public static final Werkstoff Zirconium = new Werkstoff( + new short[] { 175, 175, 175, 0 }, + "Zirconium", + "Zr", + new Werkstoff.Stats().setProtons(40) + .setBlastFurnace(true) + .setMeltingPoint(2130) + .setMeltingVoltage(480), + Werkstoff.Types.ELEMENT, + new Werkstoff.GenerationFeatures().disable() + .onlyDust() + .addMetalItems() + .enforceUnification(), + 3, + TextureSet.SET_METALLIC + // No Byproducts + ); + public static final Werkstoff CubicZirconia = new Werkstoff( + new short[] { 255, 255, 255, 0 }, + "Cubic Zirconia", + Werkstoff.Types.COMPOUND, + 3273, + new Werkstoff.GenerationFeatures().onlyDust() + .addGems() + .enforceUnification(), + 4, + TextureSet.SET_DIAMOND, + Collections.singletonList(WerkstoffLoader.Zirconium), + new Pair<>(WerkstoffLoader.Zirconium, 1), + new Pair<>(Materials.Oxygen, 2)); + public static final Werkstoff FluorBuergerit = new Werkstoff( + new short[] { 0x20, 0x20, 0x20, 0 }, + "Fluor-Buergerite", + subscriptNumbers("NaFe3Al6(Si6O18)(BO3)3O3F"), + new Werkstoff.Stats().setElektrolysis(false), + Werkstoff.Types.COMPOUND, + new Werkstoff.GenerationFeatures().addGems(), + 5, + TextureSet.SET_RUBY, + Arrays.asList(Materials.Sodium, Materials.Boron, Materials.SiliconDioxide), + new Pair<>(Materials.Sodium, 1), + new Pair<>(Materials.Iron, 3), + new Pair<>(Materials.Aluminium, 6), + new Pair<>(Materials.Silicon, 6), + new Pair<>(Materials.Boron, 3), + new Pair<>(Materials.Oxygen, 30), + new Pair<>(Materials.Fluorine, 1)); + public static final Werkstoff YttriumOxide = new Werkstoff( + new short[] { 255, 255, 255, 0 }, + "Yttrium Oxide", + Werkstoff.Types.COMPOUND, + new Werkstoff.GenerationFeatures().onlyDust() + .enforceUnification(), // No autoadd here to gate this material + // by hand + 6, + TextureSet.SET_DULL, + new Pair<>(Materials.Yttrium, 2), + new Pair<>(Materials.Oxygen, 3)); + public static final Werkstoff ChromoAluminoPovondrait = new Werkstoff( + new short[] { 0, 0x79, 0x6A, 0 }, + "Chromo-Alumino-Povondraite", + subscriptNumbers("NaCr3(Al4Mg2)(Si6O18)(BO3)3(OH)3O"), + Werkstoff.Types.getDefaultStatForType(Werkstoff.Types.COMPOUND) + .setElektrolysis(false), + Werkstoff.Types.COMPOUND, + new Werkstoff.GenerationFeatures().addGems(), + 7, + TextureSet.SET_RUBY, + Arrays.asList(Materials.Sodium, Materials.Boron, Materials.SiliconDioxide), + new Pair<>(Materials.Sodium, 1), + new Pair<>(Materials.Chrome, 3), + new Pair<>(Materials.Magnalium, 6), + new Pair<>(Materials.Silicon, 6), + new Pair<>(Materials.Boron, 3), + new Pair<>(Materials.Oxygen, 31), + new Pair<>(Materials.Hydrogen, 3)); + public static final Werkstoff VanadioOxyDravit = new Werkstoff( + new short[] { 0x60, 0xA0, 0xA0, 0 }, + "Vanadio-Oxy-Dravite", + subscriptNumbers("NaV3(Al4Mg2)(Si6O18)(BO3)3(OH)3O"), + Werkstoff.Types.getDefaultStatForType(Werkstoff.Types.COMPOUND) + .setElektrolysis(false), + Werkstoff.Types.COMPOUND, + new Werkstoff.GenerationFeatures().addGems(), + 8, + TextureSet.SET_RUBY, + Arrays.asList(Materials.Sodium, Materials.Boron, Materials.SiliconDioxide), + new Pair<>(Materials.Sodium, 1), + new Pair<>(Materials.Vanadium, 3), + new Pair<>(Materials.Magnalium, 6), + new Pair<>(Materials.Silicon, 6), + new Pair<>(Materials.Boron, 3), + new Pair<>(Materials.Oxygen, 31), + new Pair<>(Materials.Hydrogen, 3)); + public static final Werkstoff Olenit = new Werkstoff( + new short[] { 210, 210, 210, 0 }, + "Olenite", + subscriptNumbers("NaAl3Al6(Si6O18)(BO3)3O3OH"), + Werkstoff.Types.getDefaultStatForType(Werkstoff.Types.COMPOUND) + .setElektrolysis(false), + Werkstoff.Types.COMPOUND, + new Werkstoff.GenerationFeatures().addGems(), + 9, + TextureSet.SET_RUBY, + Arrays.asList(Materials.Sodium, Materials.Boron, Materials.SiliconDioxide), + new Pair<>(Materials.Sodium, 1), + new Pair<>(Materials.Aluminium, 9), + new Pair<>(Materials.Silicon, 6), + new Pair<>(Materials.Boron, 3), + new Pair<>(Materials.Oxygen, 31), + new Pair<>(Materials.Hydrogen, 1)); + public static final Werkstoff Arsenopyrite = new Werkstoff( + new short[] { 0xB0, 0xB0, 0xB0, 0 }, + "Arsenopyrite", + Werkstoff.Types.COMPOUND, + new Werkstoff.GenerationFeatures(), + 10, + TextureSet.SET_METALLIC, + Arrays.asList(Materials.Sulfur, Materials.Arsenic, Materials.Iron), + new Pair<>(Materials.Iron, 1), + new Pair<>(Materials.Arsenic, 1), + new Pair<>(Materials.Sulfur, 1)); + public static final Werkstoff Ferberite = new Werkstoff( + new short[] { 0xB0, 0xB0, 0xB0, 0 }, + "Ferberite", + Werkstoff.Types.COMPOUND, + new Werkstoff.GenerationFeatures(), + 11, + TextureSet.SET_METALLIC, + Arrays.asList(Materials.Iron, Materials.Tungsten), + new Pair<>(Materials.Iron, 1), + new Pair<>(Materials.Tungsten, 1), + new Pair<>(Materials.Oxygen, 3)); + public static final Werkstoff Loellingit = new Werkstoff( + new short[] { 0xD0, 0xD0, 0xD0, 0 }, + "Loellingite", + Werkstoff.Types.COMPOUND, + new Werkstoff.GenerationFeatures(), + 12, + TextureSet.SET_METALLIC, + Arrays.asList(Materials.Iron, Materials.Arsenic), + new Pair<>(Materials.Iron, 1), + new Pair<>(Materials.Arsenic, 2)); + public static final Werkstoff Roquesit = new Werkstoff( + new short[] { 0xA0, 0xA0, 0xA0, 0 }, + "Roquesite", + Werkstoff.Types.COMPOUND, + new Werkstoff.GenerationFeatures(), + 13, + TextureSet.SET_METALLIC, + Arrays.asList(Materials.Copper, Materials.Sulfur), + new Pair<>(Materials.Copper, 1), + new Pair<>(Materials.Indium, 1), + new Pair<>(Materials.Sulfur, 2)); + public static final Werkstoff Bornite = new Werkstoff( + new short[] { 0x97, 0x66, 0x2B, 0 }, + "Bornite", + Werkstoff.Types.COMPOUND, + new Werkstoff.GenerationFeatures(), + 14, + TextureSet.SET_METALLIC, + Arrays.asList(Materials.Copper, Materials.Iron, Materials.Sulfur), + new Pair<>(Materials.Copper, 5), + new Pair<>(Materials.Iron, 1), + new Pair<>(Materials.Sulfur, 4)); + public static final Werkstoff Wittichenit = new Werkstoff( + Materials.Copper.mRGBa, + "Wittichenite", + Werkstoff.Types.COMPOUND, + new Werkstoff.GenerationFeatures(), + 15, + TextureSet.SET_METALLIC, + Arrays.asList(Materials.Copper, Materials.Bismuth, Materials.Sulfur), + new Pair<>(Materials.Copper, 5), + new Pair<>(Materials.Bismuth, 1), + new Pair<>(Materials.Sulfur, 4)); + public static final Werkstoff Djurleit = new Werkstoff( + new short[] { 0x60, 0x60, 0x60, 0 }, + "Djurleite", + Werkstoff.Types.COMPOUND, + new Werkstoff.GenerationFeatures(), + 16, + TextureSet.SET_METALLIC, + Arrays.asList(Materials.Copper, Materials.Copper, Materials.Sulfur), + new Pair<>(Materials.Copper, 31), + new Pair<>(Materials.Sulfur, 16)); + public static final Werkstoff Huebnerit = new Werkstoff( + new short[] { 0x80, 0x60, 0x60, 0 }, + "Huebnerite", + Werkstoff.Types.COMPOUND, + new Werkstoff.GenerationFeatures(), + 17, + TextureSet.SET_METALLIC, + Arrays.asList(Materials.Manganese, Materials.Tungsten), + new Pair<>(Materials.Manganese, 1), + new Pair<>(Materials.Tungsten, 1), + new Pair<>(Materials.Oxygen, 3)); + public static final Werkstoff Thorianit = new Werkstoff( + new short[] { 0x30, 0x30, 0x30, 0 }, + "Thorianite", + new Werkstoff.Stats().setElektrolysis(true), + Werkstoff.Types.COMPOUND, + new Werkstoff.GenerationFeatures(), + 18, + TextureSet.SET_METALLIC, + Collections.singletonList(Materials.Thorium), + new Pair<>(Materials.Thorium, 1), + new Pair<>(Materials.Oxygen, 2)); + public static final Werkstoff RedZircon = new Werkstoff( + new short[] { 195, 19, 19, 0 }, + "Red Zircon", + new Werkstoff.Stats().setElektrolysis(false) + .setMeltingPoint(2130), + Werkstoff.Types.COMPOUND, + new Werkstoff.GenerationFeatures().addGems(), + 19, + TextureSet.SET_GEM_VERTICAL, + Arrays.asList(WerkstoffLoader.Zirconium, Materials.SiliconDioxide), + new Pair<>(WerkstoffLoader.Zirconium, 1), + new Pair<>(Materials.Silicon, 1), + new Pair<>(Materials.Oxygen, 4)); + + // GT Enhancements + public static final Werkstoff Salt = new Werkstoff( + Materials.Salt.mRGBa, + "Salt", + new Werkstoff.Stats(), + Werkstoff.Types.COMPOUND, + new Werkstoff.GenerationFeatures().disable() + .addGems() + .addSifterRecipes(), + 20, + TextureSet.SET_FLINT, + Arrays.asList(Materials.RockSalt, Materials.Borax), + new Pair<>(Materials.Salt, 1)); + public static final Werkstoff Spodumen = new Werkstoff( + Materials.Spodumene.mRGBa, + "Spodumene", + new Werkstoff.Stats(), + Werkstoff.Types.COMPOUND, + new Werkstoff.GenerationFeatures().disable() + .addGems() + .addSifterRecipes(), + 21, + TextureSet.SET_FLINT, + Collections.singletonList(Materials.Spodumene), + new Pair<>(Materials.Spodumene, 1)); + public static final Werkstoff RockSalt = new Werkstoff( + Materials.RockSalt.mRGBa, + "Rock Salt", + new Werkstoff.Stats(), + Werkstoff.Types.COMPOUND, + new Werkstoff.GenerationFeatures().disable() + .addGems() + .addSifterRecipes(), + 22, + TextureSet.SET_FLINT, + Arrays.asList(Materials.RockSalt, Materials.Borax), + new Pair<>(Materials.RockSalt, 1)); + + // More NonGT Stuff + public static final Werkstoff Fayalit = new Werkstoff( + new short[] { 50, 50, 50, 0 }, + "Fayalite", + new Werkstoff.Stats().setElektrolysis(false), + Werkstoff.Types.COMPOUND, + new Werkstoff.GenerationFeatures().addGems(), + 23, + TextureSet.SET_QUARTZ, + Arrays.asList(Materials.Iron, Materials.SiliconDioxide), + new Pair<>(Materials.Iron, 2), + new Pair<>(Materials.Silicon, 1), + new Pair<>(Materials.Oxygen, 4)); + public static final Werkstoff Forsterit = new Werkstoff( + new short[] { 255, 255, 255, 0 }, + "Forsterite", + new Werkstoff.Stats().setElektrolysis(false), + Werkstoff.Types.COMPOUND, + new Werkstoff.GenerationFeatures().addGems(), + 24, + TextureSet.SET_QUARTZ, + Arrays.asList(Materials.Magnesium, Materials.SiliconDioxide), + new Pair<>(Materials.Magnesium, 2), + new Pair<>(Materials.Silicon, 1), + new Pair<>(Materials.Oxygen, 4)); + public static final Werkstoff Hedenbergit = new Werkstoff( + new short[] { 100, 150, 100, 0 }, + "Hedenbergite", + new Werkstoff.Stats().setElektrolysis(false), + Werkstoff.Types.COMPOUND, + new Werkstoff.GenerationFeatures().addGems(), + 25, + TextureSet.SET_QUARTZ, + Arrays.asList(Materials.Iron, Materials.Calcium, Materials.SiliconDioxide), + new Pair<>(Materials.Calcium, 1), + new Pair<>(Materials.Iron, 1), + new Pair<>(Materials.Silicon, 2), + new Pair<>(Materials.Oxygen, 6)); + public static final Werkstoff DescloiziteZNVO4 = new Werkstoff( + new short[] { 0xBF, 0x18, 0x0F, 0 }, + "Red Descloizite", // Pb(Zn,Cu)[OH|VO4 + new Werkstoff.Stats().setElektrolysis(true), + Werkstoff.Types.COMPOUND, + new Werkstoff.GenerationFeatures(), + 26, + TextureSet.SET_QUARTZ, + Arrays.asList(Materials.Lead, Materials.Copper, Materials.Vanadium), + new Pair<>(Materials.Lead, 1), + new Pair<>(Materials.Zinc, 1), + new Pair<>(Materials.Vanadium, 1), + new Pair<>(Materials.Oxygen, 4)); + public static final Werkstoff DescloiziteCUVO4 = new Werkstoff( + new short[] { 0xf9, 0x6d, 0x18, 0 }, + "Orange Descloizite", // Pb(Zn,Cu)[OH|VO4 + new Werkstoff.Stats().setElektrolysis(true), + Werkstoff.Types.COMPOUND, + new Werkstoff.GenerationFeatures(), + 27, + TextureSet.SET_QUARTZ, + Arrays.asList(Materials.Lead, Materials.Zinc, Materials.Vanadium), + new Pair<>(Materials.Lead, 1), + new Pair<>(Materials.Copper, 1), + new Pair<>(Materials.Vanadium, 1), + new Pair<>(Materials.Oxygen, 4)); + public static final Werkstoff FuchsitAL = new Werkstoff( + new short[] { 0x4D, 0x7F, 0x64, 0 }, + "Green Fuchsite", + subscriptNumbers("KAl3Si3O10(OH)2"), + new Werkstoff.Stats().setElektrolysis(false), + Werkstoff.Types.COMPOUND, + new Werkstoff.GenerationFeatures(), + 28, + TextureSet.SET_METALLIC, + Arrays.asList(Materials.Potassium, Materials.Aluminiumoxide, Materials.SiliconDioxide), + new Pair<>(Materials.Potassium, 1), + new Pair<>(Materials.Aluminium, 3), + new Pair<>(Materials.Silicon, 3), + new Pair<>(Materials.Oxygen, 12), + new Pair<>(Materials.Hydrogen, 2)); + + public static final Werkstoff FuchsitCR = new Werkstoff( + new short[] { 128, 0, 0, 0 }, + "Red Fuchsite", + subscriptNumbers("KCr3Si3O10(OH)2"), + new Werkstoff.Stats().setElektrolysis(false), + Werkstoff.Types.COMPOUND, + new Werkstoff.GenerationFeatures(), + 29, + TextureSet.SET_METALLIC, + Arrays.asList(Materials.Potassium, Materials.Chrome, Materials.SiliconDioxide), + new Pair<>(Materials.Potassium, 1), + new Pair<>(Materials.Chrome, 3), + new Pair<>(Materials.Silicon, 3), + new Pair<>(Materials.Oxygen, 12), + new Pair<>(Materials.Hydrogen, 2)); + + public static final Werkstoff Thorium232 = new Werkstoff( + new short[] { 0, 64, 0, 0 }, + "Thorium 232", + superscriptNumbers("Th232"), + new Werkstoff.Stats().setRadioactive(true) + .setBlastFurnace(true) + .setMass(232) + .setProtons(Element.Th.mProtons), + Werkstoff.Types.ISOTOPE, + new Werkstoff.GenerationFeatures().disable() + .onlyDust() + .addMetalItems() + .enforceUnification(), + 30, + TextureSet.SET_METALLIC + // No Byproducts + ); + public static final Werkstoff BismuthTellurite = new Werkstoff( + new short[] { 32, 72, 32, 0 }, + // Telluride is correct, tellurite is not. + // Only the display name gets renamed to avoid problems in other mods + "Bismuth Telluride", + new Werkstoff.Stats().setElektrolysis(true), + Werkstoff.Types.COMPOUND, + new Werkstoff.GenerationFeatures().disable() + .onlyDust() + .addChemicalRecipes(), + 31, + TextureSet.SET_METALLIC, + // No Byproducts + new Pair<>(Materials.Bismuth, 2), + new Pair<>(Materials.Tellurium, 3)); + public static final Werkstoff Tellurium = new Werkstoff( + new short[] { 0xff, 0xff, 0xff, 0 }, + "Tellurium", + new Werkstoff.Stats(), + Werkstoff.Types.ELEMENT, + new Werkstoff.GenerationFeatures().addMetalItems() + .removePrefix(ore), + 32, + TextureSet.SET_METALLIC, + // No Byproducts + new Pair<>(Materials.Tellurium, 1)); + public static final Werkstoff BismuthHydroBorat = new Werkstoff( + new short[] { 72, 144, 72, 0 }, + "Dibismuthhydroborat", + new Werkstoff.Stats().setElektrolysis(true), + Werkstoff.Types.COMPOUND, + new Werkstoff.GenerationFeatures().disable() + .onlyDust() + .addChemicalRecipes(), + 33, + TextureSet.SET_METALLIC, + // No Byproducts + new Pair<>(Materials.Bismuth, 2), + new Pair<>(Materials.Boron, 1), + new Pair<>(Materials.Hydrogen, 1)); + public static final Werkstoff ArInGaPhoBiBoTe = new Werkstoff( + new short[] { 36, 36, 36, 0 }, + "Circuit Compound MK3", + new Werkstoff.Stats().setCentrifuge(true), + Werkstoff.Types.COMPOUND, + new Werkstoff.GenerationFeatures().disable() + .onlyDust() + .addMixerRecipes(), + 34, + TextureSet.SET_METALLIC, + // No Byproducts + new Pair<>(Materials.IndiumGalliumPhosphide, 1), + new Pair<>(WerkstoffLoader.BismuthHydroBorat, 3), + new Pair<>(WerkstoffLoader.BismuthTellurite, 2)); + + public static final Werkstoff Prasiolite = new Werkstoff( + new short[] { 0xD0, 0xDD, 0x95, 0 }, + "Prasiolite", + new Werkstoff.Stats().setElektrolysis(false) + .setMeltingPoint(1923), + Werkstoff.Types.COMPOUND, + new Werkstoff.GenerationFeatures().addGems(), + 35, + TextureSet.SET_QUARTZ, + // No Byproducts + new Pair<>(Materials.Silicon, 5), + new Pair<>(Materials.Oxygen, 10), + new Pair<>(Materials.Iron, 1)); + + public static final Werkstoff MagnetoResonaticDust = new Werkstoff( + new short[] { 0xDD, 0x77, 0xDD, 0 }, + "Magneto Resonatic", + new Werkstoff.Stats().setElektrolysis(true), + Werkstoff.Types.COMPOUND, + new Werkstoff.GenerationFeatures().onlyDust() + .addMixerRecipes() + .addGems(), + 36, + TextureSet.SET_MAGNETIC, + // No Byproducts + new Pair<>(WerkstoffLoader.Prasiolite, 3), + new Pair<>(WerkstoffLoader.BismuthTellurite, 4), + new Pair<>(WerkstoffLoader.CubicZirconia, 1), + new Pair<>(Materials.SteelMagnetic, 1)); + public static final Werkstoff Xenon = new Werkstoff( + new short[] { 0x14, 0x39, 0x7F, 0 }, + "Xenon", + "Xe", + new Werkstoff.Stats().setProtons(54) + .setMass(131) + .setGas(true) + .setEbfGasRecipeTimeMultiplier(0.4d) + .setEbfGasRecipeConsumedAmountMultiplier(0.25d), + Werkstoff.Types.ELEMENT, + new Werkstoff.GenerationFeatures().disable() + .addCells() + .enforceUnification(), + 37, + TextureSet.SET_FLUID + // No Byproducts + // No Ingredients + ); + public static final Werkstoff Oganesson = new Werkstoff( + new short[] { 0x14, 0x39, 0x7F, 0 }, + "Oganesson", + "Og", + new Werkstoff.Stats().setProtons(118) + .setMass(294) + .setGas(true) + .setEbfGasRecipeTimeMultiplier(0.3d) + .setEbfGasRecipeConsumedAmountMultiplier(0.1d), + Werkstoff.Types.ELEMENT, + new Werkstoff.GenerationFeatures().disable() + .addCells(), + 38, + TextureSet.SET_FLUID + // No Byproducts + // No Ingredients + ); + public static final Werkstoff Californium = new Werkstoff( + new short[] { 0xAA, 0xAA, 0xAA, 0 }, + "Californium", + "Cf", + new Werkstoff.Stats().setProtons(98) + .setMass(251) + .setBlastFurnace(true) + .setMeltingPoint(900), + Werkstoff.Types.ELEMENT, + new Werkstoff.GenerationFeatures().disable() + .onlyDust() + .addMetalItems() + .addMolten() + .enforceUnification(), + 39, + TextureSet.SET_METALLIC + // No Byproducts + // No Ingredients + ); + public static final Werkstoff Calcium = new Werkstoff( + Materials.Calcium.mRGBa, + "Calcium", + "Ca", + new Werkstoff.Stats().setProtons(Element.Ca.mProtons) + .setMass(Element.Ca.getMass()) + .setBlastFurnace(true) + .setMeltingPoint(1115) + .setBoilingPoint(1757), + Werkstoff.Types.ELEMENT, + new Werkstoff.GenerationFeatures().disable() + .onlyDust() + .addMetalItems() + .addMolten(), + 40, + Materials.Calcium.mIconSet, + // No Byproducts + new Pair<>(Materials.Calcium, 1)); + public static final Werkstoff Neon = new Werkstoff( + new short[] { 0xff, 0x07, 0x3a }, + "Neon", + "Ne", + new Werkstoff.Stats().setProtons(Element.Ne.mProtons) + .setMass(Element.Ne.getMass()) + .setGas(true) + .setEbfGasRecipeTimeMultiplier(0.6d) + .setEbfGasRecipeConsumedAmountMultiplier(0.55d), + Werkstoff.Types.ELEMENT, + new Werkstoff.GenerationFeatures().disable() + .addCells() + .enforceUnification(), + 41, + TextureSet.SET_FLUID + // No Byproducts + // No Ingredients + ); + public static final Werkstoff Krypton = new Werkstoff( + new short[] { 0xb1, 0xff, 0x32 }, + "Krypton", + "Kr", + new Werkstoff.Stats().setProtons(Element.Kr.mProtons) + .setMass(Element.Kr.getMass()) + .setGas(true) + .setEbfGasRecipeTimeMultiplier(0.5d) + .setEbfGasRecipeConsumedAmountMultiplier(0.4d), + Werkstoff.Types.ELEMENT, + new Werkstoff.GenerationFeatures().disable() + .addCells() + .enforceUnification(), + 42, + TextureSet.SET_FLUID + // No Byproducts + // No Ingredients + ); + public static final Werkstoff BArTiMaEuSNeK = new Werkstoff( + new short[] { 0x00, 0xff, 0x00 }, + "BArTiMaEuSNeK", + "Are you serious?", + new Werkstoff.Stats().setMeltingPoint(9001) + .setCentrifuge(true) + .setBlastFurnace(true) + .setMeltingVoltage(1920), + Werkstoff.Types.COMPOUND, + new Werkstoff.GenerationFeatures().addGems() + .addMetalItems() + .addMolten(), + 43, + TextureSet.SET_DIAMOND, + Arrays.asList(Materials.Boron, Materials.Titanium, Materials.Europium), + new Pair<>(Materials.Boron, 1), + new Pair<>(Materials.Argon, 1), + new Pair<>(Materials.Titanium, 1), + new Pair<>(Materials.Magic, 1), + new Pair<>(Materials.Europium, 1), + new Pair<>(Materials.Sulfur, 1), + new Pair<>(WerkstoffLoader.Neon, 1), + new Pair<>(Materials.Potassium, 1)); + public static final Werkstoff PTConcentrate = new Werkstoff( + Materials.Platinum.getRGBA(), + "Platinum 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(), + "Platinum 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 Platinum 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(), + "Platinum Metallic Powder", + "??PtPdIrOsRhRu??", + new Werkstoff.Stats(), + Werkstoff.Types.MIXTURE, + new Werkstoff.GenerationFeatures(), + 47, + TextureSet.SET_METALLIC, + // No Byproducts + new Pair<>(Materials.Platinum, 1), + new Pair<>(Materials.Stone, 2)); + public static final Werkstoff AquaRegia = new Werkstoff( + new short[] { 0xff, 0xb1, 0x32 }, + "Aqua Regia", + 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( + new short[] { 0x64, 0x63, 0x2E }, + "Platinum Residue", + "??IrOsRhRu??", + new Werkstoff.Stats(), + Werkstoff.Types.MIXTURE, + new Werkstoff.GenerationFeatures().disable() + .onlyDust(), + 49, + TextureSet.SET_ROUGH + // No Byproducts + ); + public static final Werkstoff AmmoniumChloride = new Werkstoff( + new short[] { 0xff, 0xff, 0xff }, + "Ammonium Chloride", + 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(), + "Reprecipitated Platinum", + "PtCl", + new Werkstoff.Stats(), + Werkstoff.Types.MIXTURE, + new Werkstoff.GenerationFeatures().disable() + .onlyDust(), + 51, + TextureSet.SET_METALLIC + // No Byproducts + ); + 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", + "??Pd??", + new Werkstoff.Stats(), + Werkstoff.Types.MIXTURE, + new Werkstoff.GenerationFeatures(), + 53, + TextureSet.SET_METALLIC, + // No Byproducts + new Pair<>(Materials.Palladium, 1), + new Pair<>(Materials.Stone, 2)); + public static final Werkstoff PDRawPowder = new Werkstoff( + Materials.Palladium.getRGBA(), + "Reprecipitated 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(false), + 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 }, + "Potassium Disulfate", + new Werkstoff.Stats().setElektrolysis(true), + Werkstoff.Types.COMPOUND, + new Werkstoff.GenerationFeatures().disable() + .onlyDust() + .addMolten() + .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 LeachResidue = new Werkstoff( + new short[] { 0x64, 0x46, 0x29 }, + "Leach Residue", + "??IrOsRu??", + new Werkstoff.Stats(), + Werkstoff.Types.MIXTURE, + new Werkstoff.GenerationFeatures(), + 60, + TextureSet.SET_ROUGH + // No Byproducts + ); + public static final Werkstoff RHSulfate = new Werkstoff( + new short[] { 0xee, 0xaa, 0x55 }, + "Rhodium Sulfate", + new Werkstoff.Stats().setGas(true), + Werkstoff.Types.COMPOUND, + new Werkstoff.GenerationFeatures().disable() + .addCells(), + 61, + TextureSet.SET_FLUID + // No Byproducts + ); + public static final Werkstoff RHSulfateSolution = new Werkstoff( + new short[] { 0xff, 0xbb, 0x66 }, + "Rhodium Sulfate Solution", + new Werkstoff.Stats(), + Werkstoff.Types.MIXTURE, + new Werkstoff.GenerationFeatures().disable() + .addCells(), + 62, + TextureSet.SET_FLUID + // 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() + .addCells(), + 63, + TextureSet.SET_DULL, + new Pair<>(Materials.Calcium, 1), + new Pair<>(Materials.Chlorine, 2) + // No Byproducts + ); + public static final Werkstoff Ruthenium = new Werkstoff( + new short[] { 0x64, 0x64, 0x64 }, + "Ruthenium", + "Ru", + new Werkstoff.Stats().setBlastFurnace(true) + .setMeltingPoint(2607) + .setMass(Element.Ru.getMass()) + .setProtons(Element.Ru.mProtons), + Werkstoff.Types.ELEMENT, + new Werkstoff.GenerationFeatures().onlyDust() + .addMolten() + .addMetalItems() + .enforceUnification(), + 64, + TextureSet.SET_METALLIC + // No Byproducts + ); + public static final Werkstoff SodiumRuthenate = new Werkstoff( + new short[] { 0x3a, 0x40, 0xcb }, + "Sodium Ruthenate", + new Werkstoff.Stats(), + Werkstoff.Types.COMPOUND, + new Werkstoff.GenerationFeatures().disable() + .onlyDust(), + 65, + TextureSet.SET_SHINY, + new Pair<>(Materials.Sodium, 2), + new Pair<>(Ruthenium, 1), + new Pair<>(Materials.Oxygen, 3) + // No Byproducts + ); + public static final Werkstoff RutheniumTetroxide = new Werkstoff( + new short[] { 0xc7, 0xc7, 0xc7 }, + "Ruthenium Tetroxide", + new Werkstoff.Stats().setMeltingPoint(313), + Werkstoff.Types.COMPOUND, + new Werkstoff.GenerationFeatures().disable() + .onlyDust() + .addCells(), + 66, + TextureSet.SET_DULL, + new Pair<>(WerkstoffLoader.Ruthenium, 1), + new Pair<>(Materials.Oxygen, 4) + // No Byproducts + ); + public static final Werkstoff HotRutheniumTetroxideSollution = new Werkstoff( + new short[] { 0xc7, 0xc7, 0xc7 }, + "Hot Ruthenium Tetroxide Solution", + "???", + new Werkstoff.Stats().setGas(true) + .setMeltingPoint(700), + Werkstoff.Types.COMPOUND, + new Werkstoff.GenerationFeatures().disable() + .addCells(), + 67, + TextureSet.SET_FLUID, + new Pair<>(WerkstoffLoader.Ruthenium, 1), + new Pair<>(Materials.Oxygen, 4), + new Pair<>(Materials.Chlorine, 2), + new Pair<>(Materials.Sodium, 2), + new Pair<>(Materials.Water, 2) + // No Byproducts + ); + public static final Werkstoff RutheniumTetroxideSollution = new Werkstoff( + new short[] { 0xc7, 0xc7, 0xc7 }, + "Ruthenium Tetroxide Solution", + "???", + new Werkstoff.Stats().setMeltingPoint(313), + Werkstoff.Types.COMPOUND, + new Werkstoff.GenerationFeatures().disable() + .addCells(), + 68, + TextureSet.SET_FLUID, + new Pair<>(Ruthenium, 1), + new Pair<>(Materials.Oxygen, 4), + new Pair<>(Materials.Chlorine, 2), + new Pair<>(Materials.Sodium, 2), + new Pair<>(Materials.Water, 2) + // No Byproducts + ); + public static final Werkstoff IrOsLeachResidue = new Werkstoff( + new short[] { 0x64, 0x46, 0x29 }, + "Rarest Metal Residue", + "??OsIr??", + new Werkstoff.Stats(), + Werkstoff.Types.MIXTURE, + new Werkstoff.GenerationFeatures(), + 69, + TextureSet.SET_ROUGH, + // No Byproducts + new Pair<>(Materials.Osmiridium, 1), + new Pair<>(Materials.Stone, 2)); + public static final Werkstoff IrLeachResidue = new Werkstoff( + new short[] { 0x84, 0x66, 0x49 }, + "Iridium Metal Residue", + "??Ir??", + new Werkstoff.Stats(), + Werkstoff.Types.MIXTURE, + new Werkstoff.GenerationFeatures(), + 70, + TextureSet.SET_ROUGH, + new Pair<>(Materials.Iridium, 1), + new Pair<>(Materials.Stone, 2) + // No Byproducts + ); + public static final Werkstoff PGSDResidue = new Werkstoff( + new short[] { 0x84, 0x66, 0x49 }, + "Sludge Dust Residue", + new Werkstoff.Stats().setCentrifuge(true), + Werkstoff.Types.MIXTURE, + new Werkstoff.GenerationFeatures().disable() + .onlyDust(), + 71, + TextureSet.SET_DULL, + new Pair<>(Materials.SiliconDioxide, 3), + new Pair<>(Materials.Gold, 2)); + public static final Werkstoff AcidicOsmiumSolution = new Werkstoff( + new short[] { 0x84, 0x66, 0x49 }, + "Acidic Osmium Solution", + "???", + new Werkstoff.Stats(), + Werkstoff.Types.MIXTURE, + new Werkstoff.GenerationFeatures().disable() + .addCells(), + 72, + TextureSet.SET_FLUID, + new Pair<>(Materials.Osmium, 1), + new Pair<>(Materials.HydrochloricAcid, 1)); + public static final Werkstoff IridiumDioxide = new Werkstoff( + new short[] { 0x84, 0x66, 0x49 }, + "Iridium Dioxide", + new Werkstoff.Stats(), + Werkstoff.Types.MIXTURE, + new Werkstoff.GenerationFeatures().disable() + .onlyDust(), + 73, + TextureSet.SET_FLUID, + new Pair<>(Materials.Iridium, 1), + new Pair<>(Materials.Oxygen, 2)); + public static final Werkstoff OsmiumSolution = new Werkstoff( + new short[] { 0x84, 0x66, 0x49 }, + "Osmium Solution", + "???", + new Werkstoff.Stats(), + Werkstoff.Types.MIXTURE, + new Werkstoff.GenerationFeatures().disable() + .addCells(), + 74, + TextureSet.SET_FLUID, + new Pair<>(Materials.Osmium, 1), + new Pair<>(Materials.Hydrogen, 1)); + public static final Werkstoff AcidicIridiumSolution = new Werkstoff( + new short[] { 0x84, 0x66, 0x49 }, + "Acidic Iridium Solution", + "???", + new Werkstoff.Stats(), + Werkstoff.Types.MIXTURE, + new Werkstoff.GenerationFeatures().disable() + .addCells(), + 75, + TextureSet.SET_FLUID, + new Pair<>(Materials.Iridium, 1), + new Pair<>(Materials.Hydrogen, 1)); + public static final Werkstoff IridiumChloride = new Werkstoff( + new short[] { 0x84, 0x66, 0x49 }, + "Iridium Chloride", + subscriptNumbers("IrCl3"), + new Werkstoff.Stats(), + Werkstoff.Types.MIXTURE, + new Werkstoff.GenerationFeatures().disable() + .onlyDust(), + 76, + TextureSet.SET_LAPIS, + new Pair<>(Materials.Iridium, 1), + new Pair<>(Materials.Chlorine, 3)); + public static final Werkstoff PGSDResidue2 = new Werkstoff( + new short[] { 0x84, 0x66, 0x49 }, + "Metallic Sludge Dust Residue", + new Werkstoff.Stats().setCentrifuge(true), + Werkstoff.Types.MIXTURE, + new Werkstoff.GenerationFeatures().disable() + .onlyDust(), + 77, + TextureSet.SET_DULL, + new Pair<>(Materials.Nickel, 1), + new Pair<>(Materials.Copper, 1)); + public static final Werkstoff Rhodium = new Werkstoff( + new short[] { 0xF4, 0xF4, 0xF4 }, + "Rhodium", + "Rh", + new Werkstoff.Stats().setProtons(Element.Rh.mProtons) + .setMass(Element.Rh.getMass()) + .setBlastFurnace(true) + .setMeltingPoint(2237), + Werkstoff.Types.ELEMENT, + new Werkstoff.GenerationFeatures().disable() + .onlyDust() + .addMetalItems() + .addMolten() + .enforceUnification(), + 78, + TextureSet.SET_METALLIC); + public static final Werkstoff CrudeRhMetall = new Werkstoff( + new short[] { 0x66, 0x66, 0x66 }, + "Crude Rhodium Metal", + "??Rh??", + new Werkstoff.Stats(), + Werkstoff.Types.MIXTURE, + new Werkstoff.GenerationFeatures(), + 79, + TextureSet.SET_DULL, + new Pair<>(Rhodium, 1), + new Pair<>(Materials.Stone, 1)); + public static final Werkstoff RHSalt = new Werkstoff( + new short[] { 0x84, 0x84, 0x84 }, + "Rhodium Salt", + new Werkstoff.Stats(), + Werkstoff.Types.MIXTURE, + new Werkstoff.GenerationFeatures().disable() + .onlyDust(), + 80, + TextureSet.SET_GEM_VERTICAL); + public static final Werkstoff RHSaltSolution = new Werkstoff( + new short[] { 0x66, 0x77, 0x88 }, + "Rhodium Salt Solution", + new Werkstoff.Stats(), + Werkstoff.Types.MIXTURE, + new Werkstoff.GenerationFeatures().disable() + .addCells(), + 81, + TextureSet.SET_FLUID); + public static final Werkstoff SodiumNitrate = new Werkstoff( + new short[] { 0x84, 0x66, 0x84 }, + "Sodium Nitrate", + subscriptNumbers("NaNO3"), + new Werkstoff.Stats(), + Werkstoff.Types.MIXTURE, + new Werkstoff.GenerationFeatures().disable() + .onlyDust(), + 82, + TextureSet.SET_ROUGH, + new Pair<>(Materials.Sodium, 1), + new Pair<>(Materials.Nitrogen, 1), + new Pair<>(Materials.Oxygen, 3)); + public static final Werkstoff RHNitrate = new Werkstoff( + new short[] { 0x77, 0x66, 0x49 }, + "Rhodium Nitrate", + new Werkstoff.Stats(), + Werkstoff.Types.MIXTURE, + new Werkstoff.GenerationFeatures().disable() + .onlyDust(), + 83, + TextureSet.SET_QUARTZ); + public static final Werkstoff ZincSulfate = new Werkstoff( + new short[] { 0x84, 0x66, 0x49 }, + "Zinc Sulfate", + new Werkstoff.Stats().setElektrolysis(true), + Werkstoff.Types.MIXTURE, + new Werkstoff.GenerationFeatures().disable() + .onlyDust(), + 84, + TextureSet.SET_QUARTZ, + new Pair<>(Materials.Zinc, 1), + new Pair<>(Materials.Sulfur, 1), + new Pair<>(Materials.Oxygen, 4)); + public static final Werkstoff RhFilterCake = new Werkstoff( + new short[] { 0x77, 0x66, 0x49 }, + "Rhodium Filter Cake", + new Werkstoff.Stats(), + Werkstoff.Types.MIXTURE, + new Werkstoff.GenerationFeatures().disable() + .onlyDust(), + 85, + TextureSet.SET_QUARTZ); + public static final Werkstoff RHFilterCakeSolution = new Werkstoff( + new short[] { 0x66, 0x77, 0x88 }, + "Rhodium Filter Cake Solution", + new Werkstoff.Stats(), + Werkstoff.Types.MIXTURE, + new Werkstoff.GenerationFeatures().disable() + .addCells(), + 86, + TextureSet.SET_FLUID); + public static final Werkstoff ReRh = new Werkstoff( + new short[] { 0x77, 0x66, 0x49 }, + "Reprecipitated Rhodium", + subscriptNumbers("Rh2NH4"), + new Werkstoff.Stats(), + Werkstoff.Types.MIXTURE, + new Werkstoff.GenerationFeatures().disable() + .onlyDust(), + 87, + TextureSet.SET_QUARTZ); + public static final Werkstoff LuVTierMaterial = new Werkstoff( + Materials.Chrome.getRGBA(), + "Rhodium-Plated Palladium", + new Werkstoff.Stats().setCentrifuge(true) + .setBlastFurnace(true) + .setMeltingPoint(4500) + .setMeltingVoltage(480), + Werkstoff.Types.COMPOUND, + new Werkstoff.GenerationFeatures().disable() + .onlyDust() + .addMolten() + .addMetalItems() + .addMixerRecipes((short) 1) + .addSimpleMetalWorkingItems() + .addCraftingMetalWorkingItems() + .addMultipleIngotMetalWorkingItems(), + 88, + TextureSet.SET_METALLIC, + new Pair<>(Materials.Palladium, 3), + new Pair<>(WerkstoffLoader.Rhodium, 1)); + public static final Werkstoff Tiberium = new Werkstoff( + new short[] { 0x22, 0xEE, 0x22 }, + "Tiberium", + "Tr", + new Werkstoff.Stats().setProtons(123) + .setMass(326) + .setBlastFurnace(true) + .setMeltingPoint(1800) + .setRadioactive(true) + .setToxic(true), + Werkstoff.Types.ELEMENT, + new Werkstoff.GenerationFeatures().addGems() + .addCraftingMetalWorkingItems() + .addSimpleMetalWorkingItems(), + 89, + TextureSet.SET_DIAMOND); + public static final Werkstoff Ruridit = new Werkstoff( + new short[] { 0xA4, 0xA4, 0xA4 }, + "Ruridit", + new Werkstoff.Stats().setCentrifuge(true) + .setBlastFurnace(true) + .setMeltingPoint(4500) + .setMeltingVoltage(480), + Werkstoff.Types.COMPOUND, + new Werkstoff.GenerationFeatures().disable() + .onlyDust() + .addMolten() + .addMetalItems() + .addMixerRecipes((short) 1) + .addSimpleMetalWorkingItems() + .addCraftingMetalWorkingItems() + .addMultipleIngotMetalWorkingItems(), + 90, + TextureSet.SET_METALLIC, + new Pair<>(WerkstoffLoader.Ruthenium, 2), + new Pair<>(Materials.Iridium, 1)); + public static final Werkstoff Fluorspar = new Werkstoff( + new short[] { 185, 69, 251 }, + "Fluorspar", + new Werkstoff.Stats().setElektrolysis(true), + Werkstoff.Types.COMPOUND, + new Werkstoff.GenerationFeatures().addGems(), + 91, + TextureSet.SET_GEM_VERTICAL, + new Pair<>(Materials.Calcium, 1), + new Pair<>(Materials.Fluorine, 2)); + public static final Werkstoff HDCS = new Werkstoff( + new short[] { 0x33, 0x44, 0x33 }, + "High Durability Compound Steel", + new Werkstoff.Stats().setCentrifuge(true) + .setBlastFurnace(true) + .setMeltingPoint(9000) + .setMeltingVoltage(7680), + Werkstoff.Types.MIXTURE, + new Werkstoff.GenerationFeatures().disable() + .onlyDust() + .addMolten() + .addMetalItems() + .addMixerRecipes() + .addSimpleMetalWorkingItems() + .addCraftingMetalWorkingItems() + .addMultipleIngotMetalWorkingItems(), + 92, + TextureSet.SET_SHINY, + new Pair<>(Materials.TungstenSteel, 12), + new Pair<>(Materials.HSSE, 9), + new Pair<>(Materials.HSSG, 6), + new Pair<>(WerkstoffLoader.Ruridit, 3), + new Pair<>(WerkstoffLoader.MagnetoResonaticDust, 2), + new Pair<>(Materials.Plutonium, 1)); + public static final Werkstoff Atheneite = new Werkstoff( + new short[] { 175, 175, 175 }, + "Atheneite", + subscriptNumbers("(Pd,Hg)3As"), + new Werkstoff.Stats().setElektrolysis(true), + Werkstoff.Types.COMPOUND, + new Werkstoff.GenerationFeatures(), + 93, + TextureSet.SET_SHINY, + new Pair<>(WerkstoffLoader.PDMetallicPowder, 3), + new Pair<>(Materials.Mercury, 3), + new Pair<>(Materials.Arsenic, 1)); + public static final Werkstoff Temagamite = new Werkstoff( + new short[] { 245, 245, 245 }, + "Temagamite", + subscriptNumbers("Pd3HgTe"), + new Werkstoff.Stats().setElektrolysis(true), + Werkstoff.Types.COMPOUND, + new Werkstoff.GenerationFeatures(), + 94, + TextureSet.SET_ROUGH, + new Pair<>(WerkstoffLoader.PDMetallicPowder, 3), + new Pair<>(Materials.Mercury, 1), + new Pair<>(Materials.Tellurium, 1)); + public static final Werkstoff Terlinguaite = new Werkstoff( + new short[] { 245, 245, 245 }, + "Terlinguaite", + new Werkstoff.Stats().setElektrolysis(true), + Werkstoff.Types.COMPOUND, + new Werkstoff.GenerationFeatures(), + 95, + TextureSet.SET_GEM_HORIZONTAL, + new Pair<>(Materials.Mercury, 2), + new Pair<>(Materials.Chlorine, 1), + new Pair<>(Materials.Oxygen, 1)); + public static final Werkstoff AdemicSteel = new Werkstoff( + new short[] { 0xcc, 0xcc, 0xcc }, + "Ademic Steel", + "The break in the line", + new Werkstoff.Stats().setCentrifuge(true) + .setBlastFurnace(true) + .setDurOverride(6144) + .setMeltingPoint(1800) + .setSpeedOverride(12) + .setQualityOverride((byte) 4) + .setMeltingVoltage(1920), + Werkstoff.Types.MIXTURE, + new Werkstoff.GenerationFeatures().onlyDust() + .addMetalItems() + .addCraftingMetalWorkingItems() + .addMolten() + .addSimpleMetalWorkingItems() + .addMultipleIngotMetalWorkingItems(), + 96, + TextureSet.SET_METALLIC, + new Pair<>(Materials.Steel, 2), + new Pair<>(Materials.VanadiumSteel, 1), + new Pair<>(Materials.DamascusSteel, 1), + new Pair<>(Materials.Carbon, 4)); + public static final Werkstoff RawAdemicSteel = new Werkstoff( + new short[] { 0xed, 0xed, 0xed }, + "Raw Ademic Steel", + new Werkstoff.Stats().setCentrifuge(true), + Werkstoff.Types.MIXTURE, + new Werkstoff.GenerationFeatures().onlyDust() + .addMixerRecipes(), + 97, + TextureSet.SET_ROUGH, + new Pair<>(Materials.Steel, 2), + new Pair<>(Materials.VanadiumSteel, 1), + new Pair<>(Materials.DamascusSteel, 1)); + public static final Werkstoff HexafluorosilicicAcid = new Werkstoff( + new short[] { 0x2c, 0x70, 0xb5 }, + "Hexafluorosilicic Acid", + subscriptNumbers("H2SiF6"), + new Werkstoff.Stats().setElektrolysis(true), + Werkstoff.Types.COMPOUND, + new Werkstoff.GenerationFeatures().disable() + .addCells(), + 98, + TextureSet.SET_FLUID, + new Pair<>(Materials.Hydrogen, 2), + new Pair<>(Materials.Silicon, 1), + new Pair<>(Materials.Fluorine, 6)); + public static final Werkstoff Potassiumfluorosilicate = new Werkstoff( + new short[] { 0x2e, 0x97, 0xb2 }, + "Potassiumfluorosilicate", + subscriptNumbers("K2SiF6"), + new Werkstoff.Stats().setElektrolysis(true), + Werkstoff.Types.COMPOUND, + new Werkstoff.GenerationFeatures().disable() + .onlyDust(), + 99, + TextureSet.SET_SHINY, + new Pair<>(Materials.Potassium, 2), + new Pair<>(Materials.Silicon, 1), + new Pair<>(Materials.Fluorine, 6)); + public static final Werkstoff Alumina = new Werkstoff( + new short[] { 0xa0, 0xad, 0xb1 }, + "Alumina", + subscriptNumbers("Al2O3"), + new Werkstoff.Stats(), + Werkstoff.Types.COMPOUND, + new Werkstoff.GenerationFeatures().disable() + .onlyDust(), + 100, + TextureSet.SET_DULL); + public static final Werkstoff PotassiumCarbonate = new Werkstoff( + new short[] { 0x7b, 0x96, 0x4f }, + "Potassium Carbonate", + subscriptNumbers("K2CO3"), + new Werkstoff.Stats().setElektrolysis(true), + Werkstoff.Types.COMPOUND, + new Werkstoff.GenerationFeatures().disable() + .onlyDust(), + 101, + TextureSet.SET_DULL, + new Pair<>(Materials.Potassium, 2), + new Pair<>(Materials.Carbon, 1), + new Pair<>(Materials.Oxygen, 3)); + public static final Werkstoff RawFluorophlogopite = new Werkstoff( + new short[] { 0x36, 0x51, 0x0b }, + "Raw Fluorophlogopite", + new Werkstoff.Stats(), + Werkstoff.Types.MIXTURE, + new Werkstoff.GenerationFeatures().disable() + .onlyDust(), + 102, + TextureSet.SET_DULL); + public static final Werkstoff HotFluorophlogopite = new Werkstoff( + new short[] { 0xbf, 0xd3, 0x55 }, + "Unformed Fluorophlogopite", + new Werkstoff.Stats(), + Werkstoff.Types.MIXTURE, + new Werkstoff.GenerationFeatures().disable() + .addCells(), + 103, + TextureSet.SET_FLUID); + public static final Werkstoff Fluorophlogopite = new Werkstoff( + new short[] { 0xbf, 0xd3, 0x55 }, + "Fluorophlogopite", + new Werkstoff.Stats(), + Werkstoff.Types.MIXTURE, + new Werkstoff.GenerationFeatures().disable() + .onlyDust() + .addMetalItems(), + 104, + TextureSet.SET_SHINY); + + public static HashMap<OrePrefixes, BWMetaGeneratedItems> items = new HashMap<>(); + public static HashBiMap<Werkstoff, Fluid> fluids = HashBiMap.create(); + public static HashBiMap<Werkstoff, Fluid> molten = HashBiMap.create(); + public static Block BWOres; + public static Block BWSmallOres; + public static Block BWBlocks; + public static Block BWBlockCasings; + public static Block BWBlockCasingsAdvanced; + public static boolean registered; + public static final HashSet<OrePrefixes> ENABLED_ORE_PREFIXES = new HashSet<>(); + + public static Werkstoff getWerkstoff(String Name) { + try { + Field f = WerkstoffLoader.class.getField(Name); + return (Werkstoff) f.get(null); + } catch (IllegalAccessException | NoSuchFieldException | ClassCastException e) { + MainMod.LOGGER.catching(e); + } + return Werkstoff.default_null_Werkstoff; + } + + public static ItemStack getCorrespondingItemStack(OrePrefixes orePrefixes, Werkstoff werkstoff) { + return WerkstoffLoader.getCorrespondingItemStack(orePrefixes, werkstoff, 1); + } + + public static ItemStack getCorrespondingItemStackUnsafe(OrePrefixes orePrefixes, Werkstoff werkstoff, int amount) { + if (!werkstoff.getGenerationFeatures().enforceUnification) { + ItemStack ret = GTOreDictUnificator.get(orePrefixes, werkstoff.getBridgeMaterial(), amount); + if (ret != null) return ret; + ret = OreDictHandler.getItemStack(werkstoff.getVarName(), orePrefixes, amount); + if (ret != null) return ret; + } + if (orePrefixes == ore) return new ItemStack(WerkstoffLoader.BWOres, amount, werkstoff.getmID()); + if (orePrefixes == oreSmall) return new ItemStack(WerkstoffLoader.BWSmallOres, amount, werkstoff.getmID()); + else if (orePrefixes == block) return new ItemStack(WerkstoffLoader.BWBlocks, amount, werkstoff.getmID()); + else if (orePrefixes == OrePrefixes.blockCasing) + return new ItemStack(WerkstoffLoader.BWBlockCasings, amount, werkstoff.getmID()); + else if (orePrefixes == OrePrefixes.blockCasingAdvanced) + return new ItemStack(WerkstoffLoader.BWBlockCasingsAdvanced, amount, werkstoff.getmID()); + else if (WerkstoffLoader.items.get(orePrefixes) == null) return null; + return new ItemStack(WerkstoffLoader.items.get(orePrefixes), amount, werkstoff.getmID()).copy(); + } + + public static ItemStack getCorrespondingItemStack(OrePrefixes orePrefixes, Werkstoff werkstoff, int amount) { + ItemStack stack = getCorrespondingItemStackUnsafe(orePrefixes, werkstoff, amount); + if (stack != null) return stack; + MainMod.LOGGER.catching( + Level.ERROR, + new Exception( + "NO SUCH ITEM! " + orePrefixes + + werkstoff.getVarName() + + " If you encounter this as a user, make sure to contact the authors of the pack/the mods you're playing! " + + "If you are a Developer, you forgot to enable " + + orePrefixes + + " OrePrefix for Werkstoff " + + werkstoff.getDefaultName())); + return new ItemStack(WerkstoffLoader.items.get(orePrefixes), amount, werkstoff.getmID()).copy(); + } + + public static void runInit() { + MainMod.LOGGER.info("Making Meta Items for BW Materials"); + long timepre = System.nanoTime(); + WerkstoffAdderRegistry.run(); + addSubTags(); + addItemsForGeneration(); + addBridgeSubTags(); + runAdditionalOreDict(); + long timepost = System.nanoTime(); + MainMod.LOGGER.info( + "Making Meta Items for BW Materials took " + (timepost - timepre) + + "ns/" + + (timepost - timepre) / 1000000 + + "ms/" + + (timepost - timepre) / 1000000000 + + "s!"); + } + + public static void run() { + if (!registered) { + MainMod.LOGGER.info("Loading Processing Recipes for BW Materials"); + long timepre = System.nanoTime(); + ProgressManager.ProgressBar progressBar = ProgressManager + .push("Register BW Materials", Werkstoff.werkstoffHashSet.size() + 1); + DebugLog.log("Loading Recipes" + (System.nanoTime() - timepre)); + Integer[] clsArr = {}; + int size = 0; + if (BetterLoadingScreen.isModLoaded()) clsArr = CLSCompat.initCls(); + + IWerkstoffRunnable[] werkstoffRunnables = { new ToolLoader(), new DustLoader(), new GemLoader(), + new SimpleMetalLoader(), new CasingLoader(), new AspectLoader(), new OreLoader(), new RawOreLoader(), + new CrushedLoader(), new CraftingMaterialLoader(), new CellLoader(), new MoltenCellLoader(), + new MultipleMetalLoader(), new MetalLoader(), new BlockLoader() }; + + long timepreone = 0; + for (Werkstoff werkstoff : Werkstoff.werkstoffHashSet) { + timepreone = System.nanoTime(); + DebugLog.log( + "Werkstoff is null or id < 0 ? " + (werkstoff == null || werkstoff.getmID() < 0) + + " " + + (System.nanoTime() - timepreone)); + if (werkstoff == null || werkstoff.getmID() < 0) { + progressBar.step(""); + continue; + } + if (BetterLoadingScreen.isModLoaded()) size = CLSCompat.invokeStepSize(werkstoff, clsArr, size); + DebugLog.log("Werkstoff: " + werkstoff.getDefaultName() + " " + (System.nanoTime() - timepreone)); + for (IWerkstoffRunnable runnable : werkstoffRunnables) { + String loaderName = runnable.getClass() + .getSimpleName(); + DebugLog.log(loaderName + " started " + (System.nanoTime() - timepreone)); + runnable.run(werkstoff); + DebugLog.log(loaderName + " done " + (System.nanoTime() - timepreone)); + } + DebugLog.log("Done" + " " + (System.nanoTime() - timepreone)); + progressBar.step(werkstoff.getDefaultName()); + } + DebugLog.log("Loading New Circuits" + " " + (System.nanoTime() - timepreone)); + BWCircuitsLoader.initNewCircuits(); + + if (BetterLoadingScreen.isModLoaded()) { + CLSCompat.disableCls(); + } + + progressBar.step("Load Additional Recipes"); + AdditionalRecipes.run(); + ProgressManager.pop(progressBar); + long timepost = System.nanoTime(); + MainMod.LOGGER.info( + "Loading Processing Recipes for BW Materials took " + (timepost - timepre) + + "ns/" + + (timepost - timepre) / 1000000 + + "ms/" + + (timepost - timepre) / 1000000000 + + "s!"); + registered = true; + } + } + + @SuppressWarnings("unchecked") + private static void addSubTags() { + WerkstoffLoader.CubicZirconia.getStats() + .setDurOverride(Materials.Diamond.mDurability); + WerkstoffLoader.HDCS.getStats() + .setSpeedOverride(Materials.HSSS.mToolSpeed); + WerkstoffLoader.HDCS.getStats() + .setDurMod(10f); + Materials.Helium.add(WerkstoffLoader.NOBLE_GAS); + WerkstoffLoader.Neon.add(WerkstoffLoader.NOBLE_GAS); + Materials.Argon.add(WerkstoffLoader.NOBLE_GAS); + WerkstoffLoader.Krypton.add(WerkstoffLoader.NOBLE_GAS); + WerkstoffLoader.Xenon.add(WerkstoffLoader.NOBLE_GAS, WerkstoffLoader.ANAEROBE_GAS); + Materials.Radon.add(WerkstoffLoader.NOBLE_GAS); + WerkstoffLoader.Oganesson.add(WerkstoffLoader.NOBLE_GAS, WerkstoffLoader.ANAEROBE_GAS); + + Materials.Nitrogen.add(WerkstoffLoader.ANAEROBE_GAS); + + WerkstoffLoader.Calcium.add(WerkstoffLoader.ANAEROBE_SMELTING); + + WerkstoffLoader.LuVTierMaterial.add(WerkstoffLoader.NOBLE_GAS_SMELTING); + WerkstoffLoader.Ruridit.add(WerkstoffLoader.NOBLE_GAS_SMELTING); + WerkstoffLoader.AdemicSteel.add(WerkstoffLoader.NOBLE_GAS_SMELTING); + + WerkstoffLoader.MagnetoResonaticDust.add(WerkstoffLoader.NO_BLAST); + + // Calcium Smelting block + Materials.Calcium.mBlastFurnaceRequired = true; + + Materials.Salt.mDurability = WerkstoffLoader.Salt.getDurability(); + Materials.Spodumene.mDurability = WerkstoffLoader.Spodumen.getDurability(); + Materials.RockSalt.mDurability = WerkstoffLoader.RockSalt.getDurability(); + Materials.Calcium.mDurability = WerkstoffLoader.Calcium.getDurability(); + + Materials.Salt.mToolSpeed = WerkstoffLoader.Salt.getToolSpeed(); + Materials.Spodumene.mToolSpeed = WerkstoffLoader.Spodumen.getToolSpeed(); + Materials.RockSalt.mToolSpeed = WerkstoffLoader.RockSalt.getToolSpeed(); + Materials.Calcium.mToolSpeed = WerkstoffLoader.Calcium.getToolSpeed(); + + Materials.Salt.mToolQuality = WerkstoffLoader.Salt.getToolQuality(); + Materials.Spodumene.mToolQuality = WerkstoffLoader.Spodumen.getToolQuality(); + Materials.RockSalt.mToolQuality = WerkstoffLoader.RockSalt.getToolQuality(); + Materials.Calcium.mToolQuality = WerkstoffLoader.Calcium.getToolQuality(); + + for (Werkstoff W : Werkstoff.werkstoffHashSet) { + for (Pair<ISubTagContainer, Integer> pair : W.getContents() + .getValue() + .toArray(new Pair[0])) { + + if (pair.getKey() instanceof Materials && pair.getKey() == Materials.Neodymium) { + W.add(SubTag.ELECTROMAGNETIC_SEPERATION_NEODYMIUM); + break; + } + if (pair.getKey() instanceof Materials && pair.getKey() == Materials.Iron) { + W.add(SubTag.ELECTROMAGNETIC_SEPERATION_IRON); + break; + } else if (pair.getKey() instanceof Materials && pair.getKey() == Materials.Gold) { + W.add(SubTag.ELECTROMAGNETIC_SEPERATION_GOLD); + break; + } + } + if (W.hasItemType(gem)) { + W.add(SubTag.CRYSTAL); + W.add(SubTag.CRYSTALLISABLE); + } + } + } + + private static void addBridgeSubTags() { + // add specific GT materials subtags to various werkstoff bridgematerials + + SubTag.METAL.addTo(LuVTierMaterial.getBridgeMaterial()); + } + + public static long toGenerateGlobal; + + private static void addItemsForGeneration() { + for (Werkstoff werkstoff : Werkstoff.werkstoffHashSet) { + if (werkstoff.hasItemType(cell)) { + if (!FluidRegistry.isFluidRegistered(werkstoff.getDefaultName())) { + DebugLog.log("Adding new Fluid: " + werkstoff.getDefaultName()); + Fluid fluid = GTFluidFactory.builder(werkstoff.getDefaultName()) + .withLocalizedName(werkstoff.getDefaultName()) + .withStateAndTemperature( + werkstoff.getStats() + .getFluidState(), + 300) + .withColorRGBA(werkstoff.getRGBA()) + .withTextureName("autogenerated") + .buildAndRegister() + .asFluid(); + WerkstoffLoader.fluids.put(werkstoff, fluid); + } else { + WerkstoffLoader.fluids.put(werkstoff, FluidRegistry.getFluid(werkstoff.getDefaultName())); + } + } + if (werkstoff.hasItemType(OrePrefixes.cellMolten)) { + if (!FluidRegistry.isFluidRegistered("molten." + werkstoff.getDefaultName())) { + DebugLog.log("Adding new Molten: " + werkstoff.getDefaultName()); + Fluid fluid = GTFluidFactory.builder("molten." + werkstoff.getDefaultName()) + .withLocalizedName("Molten " + werkstoff.getDefaultName()) + .withStateAndTemperature( + FluidState.MOLTEN, + werkstoff.getStats() + .getMeltingPoint() > 0 ? werkstoff.getStats() + .getMeltingPoint() : 300) + .withColorRGBA(werkstoff.getRGBA()) + .withTextureName("molten.autogenerated") + .buildAndRegister() + .asFluid(); + WerkstoffLoader.molten.put(werkstoff, fluid); + } else { + WerkstoffLoader.molten.put(werkstoff, FluidRegistry.getFluid(werkstoff.getDefaultName())); + } + } + for (OrePrefixes p : values()) if (Materials.get(werkstoff.getDefaultName()) != null + && Materials.get(werkstoff.getDefaultName()).mMetaItemSubID != -1 + && (werkstoff.getGenerationFeatures().toGenerate & p.mMaterialGenerationBits) != 0 + && OreDictHandler.getItemStack(werkstoff.getDefaultName(), p, 1) != null) { + DebugLog.log( + "Found: " + p + + werkstoff.getVarName() + + " in GT material system, disable and reroute my Items to that, also add a Tooltip."); + werkstoff.getGenerationFeatures() + .setBlacklist(p); + } + WerkstoffLoader.toGenerateGlobal = WerkstoffLoader.toGenerateGlobal + | werkstoff.getGenerationFeatures().toGenerate; + } + DebugLog.log("GlobalGeneration: " + WerkstoffLoader.toGenerateGlobal); + if ((WerkstoffLoader.toGenerateGlobal & 0b1) != 0) { + WerkstoffLoader.items.put(dust, new BWMetaGeneratedItems(dust)); + WerkstoffLoader.items.put(dustTiny, new BWMetaGeneratedItems(dustTiny)); + WerkstoffLoader.items.put(dustSmall, new BWMetaGeneratedItems(dustSmall)); + } + if ((WerkstoffLoader.toGenerateGlobal & 0b10) != 0) { + WerkstoffLoader.items.put(ingot, new BWMetaGeneratedItems(ingot)); + WerkstoffLoader.items.put(ingotHot, new BWMetaGeneratedItems(ingotHot)); // 1750 + WerkstoffLoader.items.put(nugget, new BWMetaGeneratedItems(nugget)); + } + if ((WerkstoffLoader.toGenerateGlobal & 0b100) != 0) { + WerkstoffLoader.items.put(gem, new BWMetaGeneratedItems(gem)); + WerkstoffLoader.items.put(gemChipped, new BWMetaGeneratedItems(gemChipped)); + WerkstoffLoader.items.put(gemExquisite, new BWMetaGeneratedItems(gemExquisite)); + WerkstoffLoader.items.put(gemFlawed, new BWMetaGeneratedItems(gemFlawed)); + WerkstoffLoader.items.put(gemFlawless, new BWMetaGeneratedItems(gemFlawless)); + WerkstoffLoader.items.put(lens, new BWMetaGeneratedItems(lens)); + } + if ((WerkstoffLoader.toGenerateGlobal & 0b1000) != 0) { + gameRegistryHandler(); + WerkstoffLoader.items.put(crushed, new BWMetaGeneratedItems(crushed)); + WerkstoffLoader.items.put(crushedPurified, new BWMetaGeneratedItems(crushedPurified)); + WerkstoffLoader.items.put(crushedCentrifuged, new BWMetaGeneratedItems(crushedCentrifuged)); + WerkstoffLoader.items.put(dustPure, new BWMetaGeneratedItems(dustPure)); + WerkstoffLoader.items.put(dustImpure, new BWMetaGeneratedItems(dustImpure)); + WerkstoffLoader.items.put(rawOre, new BWMetaGeneratedItems(rawOre)); + } + if ((WerkstoffLoader.toGenerateGlobal & 0b10000) != 0) { + WerkstoffLoader.items.put(cell, new BWMetaGeneratedItems(cell)); + if (Forestry.isModLoaded()) { + BWMetaGeneratedItems capsuleClass = new BWMetaGeneratedItems(capsule); + API.hideItem(new ItemStack(capsuleClass, 1, WILDCARD)); + WerkstoffLoader.items.put(capsule, capsuleClass); + } + } + if ((WerkstoffLoader.toGenerateGlobal & 0b100000) != 0) { + WerkstoffLoader.items.put(cellPlasma, new BWMetaGeneratedItems(cellPlasma)); + } + if ((WerkstoffLoader.toGenerateGlobal & 0b1000000) != 0) { + WerkstoffLoader.items.put(OrePrefixes.cellMolten, new BWMetaGeneratedItems(OrePrefixes.cellMolten)); + if (Forestry.isModLoaded()) { + BWMetaGeneratedItems capsuleMoltenClass = new BWMetaGeneratedItems(OrePrefixes.capsuleMolten); + API.hideItem(new ItemStack(capsuleMoltenClass, 1, WILDCARD)); + WerkstoffLoader.items.put(OrePrefixes.capsuleMolten, capsuleMoltenClass); + } + } + if ((WerkstoffLoader.toGenerateGlobal & 0b10000000) != 0) { + WerkstoffLoader.items.put(plate, new BWMetaGeneratedItems(plate)); + WerkstoffLoader.items.put(foil, new BWMetaGeneratedItems(foil)); + WerkstoffLoader.items.put(stick, new BWMetaGeneratedItems(stick)); + WerkstoffLoader.items.put(stickLong, new BWMetaGeneratedItems(stickLong)); + WerkstoffLoader.items.put(toolHeadWrench, new BWMetaGeneratedItems(toolHeadWrench)); + WerkstoffLoader.items.put(toolHeadHammer, new BWMetaGeneratedItems(toolHeadHammer)); + WerkstoffLoader.items.put(toolHeadSaw, new BWMetaGeneratedItems(toolHeadSaw)); + WerkstoffLoader.items.put(turbineBlade, new BWMetaGeneratedItems(turbineBlade)); + } + if ((WerkstoffLoader.toGenerateGlobal & 0b100000000) != 0) { + WerkstoffLoader.items.put(gearGt, new BWMetaGeneratedItems(gearGt)); + WerkstoffLoader.items.put(gearGtSmall, new BWMetaGeneratedItems(gearGtSmall)); + WerkstoffLoader.items.put(bolt, new BWMetaGeneratedItems(bolt)); + WerkstoffLoader.items.put(screw, new BWMetaGeneratedItems(screw)); + WerkstoffLoader.items.put(ring, new BWMetaGeneratedItems(ring)); + WerkstoffLoader.items.put(spring, new BWMetaGeneratedItems(spring)); + WerkstoffLoader.items.put(springSmall, new BWMetaGeneratedItems(springSmall)); + WerkstoffLoader.items.put(rotor, new BWMetaGeneratedItems(rotor)); + WerkstoffLoader.items.put(wireFine, new BWMetaGeneratedItems(wireFine)); + } + if ((WerkstoffLoader.toGenerateGlobal & 0b1000000000) != 0) { + WerkstoffLoader.items.put(plateDouble, new BWMetaGeneratedItems(plateDouble)); + WerkstoffLoader.items.put(plateTriple, new BWMetaGeneratedItems(plateTriple)); + WerkstoffLoader.items.put(plateQuadruple, new BWMetaGeneratedItems(plateQuadruple)); + WerkstoffLoader.items.put(plateQuintuple, new BWMetaGeneratedItems(plateQuintuple)); + WerkstoffLoader.items.put(plateDense, new BWMetaGeneratedItems(plateDense)); + WerkstoffLoader.items.put(ingotDouble, new BWMetaGeneratedItems(ingotDouble)); + WerkstoffLoader.items.put(ingotTriple, new BWMetaGeneratedItems(ingotTriple)); + WerkstoffLoader.items.put(ingotQuadruple, new BWMetaGeneratedItems(ingotQuadruple)); + WerkstoffLoader.items.put(ingotQuintuple, new BWMetaGeneratedItems(ingotQuintuple)); + } + ENABLED_ORE_PREFIXES.addAll(WerkstoffLoader.items.keySet()); + ENABLED_ORE_PREFIXES.add(ore); + ENABLED_ORE_PREFIXES.add(oreSmall); + WerkstoffLoader.runGTItemDataRegistrator(); + } + + static void gameRegistryHandler() { + if (SideReference.Side.Client) BWBlockOreRenderer.register(); + + GameRegistry.registerTileEntity(BWTileEntityMetaGeneratedOre.class, "bw.blockoresTE"); + GameRegistry.registerTileEntity(BWTileEntityMetaGeneratedSmallOre.class, "bw.blockoresSmallTE"); + GameRegistry.registerTileEntity(BWTileEntityMetaGeneratedWerkstoffBlock.class, "bw.werkstoffblockTE"); + GameRegistry.registerTileEntity(BWTileEntityMetaGeneratedBlocksCasing.class, "bw.werkstoffblockcasingTE"); + GameRegistry.registerTileEntity( + BWTileEntityMetaGeneratedBlocksCasingAdvanced.class, + "bw.werkstoffblockscasingadvancedTE"); + + WerkstoffLoader.BWOres = new BWMetaGeneratedOres( + Material.rock, + BWTileEntityMetaGeneratedOre.class, + "bw.blockores"); + WerkstoffLoader.BWSmallOres = new BWMetaGeneratedSmallOres( + Material.rock, + BWTileEntityMetaGeneratedSmallOre.class, + "bw.blockoresSmall"); + WerkstoffLoader.BWBlocks = new BWMetaGeneratedWerkstoffBlocks( + Material.iron, + BWTileEntityMetaGeneratedWerkstoffBlock.class, + "bw.werkstoffblocks"); + WerkstoffLoader.BWBlockCasings = new BWMetaGeneratedBlocksCasing( + Material.iron, + BWTileEntityMetaGeneratedBlocksCasing.class, + "bw.werkstoffblockscasing", + OrePrefixes.blockCasing); + WerkstoffLoader.BWBlockCasingsAdvanced = new BWMetaGeneratedBlocksCasing( + Material.iron, + BWTileEntityMetaGeneratedBlocksCasingAdvanced.class, + "bw.werkstoffblockscasingadvanced", + OrePrefixes.blockCasingAdvanced); + + GameRegistry.registerBlock(WerkstoffLoader.BWOres, BWItemMetaGeneratedBlock.class, "bw.blockores.01"); + GameRegistry.registerBlock(WerkstoffLoader.BWSmallOres, BWItemMetaGeneratedBlock.class, "bw.blockores.02"); + GameRegistry.registerBlock(WerkstoffLoader.BWBlocks, BWItemMetaGeneratedBlock.class, "bw.werkstoffblocks.01"); + if (!ConfigHandler.disableBoltedBlocksCasing) GameRegistry.registerBlock( + WerkstoffLoader.BWBlockCasings, + BWItemMetaGeneratedBlock.class, + "bw.werkstoffblockscasing.01"); + if (!ConfigHandler.disableReboltedBlocksCasing) GameRegistry.registerBlock( + WerkstoffLoader.BWBlockCasingsAdvanced, + BWItemMetaGeneratedBlock.class, + "bw.werkstoffblockscasingadvanced.01"); + + GTMetaItemEnhancer.addAdditionalOreDictToForestry(); + GTMetaItemEnhancer.init(); + } + + private static void runGTItemDataRegistrator() { + IWerkstoffRunnable[] registrations = { new BridgeMaterialsLoader(), new AssociationLoader(), + new CasingRegistrator() }; + for (Werkstoff werkstoff : Werkstoff.werkstoffHashSet) { + for (IWerkstoffRunnable registration : registrations) { + registration.run(werkstoff); + } + } + addFakeItemDataToInWorldBlocksAndCleanUpFakeData(); + addVanillaCasingsToGTOreDictUnificator(); + } + + public static void addVanillaCasingsToGTOreDictUnificator() { + GTOreDictUnificator + .addAssociation(OrePrefixes.blockCasing, Materials.Aluminium, ItemList.Casing_FrostProof.get(1L), false); + GTOreDictUnificator + .addAssociation(OrePrefixes.blockCasing, Materials.Nickel, ItemList.Casing_HeatProof.get(1L), false); + GTOreDictUnificator + .addAssociation(OrePrefixes.blockCasing, Materials.Lead, ItemList.Casing_RadiationProof.get(1L), false); + GTOreDictUnificator + .addAssociation(OrePrefixes.blockCasing, Materials.Steel, ItemList.Casing_SolidSteel.get(1L), false); + GTOreDictUnificator.addAssociation( + OrePrefixes.blockCasing, + Materials.TungstenSteel, + ItemList.Casing_RobustTungstenSteel.get(1L), + false); + GTOreDictUnificator.addAssociation( + OrePrefixes.blockCasing, + Materials.Polytetrafluoroethylene, + ItemList.Casing_Chemically_Inert.get(1L), + false); + } + + /** + * very hacky way to make my ores/blocks/smallores detectable by gt assosication in world, well at least the prefix. + * used for the miners mostly removing this hacky material from the materials map instantly. we only need the item + * data. + */ + @SuppressWarnings("unchecked") + private static void addFakeItemDataToInWorldBlocksAndCleanUpFakeData() { + + Map<String, Materials> MATERIALS_MAP = null; + + try { + Field f = Materials.class.getDeclaredField("MATERIALS_MAP"); + f.setAccessible(true); + MATERIALS_MAP = (Map<String, Materials>) f.get(null); + } catch (NoSuchFieldException | IllegalAccessException | ClassCastException e) { + e.printStackTrace(); + } + + if (MATERIALS_MAP == null) throw new NullPointerException("MATERIALS_MAP null!"); + + Materials oreMat = new Materials(-1, null, 0, 0, 0, false, "bwores", "bwores", null, true, null); + Materials smallOreMat = new Materials(-1, null, 0, 0, 0, false, "bwsmallores", "bwsmallores", null, true, null); + Materials blockMat = new Materials(-1, null, 0, 0, 0, false, "bwblocks", "bwblocks", null, true, null); + + for (int i = 0; i < 16; i++) { + GTOreDictUnificator.addAssociation(ore, oreMat, new ItemStack(BWOres, 1, i), true); + GTOreDictUnificator.addAssociation(oreSmall, smallOreMat, new ItemStack(BWSmallOres, 1, i), true); + GTOreDictUnificator.addAssociation(block, blockMat, new ItemStack(BWBlocks, 1, i), true); + } + + MATERIALS_MAP.remove("bwores"); + MATERIALS_MAP.remove("bwsmallores"); + MATERIALS_MAP.remove("bwblocks"); + } + + public static void removeIC2Recipes() { + try { + Set<Map.Entry<IRecipeInput, RecipeOutput>> remset = new HashSet<>(); + for (Map.Entry<IRecipeInput, RecipeOutput> curr : Recipes.macerator.getRecipes() + .entrySet()) { + if (curr.getKey() instanceof RecipeInputOreDict) { + if ("oreNULL".equalsIgnoreCase(((RecipeInputOreDict) curr.getKey()).input)) { + remset.add(curr); + } + for (ItemStack stack : curr.getValue().items) { + if (stack.getItem() instanceof BWMetaGeneratedItems) remset.add(curr); + } + } + } + Recipes.macerator.getRecipes() + .entrySet() + .removeAll(remset); + } catch (Exception e) { + e.printStackTrace(); + } + } + + private static void runAdditionalOreDict() { + for (Werkstoff werkstoff : Werkstoff.werkstoffHashSet) { + if (werkstoff.hasItemType(ore)) { + GTOreDictUnificator.registerOre(ore + werkstoff.getVarName(), werkstoff.get(ore)); + GTOreDictUnificator.registerOre(oreSmall + werkstoff.getVarName(), werkstoff.get(oreSmall)); + werkstoff.getADDITIONAL_OREDICT() + .forEach(e -> OreDictionary.registerOre(ore + e, werkstoff.get(ore))); + werkstoff.getADDITIONAL_OREDICT() + .forEach(e -> OreDictionary.registerOre(oreSmall + e, werkstoff.get(oreSmall))); + } + + if (werkstoff.hasItemType(gem)) OreDictionary.registerOre( + "craftingLens" + BWColorUtil.getDyeFromColor(werkstoff.getRGBA()).mName.replace(" ", ""), + werkstoff.get(lens)); + + if (werkstoff.hasItemType(gem) || werkstoff.hasItemType(ingot)) { + GTOreDictUnificator.registerOre(block + werkstoff.getVarName(), werkstoff.get(block)); + werkstoff.getADDITIONAL_OREDICT() + .forEach(e -> OreDictionary.registerOre(block + e, werkstoff.get(block))); + } + + werkstoff.getADDITIONAL_OREDICT() + .forEach( + s -> ENABLED_ORE_PREFIXES.stream() + .filter(o -> Objects.nonNull(werkstoff.get(o))) + .forEach(od -> OreDictionary.registerOre(od + s, werkstoff.get(od)))); + } + + GTOreDictUnificator.registerOre("craftingIndustrialDiamond", WerkstoffLoader.CubicZirconia.get(gemExquisite)); + } +} diff --git a/src/main/java/bartworks/system/material/gtenhancement/BWGTMetaItems.java b/src/main/java/bartworks/system/material/gtenhancement/BWGTMetaItems.java new file mode 100644 index 0000000000..b543150e35 --- /dev/null +++ b/src/main/java/bartworks/system/material/gtenhancement/BWGTMetaItems.java @@ -0,0 +1,207 @@ +/* + * Copyright (c) 2018-2020 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 bartworks.system.material.gtenhancement; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.Entity; +import net.minecraft.entity.item.EntityItem; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.IIcon; +import net.minecraft.world.World; +import net.minecraftforge.oredict.OreDictionary; + +import bartworks.API.SideReference; +import bartworks.client.textures.PrefixTextureLinker; +import bartworks.system.material.BWMetaGeneratedItems; +import bartworks.system.material.Werkstoff; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import gregtech.api.enums.Materials; +import gregtech.api.enums.OrePrefixes; +import gregtech.api.enums.TextureSet; +import gregtech.api.enums.Textures; +import gregtech.api.interfaces.IIconContainer; +import gregtech.api.util.GTOreDictUnificator; +import gregtech.common.render.items.GeneratedMaterialRenderer; + +public class BWGTMetaItems extends BWMetaGeneratedItems { + + private boolean hasList; + private final Set<Integer> hiddenThings = new HashSet<>(); + + public BWGTMetaItems(OrePrefixes orePrefixes, List<Materials> noSubIDMaterials) { + super(orePrefixes, null); + // materialloop: + for (int i = 0; i < Materials.values().length; i++) { + ItemStack tStack = new ItemStack(this, 1, i); + Materials material = Materials.values()[i]; + if (material.getMolten(1) == null && orePrefixes == OrePrefixes.capsuleMolten + || material.getFluid(1) == null && material.getGas(1) == null + && (orePrefixes == OrePrefixes.capsule || orePrefixes == OrePrefixes.bottle)) + continue; + + if (OreDictionary.doesOreNameExist(this.orePrefixes.name() + material.mDefaultLocalName.replace(" ", ""))) { + this.hiddenThings.add(i); + continue; + } + GTOreDictUnificator + .registerOre(this.orePrefixes.name() + material.mDefaultLocalName.replace(" ", ""), tStack); + } + + if (noSubIDMaterials != null) { + this.hasList = true; + // materialloop: + for (int i = 0; i < noSubIDMaterials.size(); i++) { + ItemStack tStack = new ItemStack(this, 1, i + 1001); + Materials w = noSubIDMaterials.get(i); + if (w.getMolten(1) == null && orePrefixes == OrePrefixes.capsuleMolten + || w.getFluid(1) == null && w.getGas(1) == null + && (orePrefixes == OrePrefixes.capsule || orePrefixes == OrePrefixes.bottle)) + continue; + + if (OreDictionary.doesOreNameExist(this.orePrefixes.name() + w.mDefaultLocalName.replace(" ", ""))) { + this.hiddenThings.add(i); + continue; + } + GTOreDictUnificator.registerOre(this.orePrefixes.name() + w.mDefaultLocalName.replace(" ", ""), tStack); + } + } + } + + private Materials getMaterial(ItemStack is) { + if (is == null || is.getItem() != this) return null; + final int meta = is.getItemDamage(); + return this.getMaterialFromMeta(meta); + } + + @Override + public String getItemStackDisplayName(ItemStack aStack) { + Materials material = this.getMaterial(aStack); + if (material == null) material = Materials._NULL; + return material.getLocalizedNameForItem(this.itemTypeLocalizedName); + } + + @Override + protected void addAdditionalToolTips(List<String> aList, ItemStack aStack, EntityPlayer aPlayer) { + Materials material = this.getMaterial(aStack); + if (material != null) { + String tooltip = material.getToolTip(); + if (tooltip != null && !tooltip.isEmpty()) { + aList.add(tooltip); + } + } + } + + @Override + public IIconContainer getIconContainer(int aMetaData) { + if (this.orePrefixes.mTextureIndex == -1) return this.getIconContainerBartWorks(aMetaData); + Materials material = this.getMaterialFromMeta(aMetaData); + if (material != null) { + return material.mIconSet.mTextures[this.orePrefixes.mTextureIndex]; + } + return null; + } + + @Override + protected IIconContainer getIconContainerBartWorks(int aMetaData) { + if (SideReference.Side.Server || PrefixTextureLinker.texMap == null) return null; + + HashMap<TextureSet, Textures.ItemIcons.CustomIcon> iconLink = PrefixTextureLinker.texMap.get(this.orePrefixes); + + if (iconLink == null) return null; + + Materials material = this.getMaterialFromMeta(aMetaData); + + if (material == null || material.mIconSet == null) return null; + + return iconLink.getOrDefault(material.mIconSet, iconLink.get(TextureSet.SET_DULL)); + } + + @Override + public IIcon getIconFromDamage(int aMetaData) { + return this.getIcon(aMetaData, 0); + } + + @Override + public GeneratedMaterialRenderer getMaterialRenderer(int aMetaData) { + return this.getMaterialFromMeta(aMetaData).renderer; + } + + public Materials getMaterialFromMeta(int aMetaData) { + if (aMetaData > 1000 && this.hasList) { + return GTMetaItemEnhancer.NoMetaValue.get(aMetaData - 1001); + } + if (aMetaData < 0 || aMetaData >= Materials.values().length) { + return null; + } + return Materials.values()[aMetaData]; + } + + @Override + @SideOnly(Side.CLIENT) + public void getSubItems(Item var1, CreativeTabs aCreativeTab, List<ItemStack> aList) { + for (int i = 0; i < Materials.values().length; i++) { + Materials w = Materials.values()[i]; + if (w == null || (w.mTypes & Werkstoff.GenerationFeatures.getPrefixDataRaw(this.orePrefixes)) == 0 + && Werkstoff.GenerationFeatures.getPrefixDataRaw(this.orePrefixes) != 0) continue; + if (w.getMolten(1) == null && this.orePrefixes == OrePrefixes.capsuleMolten + || w.getFluid(1) == null && w.getGas(1) == null + && (this.orePrefixes == OrePrefixes.capsule || this.orePrefixes == OrePrefixes.bottle)) + continue; + else if (this.hiddenThings.contains(i)) continue; + aList.add(new ItemStack(this, 1, i)); + } + if (this.hasList) for (int i = 0; i < GTMetaItemEnhancer.NoMetaValue.size(); i++) { + Materials w = GTMetaItemEnhancer.NoMetaValue.get(i); + if (w == null || (w.mTypes & Werkstoff.GenerationFeatures.getPrefixDataRaw(this.orePrefixes)) == 0 + && Werkstoff.GenerationFeatures.getPrefixDataRaw(this.orePrefixes) != 0) continue; + if (w.getMolten(1) == null && this.orePrefixes == OrePrefixes.capsuleMolten + || w.getFluid(1) == null && w.getGas(1) == null + && (this.orePrefixes == OrePrefixes.capsule || this.orePrefixes == OrePrefixes.bottle)) + continue; + else if (this.hiddenThings.contains(i)) continue; + aList.add(new ItemStack(this, 1, i + 1001)); + } + } + + @Override + public short[] getColorForGUI(ItemStack aStack) { + return this.getMaterial(aStack).mRGBa; + } + + @Override + public String getNameForGUI(ItemStack aStack) { + return this.getMaterial(aStack).mDefaultLocalName; + } + + @Override + public void onUpdate(ItemStack aStack, World aWorld, Entity aPlayer, int aTimer, boolean aIsInHand) {} + + @Override + public short[] getRGBa(ItemStack aStack) { + return this.getMaterial(aStack).mRGBa; + } + + @Override + public boolean onEntityItemUpdate(EntityItem aItemEntity) { + return false; + } +} diff --git a/src/main/java/bartworks/system/material/gtenhancement/GTMetaItemEnhancer.java b/src/main/java/bartworks/system/material/gtenhancement/GTMetaItemEnhancer.java new file mode 100644 index 0000000000..d3c1bb2ece --- /dev/null +++ b/src/main/java/bartworks/system/material/gtenhancement/GTMetaItemEnhancer.java @@ -0,0 +1,150 @@ +/* + * Copyright (c) 2018-2020 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 bartworks.system.material.gtenhancement; + +import static gregtech.api.enums.Mods.Forestry; +import static gregtech.api.recipe.RecipeMaps.fluidCannerRecipes; +import static gregtech.api.util.GTRecipeBuilder.TICKS; +import static gregtech.api.util.GTRecipeBuilder.WILDCARD; + +import java.util.List; +import java.util.stream.Collectors; + +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraftforge.fluids.Fluid; +import net.minecraftforge.fluids.FluidContainerRegistry; +import net.minecraftforge.fluids.FluidStack; +import net.minecraftforge.oredict.OreDictionary; + +import codechicken.nei.api.API; +import gregtech.api.enums.GTValues; +import gregtech.api.enums.Materials; +import gregtech.api.enums.OrePrefixes; +import gregtech.api.util.GTModHandler; +import gregtech.api.util.GTOreDictUnificator; +import gregtech.api.util.GTUtility; + +public class GTMetaItemEnhancer { + + static List<Materials> NoMetaValue; + + private GTMetaItemEnhancer() {} + + public static void init() { + if (!Forestry.isModLoaded()) { + return; + } + NoMetaValue = Materials.getMaterialsMap() + .values() + .stream() + .filter(m -> m.mMetaItemSubID == -1) + .collect(Collectors.toList()); + Item moltenCapsuls = new BWGTMetaItems(OrePrefixes.capsuleMolten, null); + Item capsuls = new BWGTMetaItems(OrePrefixes.capsule, NoMetaValue); + // Item bottles = new BWGTMetaItems(OrePrefixes.bottle, NoMetaValue); + + Materials[] values = Materials.values(); + for (int i = 0, valuesLength = values.length; i < valuesLength; i++) { + Materials m = values[i]; + if (m.mStandardMoltenFluid != null && GTOreDictUnificator.get(OrePrefixes.cellMolten, m, 1) != null) { + final FluidContainerRegistry.FluidContainerData emptyData = new FluidContainerRegistry.FluidContainerData( + m.getMolten(144), + new ItemStack(moltenCapsuls, 1, i), + GTModHandler.getModItem(Forestry.ID, "refractoryEmpty", 1)); + FluidContainerRegistry.registerFluidContainer(emptyData); + GTUtility.addFluidContainerData(emptyData); + + GTValues.RA.stdBuilder() + .itemInputs(GTModHandler.getModItem(Forestry.ID, "refractoryEmpty", 1)) + .itemOutputs(new ItemStack(moltenCapsuls, 1, i)) + .fluidInputs(m.getMolten(144)) + .duration(2 * TICKS) + .eut(2) + .addTo(fluidCannerRecipes); + + GTValues.RA.stdBuilder() + .itemInputs(new ItemStack(moltenCapsuls, 1, i)) + .fluidOutputs(m.getMolten(144)) + .duration(2 * TICKS) + .eut(2) + .addTo(fluidCannerRecipes); + + } + if (m.getFluid(1) == null && m.getGas(1) == null || OreDictionary.doesOreNameExist("capsule" + m.mName)) + continue; + addFluidData(m, GTModHandler.getModItem(Forestry.ID, "waxCapsule", 1), capsuls, 1000, i, true); + // addFluidData(m, new ItemStack(Items.glass_bottle), bottles, 250, i, false); + } + for (int i = 0, valuesLength = NoMetaValue.size(); i < valuesLength; i++) { + Materials m = NoMetaValue.get(i); + if (m.getFluid(1) == null && m.getGas(1) == null || OreDictionary.doesOreNameExist("capsule" + m.mName)) + continue; + addFluidData(m, GTModHandler.getModItem(Forestry.ID, "waxCapsule", 1), capsuls, 1000, i + 1001, true); + // addFluidData(m, new ItemStack(Items.glass_bottle), bottles, 250, i + 1001, false); + } + + API.hideItem(new ItemStack(capsuls, 1, WILDCARD)); + API.hideItem(new ItemStack(moltenCapsuls, 1, WILDCARD)); + } + + private static void addFluidData(Materials m, ItemStack container, Item filled, int amount, int it, boolean empty) { + Fluid f = m.getFluid(1) != null ? m.getFluid(1) + .getFluid() + : m.getGas(1) + .getFluid(); + final FluidContainerRegistry.FluidContainerData emptyData = new FluidContainerRegistry.FluidContainerData( + new FluidStack(f, amount), + new ItemStack(filled, 1, it), + container); + FluidContainerRegistry.registerFluidContainer(emptyData); + GTUtility.addFluidContainerData(emptyData); + + GTValues.RA.stdBuilder() + .itemInputs(container) + .itemOutputs(new ItemStack(filled, 1, it)) + .fluidInputs(new FluidStack(f, amount)) + .duration(amount / 62) + .eut(2) + .addTo(fluidCannerRecipes); + + GTValues.RA.stdBuilder() + .itemInputs(new ItemStack(filled, 1, it)) + .fluidOutputs(new FluidStack(f, amount)) + .duration(amount / 62) + .eut(2) + .addTo(fluidCannerRecipes); + + } + + public static void addAdditionalOreDictToForestry() { + if (!Forestry.isModLoaded()) return; + OreDictionary.registerOre("capsuleWater", getForestryItem("waxCapsuleWater")); + OreDictionary.registerOre("capsuleIce", getForestryItem("waxCapsuleIce")); + OreDictionary.registerOre("capsuleHoney", getForestryItem("waxCapsuleHoney")); + OreDictionary.registerOre("capsuleJuice", getForestryItem("waxCapsuleJuice")); + OreDictionary.registerOre("capsuleSeedOil", getForestryItem("waxCapsuleSeedOil")); + OreDictionary.registerOre("capsuleEthanol", getForestryItem("waxCapsuleEthanol")); + OreDictionary.registerOre("capsuleBiomass", getForestryItem("waxCapsuleBiomass")); + OreDictionary.registerOre("capsuleShortMead", getForestryItem("waxCapsuleShortMead")); + OreDictionary.registerOre("capsuleMead", getForestryItem("waxCapsuleMead")); + OreDictionary.registerOre("capsuleFuel", getForestryItem("waxCapsuleFuel")); + OreDictionary.registerOre("capsuleOil", getForestryItem("waxCapsuleOil")); + OreDictionary.registerOre("capsuleLava", getForestryItem("refractoryLava")); + } + + private static ItemStack getForestryItem(String itemName) { + return GTModHandler.getModItem(Forestry.ID, itemName, 1); + } +} diff --git a/src/main/java/bartworks/system/material/gtenhancement/PlatinumSludgeOverHaul.java b/src/main/java/bartworks/system/material/gtenhancement/PlatinumSludgeOverHaul.java new file mode 100644 index 0000000000..a20996d463 --- /dev/null +++ b/src/main/java/bartworks/system/material/gtenhancement/PlatinumSludgeOverHaul.java @@ -0,0 +1,1102 @@ +/* + * Copyright (c) 2018-2020 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 bartworks.system.material.gtenhancement; + +import static bartworks.system.material.WerkstoffLoader.AcidicIridiumSolution; +import static bartworks.system.material.WerkstoffLoader.AcidicOsmiumSolution; +import static bartworks.system.material.WerkstoffLoader.AmmoniumChloride; +import static bartworks.system.material.WerkstoffLoader.AquaRegia; +import static bartworks.system.material.WerkstoffLoader.CalciumChloride; +import static bartworks.system.material.WerkstoffLoader.CrudeRhMetall; +import static bartworks.system.material.WerkstoffLoader.FormicAcid; +import static bartworks.system.material.WerkstoffLoader.HotRutheniumTetroxideSollution; +import static bartworks.system.material.WerkstoffLoader.IrLeachResidue; +import static bartworks.system.material.WerkstoffLoader.IrOsLeachResidue; +import static bartworks.system.material.WerkstoffLoader.IridiumChloride; +import static bartworks.system.material.WerkstoffLoader.IridiumDioxide; +import static bartworks.system.material.WerkstoffLoader.LeachResidue; +import static bartworks.system.material.WerkstoffLoader.OsmiumSolution; +import static bartworks.system.material.WerkstoffLoader.PDAmmonia; +import static bartworks.system.material.WerkstoffLoader.PDMetallicPowder; +import static bartworks.system.material.WerkstoffLoader.PDRawPowder; +import static bartworks.system.material.WerkstoffLoader.PDSalt; +import static bartworks.system.material.WerkstoffLoader.PGSDResidue; +import static bartworks.system.material.WerkstoffLoader.PGSDResidue2; +import static bartworks.system.material.WerkstoffLoader.PTConcentrate; +import static bartworks.system.material.WerkstoffLoader.PTMetallicPowder; +import static bartworks.system.material.WerkstoffLoader.PTRawPowder; +import static bartworks.system.material.WerkstoffLoader.PTResidue; +import static bartworks.system.material.WerkstoffLoader.PTSaltCrude; +import static bartworks.system.material.WerkstoffLoader.PTSaltRefined; +import static bartworks.system.material.WerkstoffLoader.PotassiumDisulfate; +import static bartworks.system.material.WerkstoffLoader.RHFilterCakeSolution; +import static bartworks.system.material.WerkstoffLoader.RHNitrate; +import static bartworks.system.material.WerkstoffLoader.RHSalt; +import static bartworks.system.material.WerkstoffLoader.RHSaltSolution; +import static bartworks.system.material.WerkstoffLoader.RHSulfate; +import static bartworks.system.material.WerkstoffLoader.RHSulfateSolution; +import static bartworks.system.material.WerkstoffLoader.ReRh; +import static bartworks.system.material.WerkstoffLoader.RhFilterCake; +import static bartworks.system.material.WerkstoffLoader.Rhodium; +import static bartworks.system.material.WerkstoffLoader.Ruthenium; +import static bartworks.system.material.WerkstoffLoader.RutheniumTetroxide; +import static bartworks.system.material.WerkstoffLoader.RutheniumTetroxideSollution; +import static bartworks.system.material.WerkstoffLoader.SodiumNitrate; +import static bartworks.system.material.WerkstoffLoader.SodiumRuthenate; +import static bartworks.system.material.WerkstoffLoader.Sodiumformate; +import static bartworks.system.material.WerkstoffLoader.Sodiumsulfate; +import static bartworks.system.material.WerkstoffLoader.ZincSulfate; +import static gregtech.api.enums.Mods.GalaxySpace; +import static gregtech.api.enums.Mods.NewHorizonsCoreMod; +import static gregtech.api.enums.OrePrefixes.cell; +import static gregtech.api.enums.OrePrefixes.crushed; +import static gregtech.api.enums.OrePrefixes.crushedCentrifuged; +import static gregtech.api.enums.OrePrefixes.crushedPurified; +import static gregtech.api.enums.OrePrefixes.dust; +import static gregtech.api.enums.OrePrefixes.dustImpure; +import static gregtech.api.enums.OrePrefixes.dustPure; +import static gregtech.api.enums.OrePrefixes.dustRefined; +import static gregtech.api.enums.OrePrefixes.dustSmall; +import static gregtech.api.enums.OrePrefixes.dustTiny; +import static gregtech.api.enums.OrePrefixes.ingot; +import static gregtech.api.enums.OrePrefixes.nugget; +import static gregtech.api.enums.OrePrefixes.rawOre; +import static gregtech.api.recipe.RecipeMaps.*; +import static gregtech.api.util.GTRecipeBuilder.MINUTES; +import static gregtech.api.util.GTRecipeBuilder.SECONDS; +import static gregtech.api.util.GTRecipeBuilder.TICKS; +import static gregtech.api.util.GTRecipeConstants.COIL_HEAT; +import static gregtech.api.util.GTRecipeConstants.UniversalChemical; +import static gtPlusPlus.core.material.MaterialsAlloy.HELICOPTER; +import static gtPlusPlus.core.material.MaterialsElements.STANDALONE.WHITE_METAL; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import net.minecraft.block.Block; +import net.minecraft.item.ItemStack; +import net.minecraft.item.crafting.CraftingManager; +import net.minecraft.item.crafting.FurnaceRecipes; +import net.minecraft.item.crafting.IRecipe; + +import bartworks.MainMod; +import bartworks.system.material.BWMetaGeneratedItems; +import bartworks.system.material.Werkstoff; +import bartworks.util.BWUtil; +import bwcrossmod.BartWorksCrossmod; +import cpw.mods.fml.common.registry.GameRegistry; +import gregtech.api.enums.GTValues; +import gregtech.api.enums.ItemList; +import gregtech.api.enums.Materials; +import gregtech.api.enums.OrePrefixes; +import gregtech.api.enums.TierEU; +import gregtech.api.interfaces.IRecipeMutableAccess; +import gregtech.api.interfaces.ISubTagContainer; +import gregtech.api.items.GTGenericBlock; +import gregtech.api.items.GTGenericItem; +import gregtech.api.objects.ItemData; +import gregtech.api.objects.MaterialStack; +import gregtech.api.recipe.RecipeMap; +import gregtech.api.util.GTModHandler; +import gregtech.api.util.GTOreDictUnificator; +import gregtech.api.util.GTRecipe; +import gregtech.api.util.GTUtility; +import gregtech.common.blocks.BlockOresAbstract; + +public class PlatinumSludgeOverHaul { + + private static final Materials[] BLACKLIST = { Materials.HSSS, Materials.EnderiumBase, Materials.Osmiridium, + Materials.TPV, Materials.get("Uraniumtriplatinid"), Materials.get("Tetranaquadahdiindiumhexaplatiumosminid"), + Materials.get("Longasssuperconductornameforuvwire"), }; + private static final OrePrefixes[] OPBLACKLIST = { crushedCentrifuged, crushed, crushedPurified, dustPure, + dustImpure, dustRefined, dust, dustTiny, dustSmall }; + + private PlatinumSludgeOverHaul() {} + + private static void runHelperrecipes() { + // DilutedSulfuricAcid + // 2H2SO4 + H2O = 3H2SO4(d) + GTValues.RA.stdBuilder() + .itemInputs( + Materials.SulfuricAcid.getCells(2), + Materials.Water.getCells(1), + GTUtility.getIntegratedCircuit(1)) + .itemOutputs(Materials.DilutedSulfuricAcid.getCells(3)) + .duration(1 * SECONDS + 10 * TICKS) + .eut(TierEU.RECIPE_LV) + .addTo(mixerRecipes); + + GTValues.RA.stdBuilder() + .itemInputs(Materials.Water.getCells(1), GTUtility.getIntegratedCircuit(1)) + .itemOutputs(Materials.Empty.getCells(1)) + .fluidInputs(Materials.SulfuricAcid.getFluid(2000)) + .fluidOutputs(Materials.DilutedSulfuricAcid.getFluid(3000)) + .duration(1 * SECONDS + 10 * TICKS) + .eut(TierEU.RECIPE_LV) + .addTo(mixerRecipes); + + GTValues.RA.stdBuilder() + .itemInputs(Materials.SulfuricAcid.getCells(2), GTUtility.getIntegratedCircuit(1)) + .itemOutputs(Materials.Empty.getCells(2)) + .fluidInputs(Materials.Water.getFluid(1000)) + .fluidOutputs(Materials.DilutedSulfuricAcid.getFluid(3000)) + .duration(1 * SECONDS + 10 * TICKS) + .eut(TierEU.RECIPE_LV) + .addTo(mixerRecipes); + // FormicAcid + // CO + NaOH = CHO2Na + GTValues.RA.stdBuilder() + .itemInputs(Materials.CarbonMonoxide.getCells(1), Materials.SodiumHydroxide.getDust(3)) + .itemOutputs(Sodiumformate.get(cell)) + .duration(15 * TICKS) + .eut(TierEU.RECIPE_LV) + .addTo(UniversalChemical); + // H2SO4 + 2CHO2Na = 2CH2O2 + Na2SO4 + + GTValues.RA.stdBuilder() + .itemInputs(Sodiumformate.get(cell, 2), GTUtility.getIntegratedCircuit(1)) + .itemOutputs(FormicAcid.get(cell, 2), Sodiumsulfate.get(dust, 7)) + .fluidInputs(Materials.SulfuricAcid.getFluid(1000)) + .duration(15 * TICKS) + .eut(TierEU.RECIPE_LV) + .addTo(UniversalChemical); + + GTValues.RA.stdBuilder() + .itemInputs(Materials.SulfuricAcid.getCells(1), GTUtility.getIntegratedCircuit(1)) + .itemOutputs(Materials.Empty.getCells(1), Sodiumsulfate.get(dust, 7)) + .fluidInputs(Sodiumformate.getFluidOrGas(2000)) + .fluidOutputs(FormicAcid.getFluidOrGas(2000)) + .duration(15 * TICKS) + .eut(TierEU.RECIPE_LV) + .addTo(UniversalChemical); + + // AquaRegia + GTValues.RA.stdBuilder() + .itemInputs( + Materials.DilutedSulfuricAcid.getCells(1), + Materials.NitricAcid.getCells(1), + GTUtility.getIntegratedCircuit(1)) + .itemOutputs(AquaRegia.get(cell, 2)) + .duration(1 * SECONDS + 10 * TICKS) + .eut(TierEU.RECIPE_LV) + .addTo(mixerRecipes); + + GTValues.RA.stdBuilder() + .itemInputs( + Materials.DilutedSulfuricAcid.getCells(1), + Materials.NitricAcid.getCells(1), + GTUtility.getIntegratedCircuit(2)) + .itemOutputs(Materials.Empty.getCells(2)) + .fluidOutputs(AquaRegia.getFluidOrGas(2000)) + .duration(1 * SECONDS + 10 * TICKS) + .eut(TierEU.RECIPE_LV) + .addTo(mixerRecipes); + + GTValues.RA.stdBuilder() + .itemInputs(Materials.NitricAcid.getCells(1), GTUtility.getIntegratedCircuit(3)) + .itemOutputs(Materials.Empty.getCells(1)) + .fluidInputs(Materials.DilutedSulfuricAcid.getFluid(1000)) + .fluidOutputs(AquaRegia.getFluidOrGas(2000)) + .duration(1 * SECONDS + 10 * TICKS) + .eut(TierEU.RECIPE_LV) + .addTo(mixerRecipes); + + GTValues.RA.stdBuilder() + .itemInputs(Materials.DilutedSulfuricAcid.getCells(1), GTUtility.getIntegratedCircuit(4)) + .itemOutputs(Materials.Empty.getCells(1)) + .fluidInputs(Materials.NitricAcid.getFluid(1000)) + .fluidOutputs(AquaRegia.getFluidOrGas(2000)) + .duration(1 * SECONDS + 10 * TICKS) + .eut(TierEU.RECIPE_LV) + .addTo(mixerRecipes); + + // AmmoniumChloride + // NH3 + HCl = NH4Cl + + GTValues.RA.stdBuilder() + .itemInputs(Materials.Ammonia.getCells(1), GTUtility.getIntegratedCircuit(1)) + .itemOutputs(AmmoniumChloride.get(cell, 1)) + .fluidInputs(Materials.HydrochloricAcid.getFluid(1000)) + .duration(15 * TICKS) + .eut(TierEU.RECIPE_LV) + .addTo(UniversalChemical); + + GTValues.RA.stdBuilder() + .itemInputs(Materials.HydrochloricAcid.getCells(1), GTUtility.getIntegratedCircuit(1)) + .itemOutputs(Materials.Empty.getCells(1)) + .fluidInputs(Materials.Ammonia.getGas(1000)) + .fluidOutputs(AmmoniumChloride.getFluidOrGas(1000)) + .duration(15 * TICKS) + .eut(TierEU.RECIPE_LV) + .addTo(UniversalChemical); + + GTValues.RA.stdBuilder() + .itemInputs(GTUtility.getIntegratedCircuit(9)) + .fluidInputs(Materials.Ammonia.getGas(64000), Materials.HydrochloricAcid.getFluid(64000)) + .fluidOutputs(AmmoniumChloride.getFluidOrGas(64000)) + .duration(3 * SECONDS) + .eut(TierEU.RECIPE_HV) + .addTo(multiblockChemicalReactorRecipes); + + // base solution + for (Werkstoff w : Werkstoff.werkstoffHashSet) if (w.containsStuff(Materials.Sulfur) + && (w.containsStuff(Materials.Copper) || w.containsStuff(Materials.Nickel))) { + + GTValues.RA.stdBuilder() + .itemInputs(w.get(crushedPurified), GTUtility.getIntegratedCircuit(1)) + .fluidInputs(AquaRegia.getFluidOrGas(150)) + .fluidOutputs(PTConcentrate.getFluidOrGas(150)) + .duration(12 * SECONDS + 10 * TICKS) + .eut(TierEU.RECIPE_LV) + .addTo(UniversalChemical); + + GTValues.RA.stdBuilder() + .itemInputs(w.get(crushedPurified, 9), GTUtility.getIntegratedCircuit(9)) + .fluidInputs(AquaRegia.getFluidOrGas(1350)) + .fluidOutputs(PTConcentrate.getFluidOrGas(1350)) + .duration(11 * SECONDS + 5 * TICKS) + .eut(TierEU.RECIPE_LV) + .addTo(UniversalChemical); + + GTValues.RA.stdBuilder() + .itemInputs(w.get(crushedPurified, 9), PTMetallicPowder.get(dust, 9)) + .itemOutputs(PTResidue.get(dust)) + .fluidInputs(AquaRegia.getFluidOrGas(10350)) + .fluidOutputs(PTConcentrate.getFluidOrGas(10350)) + .duration(1 * MINUTES + 52 * SECONDS + 10 * TICKS) + .eut(TierEU.RECIPE_LV) + .addTo(UniversalChemical); + + } + for (Materials m : Materials.values()) if (PlatinumSludgeOverHaul.materialsContains(m, Materials.Sulfur) + && (PlatinumSludgeOverHaul.materialsContains(m, Materials.Copper) + || PlatinumSludgeOverHaul.materialsContains(m, Materials.Nickel))) { + + GTValues.RA.stdBuilder() + .itemInputs(GTOreDictUnificator.get(crushedPurified, m, 1), GTUtility.getIntegratedCircuit(1)) + .fluidInputs(AquaRegia.getFluidOrGas(150)) + .fluidOutputs(PTConcentrate.getFluidOrGas(150)) + .duration(12 * SECONDS + 10 * TICKS) + .eut(TierEU.RECIPE_LV) + .addTo(UniversalChemical); + + GTValues.RA.stdBuilder() + .itemInputs(GTOreDictUnificator.get(crushedPurified, m, 9), GTUtility.getIntegratedCircuit(9)) + .fluidInputs(AquaRegia.getFluidOrGas(1350)) + .fluidOutputs(PTConcentrate.getFluidOrGas(1350)) + .duration(1 * MINUTES + 52 * SECONDS + 10 * TICKS) + .eut(TierEU.RECIPE_LV) + .addTo(UniversalChemical); + + GTValues.RA.stdBuilder() + .itemInputs(GTOreDictUnificator.get(crushedPurified, m, 9), PTMetallicPowder.get(dust, 9)) + .itemOutputs(PTResidue.get(dust)) + .fluidInputs(AquaRegia.getFluidOrGas(10350)) + .fluidOutputs(PTConcentrate.getFluidOrGas(10350)) + .duration(1 * MINUTES + 52 * SECONDS + 10 * TICKS) + .eut(TierEU.RECIPE_LV) + .addTo(UniversalChemical); + + } + // Pt + GTValues.RA.stdBuilder() + .itemInputs(PTMetallicPowder.get(dust, 3), GTUtility.getIntegratedCircuit(1)) + .itemOutputs(Materials.Platinum.getNuggets(2)) + .duration(30 * SECONDS) + .eut(TierEU.RECIPE_MV) + .metadata(COIL_HEAT, Materials.Platinum.mMeltingPoint) + .addTo(blastFurnaceRecipes); + + GTValues.RA.stdBuilder() + .itemInputs(PTMetallicPowder.get(dust), GTUtility.getIntegratedCircuit(1)) + .itemOutputs(PTResidue.get(dustTiny)) + .fluidInputs(AquaRegia.getFluidOrGas(1000)) + .fluidOutputs(PTConcentrate.getFluidOrGas(1000)) + .duration(12 * SECONDS + 10 * TICKS) + .eut(TierEU.RECIPE_LV) + .addTo(UniversalChemical); + + GTValues.RA.stdBuilder() + .itemInputs(PTMetallicPowder.get(dust, 9), GTUtility.getIntegratedCircuit(9)) + .itemOutputs(PTResidue.get(dust)) + .fluidInputs(AquaRegia.getFluidOrGas(9000)) + .fluidOutputs(PTConcentrate.getFluidOrGas(9000)) + .duration(1 * MINUTES + 52 * SECONDS + 10 * TICKS) + .eut(TierEU.RECIPE_LV) + .addTo(UniversalChemical); + + GTValues.RA.stdBuilder() + .itemInputs(PTConcentrate.get(cell, 2)) + .itemOutputs( + PTSaltCrude.get(dustTiny, 16), + PTRawPowder.get(dustTiny, 4), + Materials.NitrogenDioxide.getCells(1), + Materials.DilutedSulfuricAcid.getCells(1)) + .fluidInputs(AmmoniumChloride.getFluidOrGas(400)) + .fluidOutputs(PDAmmonia.getFluidOrGas(400)) + .duration(60 * SECONDS) + .eut(TierEU.RECIPE_LV) + .addTo(centrifugeRecipes); + + GTValues.RA.stdBuilder() + .itemInputs(GTUtility.getIntegratedCircuit(1)) + .itemOutputs(PTSaltCrude.get(dustTiny, 16), PTRawPowder.get(dustTiny, 4)) + .fluidInputs(PTConcentrate.getFluidOrGas(2000), AmmoniumChloride.getFluidOrGas(400)) + .fluidOutputs( + PDAmmonia.getFluidOrGas(400), + Materials.NitrogenDioxide.getGas(1000), + Materials.DilutedSulfuricAcid.getFluid(1000)) + .duration(1200) + .eut(30) + .addTo(multiblockChemicalReactorRecipes); + // transitional recipe. to be removed in 2.8.0 and onwards + GTValues.RA.stdBuilder() + .itemInputs(GTUtility.getIntegratedCircuit(2)) + .itemOutputs(PTSaltCrude.get(dust, 16), PTRawPowder.get(dust, 4)) + .fluidInputs(PTConcentrate.getFluidOrGas(18000), AmmoniumChloride.getFluidOrGas(3600)) + .fluidOutputs( + PDAmmonia.getFluidOrGas(3600), + Materials.NitrogenDioxide.getGas(9000), + Materials.DilutedSulfuricAcid.getFluid(9000)) + .duration(1400) + .eut(240) + .addTo(multiblockChemicalReactorRecipes); + GTValues.RA.stdBuilder() + .itemInputs(GTUtility.getIntegratedCircuit(3)) + .itemOutputs(PTSaltCrude.get(dust, 16), PTRawPowder.get(dust, 4)) + .fluidInputs(PTConcentrate.getFluidOrGas(18000), AmmoniumChloride.getFluidOrGas(3600)) + .fluidOutputs( + PDAmmonia.getFluidOrGas(3600), + Materials.NitrogenDioxide.getGas(9000), + Materials.DilutedSulfuricAcid.getFluid(9000)) + .duration(700) + .eut(480) + .addTo(multiblockChemicalReactorRecipes); + + GTValues.RA.stdBuilder() + .itemInputs(PTSaltCrude.get(dust)) + .itemOutputs( + PTSaltRefined.get(dust), + PTSaltRefined.get(dust), + PTSaltRefined.get(dust), + PTSaltRefined.get(dust), + PTSaltRefined.get(dust), + PTSaltRefined.get(dust), + PTSaltRefined.get(dust), + PTSaltRefined.get(dust), + PTSaltRefined.get(dust)) + .outputChances(1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1500) + .duration(30 * SECONDS) + .eut(TierEU.RECIPE_LV) + .addTo(sifterRecipes); + + GTValues.RA.stdBuilder() + .itemInputs(PTSaltRefined.get(dust), GTUtility.getIntegratedCircuit(1)) + .itemOutputs(PTMetallicPowder.get(dust)) + .fluidOutputs(Materials.Chlorine.getGas(87)) + .duration(10 * SECONDS) + .eut(TierEU.RECIPE_MV) + .metadata(COIL_HEAT, 900) + .addTo(blastFurnaceRecipes); + + // 2PtCl + Ca = 2Pt + CaCl2 + + GTValues.RA.stdBuilder() + .itemInputs(PTRawPowder.get(dust, 4), Materials.Calcium.getDust(1)) + .itemOutputs(Materials.Platinum.getDust(2), CalciumChloride.get(dust, 3)) + .duration(1 * SECONDS + 10 * TICKS) + .eut(TierEU.RECIPE_LV) + .addTo(UniversalChemical); + // Pd + + GTValues.RA.stdBuilder() + .itemInputs(PDMetallicPowder.get(dust), GTUtility.getIntegratedCircuit(1)) + .fluidInputs(Materials.Ammonia.getGas(1000)) + .fluidOutputs(PDAmmonia.getFluidOrGas(1000)) + .duration(12 * SECONDS + 10 * TICKS) + .eut(TierEU.RECIPE_LV) + .addTo(UniversalChemical); + + GTValues.RA.stdBuilder() + .itemInputs(PDMetallicPowder.get(dust), GTUtility.getIntegratedCircuit(1)) + .itemOutputs(PDSalt.get(dustTiny, 16), PDRawPowder.get(dustTiny, 2)) + .fluidInputs(PDAmmonia.getFluidOrGas(1000)) + .duration(12 * SECONDS + 10 * TICKS) + .eut(TierEU.RECIPE_LV) + .addTo(UniversalChemical); + + GTValues.RA.stdBuilder() + .itemInputs(PDMetallicPowder.get(dust, 9), GTUtility.getIntegratedCircuit(9)) + .itemOutputs(PDSalt.get(dust, 16), PDRawPowder.get(dust, 2)) + .fluidInputs(PDAmmonia.getFluidOrGas(9000)) + .duration(1 * MINUTES + 52 * SECONDS + 10 * TICKS) + .eut(TierEU.RECIPE_LV) + .addTo(UniversalChemical); + + GTValues.RA.stdBuilder() + .itemInputs(GTUtility.getIntegratedCircuit(2)) + .itemOutputs(PDSalt.get(dust)) + .fluidInputs(PDAmmonia.getFluidOrGas(1000)) + .duration(12 * SECONDS + 10 * TICKS) + .eut(TierEU.RECIPE_LV) + .addTo(UniversalChemical); + + GTValues.RA.stdBuilder() + .itemInputs(PDSalt.get(dust)) + .itemOutputs( + PDMetallicPowder.get(dust), + PDMetallicPowder.get(dust), + PDMetallicPowder.get(dust), + PDMetallicPowder.get(dust), + PDMetallicPowder.get(dust), + PDMetallicPowder.get(dust), + PDMetallicPowder.get(dust), + PDMetallicPowder.get(dust), + PDMetallicPowder.get(dust)) + .outputChances(1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1500) + .duration(30 * SECONDS) + .eut(TierEU.RECIPE_LV) + .addTo(sifterRecipes); + + GTValues.RA.stdBuilder() + .itemInputs(PDRawPowder.get(dust, 4), Materials.Empty.getCells(1)) + .itemOutputs(Materials.Palladium.getDust(2), Materials.Ethylene.getCells(1)) + .fluidInputs(FormicAcid.getFluidOrGas(4000)) + .fluidOutputs(Materials.Ammonia.getGas(4000)) + .duration(12 * SECONDS + 10 * TICKS) + .eut(TierEU.RECIPE_LV) + .addTo(chemicalReactorRecipes); + + GTValues.RA.stdBuilder() + .itemInputs(PDRawPowder.get(dust, 4)) + .itemOutputs(Materials.Palladium.getDust(2)) + .fluidInputs(FormicAcid.getFluidOrGas(4000)) + .fluidOutputs( + Materials.Ammonia.getGas(4000), + Materials.Ethylene.getGas(1000), + Materials.Water.getFluid(1000)) + .duration(12 * SECONDS + 10 * TICKS) + .eut(TierEU.RECIPE_LV) + .addTo(multiblockChemicalReactorRecipes); + + // Na2SO4 + 2H = 2Na + H2SO4 + + GTValues.RA.stdBuilder() + .itemInputs(Sodiumsulfate.get(dust, 7), Materials.Hydrogen.getCells(2)) + .itemOutputs(Materials.Sodium.getDust(2), Materials.Empty.getCells(2)) + .fluidOutputs(Materials.SulfuricAcid.getFluid(1000)) + .duration(1 * SECONDS + 10 * TICKS) + .eut(TierEU.RECIPE_LV) + .addTo(UniversalChemical); + + // Rh/Os/Ir/Ru + GTValues.RA.stdBuilder() + .itemInputs(PTResidue.get(dust), GTUtility.getIntegratedCircuit(11)) + .itemOutputs(LeachResidue.get(dust)) + .fluidInputs(PotassiumDisulfate.getMolten(360)) + .fluidOutputs(RHSulfate.getFluidOrGas(360)) + .duration(10 * SECONDS) + .eut(TierEU.RECIPE_MV) + .metadata(COIL_HEAT, 775) + .addTo(blastFurnaceRecipes); + + // Ru + GTValues.RA.stdBuilder() + .itemInputs(LeachResidue.get(dust, 10), Materials.Saltpeter.getDust(10)) + .itemOutputs(SodiumRuthenate.get(dust, 3), IrOsLeachResidue.get(dust, 6)) + .fluidInputs(Materials.SaltWater.getFluid(1000)) + .fluidOutputs(GTModHandler.getSteam(1000)) + .duration(10 * SECONDS) + .eut(TierEU.RECIPE_MV) + .metadata(COIL_HEAT, 775) + .addTo(blastFurnaceRecipes); + + GTValues.RA.stdBuilder() + .itemInputs(SodiumRuthenate.get(dust, 6), Materials.Chlorine.getCells(3)) + .itemOutputs(Materials.Empty.getCells(3)) + .fluidOutputs(RutheniumTetroxideSollution.getFluidOrGas(9000)) + .duration(15 * SECONDS) + .eut(TierEU.RECIPE_LV) + .addTo(UniversalChemical); + + GTValues.RA.stdBuilder() + .itemInputs(GTUtility.getIntegratedCircuit(1)) + .fluidInputs(RutheniumTetroxideSollution.getFluidOrGas(1000)) + .fluidOutputs(HotRutheniumTetroxideSollution.getFluidOrGas(2000)) + .duration(15 * SECONDS) + .eut(TierEU.RECIPE_HV) + .noOptimize() + .addTo(fluidHeaterRecipes); + + GTValues.RA.stdBuilder() + .itemOutputs(Materials.Salt.getDust(6)) + .fluidInputs(HotRutheniumTetroxideSollution.getFluidOrGas(9000)) + .fluidOutputs(Materials.Water.getFluid(1800), RutheniumTetroxide.getFluidOrGas(7200)) + .duration(1 * MINUTES + 15 * SECONDS) + .eut(TierEU.RECIPE_HV) + .addTo(distillationTowerRecipes); + + GTValues.RA.stdBuilder() + .itemInputs(RutheniumTetroxide.get(dust, 1), Materials.HydrochloricAcid.getCells(6)) + .itemOutputs(Ruthenium.get(dust), Materials.Chlorine.getCells(6)) + .fluidOutputs(Materials.Water.getFluid(2000)) + .duration(15 * SECONDS) + .eut(TierEU.RECIPE_LV) + .addTo(UniversalChemical); + + // Os + GTValues.RA.stdBuilder() + .itemInputs(IrOsLeachResidue.get(dust, 4), GTUtility.getIntegratedCircuit(11)) + .itemOutputs(IrLeachResidue.get(dust, 2)) + .fluidInputs(Materials.HydrochloricAcid.getFluid(1000)) + .fluidOutputs(AcidicOsmiumSolution.getFluidOrGas(2000)) + .duration(10 * SECONDS) + .eut(TierEU.RECIPE_MV) + .metadata(COIL_HEAT, 775) + .addTo(blastFurnaceRecipes); + + GTValues.RA.stdBuilder() + .fluidInputs(AcidicOsmiumSolution.getFluidOrGas(1000)) + .fluidOutputs(OsmiumSolution.getFluidOrGas(100), Materials.Water.getFluid(900)) + .duration(7 * SECONDS + 10 * TICKS) + .eut(TierEU.RECIPE_IV) + .addTo(distillationTowerRecipes); + + GTValues.RA.stdBuilder() + .itemInputs(OsmiumSolution.get(cell), Materials.HydrochloricAcid.getCells(6)) + .itemOutputs(Materials.Osmium.getDust(1), Materials.Chlorine.getCells(7)) + .fluidOutputs(Materials.Water.getFluid(2000)) + .duration(15 * SECONDS) + .eut(TierEU.RECIPE_LV) + .addTo(UniversalChemical); + + // Ir + GTValues.RA.stdBuilder() + .itemInputs(IrLeachResidue.get(dust), GTUtility.getIntegratedCircuit(1)) + .itemOutputs(PGSDResidue.get(dust), IridiumDioxide.get(dust)) + .duration(10 * SECONDS) + .eut(TierEU.RECIPE_MV) + .metadata(COIL_HEAT, 775) + .addTo(blastFurnaceRecipes); + + GTValues.RA.stdBuilder() + .itemInputs(IridiumDioxide.get(dust), Materials.HydrochloricAcid.getCells(1)) + .itemOutputs(Materials.Empty.getCells(1)) + .fluidOutputs(AcidicIridiumSolution.getFluidOrGas(1000)) + .duration(15 * SECONDS) + .eut(TierEU.RECIPE_LV) + .addTo(UniversalChemical); + + GTValues.RA.stdBuilder() + .itemInputs(AcidicIridiumSolution.get(cell), AmmoniumChloride.get(cell, 3)) + .itemOutputs(Materials.Empty.getCells(4), IridiumChloride.get(dust)) + .fluidOutputs(Materials.Ammonia.getGas(3000)) + .duration(15 * SECONDS) + .eut(TierEU.RECIPE_LV) + .addTo(UniversalChemical); + + GTValues.RA.stdBuilder() + .itemInputs(IridiumChloride.get(dust), Materials.Calcium.getDust(1)) + .itemOutputs(PGSDResidue2.get(dust), Materials.Iridium.getDust(1)) + .fluidOutputs(CalciumChloride.getFluidOrGas(3000)) + .duration(15 * SECONDS) + .eut(TierEU.RECIPE_EV) + .addTo(UniversalChemical); + // Rh + + GTValues.RA.stdBuilder() + .itemInputs(RHSulfate.get(cell, 11), GTUtility.getIntegratedCircuit(1)) + .itemOutputs(RHSulfateSolution.get(cell, 11), LeachResidue.get(dustTiny, 10)) + .fluidInputs(Materials.Water.getFluid(10000)) + .fluidOutputs(Materials.Potassium.getMolten(2000)) + .duration(15 * SECONDS) + .eut(TierEU.RECIPE_LV) + .addTo(UniversalChemical); + + GTValues.RA.stdBuilder() + .itemInputs(GTUtility.getIntegratedCircuit(3)) + .itemOutputs(LeachResidue.get(dust, 4)) + .fluidInputs(Materials.Water.getFluid(36000), RHSulfate.getFluidOrGas(39600)) + .fluidOutputs(Materials.Potassium.getMolten(7200), RHSulfateSolution.getFluidOrGas(39600)) + .duration(1 * MINUTES) + .eut(TierEU.RECIPE_LV) + .addTo(multiblockChemicalReactorRecipes); + + GTValues.RA.stdBuilder() + .itemInputs(Materials.Zinc.getDust(1)) + .itemOutputs(ZincSulfate.get(dust, 6), CrudeRhMetall.get(dust)) + .fluidInputs(RHSulfateSolution.getFluidOrGas(1000)) + .duration(15 * SECONDS) + .eut(TierEU.RECIPE_LV) + .addTo(UniversalChemical); + + GTValues.RA.stdBuilder() + .itemInputs(CrudeRhMetall.get(dust), Materials.Salt.getDust(1)) + .itemOutputs(RHSalt.get(dust, 3)) + .fluidInputs(Materials.Chlorine.getGas(1000)) + .duration(15 * SECONDS) + .eut(TierEU.RECIPE_MV) + .metadata(COIL_HEAT, 600) + .addTo(blastFurnaceRecipes); + + GTValues.RA.stdBuilder() + .itemInputs(RHSalt.get(dust, 10)) + .fluidInputs(Materials.Water.getFluid(2000)) + .fluidOutputs(RHSaltSolution.getFluidOrGas(2000)) + .duration(15 * SECONDS) + .eut(TierEU.RECIPE_LV) + .addTo(mixerRecipes); + + GTValues.RA.stdBuilder() + .itemInputs(SodiumNitrate.get(dust, 5), GTUtility.getIntegratedCircuit(1)) + .itemOutputs(RHNitrate.get(dust), Materials.Salt.getDust(2)) + .fluidInputs(RHSaltSolution.getFluidOrGas(1000)) + .duration(15 * SECONDS) + .eut(TierEU.RECIPE_LV) + .addTo(UniversalChemical); + // Na + HNO3 = NaNO3 + H + + GTValues.RA.stdBuilder() + .itemInputs(Materials.Sodium.getDust(1)) + .itemOutputs(SodiumNitrate.get(dust, 5)) + .fluidInputs(Materials.NitricAcid.getFluid(1000)) + .fluidOutputs(Materials.Hydrogen.getGas(1000)) + .duration(8 * TICKS) + .eut(60) + .addTo(UniversalChemical); + + GTValues.RA.stdBuilder() + .itemInputs(RHNitrate.get(dust)) + .itemOutputs( + RhFilterCake.get(dust), + RhFilterCake.get(dust), + RhFilterCake.get(dust), + RhFilterCake.get(dust), + RhFilterCake.get(dust), + RhFilterCake.get(dust), + RhFilterCake.get(dust), + RhFilterCake.get(dust), + RhFilterCake.get(dust)) + .outputChances(1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1500) + .duration(30 * SECONDS) + .eut(TierEU.RECIPE_LV) + .addTo(sifterRecipes); + + GTValues.RA.stdBuilder() + .itemInputs(RhFilterCake.get(dust)) + .fluidInputs(Materials.Water.getFluid(1000)) + .fluidOutputs(RHFilterCakeSolution.getFluidOrGas(1000)) + .duration(15 * SECONDS) + .eut(TierEU.RECIPE_LV) + .addTo(mixerRecipes); + + GTValues.RA.stdBuilder() + .itemInputs(GTUtility.getIntegratedCircuit(2)) + .itemOutputs(ReRh.get(dust)) + .fluidInputs(RHFilterCakeSolution.getFluidOrGas(1000)) + .duration(15 * SECONDS) + .eut(TierEU.RECIPE_LV) + .addTo(UniversalChemical); + + GTValues.RA.stdBuilder() + .itemInputs(ReRh.get(dust), Materials.Empty.getCells(1)) + .itemOutputs(Rhodium.get(dust), Materials.Ammonia.getCells(1)) + .fluidInputs(Materials.HydrochloricAcid.getFluid(1000)) + .fluidOutputs(Materials.Chlorine.getGas(1000)) + .duration(15 * SECONDS) + .eut(TierEU.RECIPE_LV) + .addTo(UniversalChemical); + + } + + 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; + } + + @SuppressWarnings({ "unchecked", "rawtypes" }) + public static void replacePureElements() { + // furnace + for (Object entry : FurnaceRecipes.smelting() + .getSmeltingList() + .entrySet()) { + Map.Entry realEntry = (Map.Entry) entry; + if (GTUtility.isStackValid(realEntry.getKey()) + && BWUtil.checkStackAndPrefix((ItemStack) realEntry.getKey())) { + ItemData association = GTOreDictUnificator.getAssociation((ItemStack) realEntry.getKey()); + if (!dust.equals(association.mPrefix) && !dustTiny.equals(association.mPrefix) + || !association.mMaterial.mMaterial.equals(Materials.Platinum)) + if (GTUtility.isStackValid(realEntry.getValue()) + && BWUtil.checkStackAndPrefix((ItemStack) realEntry.getValue())) { + ItemData ass = GTOreDictUnificator.getAssociation((ItemStack) realEntry.getValue()); + if (ass.mMaterial.mMaterial.equals(Materials.Platinum)) + if (!PlatinumSludgeOverHaul.isInBlackList((ItemStack) realEntry.getKey())) + realEntry.setValue( + PTMetallicPowder.get( + ass.mPrefix == nugget ? dustTiny : dust, + ((ItemStack) realEntry.getValue()).stackSize * 2)); + else if (ass.mMaterial.mMaterial.equals(Materials.Palladium)) + if (!PlatinumSludgeOverHaul.isInBlackList((ItemStack) realEntry.getKey())) + realEntry.setValue( + PDMetallicPowder.get( + ass.mPrefix == nugget ? dustTiny : dust, + ((ItemStack) realEntry.getValue()).stackSize * 2)); + } + } + } + // vanilla crafting + CraftingManager.getInstance() + .getRecipeList() + .forEach(PlatinumSludgeOverHaul::setnewMaterialInRecipe); + // gt crafting + GTModHandler.sBufferRecipeList.forEach(PlatinumSludgeOverHaul::setnewMaterialInRecipe); + // gt machines + maploop: for (RecipeMap<?> map : RecipeMap.ALL_RECIPE_MAPS.values()) { + if (map == fusionRecipes || map == unpackagerRecipes + || map == packagerRecipes + || map == replicatorRecipes + || "gt.recipe.eyeofharmony".equals(map.unlocalizedName) + || "gtpp.recipe.quantumforcesmelter".equals(map.unlocalizedName)) continue; + HashSet<GTRecipe> toDel = new HashSet<>(); + recipeloop: for (GTRecipe recipe : map.getAllRecipes()) { + if (recipe.mFakeRecipe) continue maploop; + + for (int i = 0; i < recipe.mFluidOutputs.length; i++) { + if (map.equals(fluidExtractionRecipes)) continue maploop; + if ("gtpp.recipe.alloyblastsmelter".equals(map.unlocalizedName)) continue maploop; + if (map.equals(multiblockChemicalReactorRecipes) || map.equals(chemicalReactorRecipes)) { + if (GTUtility.areFluidsEqual(Ruthenium.getMolten(1), recipe.mFluidOutputs[i]) + || GTUtility.areFluidsEqual(Rhodium.getMolten(1), recipe.mFluidOutputs[i])) + toDel.add(recipe); + else if (GTUtility.areFluidsEqual(Materials.Iridium.getMolten(1), recipe.mFluidOutputs[i])) { + recipe.mFluidOutputs[i] = AcidicIridiumSolution.getFluidOrGas(1000); + recipe.reloadOwner(); + } else if (GTUtility.areFluidsEqual(Materials.Platinum.getMolten(1), recipe.mFluidOutputs[i])) { + recipe.mFluidOutputs[i] = PTConcentrate.getFluidOrGas(1000); + recipe.reloadOwner(); + } else if (GTUtility.areFluidsEqual(Materials.Osmium.getMolten(1), recipe.mFluidOutputs[i])) { + recipe.mFluidOutputs[i] = AcidicOsmiumSolution.getFluidOrGas(1000); + recipe.reloadOwner(); + } + } else if (GTUtility.areFluidsEqual(Ruthenium.getMolten(1), recipe.mFluidOutputs[i]) + || GTUtility.areFluidsEqual(Rhodium.getMolten(1), recipe.mFluidOutputs[i]) + || GTUtility.areFluidsEqual(Materials.Iridium.getMolten(1), recipe.mFluidOutputs[i]) + || GTUtility.areFluidsEqual(Materials.Platinum.getMolten(1), recipe.mFluidOutputs[i])) + toDel.add(recipe); + else if (GTUtility.areFluidsEqual(Materials.Osmium.getMolten(1), recipe.mFluidOutputs[i])) + toDel.add(recipe); + } + for (int i = 0; i < recipe.mOutputs.length; i++) { + if (!GTUtility.isStackValid(recipe.mOutputs[i])) continue; + if ((BWUtil.areStacksEqualOrNull(Ruthenium.get(dust), recipe.mOutputs[i]) + || BWUtil.areStacksEqualOrNull(Ruthenium.get(dustImpure), recipe.mOutputs[i]) + || BWUtil.areStacksEqualOrNull(Ruthenium.get(dustPure), recipe.mOutputs[i])) + && !BWUtil.areStacksEqualOrNull(Ruthenium.get(ingot), recipe.mInputs[0])) { + for (ItemStack mInput : recipe.mInputs) + if (PlatinumSludgeOverHaul.isInBlackList(mInput)) continue recipeloop; + int amount = recipe.mOutputs[i].stackSize * 2; + recipe.mOutputs[i] = LeachResidue.get(dust, amount); + recipe.reloadOwner(); + } + if ((BWUtil.areStacksEqualOrNull(Rhodium.get(dust), recipe.mOutputs[i]) + || BWUtil.areStacksEqualOrNull(Rhodium.get(dustImpure), recipe.mOutputs[i]) + || BWUtil.areStacksEqualOrNull(Rhodium.get(dustPure), recipe.mOutputs[i])) + && !BWUtil.areStacksEqualOrNull(Rhodium.get(ingot), recipe.mInputs[0])) { + for (ItemStack mInput : recipe.mInputs) + if (PlatinumSludgeOverHaul.isInBlackList(mInput)) continue recipeloop; + int amount = recipe.mOutputs[i].stackSize * 2; + recipe.mOutputs[i] = CrudeRhMetall.get(dust, amount); + recipe.reloadOwner(); + } + if (!BWUtil.checkStackAndPrefix(recipe.mOutputs[i])) continue; + // Pt + if (GTOreDictUnificator.getAssociation(recipe.mOutputs[i]).mMaterial.mMaterial + .equals(Materials.Platinum)) { + for (ItemStack mInput : recipe.mInputs) { + if (PlatinumSludgeOverHaul.isInBlackList(mInput)) continue recipeloop; + } + if (dust.equals(GTOreDictUnificator.getAssociation(recipe.mOutputs[i]).mPrefix) + || dustImpure.equals(GTOreDictUnificator.getAssociation(recipe.mOutputs[i]).mPrefix) + || dustPure.equals(GTOreDictUnificator.getAssociation(recipe.mOutputs[i]).mPrefix)) { + int amount = recipe.mOutputs[i].stackSize; + recipe.mOutputs[i] = BWUtil.setStackSize(PTMetallicPowder.get(dust), amount * 2); + recipe.reloadOwner(); + } else if (dustSmall.equals(GTOreDictUnificator.getAssociation(recipe.mOutputs[i]).mPrefix)) { + int amount = recipe.mOutputs[i].stackSize; + recipe.mOutputs[i] = BWUtil.setStackSize(PTMetallicPowder.get(dustSmall), amount * 2); + recipe.reloadOwner(); + } else if (dustTiny.equals(GTOreDictUnificator.getAssociation(recipe.mOutputs[i]).mPrefix)) { + int amount = recipe.mOutputs[i].stackSize; + recipe.mOutputs[i] = BWUtil.setStackSize(PTMetallicPowder.get(dustTiny), amount * 2); + recipe.reloadOwner(); + } + } else if (GTOreDictUnificator.getAssociation(recipe.mOutputs[i]).mMaterial.mMaterial + .equals(Materials.Palladium)) { + for (ItemStack mInput : recipe.mInputs) { + if (PlatinumSludgeOverHaul.isInBlackList(mInput)) continue recipeloop; + } + if (dust.equals(GTOreDictUnificator.getAssociation(recipe.mOutputs[i]).mPrefix) + || dustImpure.equals(GTOreDictUnificator.getAssociation(recipe.mOutputs[i]).mPrefix) + || dustPure.equals(GTOreDictUnificator.getAssociation(recipe.mOutputs[i]).mPrefix)) { + int amount = recipe.mOutputs[i].stackSize; + recipe.mOutputs[i] = BWUtil.setStackSize(PDMetallicPowder.get(dust), amount * 4); + recipe.reloadOwner(); + } else + if (dustSmall.equals(GTOreDictUnificator.getAssociation(recipe.mOutputs[i]).mPrefix)) { + int amount = recipe.mOutputs[i].stackSize; + recipe.mOutputs[i] = BWUtil + .setStackSize(PDMetallicPowder.get(dustSmall), amount * 4); + recipe.reloadOwner(); + } else if (dustTiny + .equals(GTOreDictUnificator.getAssociation(recipe.mOutputs[i]).mPrefix)) { + int amount = recipe.mOutputs[i].stackSize; + recipe.mOutputs[i] = BWUtil + .setStackSize(PDMetallicPowder.get(dustTiny), amount * 4); + recipe.reloadOwner(); + } + } else if (GTOreDictUnificator.getAssociation(recipe.mOutputs[i]).mMaterial.mMaterial + .equals(Materials.Osmium)) { + for (ItemStack mInput : recipe.mInputs) { + if (PlatinumSludgeOverHaul.isInBlackList(mInput)) continue recipeloop; + } + if (dust.equals(GTOreDictUnificator.getAssociation(recipe.mOutputs[i]).mPrefix) + || dustImpure.equals(GTOreDictUnificator.getAssociation(recipe.mOutputs[i]).mPrefix) + || dustPure + .equals(GTOreDictUnificator.getAssociation(recipe.mOutputs[i]).mPrefix)) { + int amount = recipe.mOutputs[i].stackSize; + recipe.mOutputs[i] = BWUtil.setStackSize(IrOsLeachResidue.get(dust), amount); + recipe.reloadOwner(); + } else if (dustSmall + .equals(GTOreDictUnificator.getAssociation(recipe.mOutputs[i]).mPrefix)) { + int amount = recipe.mOutputs[i].stackSize; + recipe.mOutputs[i] = BWUtil + .setStackSize(IrOsLeachResidue.get(dustSmall), amount); + recipe.reloadOwner(); + } else if (dustTiny + .equals(GTOreDictUnificator.getAssociation(recipe.mOutputs[i]).mPrefix)) { + int amount = recipe.mOutputs[i].stackSize; + recipe.mOutputs[i] = BWUtil + .setStackSize(IrOsLeachResidue.get(dustTiny), amount); + recipe.reloadOwner(); + } + } else if (GTOreDictUnificator.getAssociation(recipe.mOutputs[i]).mMaterial.mMaterial + .equals(Materials.Iridium)) { + for (ItemStack mInput : recipe.mInputs) { + if (PlatinumSludgeOverHaul.isInBlackList(mInput)) continue recipeloop; + } + if (dust.equals(GTOreDictUnificator.getAssociation(recipe.mOutputs[i]).mPrefix) + || dustImpure + .equals(GTOreDictUnificator.getAssociation(recipe.mOutputs[i]).mPrefix) + || dustPure + .equals(GTOreDictUnificator.getAssociation(recipe.mOutputs[i]).mPrefix)) { + int amount = recipe.mOutputs[i].stackSize; + recipe.mOutputs[i] = BWUtil.setStackSize(IrLeachResidue.get(dust), amount); + recipe.reloadOwner(); + } else if (dustSmall + .equals(GTOreDictUnificator.getAssociation(recipe.mOutputs[i]).mPrefix)) { + int amount = recipe.mOutputs[i].stackSize; + recipe.mOutputs[i] = BWUtil + .setStackSize(IrLeachResidue.get(dustSmall), amount); + recipe.reloadOwner(); + } else if (dustTiny + .equals(GTOreDictUnificator.getAssociation(recipe.mOutputs[i]).mPrefix)) { + int amount = recipe.mOutputs[i].stackSize; + recipe.mOutputs[i] = BWUtil + .setStackSize(IrLeachResidue.get(dustTiny), amount); + recipe.reloadOwner(); + } + } + } + } + map.getBackend() + .removeRecipes(toDel); + } + // TODO: remove EnderIO recipes + + // fix HV tier + PlatinumSludgeOverHaul.replaceHVCircuitMaterials(); + // add new recipes + PlatinumSludgeOverHaul.runHelperrecipes(); + } + + @SuppressWarnings("deprecation") + private static void replaceHVCircuitMaterials() { + GTValues.RA.stdBuilder() + .itemInputs(Materials.Redstone.getDust(1), Materials.Electrum.getDust(1), GTUtility.getIntegratedCircuit(1)) + .itemOutputs(Materials.Electrotine.getDust(8)) + .duration(1 * MINUTES + 30 * SECONDS) + .eut(TierEU.RECIPE_MV) + .addTo(mixerRecipes); + + for (GTRecipe recipe : circuitAssemblerRecipes.getAllRecipes()) { + if (recipe.mEUt > 512) continue; + if (BWUtil.checkStackAndPrefix(recipe.mOutputs[0])) { + for (int i = 0; i < recipe.mInputs.length; i++) { + ItemStack stack = recipe.mInputs[i]; + ItemData ass = GTOreDictUnificator.getAssociation(stack); + if (BWUtil.checkStackAndPrefix(stack) && ass.mMaterial.mMaterial.equals(Materials.Platinum)) { + recipe.mInputs[i] = GTOreDictUnificator.get(ass.mPrefix, Materials.BlueAlloy, stack.stackSize); + recipe.reloadOwner(); + } + } + } + } + } + + private static void setnewMaterialInRecipe(IRecipe recipe) { + ItemStack otpt = recipe.getRecipeOutput(); + + if (!(recipe instanceof IRecipeMutableAccess mutableRecipe)) { + return; + } + + Object input = mutableRecipe.gt5u$getRecipeInputs(); + + if (input == null) { + return; + } + + if (GTUtility.areStacksEqual(otpt, Materials.Platinum.getDust(1), true)) { + if (PlatinumSludgeOverHaul.checkRecipe(input, Materials.Platinum)) return; + mutableRecipe.gt5u$setRecipeOutputItem(PTMetallicPowder.get(dust, otpt.stackSize * 2)); + } else if (GTUtility.areStacksEqual(otpt, Materials.Palladium.getDust(1), true)) { + if (PlatinumSludgeOverHaul.checkRecipe(input, Materials.Palladium)) return; + mutableRecipe.gt5u$setRecipeOutputItem(PDMetallicPowder.get(dust, otpt.stackSize * 2)); + } else if (GTUtility.areStacksEqual(otpt, Materials.Iridium.getDust(1), true)) { + if (PlatinumSludgeOverHaul.checkRecipe(input, Materials.Iridium)) return; + mutableRecipe.gt5u$setRecipeOutputItem(IrLeachResidue.get(dust, otpt.stackSize)); + } else if (GTUtility.areStacksEqual(otpt, Materials.Osmium.getDust(1), true)) { + if (PlatinumSludgeOverHaul.checkRecipe(input, Materials.Osmium)) return; + mutableRecipe.gt5u$setRecipeOutputItem(IrOsLeachResidue.get(dust, otpt.stackSize)); + } + } + + @SuppressWarnings({ "rawtypes", "unchecked" }) + public static boolean checkRecipe(Object input, Materials mat) { + if (input instanceof List || input instanceof Object[]) { + Set lists = new HashSet(), stacks = new HashSet(); + List ip = input instanceof List ? (List) input : new ArrayList(); + Object[] ip2 = input instanceof Object[] ? (Object[]) input : new Object[0]; + + for (Object o : ip) { + if (o instanceof List) lists.add(o); + else if (o instanceof ItemStack) stacks.add(o); + } + for (Object o : ip2) { + if (o instanceof List) lists.add(o); + else if (o instanceof ItemStack) stacks.add(o); + } + + for (Object o : lists) { + if (!((List) o).isEmpty()) stacks.add(((List) o).get(0)); + } + + boolean allSame = false; + for (Object stack : stacks) { + if (!(stack instanceof ItemStack)) { + allSame = false; + break; + } + allSame = BWUtil.checkStackAndPrefix((ItemStack) stack) + && GTOreDictUnificator.getAssociation((ItemStack) stack).mMaterial.mMaterial.equals(mat); + if (!allSame) break; + } + return allSame; + } + return false; + } + + private static boolean isInBlackList(ItemStack stack) { + if (stack == null || stack.getItem() instanceof BWMetaGeneratedItems + || MainMod.MOD_ID.equals(GameRegistry.findUniqueIdentifierFor(stack.getItem()).modId) + || BartWorksCrossmod.MOD_ID.equals(GameRegistry.findUniqueIdentifierFor(stack.getItem()).modId)) + return true; + + if (GameRegistry.findUniqueIdentifierFor(stack.getItem()).modId.equals(NewHorizonsCoreMod.ID) + && !stack.getUnlocalizedName() + .contains("dust") + && !stack.getUnlocalizedName() + .contains("Dust")) + return true; + + if (Block.getBlockFromItem(stack.getItem()) instanceof GTGenericBlock + && !(Block.getBlockFromItem(stack.getItem()) instanceof BlockOresAbstract)) return true; + + if (Arrays.stream(ItemList.values()) + .filter(ItemList::hasBeenSet) + .anyMatch(e -> !BWUtil.checkStackAndPrefix(stack) && GTUtility.areStacksEqual(e.get(1), stack, true))) + return true; + + if (stack.getItem() instanceof GTGenericItem) { + if (!BWUtil.checkStackAndPrefix(stack)) return false; + if (GTOreDictUnificator.getAssociation(stack).mPrefix != rawOre) { + return !Arrays.asList(PlatinumSludgeOverHaul.OPBLACKLIST) + .contains(GTOreDictUnificator.getAssociation(stack).mPrefix) + || Arrays.asList(PlatinumSludgeOverHaul.BLACKLIST) + .contains(GTOreDictUnificator.getAssociation(stack).mMaterial.mMaterial); + } + } + + try { + if (Class.forName("gtPlusPlus.core.item.base.BaseItemComponent") + .isAssignableFrom( + stack.getItem() + .getClass()) + && !stack.getUnlocalizedName() + .contains("dust") + && !stack.getUnlocalizedName() + .contains("Dust")) { + return true; + } + if (Class.forName("gtPlusPlus.core.block.base.BlockBaseModular") + .isAssignableFrom( + Block.getBlockFromItem(stack.getItem()) + .getClass())) { + return true; + } + } catch (ClassNotFoundException e) { + e.printStackTrace(); + } + if (stack.getItem() == HELICOPTER.getDust(1) + .getItem()) { + return true; + } + if (stack.getItem() == WHITE_METAL.getDust(1) + .getItem()) { + return true; + } + if (GalaxySpace.isModLoaded()) { + if (stack.getItem() == GTModHandler.getModItem(GalaxySpace.ID, "metalsblock", 1L, 7) + .getItem()) { + return true; + } + } + if (NewHorizonsCoreMod.isModLoaded()) { + if (stack.getItem() == GTModHandler.getModItem(NewHorizonsCoreMod.ID, "item.IndustryFrame", 1L) + .getItem()) { + return true; + } + } + if (!BWUtil.checkStackAndPrefix(stack)) { + return false; + } + return Arrays.asList(PlatinumSludgeOverHaul.BLACKLIST) + .contains(GTOreDictUnificator.getAssociation(stack).mMaterial.mMaterial); + } +} diff --git a/src/main/java/bartworks/system/material/processingLoaders/AddSomeRecipes.java b/src/main/java/bartworks/system/material/processingLoaders/AddSomeRecipes.java new file mode 100644 index 0000000000..d1a4b2d2cf --- /dev/null +++ b/src/main/java/bartworks/system/material/processingLoaders/AddSomeRecipes.java @@ -0,0 +1,95 @@ +/* + * Copyright (c) 2018-2020 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 bartworks.system.material.processingLoaders; + +import static gregtech.api.enums.OrePrefixes.dust; +import static gregtech.api.enums.OrePrefixes.dustSmall; +import static gregtech.api.recipe.RecipeMaps.centrifugeRecipes; +import static gregtech.api.util.GTRecipeBuilder.MINUTES; +import static gregtech.api.util.GTRecipeBuilder.SECONDS; +import static gregtech.api.util.GTRecipeBuilder.TICKS; + +import bartworks.system.material.BWNonMetaMaterialItems; +import bartworks.system.material.WerkstoffLoader; +import gregtech.api.enums.GTValues; +import gregtech.api.enums.ItemList; +import gregtech.api.enums.Materials; +import gregtech.api.enums.TierEU; +import gregtech.api.util.GTOreDictUnificator; + +public class AddSomeRecipes implements Runnable { + + public void run() { + + GTValues.RA.stdBuilder() + .itemInputs(BWNonMetaMaterialItems.Depleted_Tiberium_1.get(1)) + .itemOutputs( + WerkstoffLoader.Zirconium.get(dust), + WerkstoffLoader.Zirconium.get(dust), + WerkstoffLoader.Tiberium.get(dustSmall, 2), + WerkstoffLoader.Zirconium.get(dust, 2), + GTOreDictUnificator.get(dust, Materials.TungstenSteel, 8L), + GTOreDictUnificator.get(dust, Materials.Platinum, 1L)) + .outputChances(100_00, 50_00, 50_00, 25_00, 100_00, 100_00) + .fluidOutputs(WerkstoffLoader.Xenon.getFluidOrGas(1)) + .duration(12 * SECONDS + 10 * TICKS) + .eut(TierEU.RECIPE_EV) + .addTo(centrifugeRecipes); + + GTValues.RA.stdBuilder() + .itemInputs(BWNonMetaMaterialItems.Depleted_Tiberium_2.get(1)) + .itemOutputs( + WerkstoffLoader.Zirconium.get(dust, 2), + WerkstoffLoader.Zirconium.get(dust, 2), + WerkstoffLoader.Tiberium.get(dust), + WerkstoffLoader.Zirconium.get(dust, 4), + GTOreDictUnificator.get(dust, Materials.TungstenSteel, 18L), + GTOreDictUnificator.get(dust, Materials.Platinum, 2L)) + .outputChances(100_00, 50_00, 50_00, 25_00, 100_00, 100_00) + .fluidOutputs(WerkstoffLoader.Xenon.getFluidOrGas(2)) + .duration(12 * SECONDS + 10 * TICKS) + .eut(TierEU.RECIPE_EV) + .addTo(centrifugeRecipes); + + GTValues.RA.stdBuilder() + .itemInputs(BWNonMetaMaterialItems.Depleted_Tiberium_4.get(1)) + .itemOutputs( + WerkstoffLoader.Zirconium.get(dust, 4), + WerkstoffLoader.Zirconium.get(dust, 4), + WerkstoffLoader.Tiberium.get(dust, 2), + WerkstoffLoader.Zirconium.get(dust, 8), + GTOreDictUnificator.get(dust, Materials.TungstenSteel, 38L), + GTOreDictUnificator.get(dust, Materials.Platinum, 4L)) + .outputChances(100_00, 50_00, 50_00, 25_00, 100_00, 100_00) + .fluidOutputs(WerkstoffLoader.Xenon.getFluidOrGas(4)) + .duration(50 * SECONDS) + .eut(TierEU.RECIPE_EV) + .addTo(centrifugeRecipes); + + GTValues.RA.stdBuilder() + .itemInputs(BWNonMetaMaterialItems.Depleted_TheCoreCell.get(1)) + .itemOutputs( + ItemList.Depleted_Naquadah_4.get(8), + WerkstoffLoader.Zirconium.get(dust, 64), + WerkstoffLoader.Zirconium.get(dust, 64), + GTOreDictUnificator.get(dust, Materials.TungstenSteel, 64L), + GTOreDictUnificator.get(dust, Materials.TungstenSteel, 64L), + GTOreDictUnificator.get(dust, Materials.TungstenSteel, 48L)) + .outputChances(100_00, 50_00, 50_00, 100_00, 100_00, 100_00) + .duration(1 * MINUTES + 40 * SECONDS) + .eut(TierEU.RECIPE_IV) + .addTo(centrifugeRecipes); + + } +} diff --git a/src/main/java/bartworks/system/material/processingLoaders/AdditionalRecipes.java b/src/main/java/bartworks/system/material/processingLoaders/AdditionalRecipes.java new file mode 100644 index 0000000000..416b12dbf7 --- /dev/null +++ b/src/main/java/bartworks/system/material/processingLoaders/AdditionalRecipes.java @@ -0,0 +1,537 @@ +/* + * Copyright (c) 2018-2020 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 bartworks.system.material.processingLoaders; + +import static bartworks.API.recipe.BartWorksRecipeMaps.bacterialVatRecipes; +import static bartworks.API.recipe.BartWorksRecipeMaps.bioLabRecipes; +import static gregtech.api.enums.Mods.Gendustry; +import static gregtech.api.enums.OrePrefixes.bolt; +import static gregtech.api.enums.OrePrefixes.crushed; +import static gregtech.api.enums.OrePrefixes.crushedPurified; +import static gregtech.api.enums.OrePrefixes.dust; +import static gregtech.api.enums.OrePrefixes.dustSmall; +import static gregtech.api.enums.OrePrefixes.gem; +import static gregtech.api.enums.OrePrefixes.gemChipped; +import static gregtech.api.enums.OrePrefixes.gemFlawed; +import static gregtech.api.enums.OrePrefixes.stick; +import static gregtech.api.enums.OrePrefixes.stickLong; +import static gregtech.api.recipe.RecipeMaps.assemblerRecipes; +import static gregtech.api.recipe.RecipeMaps.autoclaveRecipes; +import static gregtech.api.recipe.RecipeMaps.blastFurnaceRecipes; +import static gregtech.api.recipe.RecipeMaps.cannerRecipes; +import static gregtech.api.recipe.RecipeMaps.centrifugeRecipes; +import static gregtech.api.recipe.RecipeMaps.distillationTowerRecipes; +import static gregtech.api.recipe.RecipeMaps.extremeNaquadahReactorFuels; +import static gregtech.api.recipe.RecipeMaps.fusionRecipes; +import static gregtech.api.recipe.RecipeMaps.hugeNaquadahReactorFuels; +import static gregtech.api.recipe.RecipeMaps.implosionRecipes; +import static gregtech.api.recipe.RecipeMaps.largeNaquadahReactorFuels; +import static gregtech.api.recipe.RecipeMaps.primitiveBlastRecipes; +import static gregtech.api.recipe.RecipeMaps.sifterRecipes; +import static gregtech.api.recipe.RecipeMaps.smallNaquadahReactorFuels; +import static gregtech.api.recipe.RecipeMaps.ultraHugeNaquadahReactorFuels; +import static gregtech.api.util.GTRecipeBuilder.MINUTES; +import static gregtech.api.util.GTRecipeBuilder.SECONDS; +import static gregtech.api.util.GTRecipeBuilder.TICKS; +import static gregtech.api.util.GTRecipeConstants.ADDITIVE_AMOUNT; +import static gregtech.api.util.GTRecipeConstants.COIL_HEAT; +import static gregtech.api.util.GTRecipeConstants.FUEL_VALUE; +import static gregtech.api.util.GTRecipeConstants.FUSION_THRESHOLD; +import static gregtech.api.util.GTRecipeConstants.UniversalChemical; + +import java.util.Arrays; +import java.util.List; +import java.util.Objects; + +import net.minecraft.init.Items; +import net.minecraft.item.ItemStack; +import net.minecraftforge.fluids.FluidRegistry; +import net.minecraftforge.fluids.FluidStack; + +import org.apache.commons.lang3.tuple.ImmutablePair; +import org.apache.commons.lang3.tuple.Pair; + +import bartworks.API.recipe.BartWorksRecipeMaps; +import bartworks.common.loaders.BioCultureLoader; +import bartworks.common.loaders.BioItemList; +import bartworks.common.loaders.FluidLoader; +import bartworks.common.loaders.ItemRegistry; +import bartworks.system.material.BWNonMetaMaterialItems; +import bartworks.system.material.WerkstoffLoader; +import bartworks.util.BioCulture; +import bartworks.util.BioDNA; +import bartworks.util.BioData; +import bartworks.util.BioPlasmid; +import gregtech.api.GregTechAPI; +import gregtech.api.enums.GTValues; +import gregtech.api.enums.ItemList; +import gregtech.api.enums.Materials; +import gregtech.api.enums.OrePrefixes; +import gregtech.api.enums.TierEU; +import gregtech.api.util.GTModHandler; +import gregtech.api.util.GTOreDictUnificator; +import gregtech.api.util.GTUtility; +import gregtech.common.items.behaviors.BehaviourDataOrb; + +public class AdditionalRecipes { + + private static void runBWRecipes() { + + FluidStack[] dnaFluid = { Gendustry.isModLoaded() ? FluidRegistry.getFluidStack("liquiddna", 1000) + : Materials.Biomass.getFluid(1000L) }; + + for (ItemStack stack : BioItemList.getAllPetriDishes()) { + BioData DNA = BioData.getBioDataFromNBTTag( + stack.getTagCompound() + .getCompoundTag("DNA")); + if (DNA != null) { + ItemStack Detergent = BioItemList.getOther(1); + ItemStack DNAFlask = BioItemList.getDNASampleFlask(null); + ItemStack EthanolCell = Materials.Ethanol.getCells(1); + GTValues.RA.stdBuilder() + .itemInputs(stack, DNAFlask, Detergent, EthanolCell) + .itemOutputs( + BioItemList.getDNASampleFlask(BioDNA.convertDataToDNA(DNA)), + GTOreDictUnificator.get(OrePrefixes.cell, Materials.Empty, 1L)) + .outputChances(DNA.getChance(), 100_00) + .fluidInputs(FluidRegistry.getFluidStack("ic2distilledwater", 1000)) + .special(BioItemList.mBioLabParts[0]) + .duration(25 * SECONDS) + .eut(GTValues.VP[3 + DNA.getTier()]) + .ignoreCollision() + .fake() + .addTo(bioLabRecipes); + } + + } + + for (ItemStack stack : BioItemList.getAllDNASampleFlasks()) { + BioData DNA = BioData.getBioDataFromNBTTag(stack.getTagCompound()); + + if (DNA != null) { + ItemStack Outp = ItemList.Tool_DataOrb.get(1L); + BehaviourDataOrb.setDataTitle(Outp, "DNA Sample"); + BehaviourDataOrb.setDataName(Outp, DNA.getName()); + + GTValues.RA.stdBuilder() + .itemInputs( + stack, + FluidLoader.BioLabFluidCells[0], + FluidLoader.BioLabFluidCells[3], + ItemList.Tool_DataOrb.get(1L)) + .itemOutputs(Outp, ItemList.Cell_Empty.get(2L)) + .outputChances(DNA.getChance(), 100_00) + .fluidInputs(dnaFluid) + .special(BioItemList.mBioLabParts[1]) + .duration(25 * SECONDS) + .eut(GTValues.VP[4 + DNA.getTier()]) + .ignoreCollision() + .fake() + .addTo(bioLabRecipes); + } + } + + for (ItemStack stack : BioItemList.getAllPlasmidCells()) { + BioData DNA = BioData.getBioDataFromNBTTag(stack.getTagCompound()); + + if (DNA != null) { + ItemStack inp = ItemList.Tool_DataOrb.get(0L); + BehaviourDataOrb.setDataTitle(inp, "DNA Sample"); + BehaviourDataOrb.setDataName(inp, DNA.getName()); + ItemStack inp2 = ItemList.Tool_DataOrb.get(0L); + BehaviourDataOrb.setDataTitle(inp2, "DNA Sample"); + BehaviourDataOrb.setDataName(inp2, BioCultureLoader.BIO_DATA_BETA_LACMATASE.getName()); + + GTValues.RA.stdBuilder() + .itemInputs(FluidLoader.BioLabFluidCells[1], BioItemList.getPlasmidCell(null), inp, inp2) + .itemOutputs(stack, ItemList.Cell_Empty.get(1L)) + .outputChances(DNA.getChance(), 100_00) + .fluidInputs(dnaFluid) + .special(BioItemList.mBioLabParts[2]) + .duration(25 * SECONDS) + .eut(GTValues.VP[4 + DNA.getTier()]) + .ignoreCollision() + .fake() + .addTo(bioLabRecipes); + } + } + + for (ItemStack stack : BioItemList.getAllPetriDishes()) { + BioData DNA = BioData.getBioDataFromNBTTag( + stack.getTagCompound() + .getCompoundTag("DNA")); + BioData Plasmid = BioData.getBioDataFromNBTTag( + stack.getTagCompound() + .getCompoundTag("Plasmid")); + if (!Objects.equals(DNA.getName(), Plasmid.getName())) { + GTValues.RA.stdBuilder() + .itemInputs( + BioItemList.getPetriDish(BioCulture.getBioCulture(DNA.getName())), + BioItemList.getPlasmidCell(BioPlasmid.convertDataToPlasmid(Plasmid)), + FluidLoader.BioLabFluidCells[2]) + .itemOutputs(stack, ItemList.Cell_Empty.get(1L)) + .outputChances(Plasmid.getChance(), 100_00) + .fluidInputs(FluidRegistry.getFluidStack("ic2distilledwater", 1000)) + .special(BioItemList.mBioLabParts[3]) + .duration(25 * SECONDS) + .eut(TierEU.RECIPE_LuV) + .ignoreCollision() + .fake() + .addTo(bioLabRecipes); + } + } + + ItemStack Outp = ItemList.Tool_DataOrb.get(1L); + BehaviourDataOrb.setDataTitle(Outp, "DNA Sample"); + BehaviourDataOrb.setDataName(Outp, "Any DNA"); + // Clonal Cellular Synthesis- [Liquid DNA] + Medium Petri Dish + Plasma Membrane + Stem Cells + Genome Data + GTValues.RA.stdBuilder() + .itemInputs( + BioItemList.getPetriDish(null), + BioItemList.getOther(4), + ItemList.Circuit_Chip_Stemcell.get(2L), + Outp) + .itemOutputs( + BioItemList.getPetriDish(null) + .setStackDisplayName("The Culture made from DNA")) + .outputChances(75_00) + .fluidInputs(new FluidStack(dnaFluid[0].getFluid(), 8000)) + .special(BioItemList.mBioLabParts[4]) + .duration(25 * SECONDS) + .eut(TierEU.RECIPE_LuV) + .ignoreCollision() + .fake() + .addTo(bioLabRecipes); + + FluidStack[] easyFluids = { Materials.Water.getFluid(1000L), + FluidRegistry.getFluidStack("ic2distilledwater", 1000) }; + for (FluidStack fluidStack : easyFluids) { + for (BioCulture bioCulture : BioCulture.BIO_CULTURE_ARRAY_LIST) { + if (bioCulture.isBreedable() && bioCulture.getTier() == 0) { + GTValues.RA.stdBuilder() + .itemInputs(GTUtility.getIntegratedCircuit(1), new ItemStack(Items.sugar, 64)) + .special(BioItemList.getPetriDish(bioCulture)) + .fluidInputs(fluidStack) + .fluidOutputs(new FluidStack(bioCulture.getFluid(), 10)) + .duration(50 * SECONDS) + .eut(TierEU.RECIPE_MV) + .addTo(bacterialVatRecipes); + + GTValues.RA.stdBuilder() + .itemInputs( + BioItemList.getPetriDish(null), + fluidStack.equals(Materials.Water.getFluid(1000L)) ? Materials.Water.getCells(1) + : GTUtility.getContainersFromFluid(GTModHandler.getDistilledWater(1000)) + .get(0)) + .itemOutputs(BioItemList.getPetriDish(bioCulture), Materials.Empty.getCells(1)) + .outputChances(bioCulture.getChance(), 100_00) + .fluidInputs(new FluidStack(bioCulture.getFluid(), 1000)) + .duration(25 * SECONDS) + .eut(TierEU.RECIPE_HV) + .ignoreCollision() + .fake() + .addTo(bioLabRecipes); + } + } + } + + List<Pair<Materials, Integer>> liquidFuels = Arrays.asList( + ImmutablePair.of(Materials.PhosphoricAcid, 36), + ImmutablePair.of(Materials.DilutedHydrochloricAcid, 14), + ImmutablePair.of(Materials.HypochlorousAcid, 30), + ImmutablePair.of(Materials.HydrofluoricAcid, 40), + ImmutablePair.of(Materials.HydrochloricAcid, 28), + ImmutablePair.of(Materials.NitricAcid, 24), + ImmutablePair.of(Materials.Mercury, 32), + ImmutablePair.of(Materials.DilutedSulfuricAcid, 9), + ImmutablePair.of(Materials.SulfuricAcid, 18), + ImmutablePair.of(Materials.AceticAcid, 11), + ImmutablePair.of(WerkstoffLoader.FormicAcid.getBridgeMaterial(), 40)); + for (Pair<Materials, Integer> fuel : liquidFuels) { + GTValues.RA.stdBuilder() + .itemInputs( + fuel.getLeft() + .getCells(1)) + .itemOutputs(Materials.Empty.getCells(1)) + .metadata(FUEL_VALUE, fuel.getRight()) + .addTo(BartWorksRecipeMaps.acidGenFuels); + } + GTValues.RA.stdBuilder() + .itemInputs(GTOreDictUnificator.get(OrePrefixes.cellMolten, Materials.Redstone, 1)) + .itemOutputs(Materials.Empty.getCells(1)) + .metadata(FUEL_VALUE, 10) + .addTo(BartWorksRecipeMaps.acidGenFuels); + } + + @SuppressWarnings("deprecation") + public static void run() { + runBWRecipes(); + + GTValues.RA.stdBuilder() + .itemInputs(WerkstoffLoader.RawAdemicSteel.get(dust)) + .itemOutputs(WerkstoffLoader.AdemicSteel.get(dust)) + .duration(1 * SECONDS) + .eut(TierEU.RECIPE_LV) + .metadata(ADDITIVE_AMOUNT, 4) + .addTo(implosionRecipes); + + // Thorium/Yttrium Glas + GTValues.RA.stdBuilder() + .itemInputs(WerkstoffLoader.YttriumOxide.get(dustSmall, 2), WerkstoffLoader.Thorianit.get(dustSmall, 2)) + .itemOutputs(new ItemStack(ItemRegistry.bw_glasses[0], 1, 12)) + .fluidInputs(Materials.Glass.getMolten(144)) + .duration(40 * SECONDS) + .eut(TierEU.RECIPE_IV) + .metadata(COIL_HEAT, 3663) + .addTo(blastFurnaceRecipes); + + // Thorianite recipes + GTValues.RA.stdBuilder() + .itemInputs(WerkstoffLoader.Thorianit.get(crushedPurified)) + .itemOutputs( + WerkstoffLoader.Thorianit.get(dust), + WerkstoffLoader.Thorianit.get(dust), + WerkstoffLoader.Thorianit.get(dust), + Materials.Thorium.getDust(1), + Materials.Thorium.getDust(1), + WerkstoffLoader.Thorium232.get(dust)) + .outputChances(7000, 1300, 700, 600, 300, 100) + .duration(20 * SECONDS) + .eut((int) TierEU.RECIPE_IV) + .addTo(sifterRecipes); + + // 3ThO2 + 4Al = 3Th + 2Al2O3 + GTValues.RA.stdBuilder() + .itemInputs(WerkstoffLoader.Thorianit.get(dust, 9), Materials.Aluminium.getDust(4)) + .itemOutputs(Materials.Thorium.getDust(3), Materials.Aluminiumoxide.getDust(10)) + .duration(50 * SECONDS) + .eut(TierEU.RECIPE_LV) + .addTo(UniversalChemical); + + // ThO2 + 2Mg = Th + 2MgO + GTValues.RA.stdBuilder() + .itemInputs(WerkstoffLoader.Thorianit.get(dust, 3), Materials.Magnesium.getDust(2)) + .itemOutputs(Materials.Thorium.getDust(1), Materials.Magnesia.getDust(4)) + .duration(50 * SECONDS) + .eut(TierEU.RECIPE_LV) + .addTo(UniversalChemical); + + GTValues.RA.stdBuilder() + .itemInputs(WerkstoffLoader.Thorianit.get(crushed), ItemList.Crop_Drop_Thorium.get(9)) + .itemOutputs(WerkstoffLoader.Thorianit.get(crushedPurified, 4)) + .fluidInputs(Materials.Water.getFluid(1000)) + .fluidOutputs(Materials.Thorium.getMolten(144)) + .duration(4 * SECONDS + 16 * TICKS) + .eut(24) + .addTo(UniversalChemical); + + // Prasiolite + GTValues.RA.stdBuilder() + .itemInputs(GTOreDictUnificator.get(dust, Materials.Quartzite, 40L), Materials.Amethyst.getDust(10)) + .itemOutputs(WerkstoffLoader.Prasiolite.get(OrePrefixes.gemFlawed, 20)) + .duration(40 * SECONDS) + .eut(TierEU.RECIPE_MV) + .metadata(COIL_HEAT, 500) + .addTo(blastFurnaceRecipes); + + GTValues.RA.stdBuilder() + .itemInputs(GTOreDictUnificator.get(dust, Materials.Quartzite, 40L)) + .itemOutputs(Materials.Amethyst.getDust(10)) + .duration(40 * SECONDS) + .eut(0) + .metadata(ADDITIVE_AMOUNT, 6) + .addTo(primitiveBlastRecipes); + + // Cubic Circonia + // 2Y + 3O = Y2O3 + GTValues.RA.stdBuilder() + .itemInputs(Materials.Yttrium.getDust(2), GTUtility.getIntegratedCircuit(5)) + .itemOutputs(WerkstoffLoader.YttriumOxide.get(dust, 5)) + .fluidInputs(Materials.Oxygen.getGas(3000)) + .duration(3 * MINUTES + 24 * SECONDS + 16 * TICKS) + .eut(TierEU.RECIPE_LV) + .addTo(UniversalChemical); + + // Zr + 2O =Y22O3= ZrO2 + GTValues.RA.stdBuilder() + .itemInputs(WerkstoffLoader.Zirconium.get(dust, 10), WerkstoffLoader.YttriumOxide.get(dust, 0)) + .itemOutputs(WerkstoffLoader.CubicZirconia.get(gemFlawed, 40)) + .fluidInputs(Materials.Oxygen.getGas(20000)) + .duration(48 * MINUTES) + .eut(TierEU.RECIPE_HV) + .metadata(COIL_HEAT, 2953) + .noOptimize() + .addTo(blastFurnaceRecipes); + + // Tellurium + GTValues.RA.stdBuilder() + .itemInputs(GTOreDictUnificator.get(crushed, Materials.Lead, 10L), GTUtility.getIntegratedCircuit(17)) + .itemOutputs(Materials.Lead.getIngots(10), Materials.Tellurium.getNuggets(20)) + .duration(40 * SECONDS) + .eut(TierEU.RECIPE_MV) + .metadata(COIL_HEAT, 722) + .addTo(blastFurnaceRecipes); + + GTValues.RA.stdBuilder() + .fluidInputs(Materials.Plutonium.getMolten(48), Materials.Beryllium.getMolten(48)) + .fluidOutputs(WerkstoffLoader.Californium.getMolten(48)) + .duration(12 * SECONDS) + .eut(49152) + .metadata(FUSION_THRESHOLD, 480_000_000) + .addTo(fusionRecipes); + + GTValues.RA.stdBuilder() + .fluidInputs(WerkstoffLoader.Californium.getMolten(32), WerkstoffLoader.Calcium.getMolten(720)) + .fluidOutputs(WerkstoffLoader.Oganesson.getFluidOrGas(720)) + .duration(24 * SECONDS) + .eut(49152) + .metadata(FUSION_THRESHOLD, 600_000_000) + .addTo(fusionRecipes); + + GTValues.RA.stdBuilder() + .fluidInputs(Materials.LiquidAir.getFluid(100000000)) + .fluidOutputs( + Materials.Nitrogen.getGas(78084000), + Materials.Oxygen.getGas(20946000), + Materials.Argon.getGas(934000), + Materials.CarbonDioxide.getGas(40700), + WerkstoffLoader.Neon.getFluidOrGas(1818), + Materials.Helium.getGas(524), + Materials.Methane.getGas(180), + WerkstoffLoader.Krypton.getFluidOrGas(114), + Materials.Hydrogen.getGas(55), + WerkstoffLoader.Xenon.getFluidOrGas(9)) + .duration(6 * MINUTES + 15 * SECONDS) + .eut(TierEU.RECIPE_EV) + .addTo(distillationTowerRecipes); + + GTValues.RA.stdBuilder() + .itemInputs(WerkstoffLoader.MagnetoResonaticDust.get(dust)) + .itemOutputs(WerkstoffLoader.MagnetoResonaticDust.get(gemChipped, 9)) + .outputChances(90_00) + .fluidInputs(WerkstoffLoader.Neon.getFluidOrGas(1000)) + .duration(25 * SECONDS) + .eut(TierEU.RECIPE_IV) + .addTo(autoclaveRecipes); + + GTValues.RA.stdBuilder() + .itemInputs(WerkstoffLoader.MagnetoResonaticDust.get(dust)) + .itemOutputs(WerkstoffLoader.MagnetoResonaticDust.get(gem)) + .fluidInputs(WerkstoffLoader.Krypton.getFluidOrGas(1000)) + .duration(25 * SECONDS) + .eut(TierEU.RECIPE_IV) + .addTo(autoclaveRecipes); + + // Milk + + GTValues.RA.stdBuilder() + .itemInputs(GTUtility.getIntegratedCircuit(1)) + .itemOutputs( + Materials.Sugar.getDustSmall(21), + Materials.Calcium.getDustTiny(1), + Materials.Magnesium.getDustTiny(1), + Materials.Potassium.getDustTiny(1), + Materials.Sodium.getDustTiny(4), + Materials.Phosphorus.getDustTiny(1)) + .outputChances(100_00, 100_00, 10_00, 100_00, 10_00, 10_00) + .fluidInputs(Materials.Milk.getFluid(10000)) + .fluidOutputs(Materials.Water.getFluid(8832)) + .duration(2 * SECONDS + 10 * TICKS) + .eut(TierEU.RECIPE_MV) + .addTo(centrifugeRecipes); + + GTValues.RA.stdBuilder() + .itemInputs(WerkstoffLoader.Tiberium.get(bolt)) + .duration(0) + .eut(0) + .metadata(FUEL_VALUE, 12_500) + .addTo(smallNaquadahReactorFuels); + + GTValues.RA.stdBuilder() + .itemInputs(WerkstoffLoader.Tiberium.get(stick)) + .duration(0) + .eut(0) + .metadata(FUEL_VALUE, 62_500) + .addTo(largeNaquadahReactorFuels); + + GTValues.RA.stdBuilder() + .itemInputs(WerkstoffLoader.Tiberium.get(stickLong)) + .duration(0) + .eut(0) + .metadata(FUEL_VALUE, 125_000) + .addTo(hugeNaquadahReactorFuels); + + GTValues.RA.stdBuilder() + .itemInputs(WerkstoffLoader.Tiberium.get(stick)) + .duration(0) + .eut(0) + .metadata(FUEL_VALUE, 31_250) + .addTo(extremeNaquadahReactorFuels); + + GTValues.RA.stdBuilder() + .itemInputs(WerkstoffLoader.Tiberium.get(stickLong)) + .duration(0) + .eut(0) + .metadata(FUEL_VALUE, 125_000) + .addTo(ultraHugeNaquadahReactorFuels); + + LoadItemContainers.run(); + + GTValues.RA.stdBuilder() + .itemInputs(ItemList.Large_Fluid_Cell_TungstenSteel.get(1L), WerkstoffLoader.Tiberium.get(dust, 3)) + .itemOutputs(BWNonMetaMaterialItems.TiberiumCell_1.get(1L)) + .duration(1 * SECONDS + 10 * TICKS) + .eut(16) + .addTo(cannerRecipes); + GTValues.RA.stdBuilder() + .itemInputs( + BWNonMetaMaterialItems.TiberiumCell_1.get(2L), + GTOreDictUnificator.get(stick, Materials.TungstenSteel, 4L)) + .itemOutputs(BWNonMetaMaterialItems.TiberiumCell_2.get(1L)) + .duration(5 * SECONDS) + .eut(400) + .addTo(assemblerRecipes); + GTValues.RA.stdBuilder() + .itemInputs( + BWNonMetaMaterialItems.TiberiumCell_1.get(4L), + GTOreDictUnificator.get(stickLong, Materials.TungstenSteel, 6L)) + .itemOutputs(BWNonMetaMaterialItems.TiberiumCell_4.get(1L)) + .duration(7 * SECONDS + 10 * TICKS) + .eut(400) + .addTo(assemblerRecipes); + GTValues.RA.stdBuilder() + .itemInputs( + BWNonMetaMaterialItems.TiberiumCell_2.get(2L), + GTOreDictUnificator.get(stick, Materials.TungstenSteel, 4L)) + .itemOutputs(BWNonMetaMaterialItems.TiberiumCell_4.get(1L)) + .duration(5 * SECONDS) + .eut(400) + .addTo(assemblerRecipes); + + GTValues.RA.stdBuilder() + .itemInputs( + ItemList.NaquadahCell_1.get(32L), + GTOreDictUnificator.get(stickLong, Materials.TungstenSteel, 64L), + GTOreDictUnificator.get(stickLong, Materials.TungstenSteel, 64L), + GTOreDictUnificator.get(stickLong, Materials.TungstenSteel, 64L), + WerkstoffLoader.Tiberium.get(dust, 64), + WerkstoffLoader.Tiberium.get(dust, 64)) + .itemOutputs(BWNonMetaMaterialItems.TheCoreCell.get(1L)) + .duration(5 * SECONDS) + .eut(TierEU.RECIPE_LuV) + .addTo(assemblerRecipes); + + GregTechAPI.sAfterGTPostload.add(new AddSomeRecipes()); + } +} diff --git a/src/main/java/bartworks/system/material/processingLoaders/DownTierLoader.java b/src/main/java/bartworks/system/material/processingLoaders/DownTierLoader.java new file mode 100644 index 0000000000..7be8b72bf0 --- /dev/null +++ b/src/main/java/bartworks/system/material/processingLoaders/DownTierLoader.java @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2018-2020 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 bartworks.system.material.processingLoaders; + +import java.util.HashSet; +import java.util.Objects; +import java.util.Set; + +import bartworks.util.BWUtil; +import bartworks.util.StreamUtils; +import gregtech.api.recipe.RecipeMap; +import gregtech.api.recipe.RecipeMaps; +import gregtech.api.util.GTRecipe; + +public class DownTierLoader { + + public static void run() { + RecipeMap.ALL_RECIPE_MAPS.values() + .stream() + .filter(map -> StreamUtils.filterVisualMaps(map) && map != RecipeMaps.fusionRecipes) + .forEach(map -> { + Set<GTRecipe> newRecipes = new HashSet<>(); + Set<GTRecipe> toRem = new HashSet<>(); + map.getAllRecipes() + .stream() + .filter(recipe -> Objects.nonNull(recipe) && recipe.mEUt > 128) + .forEach(recipe -> { + toRem.add(recipe); + newRecipes.add(BWUtil.copyAndSetTierToNewRecipe(recipe, (byte) 2)); + }); + map.getBackend() + .removeRecipes(toRem); + newRecipes.forEach(map::add); + }); + } +} diff --git a/src/main/java/bartworks/system/material/processingLoaders/LoadItemContainers.java b/src/main/java/bartworks/system/material/processingLoaders/LoadItemContainers.java new file mode 100644 index 0000000000..2e43490a25 --- /dev/null +++ b/src/main/java/bartworks/system/material/processingLoaders/LoadItemContainers.java @@ -0,0 +1,76 @@ +/* + * Copyright (c) 2018-2020 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 bartworks.system.material.processingLoaders; + +import bartworks.system.material.BWNonMetaMaterialItems; +import gregtech.api.items.ItemRadioactiveCellIC; +import gregtech.common.items.ItemDepletedCell; + +public class LoadItemContainers { + + public static void run() { + BWNonMetaMaterialItems.Depleted_Tiberium_1 + .set(new ItemDepletedCell("TiberiumcellDep", "Fuel Rod (Depleted Tiberium)", 1)); + BWNonMetaMaterialItems.Depleted_Tiberium_2 + .set(new ItemDepletedCell("Double_TiberiumcellDep", "Dual Fuel Rod (Depleted Tiberium)", 1)); + BWNonMetaMaterialItems.Depleted_Tiberium_4 + .set(new ItemDepletedCell("Quad_TiberiumcellDep", "Quad Fuel Rod (Depleted Tiberium)", 1)); + BWNonMetaMaterialItems.TiberiumCell_1.set( + new ItemRadioactiveCellIC( + "Tiberiumcell", + "Fuel Rod (Tiberium)", + 1, + 50000, + 2F, + 1, + 0.5F, + BWNonMetaMaterialItems.Depleted_Tiberium_1.get(1), + false)); + BWNonMetaMaterialItems.TiberiumCell_2.set( + new ItemRadioactiveCellIC( + "Double_Tiberiumcell", + "Dual Fuel Rod (Tiberium)", + 2, + 50000, + 2F, + 1, + 0.5F, + BWNonMetaMaterialItems.Depleted_Tiberium_2.get(1), + false)); + BWNonMetaMaterialItems.TiberiumCell_4.set( + new ItemRadioactiveCellIC( + "Quad_Tiberiumcell", + "Quad Fuel Rod (Tiberium)", + 4, + 50000, + 2F, + 1, + 0.5F, + BWNonMetaMaterialItems.Depleted_Tiberium_4.get(1), + false)); + BWNonMetaMaterialItems.Depleted_TheCoreCell + .set(new ItemDepletedCell("Core_Reactor_CellDep", "Depleted \"The Core\" Cell", 32)); + BWNonMetaMaterialItems.TheCoreCell.set( + new ItemRadioactiveCellIC( + "Core_Reactor_Cell", + "\"The Core\" Cell", + 32, + 100000, + 8F, + 32, + 1F, + BWNonMetaMaterialItems.Depleted_TheCoreCell.get(1), + false)); + } +} diff --git a/src/main/java/bartworks/system/material/werkstoff_loaders/IWerkstoffRunnable.java b/src/main/java/bartworks/system/material/werkstoff_loaders/IWerkstoffRunnable.java new file mode 100644 index 0000000000..8399091f8b --- /dev/null +++ b/src/main/java/bartworks/system/material/werkstoff_loaders/IWerkstoffRunnable.java @@ -0,0 +1,21 @@ +/* + * Copyright (c) 2018-2020 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 bartworks.system.material.werkstoff_loaders; + +import bartworks.system.material.Werkstoff; + +public interface IWerkstoffRunnable { + + void run(Werkstoff werkstoff); +} diff --git a/src/main/java/bartworks/system/material/werkstoff_loaders/recipe/AspectLoader.java b/src/main/java/bartworks/system/material/werkstoff_loaders/recipe/AspectLoader.java new file mode 100644 index 0000000000..6635db3b3b --- /dev/null +++ b/src/main/java/bartworks/system/material/werkstoff_loaders/recipe/AspectLoader.java @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2018-2020 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 bartworks.system.material.werkstoff_loaders.recipe; + +import static gregtech.api.enums.Mods.Thaumcraft; + +import java.util.Objects; + +import bartworks.system.material.Werkstoff; +import bartworks.system.material.WerkstoffLoader; +import bartworks.system.material.werkstoff_loaders.IWerkstoffRunnable; +import bartworks.util.Pair; +import bartworks.util.log.DebugLog; +import bwcrossmod.thaumcraft.util.ThaumcraftHandler; +import gregtech.api.enums.OrePrefixes; +import gregtech.api.enums.TCAspects; + +public class AspectLoader implements IWerkstoffRunnable { + + @Override + public void run(Werkstoff werkstoff) { + if (!Thaumcraft.isModLoaded()) { + return; + } + + for (OrePrefixes enabledOrePrefixes : WerkstoffLoader.ENABLED_ORE_PREFIXES) { + if (werkstoff.hasItemType(enabledOrePrefixes)) { + if (enabledOrePrefixes.mMaterialAmount >= 3628800L || enabledOrePrefixes == OrePrefixes.ore) { + DebugLog.log( + "OrePrefix: " + enabledOrePrefixes.name() + + " mMaterialAmount: " + + enabledOrePrefixes.mMaterialAmount / 3628800L); + if (Objects.nonNull(WerkstoffLoader.items.get(enabledOrePrefixes))) + ThaumcraftHandler.AspectAdder.addAspectViaBW( + werkstoff.get(enabledOrePrefixes), + werkstoff.getTCAspects( + enabledOrePrefixes == OrePrefixes.ore ? 1 + : (int) (enabledOrePrefixes.mMaterialAmount / 3628800L))); + } else if (enabledOrePrefixes.mMaterialAmount >= 0L + && Objects.nonNull(WerkstoffLoader.items.get(enabledOrePrefixes))) + ThaumcraftHandler.AspectAdder + .addAspectViaBW(werkstoff.get(enabledOrePrefixes), new Pair<>(TCAspects.PERDITIO.mAspect, 1)); + } + } + } +} diff --git a/src/main/java/bartworks/system/material/werkstoff_loaders/recipe/BlockLoader.java b/src/main/java/bartworks/system/material/werkstoff_loaders/recipe/BlockLoader.java new file mode 100644 index 0000000000..3637385328 --- /dev/null +++ b/src/main/java/bartworks/system/material/werkstoff_loaders/recipe/BlockLoader.java @@ -0,0 +1,73 @@ +/* + * Copyright (c) 2018-2020 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 bartworks.system.material.werkstoff_loaders.recipe; + +import static gregtech.api.enums.OrePrefixes.block; +import static gregtech.api.enums.OrePrefixes.cellMolten; +import static gregtech.api.enums.OrePrefixes.ingot; +import static gregtech.api.enums.OrePrefixes.plate; +import static gregtech.api.recipe.RecipeMaps.cutterRecipes; +import static gregtech.api.recipe.RecipeMaps.fluidExtractionRecipes; +import static gregtech.api.util.GTRecipeBuilder.SECONDS; +import static gregtech.api.util.GTRecipeBuilder.TICKS; +import static gregtech.api.util.GTRecipeConstants.UniversalArcFurnace; + +import bartworks.system.material.Werkstoff; +import bartworks.system.material.werkstoff_loaders.IWerkstoffRunnable; +import gregtech.api.enums.GTValues; +import gregtech.api.enums.TierEU; +import gregtech.api.recipe.RecipeCategories; +import gregtech.api.util.GTRecipeConstants; + +public class BlockLoader implements IWerkstoffRunnable { + + @Override + public void run(Werkstoff werkstoff) { + if (!werkstoff.hasItemType(block)) return; + if (werkstoff.hasItemType(ingot)) { + GTValues.RA.stdBuilder() + .itemInputs(werkstoff.get(block)) + .itemOutputs(werkstoff.get(ingot, 9)) + .duration(16 * TICKS) + .eut(90) + .metadata(GTRecipeConstants.RECYCLE, true) + .addTo(UniversalArcFurnace); + } + if (werkstoff.hasItemType(cellMolten)) { + + GTValues.RA.stdBuilder() + .itemInputs(werkstoff.get(block)) + .fluidOutputs(werkstoff.getMolten(1296)) + .recipeCategory(RecipeCategories.fluidExtractorRecycling) + .duration(14 * SECONDS + 8 * TICKS) + .eut(8) + .addTo(fluidExtractionRecipes); + + } + if (werkstoff.hasItemType(plate)) { + + GTValues.RA.stdBuilder() + .itemInputs(werkstoff.get(block)) + .itemOutputs(werkstoff.get(plate, 9)) + .duration( + (int) Math.max( + werkstoff.getStats() + .getMass() * 10L, + 1L)) + .eut(TierEU.RECIPE_LV) + .addTo(cutterRecipes); + + } + } +} diff --git a/src/main/java/bartworks/system/material/werkstoff_loaders/recipe/CasingLoader.java b/src/main/java/bartworks/system/material/werkstoff_loaders/recipe/CasingLoader.java new file mode 100644 index 0000000000..06bda56804 --- /dev/null +++ b/src/main/java/bartworks/system/material/werkstoff_loaders/recipe/CasingLoader.java @@ -0,0 +1,77 @@ +/* + * Copyright (c) 2018-2020 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 bartworks.system.material.werkstoff_loaders.recipe; + +import static gregtech.api.enums.OrePrefixes.blockCasing; +import static gregtech.api.enums.OrePrefixes.blockCasingAdvanced; +import static gregtech.api.enums.OrePrefixes.gearGt; +import static gregtech.api.enums.OrePrefixes.gearGtSmall; +import static gregtech.api.enums.OrePrefixes.plank; +import static gregtech.api.enums.OrePrefixes.plate; +import static gregtech.api.enums.OrePrefixes.plateDouble; +import static gregtech.api.enums.OrePrefixes.screw; +import static gregtech.api.recipe.RecipeMaps.assemblerRecipes; +import static gregtech.api.util.GTRecipeBuilder.SECONDS; + +import bartworks.system.material.BWGTMaterialReference; +import bartworks.system.material.Werkstoff; +import bartworks.system.material.werkstoff_loaders.IWerkstoffRunnable; +import gregtech.api.enums.GTValues; +import gregtech.api.enums.OrePrefixes; +import gregtech.api.enums.TierEU; +import gregtech.api.util.GTModHandler; + +public class CasingLoader implements IWerkstoffRunnable { + + @Override + public void run(Werkstoff werkstoff) { + if (werkstoff == BWGTMaterialReference.Wood /* || werkstoff == BW_GT_MaterialReference.WoodSealed */) { + addCasingRecipes(werkstoff, plank); + } else { + if (!werkstoff.hasGenerationFeature(blockCasing) || !werkstoff.doesOreDictedItemExists(plate) + || !werkstoff.doesOreDictedItemExists(screw) + || !werkstoff.doesOreDictedItemExists(gearGtSmall) + || !werkstoff.doesOreDictedItemExists(gearGt) + || !werkstoff.doesOreDictedItemExists(plateDouble)) return; + + addCasingRecipes(werkstoff, plateDouble); + } + } + + private static void addCasingRecipes(Werkstoff werkstoff, OrePrefixes reboltedCasingsOuterStuff) { + GTModHandler.addCraftingRecipe( + werkstoff.get(blockCasing), + new Object[] { "PSP", "PGP", "PSP", 'P', werkstoff.get(plate), 'S', werkstoff.get(screw), 'G', + werkstoff.get(gearGtSmall) }); + + GTValues.RA.stdBuilder() + .itemInputs(werkstoff.get(plate, 6), werkstoff.get(screw, 2), werkstoff.get(gearGtSmall)) + .itemOutputs(werkstoff.get(blockCasing)) + .duration(10 * SECONDS) + .eut(TierEU.RECIPE_LV) + .addTo(assemblerRecipes); + + GTModHandler.addCraftingRecipe( + werkstoff.get(blockCasingAdvanced), + new Object[] { "PSP", "PGP", "PSP", 'P', werkstoff.get(reboltedCasingsOuterStuff), 'S', + werkstoff.get(screw), 'G', werkstoff.get(gearGt) }); + + GTValues.RA.stdBuilder() + .itemInputs(werkstoff.get(reboltedCasingsOuterStuff, 6), werkstoff.get(screw, 2), werkstoff.get(gearGt)) + .itemOutputs(werkstoff.get(blockCasingAdvanced)) + .duration(10 * SECONDS) + .eut(TierEU.RECIPE_LV) + .addTo(assemblerRecipes); + } +} diff --git a/src/main/java/bartworks/system/material/werkstoff_loaders/recipe/CellLoader.java b/src/main/java/bartworks/system/material/werkstoff_loaders/recipe/CellLoader.java new file mode 100644 index 0000000000..5458d24244 --- /dev/null +++ b/src/main/java/bartworks/system/material/werkstoff_loaders/recipe/CellLoader.java @@ -0,0 +1,330 @@ +/* + * Copyright (c) 2018-2020 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 bartworks.system.material.werkstoff_loaders.recipe; + +import static gregtech.api.enums.Mods.Forestry; +import static gregtech.api.enums.OrePrefixes.capsule; +import static gregtech.api.enums.OrePrefixes.cell; +import static gregtech.api.enums.OrePrefixes.dust; +import static gregtech.api.recipe.RecipeMaps.fluidCannerRecipes; +import static gregtech.api.recipe.RecipeMaps.fluidExtractionRecipes; +import static gregtech.api.recipe.RecipeMaps.fluidSolidifierRecipes; +import static gregtech.api.recipe.RecipeMaps.scannerFakeRecipes; +import static gregtech.api.util.GTRecipeBuilder.TICKS; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Objects; + +import net.minecraft.item.ItemStack; +import net.minecraftforge.fluids.FluidContainerRegistry; +import net.minecraftforge.fluids.FluidStack; + +import bartworks.system.material.Werkstoff; +import bartworks.system.material.WerkstoffLoader; +import bartworks.system.material.werkstoff_loaders.IWerkstoffRunnable; +import bartworks.util.Pair; +import gregtech.api.enums.Element; +import gregtech.api.enums.GTValues; +import gregtech.api.enums.ItemList; +import gregtech.api.enums.Materials; +import gregtech.api.enums.TextureSet; +import gregtech.api.enums.TierEU; +import gregtech.api.interfaces.ISubTagContainer; +import gregtech.api.recipe.RecipeCategories; +import gregtech.api.recipe.RecipeMaps; +import gregtech.api.util.GTModHandler; +import gregtech.api.util.GTOreDictUnificator; +import gregtech.api.util.GTRecipe; +import gregtech.api.util.GTUtility; +import gregtech.common.items.behaviors.BehaviourDataOrb; + +public class CellLoader implements IWerkstoffRunnable { + + @Override + @SuppressWarnings("unchecked") + public void run(Werkstoff werkstoff) { + if (!werkstoff.hasItemType(cell)) return; + + if ((werkstoff.getStats() + .isElektrolysis() + || werkstoff.getStats() + .isCentrifuge()) + && !werkstoff.hasItemType(dust)) { + 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) + && ((Materials) container.getKey()).getDust(0) == null) { + FluidStack tmpFl = ((Materials) container.getKey()).getGas(1000L * container.getValue()); + if (tmpFl == null || tmpFl.getFluid() == null) { + tmpFl = ((Materials) container.getKey()).getFluid(1000L * 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 (((Materials) container.getKey()).getDust(container.getValue()) == null) continue; + if (!tracker.containsKey(container.getKey())) { + stOutputs.add(((Materials) container.getKey()).getDust(container.getValue())); + tracker.put(container.getKey(), new Pair<>(container.getValue(), stOutputs.size() - 1)); + } else { + stOutputs.add( + ((Materials) container.getKey()).getDust( + tracker.get(container.getKey()) + .getKey() + container.getValue())); + stOutputs.remove( + tracker.get(container.getKey()) + .getValue() + 1); + } + } + } else if (container.getKey() instanceof Werkstoff) { + if (((Werkstoff) container.getKey()).getStats() + .isGas() || ((Werkstoff) container.getKey()).hasItemType(cell)) { + 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(); + } + } else { + if (!((Werkstoff) container.getKey()).hasItemType(dust)) continue; + if (!tracker.containsKey(container.getKey())) { + stOutputs.add(((Werkstoff) container.getKey()).get(dust, container.getValue())); + tracker.put(container.getKey(), new Pair<>(container.getValue(), stOutputs.size() - 1)); + } else { + stOutputs.add( + ((Werkstoff) container.getKey()).get( + dust, + tracker.get(container.getKey()) + .getKey() + container.getValue())); + stOutputs.remove( + tracker.get(container.getKey()) + .getValue() + 1); + } + } + } + } + ItemStack input = werkstoff.get(cell); + input.stackSize = 1; + + int cellEmpty = cells - 1; + + stOutputs.add(Materials.Empty.getCells(-cellEmpty)); + if (werkstoff.getStats() + .isElektrolysis()) + RecipeMaps.electrolyzerRecipes.add( + new GTRecipe( + true, + new ItemStack[] { input, cellEmpty > 0 ? Materials.Empty.getCells(cellEmpty) : 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() + .getProtons() + * werkstoff.getContents() + .getValue() + .size())), + Math.min( + 4, + werkstoff.getContents() + .getValue() + .size()) + * 30, + 0)); + if (werkstoff.getStats() + .isCentrifuge()) + RecipeMaps.centrifugeRecipes.add( + new GTRecipe( + true, + new ItemStack[] { input, cellEmpty > 0 ? Materials.Empty.getCells(cellEmpty) : 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() + .getMass() + * werkstoff.getContents() + .getValue() + .size())), + Math.min( + 4, + werkstoff.getContents() + .getValue() + .size()) + * 5, + 0)); + } + + // Tank "Recipe" + GTUtility.addFluidContainerData( + new FluidContainerRegistry.FluidContainerData( + new FluidStack(Objects.requireNonNull(WerkstoffLoader.fluids.get(werkstoff)), 1000), + werkstoff.get(cell), + Materials.Empty.getCells(1))); + FluidContainerRegistry.registerFluidContainer( + werkstoff.getFluidOrGas(1) + .getFluid(), + werkstoff.get(cell), + Materials.Empty.getCells(1)); + + GTValues.RA.stdBuilder() + .itemInputs(Materials.Empty.getCells(1)) + .itemOutputs(werkstoff.get(cell)) + .fluidInputs(new FluidStack(Objects.requireNonNull(WerkstoffLoader.fluids.get(werkstoff)), 1000)) + .duration(16 * TICKS) + .eut(2) + .addTo(fluidCannerRecipes); + + GTValues.RA.stdBuilder() + .itemInputs(werkstoff.get(cell)) + .itemOutputs(Materials.Empty.getCells(1)) + .fluidOutputs(new FluidStack(Objects.requireNonNull(WerkstoffLoader.fluids.get(werkstoff)), 1000)) + .duration(16 * TICKS) + .eut(2) + .addTo(fluidCannerRecipes); + + if (Forestry.isModLoaded()) { + FluidContainerRegistry.FluidContainerData emptyData = new FluidContainerRegistry.FluidContainerData( + new FluidStack(Objects.requireNonNull(WerkstoffLoader.fluids.get(werkstoff)), 1000), + werkstoff.get(capsule), + GTModHandler.getModItem(Forestry.ID, "waxCapsule", 1), + true); + GTUtility.addFluidContainerData(emptyData); + FluidContainerRegistry.registerFluidContainer(emptyData); + + GTValues.RA.stdBuilder() + .itemInputs(werkstoff.get(capsule)) + .fluidOutputs(new FluidStack(Objects.requireNonNull(WerkstoffLoader.fluids.get(werkstoff)), 1000)) + .duration(16 * TICKS) + .eut(2) + .addTo(fluidCannerRecipes); + } + + if (werkstoff.hasItemType(dust)) { + + GTValues.RA.stdBuilder() + .itemInputs(werkstoff.get(dust)) + .fluidOutputs(werkstoff.getFluidOrGas(1000)) + .duration( + werkstoff.getStats() + .getMass()) + .eut( + werkstoff.getStats() + .getMass() > 128 ? 64 : 30) + .recipeCategory(RecipeCategories.fluidExtractorRecycling) + .addTo(fluidExtractionRecipes); + + GTValues.RA.stdBuilder() + .itemInputs(GTUtility.getIntegratedCircuit(1)) + .itemOutputs(werkstoff.get(dust)) + .fluidInputs(werkstoff.getFluidOrGas(1000)) + .duration( + (int) werkstoff.getStats() + .getMass()) + .eut( + werkstoff.getStats() + .getMass() > 128 ? 64 : 30) + .addTo(fluidSolidifierRecipes); + + } + + if (Werkstoff.Types.ELEMENT.equals(werkstoff.getType())) { + Materials werkstoffBridgeMaterial = null; + boolean ElementSet = false; + for (Element e : Element.values()) { + if (e.toString() + .equals(werkstoff.getToolTip())) { + werkstoffBridgeMaterial = werkstoff.getBridgeMaterial() != null ? werkstoff.getBridgeMaterial() + : new Materials( + -1, + werkstoff.getTexSet(), + 0, + 0, + 0, + false, + werkstoff.getDefaultName(), + werkstoff.getDefaultName()); + werkstoffBridgeMaterial.mElement = e; + e.mLinkedMaterials.add(werkstoffBridgeMaterial); + ElementSet = true; + werkstoff.setBridgeMaterial(werkstoffBridgeMaterial); + break; + } + } + if (!ElementSet) return; + + GTOreDictUnificator.addAssociation(cell, werkstoffBridgeMaterial, werkstoff.get(cell), false); + + ItemStack scannerOutput = ItemList.Tool_DataOrb.get(1L); + BehaviourDataOrb.setDataTitle(scannerOutput, "Elemental-Scan"); + BehaviourDataOrb.setDataName(scannerOutput, werkstoff.getToolTip()); + GTValues.RA.stdBuilder() + .itemInputs(werkstoff.get(cell)) + .itemOutputs(scannerOutput) + .special(ItemList.Tool_DataOrb.get(1L)) + .duration(werkstoffBridgeMaterial.getMass() * 8192) + .eut(TierEU.RECIPE_LV) + .noOptimize() + .ignoreCollision() + .fake() + .addTo(scannerFakeRecipes); + } + } +} diff --git a/src/main/java/bartworks/system/material/werkstoff_loaders/recipe/CraftingMaterialLoader.java b/src/main/java/bartworks/system/material/werkstoff_loaders/recipe/CraftingMaterialLoader.java new file mode 100644 index 0000000000..022cf4c3e6 --- /dev/null +++ b/src/main/java/bartworks/system/material/werkstoff_loaders/recipe/CraftingMaterialLoader.java @@ -0,0 +1,295 @@ +/* + * Copyright (c) 2018-2020 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 bartworks.system.material.werkstoff_loaders.recipe; + +import static gregtech.api.enums.OrePrefixes.bolt; +import static gregtech.api.enums.OrePrefixes.cellMolten; +import static gregtech.api.enums.OrePrefixes.dust; +import static gregtech.api.enums.OrePrefixes.dustSmall; +import static gregtech.api.enums.OrePrefixes.dustTiny; +import static gregtech.api.enums.OrePrefixes.gearGt; +import static gregtech.api.enums.OrePrefixes.gearGtSmall; +import static gregtech.api.enums.OrePrefixes.gem; +import static gregtech.api.enums.OrePrefixes.ingot; +import static gregtech.api.enums.OrePrefixes.plate; +import static gregtech.api.enums.OrePrefixes.ring; +import static gregtech.api.enums.OrePrefixes.rotor; +import static gregtech.api.enums.OrePrefixes.screw; +import static gregtech.api.enums.OrePrefixes.stick; +import static gregtech.api.enums.OrePrefixes.wireFine; +import static gregtech.api.recipe.RecipeMaps.assemblerRecipes; +import static gregtech.api.recipe.RecipeMaps.cutterRecipes; +import static gregtech.api.recipe.RecipeMaps.extruderRecipes; +import static gregtech.api.recipe.RecipeMaps.latheRecipes; +import static gregtech.api.recipe.RecipeMaps.maceratorRecipes; +import static gregtech.api.recipe.RecipeMaps.wiremillRecipes; +import static gregtech.api.util.GTRecipeBuilder.SECONDS; +import static gregtech.api.util.GTRecipeBuilder.TICKS; + +import bartworks.system.material.Werkstoff; +import bartworks.system.material.WerkstoffLoader; +import bartworks.system.material.werkstoff_loaders.IWerkstoffRunnable; +import gregtech.api.enums.GTValues; +import gregtech.api.enums.ItemList; +import gregtech.api.enums.Materials; +import gregtech.api.util.GTModHandler; +import gregtech.api.util.GTUtility; +import gregtech.common.GTProxy; + +public class CraftingMaterialLoader implements IWerkstoffRunnable { + + @Override + public void run(Werkstoff werkstoff) { + if (werkstoff.hasItemType(screw)) { + int tVoltageMultiplier = werkstoff.getStats() + .getMeltingPoint() >= 2800 ? 60 : 15; + + // bolt + + GTValues.RA.stdBuilder() + .itemInputs( + werkstoff.hasItemType(gem) ? werkstoff.get(gem) : werkstoff.get(ingot), + ItemList.Shape_Extruder_Bolt.get(0L)) + .itemOutputs(werkstoff.get(bolt, 8)) + .duration( + (int) Math.max( + werkstoff.getStats() + .getMass() * 2L, + 1)) + .eut(8 * tVoltageMultiplier) + .addTo(extruderRecipes); + + GTValues.RA.stdBuilder() + .itemInputs(werkstoff.get(stick)) + .itemOutputs(werkstoff.get(bolt, 4)) + .duration( + (int) Math.max( + werkstoff.getStats() + .getMass() * 2L, + 1L)) + .eut(4) + .addTo(cutterRecipes); + + GTValues.RA.stdBuilder() + .itemInputs(werkstoff.get(bolt)) + .itemOutputs(werkstoff.get(dustTiny, 1)) + .duration(2 * TICKS) + .eut(8) + .addTo(maceratorRecipes); + + // screw + + GTValues.RA.stdBuilder() + .itemInputs(werkstoff.get(bolt)) + .itemOutputs(werkstoff.get(screw)) + .duration( + (int) Math.max( + werkstoff.getStats() + .getMass() / 8L, + 1L)) + .eut(4) + .addTo(latheRecipes); + + GTModHandler.addCraftingRecipe( + werkstoff.get(screw), + GTProxy.tBits, + new Object[] { "fX", "X ", 'X', werkstoff.get(bolt) }); + + GTValues.RA.stdBuilder() + .itemInputs(werkstoff.get(screw)) + .itemOutputs(werkstoff.get(dustTiny, 1)) + .duration(2 * TICKS) + .eut(8) + .addTo(maceratorRecipes); + + if (werkstoff.hasItemType(gem)) return; + + // ring + + GTValues.RA.stdBuilder() + .itemInputs(werkstoff.get(ingot), ItemList.Shape_Extruder_Ring.get(0L)) + .itemOutputs(werkstoff.get(ring, 4)) + .duration( + (int) Math.max( + werkstoff.getStats() + .getMass() * 2L, + 1)) + .eut(6 * tVoltageMultiplier) + .addTo(extruderRecipes); + + GTModHandler.addCraftingRecipe( + werkstoff.get(ring), + GTProxy.tBits, + new Object[] { "h ", "fX", 'X', werkstoff.get(stick) }); + + // Gear + GTModHandler.addCraftingRecipe( + werkstoff.get(gearGt), + GTProxy.tBits, + new Object[] { "SPS", "PwP", "SPS", 'P', werkstoff.get(plate), 'S', werkstoff.get(stick) }); + + GTValues.RA.stdBuilder() + .itemInputs(werkstoff.get(ingot, 4), ItemList.Shape_Extruder_Gear.get(0L)) + .itemOutputs(werkstoff.get(gearGt)) + .duration( + (int) Math.max( + werkstoff.getStats() + .getMass() * 5L, + 1)) + .eut(8 * tVoltageMultiplier) + .addTo(extruderRecipes); + // wireFine + + GTValues.RA.stdBuilder() + .itemInputs(werkstoff.get(ingot), ItemList.Shape_Extruder_Wire.get(0L)) + .itemOutputs(werkstoff.get(wireFine, 8)) + .duration( + (int) Math.max( + werkstoff.getStats() + .getMass() * 1.5F, + 1F)) + .eut(8 * tVoltageMultiplier) + .addTo(extruderRecipes); + + GTValues.RA.stdBuilder() + .itemInputs(werkstoff.get(ingot), GTUtility.getIntegratedCircuit(3)) + .itemOutputs(werkstoff.get(wireFine, 8)) + .duration( + (int) Math.max( + werkstoff.getStats() + .getMass(), + 1)) + .eut(8 * tVoltageMultiplier) + .addTo(wiremillRecipes); + + GTValues.RA.stdBuilder() + .itemInputs(werkstoff.get(stick), GTUtility.getIntegratedCircuit(3)) + .itemOutputs(werkstoff.get(wireFine, 4)) + .duration( + (int) Math.max( + werkstoff.getStats() + .getMass() * 0.5F, + 1F)) + .eut(8 * tVoltageMultiplier) + .addTo(wiremillRecipes); + + // smallGear + if (WerkstoffLoader.smallGearShape != null) { + + GTValues.RA.stdBuilder() + .itemInputs(werkstoff.get(ingot), WerkstoffLoader.smallGearShape.get(0L)) + .itemOutputs(werkstoff.get(gearGtSmall)) + .duration( + (int) werkstoff.getStats() + .getMass()) + .eut(8 * tVoltageMultiplier) + .addTo(extruderRecipes); + + } + + GTModHandler.addCraftingRecipe( + werkstoff.get(gearGtSmall), + GTProxy.tBits, + new Object[] { " S ", "hPx", " S ", 'S', werkstoff.get(stick), 'P', werkstoff.get(plate) }); + + // Rotor + GTModHandler.addCraftingRecipe( + werkstoff.get(rotor), + GTProxy.tBits, + new Object[] { "PhP", "SRf", "PdP", 'P', werkstoff.get(plate), 'R', werkstoff.get(ring), 'S', + werkstoff.get(screw) }); + + GTValues.RA.stdBuilder() + .itemInputs(werkstoff.get(plate, 4), werkstoff.get(ring)) + .itemOutputs(werkstoff.get(rotor)) + .fluidInputs(Materials.Tin.getMolten(32)) + .duration(12 * SECONDS) + .eut(24) + .addTo(assemblerRecipes); + + GTValues.RA.stdBuilder() + .itemInputs(werkstoff.get(plate, 4), werkstoff.get(ring)) + .itemOutputs(werkstoff.get(rotor)) + .fluidInputs(Materials.Lead.getMolten(48)) + .duration(12 * SECONDS) + .eut(24) + .addTo(assemblerRecipes); + + GTValues.RA.stdBuilder() + .itemInputs(werkstoff.get(plate, 4), werkstoff.get(ring)) + .itemOutputs(werkstoff.get(rotor)) + .fluidInputs(Materials.SolderingAlloy.getMolten(16)) + .duration(12 * SECONDS) + .eut(24) + .addTo(assemblerRecipes); + + if (WerkstoffLoader.rotorShape != null) { + + GTValues.RA.stdBuilder() + .itemInputs(werkstoff.get(ingot, 5), WerkstoffLoader.rotorShape.get(0L)) + .itemOutputs(werkstoff.get(rotor)) + .duration(10 * SECONDS) + .eut(60) + .addTo(extruderRecipes); + + } + + // molten -> metal + if (werkstoff.hasItemType(cellMolten)) { + + /* + * !! No more hardcoded gear, etc. recipe gen, now must go through GenerationFeatures() !! + * GT_Values.RA.addFluidSolidifierRecipe( ItemList.Shape_Mold_Gear.get(0L), werkstoff.getMolten(576), + * werkstoff.get(gearGt), 128, 8); GT_Values.RA.addFluidSolidifierRecipe( + * ItemList.Shape_Mold_Gear_Small.get(0L), werkstoff.getMolten(144), werkstoff.get(gearGtSmall), 16, 8); + * if (WerkstoffLoader.ringMold != null) GT_Values.RA.addFluidSolidifierRecipe( + * WerkstoffLoader.ringMold.get(0L), werkstoff.getMolten(36), werkstoff.get(ring), 100, 4 * + * tVoltageMultiplier); if (WerkstoffLoader.boltMold != null) GT_Values.RA.addFluidSolidifierRecipe( + * WerkstoffLoader.boltMold.get(0L), werkstoff.getMolten(18), werkstoff.get(bolt), 50, 2 * + * tVoltageMultiplier); if (WerkstoffLoader.rotorMold != null) GT_Values.RA.addFluidSolidifierRecipe( + * WerkstoffLoader.rotorMold.get(0L), werkstoff.getMolten(612), werkstoff.get(rotor), 100, 60); + */ + } + + GTValues.RA.stdBuilder() + .itemInputs(werkstoff.get(gearGt)) + .itemOutputs(werkstoff.get(dust, 4)) + .duration(2 * TICKS) + .eut(8) + .addTo(maceratorRecipes); + + GTValues.RA.stdBuilder() + .itemInputs(werkstoff.get(gearGtSmall)) + .itemOutputs(werkstoff.get(dust, 1)) + .duration(2 * TICKS) + .eut(8) + .addTo(maceratorRecipes); + + GTValues.RA.stdBuilder() + .itemInputs(werkstoff.get(rotor)) + .itemOutputs(werkstoff.get(dust, 4), werkstoff.get(dustSmall)) + .duration(2 * TICKS) + .eut(8) + .addTo(maceratorRecipes); + + GTValues.RA.stdBuilder() + .itemInputs(werkstoff.get(ring)) + .itemOutputs(werkstoff.get(dustSmall, 1)) + .duration(2 * TICKS) + .eut(8) + .addTo(maceratorRecipes); + + } + } +} diff --git a/src/main/java/bartworks/system/material/werkstoff_loaders/recipe/CrushedLoader.java b/src/main/java/bartworks/system/material/werkstoff_loaders/recipe/CrushedLoader.java new file mode 100644 index 0000000000..ab3874f6bc --- /dev/null +++ b/src/main/java/bartworks/system/material/werkstoff_loaders/recipe/CrushedLoader.java @@ -0,0 +1,301 @@ +/* + * Copyright (c) 2018-2020 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 bartworks.system.material.werkstoff_loaders.recipe; + +import static gregtech.api.enums.GTValues.RA; +import static gregtech.api.enums.OrePrefixes.crushed; +import static gregtech.api.enums.OrePrefixes.crushedCentrifuged; +import static gregtech.api.enums.OrePrefixes.crushedPurified; +import static gregtech.api.enums.OrePrefixes.dust; +import static gregtech.api.enums.OrePrefixes.dustImpure; +import static gregtech.api.enums.OrePrefixes.dustPure; +import static gregtech.api.enums.OrePrefixes.dustSmall; +import static gregtech.api.enums.OrePrefixes.gem; +import static gregtech.api.enums.OrePrefixes.ingot; +import static gregtech.api.enums.OrePrefixes.nugget; +import static gregtech.api.enums.OrePrefixes.ore; +import static gregtech.api.recipe.RecipeMaps.autoclaveRecipes; +import static gregtech.api.recipe.RecipeMaps.centrifugeRecipes; +import static gregtech.api.recipe.RecipeMaps.chemicalBathRecipes; +import static gregtech.api.recipe.RecipeMaps.electroMagneticSeparatorRecipes; +import static gregtech.api.recipe.RecipeMaps.hammerRecipes; +import static gregtech.api.recipe.RecipeMaps.maceratorRecipes; +import static gregtech.api.recipe.RecipeMaps.oreWasherRecipes; +import static gregtech.api.recipe.RecipeMaps.thermalCentrifugeRecipes; +import static gregtech.api.util.GTRecipeBuilder.MINUTES; +import static gregtech.api.util.GTRecipeBuilder.SECONDS; +import static gregtech.api.util.GTRecipeBuilder.TICKS; + +import bartworks.system.material.Werkstoff; +import bartworks.system.material.werkstoff_loaders.IWerkstoffRunnable; +import gregtech.api.enums.GTValues; +import gregtech.api.enums.Materials; +import gregtech.api.enums.SubTag; +import gregtech.api.util.GTModHandler; +import gregtech.api.util.GTOreDictUnificator; + +public class CrushedLoader implements IWerkstoffRunnable { + + @Override + public void run(Werkstoff werkstoff) { + if (!werkstoff.hasItemType(ore) || !werkstoff.hasItemType(dust)) return; + + if (werkstoff.hasItemType(ingot) && !werkstoff.getStats() + .isBlastFurnace()) { + if (Werkstoff.Types.ELEMENT.equals(werkstoff.getType())) { + GTModHandler.addSmeltingRecipe(werkstoff.get(crushed), werkstoff.get(nugget, 10)); + GTModHandler.addSmeltingRecipe(werkstoff.get(crushedPurified), werkstoff.get(nugget, 10)); + GTModHandler.addSmeltingRecipe(werkstoff.get(crushedCentrifuged), werkstoff.get(nugget, 10)); + } else { + GTModHandler.addSmeltingRecipe(werkstoff.get(crushed), werkstoff.get(ingot)); + GTModHandler.addSmeltingRecipe(werkstoff.get(crushedPurified), werkstoff.get(ingot)); + GTModHandler.addSmeltingRecipe(werkstoff.get(crushedCentrifuged), werkstoff.get(ingot)); + } + GTModHandler.addSmeltingRecipe(werkstoff.get(dustImpure), werkstoff.get(ingot)); + GTModHandler.addSmeltingRecipe(werkstoff.get(dustPure), werkstoff.get(ingot)); + GTModHandler.addSmeltingRecipe(werkstoff.get(dust), werkstoff.get(ingot)); + } + + GTModHandler + .addCraftingRecipe(werkstoff.get(dustImpure), new Object[] { "h ", "W ", 'W', werkstoff.get(crushed) }); + GTModHandler.addCraftingRecipe( + werkstoff.get(dustPure), + new Object[] { "h ", "W ", 'W', werkstoff.get(crushedPurified) }); + GTModHandler.addCraftingRecipe( + werkstoff.get(dust), + new Object[] { "h ", "W ", 'W', werkstoff.get(crushedCentrifuged) }); + + GTValues.RA.stdBuilder() + .itemInputs(werkstoff.get(crushed)) + .itemOutputs(werkstoff.get(dustImpure)) + .duration(10 * TICKS) + .eut(16) + .addTo(hammerRecipes); + + RA.stdBuilder() + .itemInputs(werkstoff.get(crushed)) + .itemOutputs(werkstoff.get(dustImpure), werkstoff.getOreByProduct(0, dust)) + .outputChances(100_00, 10_00) + .eut(2) + .duration(20 * SECONDS) + .addTo(maceratorRecipes); + + RA.stdBuilder() + .itemInputs(werkstoff.get(crushed)) + .itemOutputs( + werkstoff.get(crushedPurified), + werkstoff.getOreByProduct(0, dust), + GTOreDictUnificator.get(dust, Materials.Stone, 1L)) + .outputChances(100_00, 11_11, 100_00) + .fluidInputs(GTModHandler.getWater(1000)) + .duration(25 * SECONDS) + .eut(16) + .addTo(oreWasherRecipes); + + RA.stdBuilder() + .itemInputs(werkstoff.get(crushed)) + .itemOutputs( + werkstoff.get(crushedPurified), + werkstoff.getOreByProduct(0, dust), + GTOreDictUnificator.get(dust, Materials.Stone, 1L)) + .outputChances(100_00, 11_11, 100_00) + .fluidInputs(GTModHandler.getDistilledWater(200)) + .duration(15 * SECONDS) + .eut(16) + .addTo(oreWasherRecipes); + + GTValues.RA.stdBuilder() + .itemInputs(werkstoff.get(crushed)) + .itemOutputs( + werkstoff.get(crushedCentrifuged), + werkstoff.getOreByProduct(1, dust), + GTOreDictUnificator.get(dust, Materials.Stone, 1L)) + .outputChances(100_00, 11_11, 100_00) + .duration(25 * SECONDS) + .eut(48) + .addTo(thermalCentrifugeRecipes); + + GTValues.RA.stdBuilder() + .itemInputs(werkstoff.get(crushedPurified)) + .itemOutputs(werkstoff.get(dustPure)) + .duration(10 * TICKS) + .eut(16) + .addTo(hammerRecipes); + + RA.stdBuilder() + .itemInputs(werkstoff.get(crushedPurified)) + .itemOutputs(werkstoff.get(dustPure), werkstoff.getOreByProduct(1, dust)) + .outputChances(100_00, 10_00) + .eut(2) + .duration(20 * SECONDS) + .addTo(maceratorRecipes); + + GTValues.RA.stdBuilder() + .itemInputs(werkstoff.get(crushedPurified)) + .itemOutputs(werkstoff.get(crushedCentrifuged), werkstoff.getOreByProduct(1, dust)) + .outputChances(100_00, 11_11) + .duration(25 * SECONDS) + .eut(48) + .addTo(thermalCentrifugeRecipes); + + GTValues.RA.stdBuilder() + .itemInputs(werkstoff.get(crushedCentrifuged)) + .itemOutputs(werkstoff.get(dust)) + .duration(10 * TICKS) + .eut(16) + .addTo(hammerRecipes); + + RA.stdBuilder() + .itemInputs(werkstoff.get(crushedCentrifuged)) + .itemOutputs(werkstoff.get(dust), werkstoff.getOreByProduct(2, dust)) + .outputChances(100_00, 10_00) + .eut(2) + .duration(20 * SECONDS) + .addTo(maceratorRecipes); + + GTValues.RA.stdBuilder() + .itemInputs(werkstoff.get(dustImpure)) + .itemOutputs(werkstoff.get(dust), werkstoff.getOreByProduct(0, dust)) + .outputChances(100_00, 11_11) + .duration( + Math.max( + 1L, + werkstoff.getStats() + .getMass() * 8L)) + .eut(5) + .addTo(centrifugeRecipes); + + GTValues.RA.stdBuilder() + .itemInputs(werkstoff.get(dustPure)) + .itemOutputs(werkstoff.get(dust), werkstoff.getOreByProduct(1, dust)) + .outputChances(100_00, 11_11) + .duration( + Math.max( + 1L, + werkstoff.getStats() + .getMass() * 8L)) + .eut(5) + .addTo(centrifugeRecipes); + + if (werkstoff.contains(SubTag.CRYSTALLISABLE)) { + + GTValues.RA.stdBuilder() + .itemInputs(werkstoff.get(dustPure)) + .itemOutputs(werkstoff.get(gem)) + .outputChances(9000) + .fluidInputs(Materials.Water.getFluid(200L)) + .duration(1 * MINUTES + 40 * SECONDS) + .eut(24) + .addTo(autoclaveRecipes); + + GTValues.RA.stdBuilder() + .itemInputs(werkstoff.get(dustImpure)) + .itemOutputs(werkstoff.get(gem)) + .outputChances(9000) + .fluidInputs(Materials.Water.getFluid(200L)) + .duration(1 * MINUTES + 40 * SECONDS) + .eut(24) + .addTo(autoclaveRecipes); + + GTValues.RA.stdBuilder() + .itemInputs(werkstoff.get(dustPure)) + .itemOutputs(werkstoff.get(gem)) + .outputChances(9500) + .fluidInputs(GTModHandler.getDistilledWater(200L)) + .duration(1 * MINUTES + 15 * SECONDS) + .eut(24) + .addTo(autoclaveRecipes); + + GTValues.RA.stdBuilder() + .itemInputs(werkstoff.get(dustImpure)) + .itemOutputs(werkstoff.get(gem)) + .outputChances(9500) + .fluidInputs(GTModHandler.getDistilledWater(200L)) + .duration(1 * MINUTES + 15 * SECONDS) + .eut(24) + .addTo(autoclaveRecipes); + + } + if (werkstoff.contains(SubTag.WASHING_MERCURY)) { + + GTValues.RA.stdBuilder() + .itemInputs(werkstoff.get(crushed)) + .itemOutputs( + werkstoff.get(crushedPurified), + werkstoff.getOreByProduct(1, dust), + GTOreDictUnificator.get(dust, Materials.Stone, 1L)) + .outputChances(10000, 7000, 4000) + .fluidInputs(Materials.Mercury.getFluid(1000L)) + .duration(40 * SECONDS) + .eut(8) + .addTo(chemicalBathRecipes); + + } + if (werkstoff.contains(SubTag.WASHING_SODIUMPERSULFATE)) { + + GTValues.RA.stdBuilder() + .itemInputs(werkstoff.get(crushed)) + .itemOutputs( + werkstoff.get(crushedPurified), + werkstoff.getOreByProduct(1, dust), + GTOreDictUnificator.get(dust, Materials.Stone, 1L)) + .outputChances(10000, 7000, 4000) + .fluidInputs(Materials.SodiumPersulfate.getFluid(100L)) + .duration(40 * SECONDS) + .eut(8) + .addTo(chemicalBathRecipes); + + } + if (werkstoff.contains(SubTag.ELECTROMAGNETIC_SEPERATION_GOLD)) { + + GTValues.RA.stdBuilder() + .itemInputs(werkstoff.get(dustPure)) + .itemOutputs( + werkstoff.get(dust), + GTOreDictUnificator.get(dustSmall, Materials.Gold, 1L), + GTOreDictUnificator.get(nugget, Materials.Gold, 1L)) + .outputChances(10000, 4000, 2000) + .duration(20 * SECONDS) + .eut(24) + .addTo(electroMagneticSeparatorRecipes); + + } else if (werkstoff.contains(SubTag.ELECTROMAGNETIC_SEPERATION_IRON)) { + + GTValues.RA.stdBuilder() + .itemInputs(werkstoff.get(dustPure)) + .itemOutputs( + werkstoff.get(dust), + GTOreDictUnificator.get(dustSmall, Materials.Iron, 1L), + GTOreDictUnificator.get(nugget, Materials.Iron, 1L)) + .outputChances(10000, 4000, 2000) + .duration(20 * SECONDS) + .eut(24) + .addTo(electroMagneticSeparatorRecipes); + + } else if (werkstoff.contains(SubTag.ELECTROMAGNETIC_SEPERATION_NEODYMIUM)) { + + GTValues.RA.stdBuilder() + .itemInputs(werkstoff.get(dustPure)) + .itemOutputs( + werkstoff.get(dust), + GTOreDictUnificator.get(dustSmall, Materials.Neodymium, 1L), + GTOreDictUnificator.get(nugget, Materials.Neodymium, 1L)) + .outputChances(10000, 4000, 2000) + .duration(20 * SECONDS) + .eut(24) + .addTo(electroMagneticSeparatorRecipes); + + } + } +} diff --git a/src/main/java/bartworks/system/material/werkstoff_loaders/recipe/DustLoader.java b/src/main/java/bartworks/system/material/werkstoff_loaders/recipe/DustLoader.java new file mode 100644 index 0000000000..53da59aceb --- /dev/null +++ b/src/main/java/bartworks/system/material/werkstoff_loaders/recipe/DustLoader.java @@ -0,0 +1,528 @@ +/* + * Copyright (c) 2018-2020 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 bartworks.system.material.werkstoff_loaders.recipe; + +import static gregtech.api.enums.OrePrefixes.block; +import static gregtech.api.enums.OrePrefixes.cell; +import static gregtech.api.enums.OrePrefixes.dust; +import static gregtech.api.enums.OrePrefixes.dustSmall; +import static gregtech.api.enums.OrePrefixes.dustTiny; +import static gregtech.api.enums.OrePrefixes.gem; +import static gregtech.api.enums.OrePrefixes.ingot; +import static gregtech.api.enums.OrePrefixes.ingotHot; +import static gregtech.api.enums.OrePrefixes.nugget; +import static gregtech.api.recipe.RecipeMaps.blastFurnaceRecipes; +import static gregtech.api.recipe.RecipeMaps.maceratorRecipes; +import static gregtech.api.recipe.RecipeMaps.packagerRecipes; +import static gregtech.api.recipe.RecipeMaps.primitiveBlastRecipes; +import static gregtech.api.recipe.RecipeMaps.vacuumFreezerRecipes; +import static gregtech.api.util.GTRecipeBuilder.SECONDS; +import static gregtech.api.util.GTRecipeConstants.ADDITIVE_AMOUNT; +import static gregtech.api.util.GTRecipeConstants.COIL_HEAT; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import net.minecraft.item.ItemStack; +import net.minecraftforge.fluids.FluidStack; + +import bartworks.system.material.Werkstoff; +import bartworks.system.material.WerkstoffLoader; +import bartworks.system.material.werkstoff_loaders.IWerkstoffRunnable; +import bartworks.util.Pair; +import gregtech.api.enums.GTValues; +import gregtech.api.enums.ItemList; +import gregtech.api.enums.Materials; +import gregtech.api.enums.TextureSet; +import gregtech.api.enums.TierEU; +import gregtech.api.interfaces.ISubTagContainer; +import gregtech.api.recipe.RecipeMaps; +import gregtech.api.util.GTModHandler; +import gregtech.api.util.GTRecipe; +import gregtech.api.util.GTRecipeConstants; +import gregtech.api.util.GTUtility; + +public class DustLoader implements IWerkstoffRunnable { + + @Override + @SuppressWarnings("unchecked") + public void run(Werkstoff werkstoff) { + if (werkstoff.hasItemType(dust)) { + List<FluidStack> flOutputs = new ArrayList<>(); + List<ItemStack> stOutputs = new ArrayList<>(); + HashMap<ISubTagContainer, Pair<Integer, Integer>> tracker = new HashMap<>(); + int cells = 0; + + if (werkstoff.getGenerationFeatures() + .hasMixerRecipes() + || werkstoff.getStats() + .isElektrolysis() + || werkstoff.getStats() + .isCentrifuge() + || werkstoff.getGenerationFeatures() + .hasChemicalRecipes()) { + for (Pair<ISubTagContainer, Integer> container : werkstoff.getContents() + .getValue() + .toArray(new Pair[0])) { + final ISubTagContainer key = container.getKey(); + final int value = container.getValue(); + if (key instanceof Materials materialKey) { + if ((materialKey.getGas(0) != null || materialKey.getFluid(0) != null + || materialKey.mIconSet == TextureSet.SET_FLUID) && materialKey.getDust(0) == null) { + FluidStack tmpFl = materialKey.getGas(1000L * value); + if (tmpFl == null || tmpFl.getFluid() == null) { + tmpFl = materialKey.getFluid(1000L * value); + } + flOutputs.add(tmpFl); + if (flOutputs.size() > 1) { + if (!tracker.containsKey(key)) { + stOutputs.add(materialKey.getCells(value)); + tracker.put(key, new Pair<>(value, stOutputs.size() - 1)); + } else { + stOutputs.add( + materialKey.getCells( + tracker.get(key) + .getKey() + value)); + stOutputs.remove( + tracker.get(key) + .getValue() + 1); + } + cells += value; + } + } else { + if (materialKey.getDust(value) == null) { + if (materialKey.getCells(value) == null + || materialKey.getMolten(0) == null && materialKey.getSolid(0) == null) continue; + FluidStack tmpFl = materialKey.getMolten(1000L * value); + if (tmpFl == null || tmpFl.getFluid() == null) { + tmpFl = materialKey.getSolid(1000L * value); + } + flOutputs.add(tmpFl); + if (flOutputs.size() > 1) { + if (!tracker.containsKey(key)) { + stOutputs.add(materialKey.getCells(value)); + tracker.put(key, new Pair<>(value, stOutputs.size() - 1)); + } else { + stOutputs.add( + materialKey.getCells( + tracker.get(key) + .getKey() + value)); + stOutputs.remove( + tracker.get(key) + .getValue() + 1); + } + cells += value; + } + } + if (!tracker.containsKey(key)) { + stOutputs.add(materialKey.getDust(value)); + tracker.put(key, new Pair<>(value, stOutputs.size() - 1)); + } else { + stOutputs.add( + materialKey.getDust( + tracker.get(key) + .getKey() + value)); + stOutputs.remove( + tracker.get(key) + .getValue() + 1); + } + } + } else if (key instanceof Werkstoff werkstoffKey) { + if (werkstoffKey.getStats() + .isGas() || werkstoffKey.hasItemType(cell)) { + FluidStack tmpFl = werkstoffKey.getFluidOrGas(1000 * value); + if (tmpFl == null || tmpFl.getFluid() == null) { + tmpFl = werkstoffKey.getFluidOrGas(1000 * value); + } + flOutputs.add(tmpFl); + if (flOutputs.size() > 1) { + if (!tracker.containsKey(key)) { + stOutputs.add(werkstoffKey.get(cell, value)); + tracker.put(key, new Pair<>(value, stOutputs.size() - 1)); + } else { + stOutputs.add( + werkstoffKey.get( + cell, + tracker.get(key) + .getKey() + value)); + stOutputs.remove( + tracker.get(key) + .getValue() + 1); + } + cells += value; + } + } else { + if (!werkstoffKey.hasItemType(dust)) continue; + if (!tracker.containsKey(key)) { + stOutputs.add(werkstoffKey.get(dust, value)); + tracker.put(key, new Pair<>(value, stOutputs.size() - 1)); + } else { + stOutputs.add( + werkstoffKey.get( + dust, + tracker.get(key) + .getKey() + value)); + stOutputs.remove( + tracker.get(key) + .getValue() + 1); + } + } + } + } + ItemStack input = werkstoff.get(dust); + input.stackSize = werkstoff.getContents() + .getKey(); + if (werkstoff.getStats() + .isElektrolysis()) { + GTRecipe tRecipe = new GTRecipe( + 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() + .getProtons() + / werkstoff.getContents() + .getValue() + .size())), + Math.min( + 4, + werkstoff.getContents() + .getValue() + .size()) + * 30, + 0); + RecipeMaps.electrolyzerRecipes.add(tRecipe); + RecipeMaps.electrolyzerNonCellRecipes.add(tRecipe); + } + if (werkstoff.getStats() + .isCentrifuge()) { + RecipeMaps.centrifugeRecipes.add( + new GTRecipe( + 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() + .getMass() + / werkstoff.getContents() + .getValue() + .size())), + Math.min( + 4, + werkstoff.getContents() + .getValue() + .size()) + * 5, + 0)); + GTRecipe tRecipe = new GTRecipe( + false, + 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() + .getProtons() + / werkstoff.getContents() + .getValue() + .size())), + Math.min( + 4, + werkstoff.getContents() + .getValue() + .size()) + * 30, + 0); + RecipeMaps.centrifugeNonCellRecipes.add(tRecipe); + } + if (werkstoff.getGenerationFeatures() + .hasChemicalRecipes()) { + if (cells > 0) stOutputs.add(Materials.Empty.getCells(cells)); + GTValues.RA.stdBuilder() + .itemInputs(stOutputs.toArray(new ItemStack[0])) + .itemOutputs(input) + .fluidInputs(flOutputs.toArray(new FluidStack[0])) + .duration( + (int) Math.max( + 1L, + Math.abs( + werkstoff.getStats() + .getProtons() + / werkstoff.getContents() + .getValue() + .size()))) + .eut( + Math.min( + 4, + werkstoff.getContents() + .getValue() + .size()) + * 30) + .addTo(GTRecipeConstants.UniversalChemical); + } + if (werkstoff.getGenerationFeatures() + .hasMixerRecipes()) { + if (cells > 0) stOutputs.add(Materials.Empty.getCells(cells)); + short circuitID = werkstoff.getMixCircuit(); + ItemStack circuit = circuitID == -1 ? null : GTUtility.getIntegratedCircuit(circuitID); + if (circuit != null) stOutputs.add(circuit); + RecipeMaps.mixerRecipes.add( + new GTRecipe( + 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() + .getMass() + / werkstoff.getContents() + .getValue() + .size())), + Math.min( + 4, + werkstoff.getContents() + .getValue() + .size()) + * 5, + 0)); + GTRecipe tRecipe = new GTRecipe( + false, + 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() + .getProtons() + / werkstoff.getContents() + .getValue() + .size())), + Math.min( + 4, + werkstoff.getContents() + .getValue() + .size()) + * 30, + 0); + RecipeMaps.mixerNonCellRecipes.add(tRecipe); + } + } + + GTModHandler.addCraftingRecipe( + werkstoff.get(dust), + new Object[] { "TTT", "TTT", "TTT", 'T', werkstoff.get(dustTiny) }); + GTModHandler.addCraftingRecipe( + werkstoff.get(dust), + new Object[] { "TT ", "TT ", 'T', WerkstoffLoader.getCorrespondingItemStack(dustSmall, werkstoff) }); + GTModHandler.addCraftingRecipe( + WerkstoffLoader.getCorrespondingItemStack(dustSmall, werkstoff, 4), + new Object[] { " T ", 'T', werkstoff.get(dust) }); + GTModHandler.addCraftingRecipe( + WerkstoffLoader.getCorrespondingItemStack(dustTiny, werkstoff, 9), + new Object[] { "T ", 'T', werkstoff.get(dust) }); + + GTValues.RA.stdBuilder() + .itemInputs(werkstoff.get(dustTiny, 9), ItemList.Schematic_Dust.get(0L)) + .itemOutputs(werkstoff.get(dust)) + .duration(5 * SECONDS) + .eut(4) + .addTo(packagerRecipes); + + GTValues.RA.stdBuilder() + .itemInputs(werkstoff.get(dustSmall, 4), ItemList.Schematic_Dust.get(0L)) + .itemOutputs(werkstoff.get(dust)) + .duration(5 * SECONDS) + .eut(4) + .addTo(packagerRecipes); + + GTValues.RA.stdBuilder() + .itemInputs(werkstoff.get(dustTiny, 9), ItemList.Schematic_3by3.get(0L)) + .itemOutputs(werkstoff.get(dust)) + .duration(5 * SECONDS) + .eut(4) + .addTo(packagerRecipes); + + GTValues.RA.stdBuilder() + .itemInputs(werkstoff.get(dustSmall, 4), ItemList.Schematic_2by2.get(0L)) + .itemOutputs(werkstoff.get(dust)) + .duration(5 * SECONDS) + .eut(4) + .addTo(packagerRecipes); + + if (werkstoff.hasItemType(ingot) && !werkstoff.getStats() + .isBlastFurnace()) { + GTModHandler.addSmeltingRecipe(werkstoff.get(dust), werkstoff.get(ingot)); + GTModHandler.addSmeltingRecipe(werkstoff.get(dustTiny), werkstoff.get(nugget)); + } else if (werkstoff.hasItemType(ingot) && werkstoff.getStats() + .isBlastFurnace() + && werkstoff.getStats() + .getMeltingPoint() != 0) { + if (werkstoff.contains(WerkstoffLoader.ANAEROBE_SMELTING)) { + GTValues.RA.stdBuilder() + .itemInputs(werkstoff.get(dust), GTUtility.getIntegratedCircuit(11)) + .itemOutputs( + werkstoff.getStats() + .getMeltingPoint() < 1750 ? werkstoff.get(ingot) : werkstoff.get(ingotHot)) + .fluidInputs(Materials.Nitrogen.getGas(1000)) + .duration( + Math.max( + werkstoff.getStats() + .getMass() / 40L, + 1L) + * werkstoff.getStats() + .getMeltingPoint()) + .eut( + werkstoff.getStats() + .getMeltingVoltage()) + .metadata( + COIL_HEAT, + werkstoff.getStats() + .getMeltingPoint()) + .addTo(blastFurnaceRecipes); + + } else if (werkstoff.contains(WerkstoffLoader.NOBLE_GAS_SMELTING)) { + GTValues.RA.stdBuilder() + .itemInputs(werkstoff.get(dust), GTUtility.getIntegratedCircuit(11)) + .itemOutputs( + werkstoff.getStats() + .getMeltingPoint() < 1750 ? werkstoff.get(ingot) : werkstoff.get(ingotHot)) + .fluidInputs(Materials.Argon.getGas(1000)) + .duration( + Math.max( + werkstoff.getStats() + .getMass() / 40L, + 1L) + * werkstoff.getStats() + .getMeltingPoint()) + .eut( + werkstoff.getStats() + .getMeltingVoltage()) + .metadata( + COIL_HEAT, + werkstoff.getStats() + .getMeltingPoint()) + .addTo(blastFurnaceRecipes); + + } else { + GTValues.RA.stdBuilder() + .itemInputs(werkstoff.get(dust), GTUtility.getIntegratedCircuit(1)) + .itemOutputs( + werkstoff.getStats() + .getMeltingPoint() < 1750 ? werkstoff.get(ingot) : werkstoff.get(ingotHot)) + .duration( + Math.max( + werkstoff.getStats() + .getMass() / 40L, + 1L) + * werkstoff.getStats() + .getMeltingPoint()) + .eut( + werkstoff.getStats() + .getMeltingVoltage()) + .metadata( + COIL_HEAT, + werkstoff.getStats() + .getMeltingPoint()) + .addTo(blastFurnaceRecipes); + + if (werkstoff.getStats() + .getMeltingPoint() <= 1000) { + GTValues.RA.stdBuilder() + .itemInputs(werkstoff.get(dust)) + .itemOutputs(werkstoff.get(ingot)) + .duration( + (int) Math.max( + werkstoff.getStats() + .getMass() / 40L, + 1L) * werkstoff.getStats() + .getMeltingPoint()) + .eut(0) + .metadata(ADDITIVE_AMOUNT, 9) + .addTo(primitiveBlastRecipes); + } + } + } + + if (werkstoff.getStats() + .isBlastFurnace() + && werkstoff.getStats() + .getMeltingPoint() > 1750) { + GTValues.RA.stdBuilder() + .itemInputs(werkstoff.get(ingotHot)) + .itemOutputs(werkstoff.get(ingot)) + .duration( + (int) Math.max( + werkstoff.getStats() + .getMass() * 3L, + 1L)) + .eut(TierEU.RECIPE_MV) + .addTo(vacuumFreezerRecipes); + } + + if (werkstoff.hasItemType(ingot)) { + + GTValues.RA.stdBuilder() + .itemInputs(werkstoff.get(ingot)) + .itemOutputs(werkstoff.get(dust)) + .duration(20 * SECONDS) + .eut(2) + .addTo(maceratorRecipes); + + GTValues.RA.stdBuilder() + .itemInputs(werkstoff.get(nugget)) + .itemOutputs(werkstoff.get(dustTiny)) + .duration(20 * SECONDS) + .eut(2) + .addTo(maceratorRecipes); + + } + if (werkstoff.hasItemType(ingot) || werkstoff.hasItemType(gem)) { + + GTValues.RA.stdBuilder() + .itemInputs(werkstoff.get(block)) + .itemOutputs(werkstoff.get(dust, 9)) + .duration(20 * SECONDS) + .eut(2) + .addTo(maceratorRecipes); + + } + } + } +} diff --git a/src/main/java/bartworks/system/material/werkstoff_loaders/recipe/GemLoader.java b/src/main/java/bartworks/system/material/werkstoff_loaders/recipe/GemLoader.java new file mode 100644 index 0000000000..cc21110a14 --- /dev/null +++ b/src/main/java/bartworks/system/material/werkstoff_loaders/recipe/GemLoader.java @@ -0,0 +1,294 @@ +/* + * Copyright (c) 2018-2020 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 bartworks.system.material.werkstoff_loaders.recipe; + +import static gregtech.api.enums.OrePrefixes.block; +import static gregtech.api.enums.OrePrefixes.crushedPurified; +import static gregtech.api.enums.OrePrefixes.dust; +import static gregtech.api.enums.OrePrefixes.dustSmall; +import static gregtech.api.enums.OrePrefixes.dustTiny; +import static gregtech.api.enums.OrePrefixes.gem; +import static gregtech.api.enums.OrePrefixes.gemChipped; +import static gregtech.api.enums.OrePrefixes.gemExquisite; +import static gregtech.api.enums.OrePrefixes.gemFlawed; +import static gregtech.api.enums.OrePrefixes.gemFlawless; +import static gregtech.api.enums.OrePrefixes.lens; +import static gregtech.api.enums.OrePrefixes.ore; +import static gregtech.api.enums.OrePrefixes.plate; +import static gregtech.api.recipe.RecipeMaps.compressorRecipes; +import static gregtech.api.recipe.RecipeMaps.hammerRecipes; +import static gregtech.api.recipe.RecipeMaps.implosionRecipes; +import static gregtech.api.recipe.RecipeMaps.laserEngraverRecipes; +import static gregtech.api.recipe.RecipeMaps.latheRecipes; +import static gregtech.api.recipe.RecipeMaps.maceratorRecipes; +import static gregtech.api.recipe.RecipeMaps.sifterRecipes; +import static gregtech.api.util.GTRecipeBuilder.MINUTES; +import static gregtech.api.util.GTRecipeBuilder.SECONDS; +import static gregtech.api.util.GTRecipeBuilder.TICKS; +import static gregtech.api.util.GTRecipeConstants.ADDITIVE_AMOUNT; + +import net.minecraft.item.ItemStack; +import net.minecraftforge.oredict.OreDictionary; + +import bartworks.system.material.Werkstoff; +import bartworks.system.material.WerkstoffLoader; +import bartworks.system.material.werkstoff_loaders.IWerkstoffRunnable; +import bartworks.util.BWColorUtil; +import gregtech.api.GregTechAPI; +import gregtech.api.enums.GTValues; +import gregtech.api.enums.Materials; +import gregtech.api.enums.Textures; +import gregtech.api.enums.TierEU; +import gregtech.api.interfaces.ITexture; +import gregtech.api.render.TextureFactory; +import gregtech.api.util.GTModHandler; +import gregtech.api.util.GTOreDictUnificator; +import gregtech.common.covers.CoverLens; + +public class GemLoader implements IWerkstoffRunnable { + + @Override + public void run(Werkstoff werkstoff) { + if (werkstoff.hasItemType(gem)) { + if (werkstoff.getGenerationFeatures() + .hasSifterRecipes() || werkstoff.hasItemType(ore) && werkstoff.hasItemType(dust)) { + + GTValues.RA.stdBuilder() + .itemInputs(werkstoff.get(gem, 9)) + .itemOutputs(werkstoff.get(block)) + .duration(15 * SECONDS) + .eut(2) + .addTo(compressorRecipes); + + GTValues.RA.stdBuilder() + .itemInputs(werkstoff.get(block)) + .itemOutputs(werkstoff.get(gem, 9)) + .duration(5 * SECONDS) + .eut(24) + .addTo(hammerRecipes); + + GTValues.RA.stdBuilder() + .itemInputs(werkstoff.get(crushedPurified)) + .itemOutputs( + werkstoff.get(gemExquisite), + werkstoff.get(gemFlawless), + werkstoff.get(gem), + werkstoff.get(gemFlawed), + werkstoff.get(gemChipped), + werkstoff.get(dust)) + .outputChances(200, 1000, 2500, 2000, 4000, 5000) + .duration(40 * SECONDS) + .eut(16) + .addTo(sifterRecipes); + + } + + GTValues.RA.stdBuilder() + .itemInputs(werkstoff.get(gemExquisite)) + .itemOutputs(werkstoff.get(dust, 4)) + .duration(20 * SECONDS) + .eut(2) + .addTo(maceratorRecipes); + + GTValues.RA.stdBuilder() + .itemInputs(werkstoff.get(gemFlawless)) + .itemOutputs(werkstoff.get(dust, 2)) + .duration(20 * SECONDS) + .eut(2) + .addTo(maceratorRecipes); + + GTValues.RA.stdBuilder() + .itemInputs(werkstoff.get(gem)) + .itemOutputs(werkstoff.get(dust)) + .duration(20 * SECONDS) + .eut(2) + .addTo(maceratorRecipes); + + GTValues.RA.stdBuilder() + .itemInputs(werkstoff.get(gemFlawed)) + .itemOutputs(werkstoff.get(dustSmall, 2)) + .duration(20 * SECONDS) + .eut(2) + .addTo(maceratorRecipes); + + GTValues.RA.stdBuilder() + .itemInputs(werkstoff.get(gemChipped)) + .itemOutputs(werkstoff.get(dustSmall)) + .duration(20 * SECONDS) + .eut(2) + .addTo(maceratorRecipes); + + GTModHandler.addCraftingRecipe( + werkstoff.get(gemFlawless, 2), + 0, + new Object[] { "h ", "W ", 'W', werkstoff.get(gemExquisite) }); + GTModHandler.addCraftingRecipe( + werkstoff.get(gem, 2), + 0, + new Object[] { "h ", "W ", 'W', werkstoff.get(gemFlawless) }); + GTModHandler.addCraftingRecipe( + werkstoff.get(gemFlawed, 2), + 0, + new Object[] { "h ", "W ", 'W', werkstoff.get(gem) }); + GTModHandler.addCraftingRecipe( + werkstoff.get(gemChipped, 2), + 0, + new Object[] { "h ", "W ", 'W', werkstoff.get(gemFlawed) }); + + GTValues.RA.stdBuilder() + .itemInputs(werkstoff.get(gemExquisite)) + .itemOutputs(werkstoff.get(gemFlawless, 2)) + .duration(3 * SECONDS + 4 * TICKS) + .eut(16) + .addTo(hammerRecipes); + + GTValues.RA.stdBuilder() + .itemInputs(werkstoff.get(gemFlawless)) + .itemOutputs(werkstoff.get(gem, 2)) + .duration(3 * SECONDS + 4 * TICKS) + .eut(16) + .addTo(hammerRecipes); + + GTValues.RA.stdBuilder() + .itemInputs(werkstoff.get(gem)) + .itemOutputs(werkstoff.get(gemFlawed, 2)) + .duration(3 * SECONDS + 4 * TICKS) + .eut(16) + .addTo(hammerRecipes); + + GTValues.RA.stdBuilder() + .itemInputs(werkstoff.get(gemFlawed)) + .itemOutputs(werkstoff.get(gemChipped, 2)) + .duration(3 * SECONDS + 4 * TICKS) + .eut(16) + .addTo(hammerRecipes); + + GTValues.RA.stdBuilder() + .itemInputs(werkstoff.get(gemChipped)) + .itemOutputs(werkstoff.get(dustTiny)) + .duration(3 * SECONDS + 4 * TICKS) + .eut(16) + .addTo(hammerRecipes); + + if (!werkstoff.contains(WerkstoffLoader.NO_BLAST)) { + GTValues.RA.stdBuilder() + .itemInputs(werkstoff.get(gemFlawless, 3)) + .itemOutputs(werkstoff.get(gemExquisite), GTOreDictUnificator.get(dustTiny, Materials.DarkAsh, 2)) + .duration(20 * TICKS) + .eut(TierEU.RECIPE_LV) + .metadata(ADDITIVE_AMOUNT, 8) + .addTo(implosionRecipes); + + GTValues.RA.stdBuilder() + .itemInputs(werkstoff.get(gem, 3)) + .itemOutputs(werkstoff.get(gemFlawless), GTOreDictUnificator.get(dustTiny, Materials.DarkAsh, 2)) + .duration(20 * TICKS) + .eut(TierEU.RECIPE_LV) + .metadata(ADDITIVE_AMOUNT, 8) + .addTo(implosionRecipes); + + GTValues.RA.stdBuilder() + .itemInputs(werkstoff.get(gemFlawed, 3)) + .itemOutputs(werkstoff.get(gem), GTOreDictUnificator.get(dustTiny, Materials.DarkAsh, 2)) + .duration(20 * TICKS) + .eut(TierEU.RECIPE_LV) + .metadata(ADDITIVE_AMOUNT, 8) + .addTo(implosionRecipes); + + GTValues.RA.stdBuilder() + .itemInputs(werkstoff.get(gemChipped, 3)) + .itemOutputs(werkstoff.get(gemFlawed), GTOreDictUnificator.get(dustTiny, Materials.DarkAsh, 2)) + .duration(20 * TICKS) + .eut(TierEU.RECIPE_LV) + .metadata(ADDITIVE_AMOUNT, 8) + .addTo(implosionRecipes); + + GTValues.RA.stdBuilder() + .itemInputs(werkstoff.get(dust, 4)) + .itemOutputs(werkstoff.get(gem, 3), GTOreDictUnificator.get(dustTiny, Materials.DarkAsh, 8)) + .duration(20 * TICKS) + .eut(TierEU.RECIPE_LV) + .metadata(ADDITIVE_AMOUNT, 24) + .addTo(implosionRecipes); + } + + if (werkstoff.hasItemType(plate)) { + + GTValues.RA.stdBuilder() + .itemInputs(werkstoff.get(plate)) + .itemOutputs(werkstoff.get(lens), werkstoff.get(dustSmall)) + .duration(60 * SECONDS) + .eut(TierEU.RECIPE_MV) + .addTo(latheRecipes); + + } + + GTValues.RA.stdBuilder() + .itemInputs(werkstoff.get(gemExquisite)) + .itemOutputs(werkstoff.get(lens), werkstoff.get(dust, 2)) + .duration(2 * MINUTES) + .eut(TierEU.RECIPE_LV) + .addTo(latheRecipes); + + final ITexture texture = TextureFactory.of( + Textures.BlockIcons.MACHINE_CASINGS[2][0], + TextureFactory.of(Textures.BlockIcons.OVERLAY_LENS, werkstoff.getRGBA(), false)); + GregTechAPI.registerCover( + werkstoff.get(lens), + texture, + new CoverLens(BWColorUtil.getDyeFromColor(werkstoff.getRGBA()).mIndex, texture)); + + GTValues.RA.stdBuilder() + .itemInputs(werkstoff.get(lens)) + .itemOutputs(werkstoff.get(dustSmall, 3)) + .duration(20 * SECONDS) + .eut(2) + .addTo(maceratorRecipes); + + for (ItemStack is : OreDictionary + .getOres("craftingLens" + BWColorUtil.getDyeFromColor(werkstoff.getRGBA()).mName.replace(" ", ""))) { + is.stackSize = 0; + + GTValues.RA.stdBuilder() + .itemInputs(werkstoff.get(gemChipped, 3), is) + .itemOutputs(werkstoff.get(gemFlawed, 1)) + .duration(30 * SECONDS) + .eut(TierEU.RECIPE_LV) + .addTo(laserEngraverRecipes); + + GTValues.RA.stdBuilder() + .itemInputs(werkstoff.get(gemFlawed, 3), is) + .itemOutputs(werkstoff.get(gem, 1)) + .duration(30 * SECONDS) + .eut(TierEU.RECIPE_MV) + .addTo(laserEngraverRecipes); + + GTValues.RA.stdBuilder() + .itemInputs(werkstoff.get(gem, 3), is) + .itemOutputs(werkstoff.get(gemFlawless, 1)) + .duration(60 * SECONDS) + .eut(TierEU.RECIPE_HV) + .addTo(laserEngraverRecipes); + + GTValues.RA.stdBuilder() + .itemInputs(werkstoff.get(gemFlawless, 3), is) + .itemOutputs(werkstoff.get(gemExquisite, 1)) + .duration(2 * MINUTES) + .eut(TierEU.RECIPE_EV) + .addTo(laserEngraverRecipes); + + } + } + } +} diff --git a/src/main/java/bartworks/system/material/werkstoff_loaders/recipe/MetalLoader.java b/src/main/java/bartworks/system/material/werkstoff_loaders/recipe/MetalLoader.java new file mode 100644 index 0000000000..53c25b4ab0 --- /dev/null +++ b/src/main/java/bartworks/system/material/werkstoff_loaders/recipe/MetalLoader.java @@ -0,0 +1,65 @@ +/* + * Copyright (c) 2018-2020 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 bartworks.system.material.werkstoff_loaders.recipe; + +import static gregtech.api.enums.OrePrefixes.block; +import static gregtech.api.enums.OrePrefixes.ingot; +import static gregtech.api.recipe.RecipeMaps.compressorRecipes; +import static gregtech.api.recipe.RecipeMaps.extruderRecipes; +import static gregtech.api.util.GTRecipeBuilder.SECONDS; + +import bartworks.system.material.Werkstoff; +import bartworks.system.material.werkstoff_loaders.IWerkstoffRunnable; +import gregtech.api.enums.GTValues; +import gregtech.api.enums.ItemList; +import gregtech.api.recipe.RecipeCategories; +import gregtech.api.recipe.RecipeMaps; + +public class MetalLoader implements IWerkstoffRunnable { + + @Override + public void run(Werkstoff werkstoff) { + if (werkstoff.hasItemType(ingot)) { + GTValues.RA.stdBuilder() + .itemInputs(werkstoff.get(ingot, 9)) + .itemOutputs(werkstoff.get(block)) + .duration(15 * SECONDS) + .eut(2) + .addTo(compressorRecipes); + + GTValues.RA.stdBuilder() + .itemInputs(werkstoff.get(ingot, 9), ItemList.Shape_Extruder_Block.get(0)) + .itemOutputs(werkstoff.get(block)) + .duration( + (int) werkstoff.getStats() + .getMass()) + .eut( + 8 * werkstoff.getStats() + .getMeltingPoint() >= 2800 ? 60 : 15) + .addTo(extruderRecipes); + + GTValues.RA.stdBuilder() + .itemInputs(werkstoff.get(ingot, 9), ItemList.Shape_Mold_Block.get(0L)) + .itemOutputs(werkstoff.get(block)) + .duration( + (int) (werkstoff.getStats() + .getMass() / 2)) + .eut( + 4 * werkstoff.getStats() + .getMeltingPoint() >= 2800 ? 60 : 15) + .recipeCategory(RecipeCategories.alloySmelterMolding) + .addTo(RecipeMaps.alloySmelterRecipes); + } + } +} diff --git a/src/main/java/bartworks/system/material/werkstoff_loaders/recipe/MoltenCellLoader.java b/src/main/java/bartworks/system/material/werkstoff_loaders/recipe/MoltenCellLoader.java new file mode 100644 index 0000000000..8d639574cb --- /dev/null +++ b/src/main/java/bartworks/system/material/werkstoff_loaders/recipe/MoltenCellLoader.java @@ -0,0 +1,376 @@ +/* + * Copyright (c) 2018-2020 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 bartworks.system.material.werkstoff_loaders.recipe; + +import static gregtech.api.enums.Mods.Forestry; +import static gregtech.api.enums.OrePrefixes.block; +import static gregtech.api.enums.OrePrefixes.bolt; +import static gregtech.api.enums.OrePrefixes.capsuleMolten; +import static gregtech.api.enums.OrePrefixes.cellMolten; +import static gregtech.api.enums.OrePrefixes.dust; +import static gregtech.api.enums.OrePrefixes.dustSmall; +import static gregtech.api.enums.OrePrefixes.dustTiny; +import static gregtech.api.enums.OrePrefixes.gearGt; +import static gregtech.api.enums.OrePrefixes.gearGtSmall; +import static gregtech.api.enums.OrePrefixes.ingot; +import static gregtech.api.enums.OrePrefixes.nugget; +import static gregtech.api.enums.OrePrefixes.plate; +import static gregtech.api.enums.OrePrefixes.plateDouble; +import static gregtech.api.enums.OrePrefixes.ring; +import static gregtech.api.enums.OrePrefixes.rotor; +import static gregtech.api.enums.OrePrefixes.screw; +import static gregtech.api.enums.OrePrefixes.stick; +import static gregtech.api.enums.OrePrefixes.stickLong; +import static gregtech.api.recipe.RecipeMaps.fluidCannerRecipes; +import static gregtech.api.recipe.RecipeMaps.fluidExtractionRecipes; +import static gregtech.api.recipe.RecipeMaps.fluidSolidifierRecipes; +import static gregtech.api.util.GTRecipeBuilder.SECONDS; +import static gregtech.api.util.GTRecipeBuilder.TICKS; + +import java.util.Objects; + +import net.minecraftforge.fluids.FluidContainerRegistry; +import net.minecraftforge.fluids.FluidStack; + +import bartworks.system.material.Werkstoff; +import bartworks.system.material.WerkstoffLoader; +import bartworks.system.material.werkstoff_loaders.IWerkstoffRunnable; +import gregtech.api.enums.GTValues; +import gregtech.api.enums.ItemList; +import gregtech.api.enums.Materials; +import gregtech.api.recipe.RecipeCategories; +import gregtech.api.util.GTModHandler; +import gregtech.api.util.GTUtility; + +public class MoltenCellLoader implements IWerkstoffRunnable { + + @Override + public void run(Werkstoff werkstoff) { + if (!werkstoff.hasItemType(cellMolten)) { + return; + } + + if (!werkstoff.hasItemType(ingot)) { + if (!werkstoff.hasItemType(dust)) { + return; + } + + GTValues.RA.stdBuilder() + .itemInputs(werkstoff.get(dust)) + .fluidOutputs(werkstoff.getMolten(144)) + .duration(15 * SECONDS) + .eut(2) + .recipeCategory(RecipeCategories.fluidExtractorRecycling) + .addTo(fluidExtractionRecipes); + + GTValues.RA.stdBuilder() + .itemInputs(werkstoff.get(dustSmall)) + .fluidOutputs(werkstoff.getMolten(36)) + .duration(15 * SECONDS) + .eut(2) + .recipeCategory(RecipeCategories.fluidExtractorRecycling) + .addTo(fluidExtractionRecipes); + + GTValues.RA.stdBuilder() + .itemInputs(werkstoff.get(dustTiny)) + .fluidOutputs(werkstoff.getMolten(16)) + .duration(15 * SECONDS) + .eut(2) + .recipeCategory(RecipeCategories.fluidExtractorRecycling) + .addTo(fluidExtractionRecipes); + + } else { + + GTValues.RA.stdBuilder() + .itemInputs(werkstoff.get(ingot)) + .fluidOutputs(werkstoff.getMolten(144)) + .duration(15 * SECONDS) + .eut(2) + .recipeCategory(RecipeCategories.fluidExtractorRecycling) + .addTo(fluidExtractionRecipes); + + GTValues.RA.stdBuilder() + .itemInputs(werkstoff.get(nugget)) + .fluidOutputs(werkstoff.getMolten(16)) + .duration(15 * SECONDS) + .eut(2) + .recipeCategory(RecipeCategories.fluidExtractorRecycling) + .addTo(fluidExtractionRecipes); + + GTValues.RA.stdBuilder() + .itemInputs(ItemList.Shape_Mold_Ingot.get(0)) + .itemOutputs(werkstoff.get(ingot)) + .fluidInputs(werkstoff.getMolten(144)) + .duration( + (int) werkstoff.getStats() + .getMass()) + .eut( + werkstoff.getStats() + .getMass() > 128 ? 64 : 30) + .addTo(fluidSolidifierRecipes); + + GTValues.RA.stdBuilder() + .itemInputs(ItemList.Shape_Mold_Nugget.get(0)) + .itemOutputs(werkstoff.get(nugget)) + .fluidInputs(werkstoff.getMolten(16)) + .duration( + (int) ((double) werkstoff.getStats() + .getMass() / 9D)) + .eut( + werkstoff.getStats() + .getMass() > 128 ? 64 : 30) + .addTo(fluidSolidifierRecipes); + + GTValues.RA.stdBuilder() + .itemInputs(ItemList.Shape_Mold_Block.get(0)) + .itemOutputs(werkstoff.get(block)) + .fluidInputs(werkstoff.getMolten(1296)) + .duration( + (int) werkstoff.getStats() + .getMass() * 9) + .eut( + werkstoff.getStats() + .getMass() > 128 ? 64 : 30) + .addTo(fluidSolidifierRecipes); + + if (!werkstoff.hasItemType(plate)) { + return; + } + + GTValues.RA.stdBuilder() + .itemInputs(werkstoff.get(stickLong)) + .fluidOutputs(werkstoff.getMolten(144)) + .duration(15 * SECONDS) + .eut(2) + .recipeCategory(RecipeCategories.fluidExtractorRecycling) + .addTo(fluidExtractionRecipes); + + GTValues.RA.stdBuilder() + .itemInputs(werkstoff.get(plate)) + .fluidOutputs(werkstoff.getMolten(144)) + .duration(15 * SECONDS) + .eut(2) + .recipeCategory(RecipeCategories.fluidExtractorRecycling) + .addTo(fluidExtractionRecipes); + + GTValues.RA.stdBuilder() + .itemInputs(werkstoff.get(stick)) + .fluidOutputs(werkstoff.getMolten(72)) + .duration(15 * SECONDS) + .eut(2) + .recipeCategory(RecipeCategories.fluidExtractorRecycling) + .addTo(fluidExtractionRecipes); + } + + if (werkstoff.getGenerationFeatures() + .hasMetalCraftingSolidifierRecipes()) { + + if (!werkstoff.hasItemType(plate)) { + return; + } + + GTValues.RA.stdBuilder() + .itemInputs(ItemList.Shape_Mold_Rod_Long.get(0)) + .itemOutputs(werkstoff.get(stickLong)) + .fluidInputs(werkstoff.getMolten(144)) + .duration( + (int) Math.max( + werkstoff.getStats() + .getMass(), + 1L)) + .eut( + werkstoff.getStats() + .getMass() > 128 ? 64 : 30) + .addTo(fluidSolidifierRecipes); + + GTValues.RA.stdBuilder() + .itemInputs(ItemList.Shape_Mold_Rod.get(0)) + .itemOutputs(werkstoff.get(stick)) + .fluidInputs(werkstoff.getMolten(72)) + .duration( + (int) Math.max( + werkstoff.getStats() + .getMass() / 2, + 1L)) + .eut( + werkstoff.getStats() + .getMass() > 128 ? 64 : 30) + .addTo(fluidSolidifierRecipes); + + GTValues.RA.stdBuilder() + .itemInputs(ItemList.Shape_Mold_Plate.get(0)) + .itemOutputs(werkstoff.get(plate)) + .fluidInputs(werkstoff.getMolten(144)) + .duration( + (int) Math.max( + werkstoff.getStats() + .getMass(), + 1L)) + .eut( + werkstoff.getStats() + .getMass() > 128 ? 64 : 30) + .addTo(fluidSolidifierRecipes); + + } + + if (werkstoff.getGenerationFeatures() + .hasMetaSolidifierRecipes()) { + if (!werkstoff.hasItemType(screw)) { + return; + } + + GTValues.RA.stdBuilder() + .itemInputs(ItemList.Shape_Mold_Screw.get(0)) + .itemOutputs(werkstoff.get(screw)) + .fluidInputs(werkstoff.getMolten(18)) + .duration( + (int) Math.max( + werkstoff.getStats() + .getMass() / 8, + 1L)) + .eut( + werkstoff.getStats() + .getMass() > 128 ? 64 : 30) + .addTo(fluidSolidifierRecipes); + + GTValues.RA.stdBuilder() + .itemInputs(ItemList.Shape_Mold_Gear.get(0)) + .itemOutputs(werkstoff.get(gearGt)) + .fluidInputs(werkstoff.getMolten(576)) + .duration( + (int) Math.max( + werkstoff.getStats() + .getMass() / 4, + 1L)) + .eut( + werkstoff.getStats() + .getMass() > 128 ? 64 : 30) + .addTo(fluidSolidifierRecipes); + + GTValues.RA.stdBuilder() + .itemInputs(ItemList.Shape_Mold_Gear_Small.get(0)) + .itemOutputs(werkstoff.get(gearGtSmall)) + .fluidInputs(werkstoff.getMolten(144)) + .duration( + (int) Math.max( + werkstoff.getStats() + .getMass(), + 1L)) + .eut( + werkstoff.getStats() + .getMass() > 128 ? 64 : 30) + .addTo(fluidSolidifierRecipes); + + GTValues.RA.stdBuilder() + .itemInputs(ItemList.Shape_Mold_Bolt.get(0)) + .itemOutputs(werkstoff.get(bolt)) + .fluidInputs(werkstoff.getMolten(18)) + .duration( + (int) Math.max( + werkstoff.getStats() + .getMass() / 8, + 1L)) + .eut( + werkstoff.getStats() + .getMass() > 128 ? 64 : 30) + .addTo(fluidSolidifierRecipes); + + GTValues.RA.stdBuilder() + .itemInputs(ItemList.Shape_Mold_Ring.get(0)) + .itemOutputs(werkstoff.get(ring)) + .fluidInputs(werkstoff.getMolten(36)) + .duration( + (int) Math.max( + werkstoff.getStats() + .getMass() / 4, + 1L)) + .eut( + werkstoff.getStats() + .getMass() > 128 ? 64 : 30) + .addTo(fluidSolidifierRecipes); + + // No Spring Molds + + if (WerkstoffLoader.rotorMold == null) { + return; + } + + GTValues.RA.stdBuilder() + .itemInputs(ItemList.Shape_Mold_Rotor.get(0)) + .itemOutputs(werkstoff.get(rotor)) + .fluidInputs(werkstoff.getMolten(612)) + .duration( + (int) Math.max( + werkstoff.getStats() + .getMass() * 4.25, + 1L)) + .eut( + werkstoff.getStats() + .getMass() > 128 ? 64 : 30) + .addTo(fluidSolidifierRecipes); + + } + + if (werkstoff.getGenerationFeatures() + .hasMultipleMetalSolidifierRecipes() && !werkstoff.hasItemType(plateDouble)) { + // No multiple plate molds + return; + } + + // Tank "Recipe" + final FluidContainerRegistry.FluidContainerData data = new FluidContainerRegistry.FluidContainerData( + new FluidStack(Objects.requireNonNull(WerkstoffLoader.molten.get(werkstoff)), 144), + werkstoff.get(cellMolten), + Materials.Empty.getCells(1)); + FluidContainerRegistry + .registerFluidContainer(werkstoff.getMolten(144), werkstoff.get(cellMolten), Materials.Empty.getCells(1)); + GTUtility.addFluidContainerData(data); + + GTValues.RA.stdBuilder() + .itemInputs(Materials.Empty.getCells(1)) + .itemOutputs(werkstoff.get(cellMolten)) + .fluidInputs(new FluidStack(Objects.requireNonNull(WerkstoffLoader.molten.get(werkstoff)), 144)) + .duration(2 * TICKS) + .eut(2) + .addTo(fluidCannerRecipes); + + GTValues.RA.stdBuilder() + .itemInputs(werkstoff.get(cellMolten)) + .itemOutputs(Materials.Empty.getCells(1)) + .fluidOutputs(new FluidStack(Objects.requireNonNull(WerkstoffLoader.molten.get(werkstoff)), 144)) + .duration(2 * TICKS) + .eut(2) + .addTo(fluidCannerRecipes); + + if (!Forestry.isModLoaded()) return; + + final FluidContainerRegistry.FluidContainerData emptyData = new FluidContainerRegistry.FluidContainerData( + new FluidStack(Objects.requireNonNull(WerkstoffLoader.molten.get(werkstoff)), 144), + werkstoff.get(capsuleMolten), + GTModHandler.getModItem(Forestry.ID, "refractoryEmpty", 1)); + FluidContainerRegistry.registerFluidContainer( + werkstoff.getMolten(144), + werkstoff.get(capsuleMolten), + GTModHandler.getModItem(Forestry.ID, "refractoryEmpty", 1)); + GTUtility.addFluidContainerData(emptyData); + + GTValues.RA.stdBuilder() + .itemInputs(werkstoff.get(capsuleMolten)) + .fluidOutputs(new FluidStack(Objects.requireNonNull(WerkstoffLoader.molten.get(werkstoff)), 144)) + .duration(2 * TICKS) + .eut(2) + .addTo(fluidCannerRecipes); + + } +} diff --git a/src/main/java/bartworks/system/material/werkstoff_loaders/recipe/MultipleMetalLoader.java b/src/main/java/bartworks/system/material/werkstoff_loaders/recipe/MultipleMetalLoader.java new file mode 100644 index 0000000000..25e49b0666 --- /dev/null +++ b/src/main/java/bartworks/system/material/werkstoff_loaders/recipe/MultipleMetalLoader.java @@ -0,0 +1,68 @@ +/* + * Copyright (c) 2018-2020 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 bartworks.system.material.werkstoff_loaders.recipe; + +import static gregtech.api.enums.OrePrefixes.dust; +import static gregtech.api.enums.OrePrefixes.ingot; +import static gregtech.api.enums.OrePrefixes.plateDense; +import static gregtech.api.enums.OrePrefixes.plateDouble; +import static gregtech.api.recipe.RecipeMaps.maceratorRecipes; +import static gregtech.api.util.GTRecipeBuilder.TICKS; + +import net.minecraft.item.ItemStack; + +import bartworks.system.material.Werkstoff; +import bartworks.system.material.werkstoff_loaders.IWerkstoffRunnable; +import gregtech.api.GregTechAPI; +import gregtech.api.enums.GTValues; +import gregtech.api.recipe.RecipeMaps; +import gregtech.api.render.TextureFactory; +import gregtech.api.util.GTRecipe; +import gregtech.api.util.GTUtility; + +public class MultipleMetalLoader implements IWerkstoffRunnable { + + @Override + public void run(Werkstoff werkstoff) { + if (werkstoff.hasItemType(plateDense)) { + RecipeMaps.benderRecipes.add( + new GTRecipe( + true, + new ItemStack[] { werkstoff.get(ingot, 2), GTUtility.getIntegratedCircuit(2) }, + new ItemStack[] { werkstoff.get(plateDouble) }, + null, + null, + null, + null, + (int) Math.max( + werkstoff.getStats() + .getMass() * 2, + 1L), + 60, + 0)); + GregTechAPI.registerCover( + werkstoff.get(plateDouble), + TextureFactory.of(werkstoff.getTexSet().mTextures[72], werkstoff.getRGBA(), false), + null); + + GTValues.RA.stdBuilder() + .itemInputs(werkstoff.get(plateDouble)) + .itemOutputs(werkstoff.get(dust, 2)) + .duration(2 * TICKS) + .eut(8) + .addTo(maceratorRecipes); + + } + } +} diff --git a/src/main/java/bartworks/system/material/werkstoff_loaders/recipe/OreLoader.java b/src/main/java/bartworks/system/material/werkstoff_loaders/recipe/OreLoader.java new file mode 100644 index 0000000000..cd5effd0f0 --- /dev/null +++ b/src/main/java/bartworks/system/material/werkstoff_loaders/recipe/OreLoader.java @@ -0,0 +1,65 @@ +/* + * Copyright (c) 2018-2020 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 bartworks.system.material.werkstoff_loaders.recipe; + +import static gregtech.api.enums.GTValues.RA; +import static gregtech.api.enums.OrePrefixes.crushed; +import static gregtech.api.enums.OrePrefixes.dust; +import static gregtech.api.enums.OrePrefixes.gem; +import static gregtech.api.enums.OrePrefixes.ingot; +import static gregtech.api.enums.OrePrefixes.ore; +import static gregtech.api.recipe.RecipeMaps.hammerRecipes; +import static gregtech.api.recipe.RecipeMaps.maceratorRecipes; +import static gregtech.api.util.GTRecipeBuilder.SECONDS; +import static gregtech.api.util.GTRecipeBuilder.TICKS; + +import bartworks.system.material.Werkstoff; +import bartworks.system.material.WerkstoffLoader; +import bartworks.system.material.werkstoff_loaders.IWerkstoffRunnable; +import gregtech.api.enums.Materials; +import gregtech.api.enums.SubTag; +import gregtech.api.util.GTModHandler; + +public class OreLoader implements IWerkstoffRunnable { + + @Override + public void run(Werkstoff werkstoff) { + if (werkstoff.hasItemType(ore) && werkstoff.hasItemType(ingot) + && !werkstoff.getStats() + .isBlastFurnace()) + GTModHandler + .addSmeltingRecipe(WerkstoffLoader.getCorrespondingItemStack(ore, werkstoff), werkstoff.get(ingot)); + + if (werkstoff.hasItemType(ore)) { + + RA.stdBuilder() + .itemInputs(werkstoff.get(ore)) + .itemOutputs(werkstoff.hasItemType(gem) ? werkstoff.get(gem) : werkstoff.get(crushed)) + .duration(16 * TICKS) + .eut(10) + .addTo(hammerRecipes); + + RA.stdBuilder() + .itemInputs(werkstoff.get(ore)) + .itemOutputs( + werkstoff.get(crushed, 2), + werkstoff.contains(SubTag.CRYSTAL) ? werkstoff.get(gem) : werkstoff.getOreByProduct(0, dust), + Materials.Stone.getDust(1)) + .outputChances(100_00, 10_00, 50_00) + .eut(2) + .duration(20 * SECONDS) + .addTo(maceratorRecipes); + } + } +} diff --git a/src/main/java/bartworks/system/material/werkstoff_loaders/recipe/RawOreLoader.java b/src/main/java/bartworks/system/material/werkstoff_loaders/recipe/RawOreLoader.java new file mode 100644 index 0000000000..8c9c3c1f5f --- /dev/null +++ b/src/main/java/bartworks/system/material/werkstoff_loaders/recipe/RawOreLoader.java @@ -0,0 +1,65 @@ +/* + * Copyright (c) 2018-2020 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 bartworks.system.material.werkstoff_loaders.recipe; + +import static gregtech.api.enums.GTValues.RA; +import static gregtech.api.enums.OrePrefixes.crushed; +import static gregtech.api.enums.OrePrefixes.dust; +import static gregtech.api.enums.OrePrefixes.gem; +import static gregtech.api.enums.OrePrefixes.ingot; +import static gregtech.api.enums.OrePrefixes.rawOre; +import static gregtech.api.recipe.RecipeMaps.hammerRecipes; +import static gregtech.api.recipe.RecipeMaps.maceratorRecipes; +import static gregtech.api.util.GTRecipeBuilder.SECONDS; +import static gregtech.api.util.GTRecipeBuilder.TICKS; + +import bartworks.system.material.Werkstoff; +import bartworks.system.material.WerkstoffLoader; +import bartworks.system.material.werkstoff_loaders.IWerkstoffRunnable; +import gregtech.api.enums.Materials; +import gregtech.api.enums.SubTag; +import gregtech.api.util.GTModHandler; + +public class RawOreLoader implements IWerkstoffRunnable { + + @Override + public void run(Werkstoff werkstoff) { + if (werkstoff.hasItemType(rawOre) && werkstoff.hasItemType(ingot) + && !werkstoff.getStats() + .isBlastFurnace()) + GTModHandler + .addSmeltingRecipe(WerkstoffLoader.getCorrespondingItemStack(rawOre, werkstoff), werkstoff.get(ingot)); + + if (werkstoff.hasItemType(rawOre)) { + + RA.stdBuilder() + .itemInputs(werkstoff.get(rawOre)) + .itemOutputs(werkstoff.hasItemType(gem) ? werkstoff.get(gem) : werkstoff.get(crushed)) + .duration(16 * TICKS) + .eut(10) + .addTo(hammerRecipes); + + RA.stdBuilder() + .itemInputs(werkstoff.get(rawOre)) + .itemOutputs( + werkstoff.get(crushed, 2), + werkstoff.contains(SubTag.CRYSTAL) ? werkstoff.get(gem) : werkstoff.getOreByProduct(0, dust), + Materials.Stone.getDust(1)) + .outputChances(100_00, werkstoff.getNoOfByProducts() > 0 ? 5_00 : 10_00, 50_00) + .eut(2) + .duration(20 * SECONDS) + .addTo(maceratorRecipes); + } + } +} diff --git a/src/main/java/bartworks/system/material/werkstoff_loaders/recipe/SimpleMetalLoader.java b/src/main/java/bartworks/system/material/werkstoff_loaders/recipe/SimpleMetalLoader.java new file mode 100644 index 0000000000..1fa51359d9 --- /dev/null +++ b/src/main/java/bartworks/system/material/werkstoff_loaders/recipe/SimpleMetalLoader.java @@ -0,0 +1,249 @@ +/* + * Copyright (c) 2018-2020 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 bartworks.system.material.werkstoff_loaders.recipe; + +import static gregtech.api.enums.OrePrefixes.block; +import static gregtech.api.enums.OrePrefixes.dust; +import static gregtech.api.enums.OrePrefixes.dustSmall; +import static gregtech.api.enums.OrePrefixes.foil; +import static gregtech.api.enums.OrePrefixes.gem; +import static gregtech.api.enums.OrePrefixes.ingot; +import static gregtech.api.enums.OrePrefixes.plate; +import static gregtech.api.enums.OrePrefixes.stick; +import static gregtech.api.enums.OrePrefixes.stickLong; +import static gregtech.api.recipe.RecipeMaps.benderRecipes; +import static gregtech.api.recipe.RecipeMaps.extruderRecipes; +import static gregtech.api.recipe.RecipeMaps.hammerRecipes; +import static gregtech.api.recipe.RecipeMaps.latheRecipes; +import static gregtech.api.recipe.RecipeMaps.maceratorRecipes; +import static gregtech.api.util.GTRecipeBuilder.TICKS; + +import net.minecraft.item.ItemStack; + +import bartworks.API.SideReference; +import bartworks.client.textures.PrefixTextureLinker; +import bartworks.system.material.Werkstoff; +import bartworks.system.material.werkstoff_loaders.IWerkstoffRunnable; +import gregtech.api.GregTechAPI; +import gregtech.api.enums.GTValues; +import gregtech.api.enums.ItemList; +import gregtech.api.enums.TextureSet; +import gregtech.api.interfaces.ITexture; +import gregtech.api.render.TextureFactory; +import gregtech.api.util.GTModHandler; +import gregtech.api.util.GTRecipe; +import gregtech.api.util.GTUtility; +import gregtech.common.GTProxy; + +public class SimpleMetalLoader implements IWerkstoffRunnable { + + @Override + public void run(Werkstoff werkstoff) { + if (werkstoff.hasItemType(plate)) { + if (werkstoff.hasItemType(gem)) { + + GTValues.RA.stdBuilder() + .itemInputs(werkstoff.get(gem)) + .itemOutputs(werkstoff.get(stick), werkstoff.get(dustSmall, 2)) + .duration( + (int) Math.max( + werkstoff.getStats() + .getMass() * 5L, + 1L)) + .eut(16) + .addTo(latheRecipes); + + GTModHandler.addCraftingRecipe( + werkstoff.get(stick, 2), + GTProxy.tBits, + new Object[] { "s", "X", 'X', werkstoff.get(stickLong) }); + GTModHandler.addCraftingRecipe( + werkstoff.get(stick), + GTProxy.tBits, + new Object[] { "f ", " X", 'X', werkstoff.get(gem) }); + + GTValues.RA.stdBuilder() + .itemInputs(werkstoff.get(stick, 2)) + .itemOutputs(werkstoff.get(stickLong)) + .duration( + (int) Math.max( + werkstoff.getStats() + .getMass(), + 1L)) + .eut(16) + .addTo(hammerRecipes); + + TextureSet texSet = werkstoff.getTexSet(); + ITexture texture = SideReference.Side.Client ? TextureFactory.of( + texSet.mTextures[PrefixTextureLinker.blockTexMap.getOrDefault(texSet, block.mTextureIndex)], + werkstoff.getRGBA(), + false) : TextureFactory.of(texSet.mTextures[block.mTextureIndex], werkstoff.getRGBA(), false); + GregTechAPI.registerCover(werkstoff.get(plate), texture, null); + + GTValues.RA.stdBuilder() + .itemInputs(werkstoff.get(plate)) + .itemOutputs(werkstoff.get(dust)) + .duration(2 * TICKS) + .eut(8) + .addTo(maceratorRecipes); + + return; + } + + GTModHandler.addCraftingRecipe( + werkstoff.get(stick, 2), + GTProxy.tBits, + new Object[] { "s", "X", 'X', werkstoff.get(stickLong) }); + GTModHandler.addCraftingRecipe( + werkstoff.get(stick), + GTProxy.tBits, + new Object[] { "f ", " X", 'X', werkstoff.get(ingot) }); + GTModHandler.addCraftingRecipe( + werkstoff.get(plate), + GTProxy.tBits, + new Object[] { "h", "X", "X", 'X', werkstoff.get(ingot) }); + GTModHandler.addCraftingRecipe( + werkstoff.get(foil, 2), + GTProxy.tBits, + new Object[] { "hX", 'X', werkstoff.get(plate) }); + + benderRecipes.add( + new GTRecipe( + true, + new ItemStack[] { werkstoff.get(ingot), GTUtility.getIntegratedCircuit(1) }, + new ItemStack[] { werkstoff.get(plate) }, + null, + null, + null, + null, + (int) Math.max( + werkstoff.getStats() + .getMass(), + 1L), + 24, + 0)); + + GTValues.RA.stdBuilder() + .itemInputs(werkstoff.get(ingot, 3)) + .itemOutputs(werkstoff.get(plate, 2)) + .duration( + (int) Math.max( + werkstoff.getStats() + .getMass(), + 1L)) + .eut(16) + .addTo(hammerRecipes); + + GregTechAPI.registerCover( + werkstoff.get(plate), + TextureFactory.of(werkstoff.getTexSet().mTextures[71], werkstoff.getRGBA(), false), + null); + + GTValues.RA.stdBuilder() + .itemInputs(werkstoff.get(ingot)) + .itemOutputs(werkstoff.get(stick), werkstoff.get(dustSmall, 2)) + .duration( + (int) Math.max( + werkstoff.getStats() + .getMass() * 5L, + 1L)) + .eut(16) + .addTo(latheRecipes); + + GTValues.RA.stdBuilder() + .itemInputs(werkstoff.get(plate), GTUtility.getIntegratedCircuit(1)) + .itemOutputs(werkstoff.get(foil, 4)) + .duration( + (int) Math.max( + werkstoff.getStats() + .getMass() * 1L, + 1L)) + .eut(24) + .addTo(benderRecipes); + + GTValues.RA.stdBuilder() + .itemInputs(werkstoff.get(ingot), GTUtility.getIntegratedCircuit(10)) + .itemOutputs(werkstoff.get(foil, 4)) + .duration( + (int) Math.max( + werkstoff.getStats() + .getMass() * 2L, + 1L)) + .eut(24) + .addTo(benderRecipes); + + GTValues.RA.stdBuilder() + .itemInputs(werkstoff.get(stick, 2)) + .itemOutputs(werkstoff.get(stickLong)) + .duration( + (int) Math.max( + werkstoff.getStats() + .getMass(), + 1L)) + .eut(16) + .addTo(hammerRecipes); + + GTValues.RA.stdBuilder() + .itemInputs(werkstoff.get(ingot), ItemList.Shape_Extruder_Plate.get(0)) + .itemOutputs(werkstoff.get(plate)) + .duration( + (int) Math.max( + werkstoff.getStats() + .getMass() * 2L, + 1L)) + .eut(45) + .addTo(extruderRecipes); + + GTValues.RA.stdBuilder() + .itemInputs(werkstoff.get(ingot), ItemList.Shape_Extruder_Rod.get(0)) + .itemOutputs(werkstoff.get(stick, 2)) + .duration( + (int) Math.max( + werkstoff.getStats() + .getMass() * 2L, + 1L)) + .eut(45) + .addTo(extruderRecipes); + + GTValues.RA.stdBuilder() + .itemInputs(werkstoff.get(ingot)) + .itemOutputs(werkstoff.get(dust)) + .duration(2 * TICKS) + .eut(8) + .addTo(maceratorRecipes); + + GTValues.RA.stdBuilder() + .itemInputs(werkstoff.get(plate)) + .itemOutputs(werkstoff.get(dust)) + .duration(2 * TICKS) + .eut(8) + .addTo(maceratorRecipes); + + GTValues.RA.stdBuilder() + .itemInputs(werkstoff.get(stickLong)) + .itemOutputs(werkstoff.get(dust)) + .duration(2 * TICKS) + .eut(8) + .addTo(maceratorRecipes); + + GTValues.RA.stdBuilder() + .itemInputs(werkstoff.get(stick)) + .itemOutputs(werkstoff.get(dustSmall, 2)) + .duration(2 * TICKS) + .eut(8) + .addTo(maceratorRecipes); + + } + } +} diff --git a/src/main/java/bartworks/system/material/werkstoff_loaders/recipe/ToolLoader.java b/src/main/java/bartworks/system/material/werkstoff_loaders/recipe/ToolLoader.java new file mode 100644 index 0000000000..4110ec25eb --- /dev/null +++ b/src/main/java/bartworks/system/material/werkstoff_loaders/recipe/ToolLoader.java @@ -0,0 +1,600 @@ +/* + * Copyright (c) 2018-2020 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 bartworks.system.material.werkstoff_loaders.recipe; + +import static gregtech.api.enums.OrePrefixes.bolt; +import static gregtech.api.enums.OrePrefixes.cellMolten; +import static gregtech.api.enums.OrePrefixes.gearGtSmall; +import static gregtech.api.enums.OrePrefixes.gem; +import static gregtech.api.enums.OrePrefixes.ingot; +import static gregtech.api.enums.OrePrefixes.plate; +import static gregtech.api.enums.OrePrefixes.plateDouble; +import static gregtech.api.enums.OrePrefixes.ring; +import static gregtech.api.enums.OrePrefixes.screw; +import static gregtech.api.enums.OrePrefixes.stick; +import static gregtech.api.enums.OrePrefixes.stickLong; +import static gregtech.api.enums.OrePrefixes.toolHeadHammer; +import static gregtech.api.enums.OrePrefixes.toolHeadSaw; +import static gregtech.api.enums.OrePrefixes.toolHeadWrench; +import static gregtech.api.enums.OrePrefixes.turbineBlade; +import static gregtech.api.recipe.RecipeMaps.assemblerRecipes; +import static gregtech.api.recipe.RecipeMaps.extruderRecipes; +import static gregtech.api.recipe.RecipeMaps.fluidSolidifierRecipes; +import static gregtech.api.recipe.RecipeMaps.formingPressRecipes; +import static gregtech.api.util.GTRecipeBuilder.MINUTES; +import static gregtech.api.util.GTRecipeBuilder.SECONDS; + +import net.minecraft.init.Blocks; +import net.minecraft.item.ItemStack; + +import bartworks.system.material.Werkstoff; +import bartworks.system.material.werkstoff_loaders.IWerkstoffRunnable; +import gregtech.api.enums.Dyes; +import gregtech.api.enums.GTValues; +import gregtech.api.enums.ItemList; +import gregtech.api.enums.Materials; +import gregtech.api.enums.TierEU; +import gregtech.api.util.GTModHandler; +import gregtech.api.util.GTOreDictUnificator; +import gregtech.common.GTProxy; +import gregtech.common.items.IDMetaTool01; +import gregtech.common.items.MetaGeneratedTool01; + +public class ToolLoader implements IWerkstoffRunnable { + + // GTNH-Specific + public static final short SCREWDRIVER_MV = 152; + public static final short SCREWDRIVER_HV = 154; + public static final short SOLDERING_IRON_MV = 162; + public static final short SOLDERING_IRON_HV = 164; + + public void run(Werkstoff werkstoff) { + if (werkstoff.getBridgeMaterial().mDurability == 0) return; + + if (werkstoff.hasItemType(gem)) { + if (!werkstoff.getGenerationFeatures() + .isExtension()) + GTModHandler.addCraftingRecipe( + MetaGeneratedTool01.INSTANCE.getToolWithStats( + IDMetaTool01.HARDHAMMER.ID, + 1, + werkstoff.getBridgeMaterial(), + werkstoff.getBridgeMaterial().mHandleMaterial, + null), + GTModHandler.RecipeBits.DO_NOT_CHECK_FOR_COLLISIONS | GTModHandler.RecipeBits.BUFFERED, + new Object[] { "XX ", "XXS", "XX ", 'X', gem.get(werkstoff.getBridgeMaterial()), 'S', + stick.get(werkstoff.getBridgeMaterial().mHandleMaterial) }); + GTModHandler.addCraftingRecipe( + GTOreDictUnificator.get(toolHeadSaw, werkstoff.getBridgeMaterial(), 1L), + GTProxy.tBits, + new Object[] { "GGf", 'G', gem.get(werkstoff.getBridgeMaterial()) }); + } + + if (!werkstoff.hasItemType(plate)) return; + + // Disable recipe gen with handle Material for GT Materials + if (!werkstoff.getGenerationFeatures() + .isExtension()) { + GTModHandler.addCraftingRecipe( + MetaGeneratedTool01.INSTANCE.getToolWithStats( + IDMetaTool01.SCREWDRIVER.ID, + 1, + werkstoff.getBridgeMaterial(), + werkstoff.getBridgeMaterial().mHandleMaterial, + null), + GTModHandler.RecipeBits.DO_NOT_CHECK_FOR_COLLISIONS | GTModHandler.RecipeBits.BUFFERED, + new Object[] { " fS", " Sh", "W ", 'S', stick.get(werkstoff.getBridgeMaterial()), 'W', + stick.get(werkstoff.getBridgeMaterial().mHandleMaterial) }); + GTModHandler.addCraftingRecipe( + GTOreDictUnificator.get(toolHeadWrench, werkstoff.getBridgeMaterial(), 1L), + GTProxy.tBits, + new Object[] { "hXW", "XRX", "WXd", 'X', plate.get(werkstoff.getBridgeMaterial()), 'S', + plate.get(werkstoff.getBridgeMaterial().mHandleMaterial), 'R', + ring.get(werkstoff.getBridgeMaterial().mHandleMaterial), 'W', + screw.get(werkstoff.getBridgeMaterial().mHandleMaterial) }); + GTModHandler.addShapelessCraftingRecipe( + MetaGeneratedTool01.INSTANCE.getToolWithStats( + IDMetaTool01.HARDHAMMER.ID, + 1, + werkstoff.getBridgeMaterial(), + werkstoff.getBridgeMaterial().mHandleMaterial, + null), + GTModHandler.RecipeBits.DO_NOT_CHECK_FOR_COLLISIONS | GTModHandler.RecipeBits.BUFFERED, + new Object[] { toolHeadHammer.get(werkstoff.getBridgeMaterial()), + stick.get(werkstoff.getBridgeMaterial().mHandleMaterial) }); + GTModHandler.addCraftingRecipe( + MetaGeneratedTool01.INSTANCE.getToolWithStats( + IDMetaTool01.FILE.ID, + 1, + werkstoff.getBridgeMaterial(), + werkstoff.getBridgeMaterial().mHandleMaterial, + null), + GTModHandler.RecipeBits.MIRRORED | GTModHandler.RecipeBits.DO_NOT_CHECK_FOR_COLLISIONS + | GTModHandler.RecipeBits.BUFFERED, + new Object[] { "P", "P", "S", 'P', plate.get(werkstoff.getBridgeMaterial()), 'S', + stick.get(werkstoff.getBridgeMaterial().mHandleMaterial) }); + GTModHandler.addShapelessCraftingRecipe( + MetaGeneratedTool01.INSTANCE.getToolWithStats( + IDMetaTool01.SAW.ID, + 1, + werkstoff.getBridgeMaterial(), + werkstoff.getBridgeMaterial().mHandleMaterial, + null), + new Object[] { toolHeadSaw.get(werkstoff.getBridgeMaterial()), + stick.get(werkstoff.getBridgeMaterial().mHandleMaterial) }); + GTModHandler.addCraftingRecipe( + MetaGeneratedTool01.INSTANCE.getToolWithStats( + IDMetaTool01.SOLDERING_IRON_LV.ID, + 1, + werkstoff.getBridgeMaterial(), + Materials.Rubber, + new long[] { 100000L, 32L, 1L, -1L }), + GTModHandler.RecipeBits.DO_NOT_CHECK_FOR_COLLISIONS | GTModHandler.RecipeBits.BUFFERED, + new Object[] { "LBf", "Sd ", "P ", 'B', bolt.get(werkstoff.getBridgeMaterial()), 'P', + plate.get(Materials.AnyRubber), 'S', stick.get(werkstoff.getBridgeMaterial().mHandleMaterial), 'L', + ItemList.Battery_RE_LV_Lithium.get(1L) }); + + GTModHandler.addCraftingRecipe( + MetaGeneratedTool01.INSTANCE.getToolWithStats( + SOLDERING_IRON_MV, + 1, + werkstoff.getBridgeMaterial(), + Materials.Rubber, + new long[] { 400000L, 128L, 2L, -1L }), + GTModHandler.RecipeBits.DO_NOT_CHECK_FOR_COLLISIONS | GTModHandler.RecipeBits.BUFFERED, + new Object[] { "LBf", "Sd ", "P ", 'B', bolt.get(werkstoff.getBridgeMaterial()), 'P', + plate.get(Materials.AnyRubber), 'S', stick.get(werkstoff.getBridgeMaterial().mHandleMaterial), 'L', + ItemList.Battery_RE_MV_Lithium.get(1L) }); + GTModHandler.addCraftingRecipe( + MetaGeneratedTool01.INSTANCE.getToolWithStats( + SOLDERING_IRON_HV, + 1, + werkstoff.getBridgeMaterial(), + Materials.StyreneButadieneRubber, + new long[] { 1600000L, 512L, 3L, -1L }), + GTModHandler.RecipeBits.DO_NOT_CHECK_FOR_COLLISIONS | GTModHandler.RecipeBits.BUFFERED, + new Object[] { "LBf", "Sd ", "P ", 'B', bolt.get(werkstoff.getBridgeMaterial()), 'P', + plate.get(Materials.StyreneButadieneRubber), 'S', + stick.get(werkstoff.getBridgeMaterial().mHandleMaterial), 'L', + ItemList.Battery_RE_HV_Lithium.get(1L) }); + + if (!werkstoff.hasItemType(gem)) { + GTModHandler.addCraftingRecipe( + MetaGeneratedTool01.INSTANCE.getToolWithStats( + IDMetaTool01.HARDHAMMER.ID, + 1, + werkstoff.getBridgeMaterial(), + werkstoff.getBridgeMaterial().mHandleMaterial, + null), + GTModHandler.RecipeBits.DO_NOT_CHECK_FOR_COLLISIONS | GTModHandler.RecipeBits.BUFFERED, + new Object[] { "XX ", "XXS", "XX ", 'X', ingot.get(werkstoff.getBridgeMaterial()), 'S', + stick.get(werkstoff.getBridgeMaterial().mHandleMaterial) }); + } + } + + GTModHandler.addCraftingRecipe( + MetaGeneratedTool01.INSTANCE.getToolWithStats( + IDMetaTool01.PLUNGER.ID, + 1, + werkstoff.getBridgeMaterial(), + werkstoff.getBridgeMaterial(), + null), + GTModHandler.RecipeBits.DO_NOT_CHECK_FOR_COLLISIONS | GTModHandler.RecipeBits.BUFFERED, + new Object[] { "xRR", " SR", "S f", 'S', stick.get(werkstoff.getBridgeMaterial()), 'R', + plate.get(Materials.AnyRubber) }); + GTModHandler.addCraftingRecipe( + MetaGeneratedTool01.INSTANCE.getToolWithStats( + IDMetaTool01.WRENCH.ID, + 1, + werkstoff.getBridgeMaterial(), + werkstoff.getBridgeMaterial(), + null), + GTModHandler.RecipeBits.DO_NOT_CHECK_FOR_COLLISIONS | GTModHandler.RecipeBits.BUFFERED, + new Object[] { "IhI", "III", " I ", 'I', ingot.get(werkstoff.getBridgeMaterial()) }); + GTModHandler.addCraftingRecipe( + MetaGeneratedTool01.INSTANCE.getToolWithStats( + IDMetaTool01.CROWBAR.ID, + 1, + werkstoff.getBridgeMaterial(), + werkstoff.getBridgeMaterial(), + null), + GTModHandler.RecipeBits.DO_NOT_CHECK_FOR_COLLISIONS | GTModHandler.RecipeBits.BUFFERED, + new Object[] { "hDS", "DSD", "SDf", 'S', stick.get(werkstoff.getBridgeMaterial()), 'D', Dyes.dyeBlue }); + + GTModHandler.addCraftingRecipe( + MetaGeneratedTool01.INSTANCE.getToolWithStats( + IDMetaTool01.WIRECUTTER.ID, + 1, + werkstoff.getBridgeMaterial(), + werkstoff.getBridgeMaterial(), + null), + GTModHandler.RecipeBits.DO_NOT_CHECK_FOR_COLLISIONS | GTModHandler.RecipeBits.BUFFERED, + new Object[] { "PfP", "hPd", "STS", 'S', stick.get(werkstoff.getBridgeMaterial()), 'P', + plate.get(werkstoff.getBridgeMaterial()), 'T', screw.get(werkstoff.getBridgeMaterial()) }); + GTModHandler.addCraftingRecipe( + MetaGeneratedTool01.INSTANCE.getToolWithStats( + IDMetaTool01.SCOOP.ID, + 1, + werkstoff.getBridgeMaterial(), + werkstoff.getBridgeMaterial(), + null), + GTModHandler.RecipeBits.DO_NOT_CHECK_FOR_COLLISIONS | GTModHandler.RecipeBits.BUFFERED, + new Object[] { "SWS", "SSS", "xSh", 'S', stick.get(werkstoff.getBridgeMaterial()), 'W', + new ItemStack(Blocks.wool, 1, 32767) }); + GTModHandler.addCraftingRecipe( + MetaGeneratedTool01.INSTANCE.getToolWithStats( + IDMetaTool01.BRANCHCUTTER.ID, + 1, + werkstoff.getBridgeMaterial(), + werkstoff.getBridgeMaterial(), + null), + GTModHandler.RecipeBits.DO_NOT_CHECK_FOR_COLLISIONS | GTModHandler.RecipeBits.BUFFERED, + new Object[] { "PfP", "PdP", "STS", 'S', stick.get(werkstoff.getBridgeMaterial()), 'P', + plate.get(werkstoff.getBridgeMaterial()), 'T', screw.get(werkstoff.getBridgeMaterial()) }); + GTModHandler.addCraftingRecipe( + MetaGeneratedTool01.INSTANCE.getToolWithStats( + IDMetaTool01.KNIFE.ID, + 1, + werkstoff.getBridgeMaterial(), + werkstoff.getBridgeMaterial(), + null), + GTModHandler.RecipeBits.DO_NOT_CHECK_FOR_COLLISIONS | GTModHandler.RecipeBits.BUFFERED, + new Object[] { "fPh", " S ", 'S', stick.get(werkstoff.getBridgeMaterial()), 'P', + plate.get(werkstoff.getBridgeMaterial()) }); + GTModHandler.addCraftingRecipe( + MetaGeneratedTool01.INSTANCE.getToolWithStats( + IDMetaTool01.BUTCHERYKNIFE.ID, + 1, + werkstoff.getBridgeMaterial(), + werkstoff.getBridgeMaterial(), + null), + GTModHandler.RecipeBits.DO_NOT_CHECK_FOR_COLLISIONS | GTModHandler.RecipeBits.BUFFERED, + new Object[] { "PPf", "PP ", "Sh ", 'S', stick.get(werkstoff.getBridgeMaterial()), 'P', + plate.get(werkstoff.getBridgeMaterial()) }); + + GTModHandler.addCraftingRecipe( + MetaGeneratedTool01.INSTANCE.getToolWithStats( + IDMetaTool01.WRENCH_LV.ID, + 1, + werkstoff.getBridgeMaterial(), + Materials.Steel, + new long[] { 100000L, 32L, 1L, -1L }), + GTModHandler.RecipeBits.DISMANTLEABLE | GTModHandler.RecipeBits.DO_NOT_CHECK_FOR_COLLISIONS + | GTModHandler.RecipeBits.BUFFERED, + new Object[] { "SXd", "GMG", "PBP", 'X', toolHeadWrench.get(werkstoff.getBridgeMaterial()), 'M', + ItemList.Electric_Motor_LV.get(1L), 'S', screw.get(Materials.Steel), 'P', plate.get(Materials.Steel), + 'G', gearGtSmall.get(Materials.Steel), 'B', ItemList.Battery_RE_LV_Lithium.get(1L) }); + GTModHandler.addCraftingRecipe( + MetaGeneratedTool01.INSTANCE.getToolWithStats( + IDMetaTool01.WRENCH_LV.ID, + 1, + werkstoff.getBridgeMaterial(), + Materials.Steel, + new long[] { 75000L, 32L, 1L, -1L }), + GTModHandler.RecipeBits.DISMANTLEABLE | GTModHandler.RecipeBits.DO_NOT_CHECK_FOR_COLLISIONS + | GTModHandler.RecipeBits.BUFFERED, + new Object[] { "SXd", "GMG", "PBP", 'X', toolHeadWrench.get(werkstoff.getBridgeMaterial()), 'M', + ItemList.Electric_Motor_LV.get(1L), 'S', screw.get(Materials.Steel), 'P', plate.get(Materials.Steel), + 'G', gearGtSmall.get(Materials.Steel), 'B', ItemList.Battery_RE_LV_Cadmium.get(1L) }); + GTModHandler.addCraftingRecipe( + MetaGeneratedTool01.INSTANCE.getToolWithStats( + IDMetaTool01.WRENCH_LV.ID, + 1, + werkstoff.getBridgeMaterial(), + Materials.Steel, + new long[] { 50000L, 32L, 1L, -1L }), + GTModHandler.RecipeBits.DISMANTLEABLE | GTModHandler.RecipeBits.DO_NOT_CHECK_FOR_COLLISIONS + | GTModHandler.RecipeBits.BUFFERED, + new Object[] { "SXd", "GMG", "PBP", 'X', toolHeadWrench.get(werkstoff.getBridgeMaterial()), 'M', + ItemList.Electric_Motor_LV.get(1L), 'S', screw.get(Materials.Steel), 'P', plate.get(Materials.Steel), + 'G', gearGtSmall.get(Materials.Steel), 'B', ItemList.Battery_RE_LV_Sodium.get(1L) }); + GTModHandler.addCraftingRecipe( + MetaGeneratedTool01.INSTANCE.getToolWithStats( + IDMetaTool01.WRENCH_MV.ID, + 1, + werkstoff.getBridgeMaterial(), + Materials.Aluminium, + new long[] { 400000L, 128L, 2L, -1L }), + GTModHandler.RecipeBits.DISMANTLEABLE | GTModHandler.RecipeBits.DO_NOT_CHECK_FOR_COLLISIONS + | GTModHandler.RecipeBits.BUFFERED, + new Object[] { "SXd", "GMG", "PBP", 'X', toolHeadWrench.get(werkstoff.getBridgeMaterial()), 'M', + ItemList.Electric_Motor_MV.get(1L), 'S', screw.get(Materials.Aluminium), 'P', + plate.get(Materials.Aluminium), 'G', gearGtSmall.get(Materials.Aluminium), 'B', + ItemList.Battery_RE_MV_Lithium.get(1L) }); + GTModHandler.addCraftingRecipe( + MetaGeneratedTool01.INSTANCE.getToolWithStats( + IDMetaTool01.WRENCH_MV.ID, + 1, + werkstoff.getBridgeMaterial(), + Materials.Aluminium, + new long[] { 300000L, 128L, 2L, -1L }), + GTModHandler.RecipeBits.DISMANTLEABLE | GTModHandler.RecipeBits.DO_NOT_CHECK_FOR_COLLISIONS + | GTModHandler.RecipeBits.BUFFERED, + new Object[] { "SXd", "GMG", "PBP", 'X', toolHeadWrench.get(werkstoff.getBridgeMaterial()), 'M', + ItemList.Electric_Motor_MV.get(1L), 'S', screw.get(Materials.Aluminium), 'P', + plate.get(Materials.Aluminium), 'G', gearGtSmall.get(Materials.Aluminium), 'B', + ItemList.Battery_RE_MV_Cadmium.get(1L) }); + GTModHandler.addCraftingRecipe( + MetaGeneratedTool01.INSTANCE.getToolWithStats( + IDMetaTool01.WRENCH_MV.ID, + 1, + werkstoff.getBridgeMaterial(), + Materials.Aluminium, + new long[] { 200000L, 128L, 2L, -1L }), + GTModHandler.RecipeBits.DISMANTLEABLE | GTModHandler.RecipeBits.DO_NOT_CHECK_FOR_COLLISIONS + | GTModHandler.RecipeBits.BUFFERED, + new Object[] { "SXd", "GMG", "PBP", 'X', toolHeadWrench.get(werkstoff.getBridgeMaterial()), 'M', + ItemList.Electric_Motor_MV.get(1L), 'S', screw.get(Materials.Aluminium), 'P', + plate.get(Materials.Aluminium), 'G', gearGtSmall.get(Materials.Aluminium), 'B', + ItemList.Battery_RE_MV_Sodium.get(1L) }); + GTModHandler.addCraftingRecipe( + MetaGeneratedTool01.INSTANCE.getToolWithStats( + IDMetaTool01.WRENCH_HV.ID, + 1, + werkstoff.getBridgeMaterial(), + Materials.StainlessSteel, + new long[] { 1600000L, 512L, 3L, -1L }), + GTModHandler.RecipeBits.DISMANTLEABLE | GTModHandler.RecipeBits.DO_NOT_CHECK_FOR_COLLISIONS + | GTModHandler.RecipeBits.BUFFERED, + new Object[] { "SXd", "GMG", "PBP", 'X', toolHeadWrench.get(werkstoff.getBridgeMaterial()), 'M', + ItemList.Electric_Motor_HV.get(1L), 'S', screw.get(Materials.StainlessSteel), 'P', + plate.get(Materials.StainlessSteel), 'G', gearGtSmall.get(Materials.StainlessSteel), 'B', + ItemList.Battery_RE_HV_Lithium.get(1L) }); + GTModHandler.addCraftingRecipe( + MetaGeneratedTool01.INSTANCE.getToolWithStats( + IDMetaTool01.WRENCH_HV.ID, + 1, + werkstoff.getBridgeMaterial(), + Materials.StainlessSteel, + new long[] { 1200000L, 512L, 3L, -1L }), + GTModHandler.RecipeBits.DISMANTLEABLE | GTModHandler.RecipeBits.DO_NOT_CHECK_FOR_COLLISIONS + | GTModHandler.RecipeBits.BUFFERED, + new Object[] { "SXd", "GMG", "PBP", 'X', toolHeadWrench.get(werkstoff.getBridgeMaterial()), 'M', + ItemList.Electric_Motor_HV.get(1L), 'S', screw.get(Materials.StainlessSteel), 'P', + plate.get(Materials.StainlessSteel), 'G', gearGtSmall.get(Materials.StainlessSteel), 'B', + ItemList.Battery_RE_HV_Cadmium.get(1L) }); + GTModHandler.addCraftingRecipe( + MetaGeneratedTool01.INSTANCE.getToolWithStats( + IDMetaTool01.WRENCH_HV.ID, + 1, + werkstoff.getBridgeMaterial(), + Materials.StainlessSteel, + new long[] { 800000L, 512L, 3L, -1L }), + GTModHandler.RecipeBits.DISMANTLEABLE | GTModHandler.RecipeBits.DO_NOT_CHECK_FOR_COLLISIONS + | GTModHandler.RecipeBits.BUFFERED, + new Object[] { "SXd", "GMG", "PBP", 'X', toolHeadWrench.get(werkstoff.getBridgeMaterial()), 'M', + ItemList.Electric_Motor_HV.get(1L), 'S', screw.get(Materials.StainlessSteel), 'P', + plate.get(Materials.StainlessSteel), 'G', gearGtSmall.get(Materials.StainlessSteel), 'B', + ItemList.Battery_RE_HV_Sodium.get(1L) }); + + GTModHandler.addCraftingRecipe( + MetaGeneratedTool01.INSTANCE.getToolWithStats( + IDMetaTool01.SCREWDRIVER_LV.ID, + 1, + werkstoff.getBridgeMaterial(), + Materials.Steel, + new long[] { 100000L, 32L, 1L, -1L }), + GTModHandler.RecipeBits.DISMANTLEABLE | GTModHandler.RecipeBits.DO_NOT_CHECK_FOR_COLLISIONS + | GTModHandler.RecipeBits.BUFFERED, + new Object[] { "PdX", "MGS", "GBP", 'X', stickLong.get(werkstoff.getBridgeMaterial()), 'M', + ItemList.Electric_Motor_LV.get(1L), 'S', screw.get(Materials.Steel), 'P', plate.get(Materials.Steel), + 'G', gearGtSmall.get(Materials.Steel), 'B', ItemList.Battery_RE_LV_Lithium.get(1L) }); + GTModHandler.addCraftingRecipe( + MetaGeneratedTool01.INSTANCE.getToolWithStats( + IDMetaTool01.SCREWDRIVER_LV.ID, + 1, + werkstoff.getBridgeMaterial(), + Materials.Steel, + new long[] { 75000L, 32L, 1L, -1L }), + GTModHandler.RecipeBits.DISMANTLEABLE | GTModHandler.RecipeBits.DO_NOT_CHECK_FOR_COLLISIONS + | GTModHandler.RecipeBits.BUFFERED, + new Object[] { "PdX", "MGS", "GBP", 'X', stickLong.get(werkstoff.getBridgeMaterial()), 'M', + ItemList.Electric_Motor_LV.get(1L), 'S', screw.get(Materials.Steel), 'P', plate.get(Materials.Steel), + 'G', gearGtSmall.get(Materials.Steel), 'B', ItemList.Battery_RE_LV_Cadmium.get(1L) }); + GTModHandler.addCraftingRecipe( + MetaGeneratedTool01.INSTANCE.getToolWithStats( + IDMetaTool01.SCREWDRIVER_LV.ID, + 1, + werkstoff.getBridgeMaterial(), + Materials.Steel, + new long[] { 50000L, 32L, 1L, -1L }), + GTModHandler.RecipeBits.DISMANTLEABLE | GTModHandler.RecipeBits.DO_NOT_CHECK_FOR_COLLISIONS + | GTModHandler.RecipeBits.BUFFERED, + new Object[] { "PdX", "MGS", "GBP", 'X', stickLong.get(werkstoff.getBridgeMaterial()), 'M', + ItemList.Electric_Motor_LV.get(1L), 'S', screw.get(Materials.Steel), 'P', plate.get(Materials.Steel), + 'G', gearGtSmall.get(Materials.Steel), 'B', ItemList.Battery_RE_LV_Sodium.get(1L) }); + + GTModHandler.addCraftingRecipe( + GTOreDictUnificator.get(toolHeadHammer, werkstoff.getBridgeMaterial(), 1L), + GTProxy.tBits, + new Object[] { "II ", "IIh", "II ", 'P', plate.get(werkstoff.getBridgeMaterial()), 'I', + ingot.get(werkstoff.getBridgeMaterial()) }); + if (werkstoff.hasItemType(plateDouble) && werkstoff.hasItemType(cellMolten)) { + GTModHandler.addCraftingRecipe( + GTOreDictUnificator.get(turbineBlade, werkstoff.getBridgeMaterial(), 1L), + GTProxy.tBits, + new Object[] { "fPd", "SPS", " P ", 'P', plateDouble.get(werkstoff.getBridgeMaterial()), 'S', + screw.get(werkstoff.getBridgeMaterial()) }); + + GTValues.RA.stdBuilder() + .itemInputs(werkstoff.get(ingot, 6), ItemList.Shape_Extruder_Turbine_Blade.get(0)) + .itemOutputs(werkstoff.get(turbineBlade, 1)) + .duration( + (int) werkstoff.getStats() + .getMass() / 2 * 20) + .eut(TierEU.RECIPE_MV) + .addTo(extruderRecipes); + + GTValues.RA.stdBuilder() + .itemInputs(ItemList.Shape_Mold_Turbine_Blade.get(0)) + .itemOutputs(werkstoff.get(turbineBlade, 1)) + .fluidInputs(werkstoff.getMolten(864)) + .duration( + (int) werkstoff.getStats() + .getMass() * 20) + .eut(TierEU.RECIPE_MV) + .addTo(fluidSolidifierRecipes); + + GTValues.RA.stdBuilder() + .itemInputs(werkstoff.get(plateDouble, 3), werkstoff.get(screw, 2)) + .itemOutputs(werkstoff.get(turbineBlade, 1)) + .duration( + (werkstoff.getStats() + .getMass() / 4) * SECONDS) + .eut(TierEU.RECIPE_LV) + .addTo(formingPressRecipes); + + GTValues.RA.stdBuilder() + .itemInputs(werkstoff.get(turbineBlade, 4), GTOreDictUnificator.get(stickLong, Materials.Magnalium, 1)) + .itemOutputs( + MetaGeneratedTool01.INSTANCE.getToolWithStats( + IDMetaTool01.TURBINE_SMALL.ID, + 1, + werkstoff.getBridgeMaterial(), + Materials.Magnalium, + null)) + .duration(8 * SECONDS) + .eut(100) + .addTo(assemblerRecipes); + + GTValues.RA.stdBuilder() + .itemInputs(werkstoff.get(turbineBlade, 8), GTOreDictUnificator.get(stickLong, Materials.Titanium, 1)) + .itemOutputs( + MetaGeneratedTool01.INSTANCE.getToolWithStats( + IDMetaTool01.TURBINE.ID, + 1, + werkstoff.getBridgeMaterial(), + Materials.Titanium, + null)) + .duration(16 * SECONDS) + .eut(400) + .addTo(assemblerRecipes); + + GTValues.RA.stdBuilder() + .itemInputs( + werkstoff.get(turbineBlade, 12), + GTOreDictUnificator.get(stickLong, Materials.TungstenSteel, 1)) + .itemOutputs( + MetaGeneratedTool01.INSTANCE.getToolWithStats( + IDMetaTool01.TURBINE_LARGE.ID, + 1, + werkstoff.getBridgeMaterial(), + Materials.TungstenSteel, + null)) + .duration(32 * SECONDS) + .eut(1600) + .addTo(assemblerRecipes); + + GTValues.RA.stdBuilder() + .itemInputs(werkstoff.get(turbineBlade, 16), GTOreDictUnificator.get(stickLong, Materials.Americium, 1)) + .itemOutputs( + MetaGeneratedTool01.INSTANCE.getToolWithStats( + IDMetaTool01.TURBINE_HUGE.ID, + 1, + werkstoff.getBridgeMaterial(), + Materials.Americium, + null)) + .duration(1 * MINUTES + 4 * SECONDS) + .eut(6400) + .addTo(assemblerRecipes); + } + + if (!werkstoff.hasItemType(gem)) { + GTModHandler.addCraftingRecipe( + GTOreDictUnificator.get(toolHeadSaw, werkstoff.getBridgeMaterial(), 1L), + GTProxy.tBits, + new Object[] { "PP ", "fh ", 'P', plate.get(werkstoff.getBridgeMaterial()), 'I', + ingot.get(werkstoff.getBridgeMaterial()) }); + } + + GTModHandler.addCraftingRecipe( + MetaGeneratedTool01.INSTANCE.getToolWithStats( + SCREWDRIVER_MV, + 1, + werkstoff.getBridgeMaterial(), + Materials.Aluminium, + new long[] { 400000L, 128L, 2L, -1L }), + GTModHandler.RecipeBits.DISMANTLEABLE | GTModHandler.RecipeBits.DO_NOT_CHECK_FOR_COLLISIONS + | GTModHandler.RecipeBits.BUFFERED, + new Object[] { "PdX", "MGS", "GBP", 'X', stickLong.get(werkstoff.getBridgeMaterial()), 'M', + ItemList.Electric_Motor_MV.get(1L), 'S', screw.get(Materials.Aluminium), 'P', + plate.get(Materials.Aluminium), 'G', gearGtSmall.get(Materials.Titanium), 'B', + ItemList.Battery_RE_MV_Lithium.get(1L) }); + GTModHandler.addCraftingRecipe( + MetaGeneratedTool01.INSTANCE.getToolWithStats( + SCREWDRIVER_MV, + 1, + werkstoff.getBridgeMaterial(), + Materials.Aluminium, + new long[] { 300000L, 128L, 2L, -1L }), + GTModHandler.RecipeBits.DISMANTLEABLE | GTModHandler.RecipeBits.DO_NOT_CHECK_FOR_COLLISIONS + | GTModHandler.RecipeBits.BUFFERED, + new Object[] { "PdX", "MGS", "GBP", 'X', stickLong.get(werkstoff.getBridgeMaterial()), 'M', + ItemList.Electric_Motor_MV.get(1L), 'S', screw.get(Materials.Aluminium), 'P', + plate.get(Materials.Aluminium), 'G', gearGtSmall.get(Materials.Titanium), 'B', + ItemList.Battery_RE_MV_Cadmium.get(1L) }); + GTModHandler.addCraftingRecipe( + MetaGeneratedTool01.INSTANCE.getToolWithStats( + SCREWDRIVER_MV, + 1, + werkstoff.getBridgeMaterial(), + Materials.Aluminium, + new long[] { 200000L, 128L, 2L, -1L }), + GTModHandler.RecipeBits.DISMANTLEABLE | GTModHandler.RecipeBits.DO_NOT_CHECK_FOR_COLLISIONS + | GTModHandler.RecipeBits.BUFFERED, + new Object[] { "PdX", "MGS", "GBP", 'X', stickLong.get(werkstoff.getBridgeMaterial()), 'M', + ItemList.Electric_Motor_MV.get(1L), 'S', screw.get(Materials.Aluminium), 'P', + plate.get(Materials.Aluminium), 'G', gearGtSmall.get(Materials.Titanium), 'B', + ItemList.Battery_RE_MV_Sodium.get(1L) }); + GTModHandler.addCraftingRecipe( + MetaGeneratedTool01.INSTANCE.getToolWithStats( + SCREWDRIVER_HV, + 1, + werkstoff.getBridgeMaterial(), + Materials.StainlessSteel, + new long[] { 1600000L, 512L, 3L, -1L }), + GTModHandler.RecipeBits.DISMANTLEABLE | GTModHandler.RecipeBits.DO_NOT_CHECK_FOR_COLLISIONS + | GTModHandler.RecipeBits.BUFFERED, + new Object[] { "PdX", "MGS", "GBP", 'X', stickLong.get(werkstoff.getBridgeMaterial()), 'M', + ItemList.Electric_Motor_HV.get(1L), 'S', screw.get(Materials.StainlessSteel), 'P', + plate.get(Materials.StainlessSteel), 'G', gearGtSmall.get(Materials.StainlessSteel), 'B', + ItemList.Battery_RE_HV_Lithium.get(1L) }); + GTModHandler.addCraftingRecipe( + MetaGeneratedTool01.INSTANCE.getToolWithStats( + SCREWDRIVER_HV, + 1, + werkstoff.getBridgeMaterial(), + Materials.StainlessSteel, + new long[] { 1200000L, 512L, 3L, -1L }), + GTModHandler.RecipeBits.DISMANTLEABLE | GTModHandler.RecipeBits.DO_NOT_CHECK_FOR_COLLISIONS + | GTModHandler.RecipeBits.BUFFERED, + new Object[] { "PdX", "MGS", "GBP", 'X', stickLong.get(werkstoff.getBridgeMaterial()), 'M', + ItemList.Electric_Motor_HV.get(1L), 'S', screw.get(Materials.StainlessSteel), 'P', + plate.get(Materials.StainlessSteel), 'G', gearGtSmall.get(Materials.StainlessSteel), 'B', + ItemList.Battery_RE_HV_Cadmium.get(1L) }); + GTModHandler.addCraftingRecipe( + MetaGeneratedTool01.INSTANCE.getToolWithStats( + SCREWDRIVER_HV, + 1, + werkstoff.getBridgeMaterial(), + Materials.StainlessSteel, + new long[] { 800000L, 512L, 3L, -1L }), + GTModHandler.RecipeBits.DISMANTLEABLE | GTModHandler.RecipeBits.DO_NOT_CHECK_FOR_COLLISIONS + | GTModHandler.RecipeBits.BUFFERED, + new Object[] { "PdX", "MGS", "GBP", 'X', stickLong.get(werkstoff.getBridgeMaterial()), 'M', + ItemList.Electric_Motor_HV.get(1L), 'S', screw.get(Materials.StainlessSteel), 'P', + plate.get(Materials.StainlessSteel), 'G', gearGtSmall.get(Materials.StainlessSteel), 'B', + ItemList.Battery_RE_HV_Sodium.get(1L) }); + } +} diff --git a/src/main/java/bartworks/system/material/werkstoff_loaders/registration/AssociationLoader.java b/src/main/java/bartworks/system/material/werkstoff_loaders/registration/AssociationLoader.java new file mode 100644 index 0000000000..3cf224e777 --- /dev/null +++ b/src/main/java/bartworks/system/material/werkstoff_loaders/registration/AssociationLoader.java @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2018-2020 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 bartworks.system.material.werkstoff_loaders.registration; + +import net.minecraft.item.ItemStack; + +import bartworks.system.material.Werkstoff; +import bartworks.system.material.WerkstoffLoader; +import bartworks.system.material.werkstoff_loaders.IWerkstoffRunnable; +import gregtech.api.enums.Materials; +import gregtech.api.enums.OrePrefixes; +import gregtech.api.util.GTOreDictUnificator; + +public class AssociationLoader implements IWerkstoffRunnable { + + @Override + public void run(Werkstoff werkstoff) { + for (OrePrefixes prefixes : OrePrefixes.values()) { + if (!werkstoff.hasItemType(prefixes)) continue; + + Materials werkstoffBridgeMaterial = werkstoff.getBridgeMaterial(); + ItemStack stack = WerkstoffLoader.getCorrespondingItemStackUnsafe(prefixes, werkstoff, 1); + + if (stack != null && stack.getItem() != null) { + GTOreDictUnificator.addAssociation(prefixes, werkstoffBridgeMaterial, stack, false); + GTOreDictUnificator.set(prefixes, werkstoffBridgeMaterial, stack, true, true); + } + } + } +} diff --git a/src/main/java/bartworks/system/material/werkstoff_loaders/registration/BridgeMaterialsLoader.java b/src/main/java/bartworks/system/material/werkstoff_loaders/registration/BridgeMaterialsLoader.java new file mode 100644 index 0000000000..2bf712ed7a --- /dev/null +++ b/src/main/java/bartworks/system/material/werkstoff_loaders/registration/BridgeMaterialsLoader.java @@ -0,0 +1,171 @@ +/* + * Copyright (c) 2018-2020 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 bartworks.system.material.werkstoff_loaders.registration; + +import static gregtech.api.enums.Mods.Thaumcraft; +import static gregtech.api.enums.OrePrefixes.cell; +import static gregtech.api.enums.OrePrefixes.cellMolten; +import static gregtech.api.enums.OrePrefixes.dust; +import static gregtech.api.enums.OrePrefixes.values; + +import java.util.ArrayList; + +import bartworks.system.material.Werkstoff; +import bartworks.system.material.werkstoff_loaders.IWerkstoffRunnable; +import gregtech.api.enchants.EnchantmentRadioactivity; +import gregtech.api.enums.Element; +import gregtech.api.enums.Materials; +import gregtech.api.enums.OrePrefixes; +import gregtech.api.enums.SubTag; +import gregtech.api.util.GTLanguageManager; +import gregtech.api.util.GTOreDictUnificator; + +public class BridgeMaterialsLoader implements IWerkstoffRunnable { + + @Override + public void run(Werkstoff werkstoff) { + // int aMetaItemSubID, TextureSet aIconSet, float aToolSpeed, int aDurability, int aToolQuality, int aTypes, int + // aR, int aG, int aB, int aA, String aName, String aDefaultLocalName, int aFuelType, int aFuelPower, int + // aMeltingPoint, int aBlastFurnaceTemp, boolean aBlastFurnaceRequired, boolean aTransparent, int aOreValue, int + // aDensityMultiplier, int aDensityDivider, Dyes aColor, String aConfigSection, boolean aCustomOre, String + // aCustomID + Materials werkstoffBridgeMaterial = werkstoff.getBridgeMaterial() != null ? werkstoff.getBridgeMaterial() + : Materials.get(werkstoff.getVarName()) != Materials._NULL ? Materials.get(werkstoff.getVarName()) + : new Materials( + -1, + werkstoff.getTexSet(), + werkstoff.getToolSpeed(), + werkstoff.getDurability(), + werkstoff.getToolQuality(), + 0, + werkstoff.getRGBA()[0], + werkstoff.getRGBA()[1], + werkstoff.getRGBA()[2], + werkstoff.getRGBA()[3], + werkstoff.getVarName(), + werkstoff.getDefaultName(), + 0, + 0, + werkstoff.getStats() + .getMeltingPoint(), + werkstoff.getStats() + .getMeltingPoint(), + werkstoff.getStats() + .isBlastFurnace(), + false, + 0, + 1, + 1, + null); + for (OrePrefixes prefixes : values()) { + if (prefixes != cell || !Werkstoff.Types.ELEMENT.equals(werkstoff.getType())) { + if (prefixes == dust && Werkstoff.Types.ELEMENT.equals(werkstoff.getType()) + && Werkstoff.Types.ELEMENT.equals(werkstoff.getType())) { + boolean ElementSet = false; + for (Element e : Element.values()) { + if (e.toString() + .equals(werkstoff.getToolTip())) { + if (!e.mLinkedMaterials.isEmpty()) break; + werkstoffBridgeMaterial = werkstoff.getBridgeMaterial() != null + ? werkstoff.getBridgeMaterial() + : Materials.get(werkstoff.getVarName()) != Materials._NULL + ? Materials.get(werkstoff.getVarName()) + : new Materials( + -1, + werkstoff.getTexSet(), + werkstoff.getToolSpeed(), + werkstoff.getDurability(), + werkstoff.getToolQuality(), + 0, + werkstoff.getRGBA()[0], + werkstoff.getRGBA()[1], + werkstoff.getRGBA()[2], + werkstoff.getRGBA()[3], + werkstoff.getVarName(), + werkstoff.getDefaultName(), + 0, + 0, + werkstoff.getStats() + .getMeltingPoint(), + werkstoff.getStats() + .getMeltingPoint(), + werkstoff.getStats() + .isBlastFurnace(), + false, + 0, + 1, + 1, + null); + werkstoffBridgeMaterial.mElement = e; + e.mLinkedMaterials = new ArrayList<>(); + e.mLinkedMaterials.add(werkstoffBridgeMaterial); + if (werkstoff.hasItemType(dust)) { + GTOreDictUnificator + .addAssociation(dust, werkstoffBridgeMaterial, werkstoff.get(dust), false); + GTOreDictUnificator.set(dust, werkstoffBridgeMaterial, werkstoff.get(dust), true, true); + } + ElementSet = true; + break; + } + } + if (!ElementSet) { + continue; + } + } + + if (werkstoff.hasItemType(cell)) { + werkstoffBridgeMaterial.setHasCorrespondingFluid(true); + werkstoffBridgeMaterial.setHasCorrespondingGas(true); + werkstoffBridgeMaterial.mFluid = werkstoff.getFluidOrGas(1) + .getFluid(); + werkstoffBridgeMaterial.mGas = werkstoff.getFluidOrGas(1) + .getFluid(); + } + + if (werkstoff.hasItemType(cellMolten)) { + werkstoffBridgeMaterial.mStandardMoltenFluid = werkstoff.getMolten(1) + .getFluid(); + } + werkstoffBridgeMaterial.mName = werkstoff.getVarName(); + werkstoffBridgeMaterial.mDefaultLocalName = werkstoff.getDefaultName(); + werkstoffBridgeMaterial.mChemicalFormula = werkstoff.getToolTip(); + if ("null".equals(werkstoffBridgeMaterial.mLocalizedName)) + // only reload from lang file if not localized already + werkstoffBridgeMaterial.mLocalizedName = GTLanguageManager.addStringLocalization( + "Material." + werkstoffBridgeMaterial.mName.toLowerCase(), + werkstoffBridgeMaterial.mDefaultLocalName); + if (Thaumcraft.isModLoaded()) { + werkstoffBridgeMaterial.mAspects = werkstoff.getGTWrappedTCAspects(); + } + werkstoffBridgeMaterial.mMaterialInto = werkstoffBridgeMaterial; + werkstoffBridgeMaterial.mHandleMaterial = werkstoff.contains(SubTag.BURNING) ? Materials.Blaze + : werkstoff.contains(SubTag.MAGICAL) ? Materials.Thaumium + : werkstoffBridgeMaterial.mDurability > 5120 ? Materials.TungstenSteel + : werkstoffBridgeMaterial.mDurability > 1280 ? Materials.Steel : Materials.Wood; + if (werkstoff.getStats() + .isRadioactive()) { + werkstoffBridgeMaterial.setEnchantmentForArmors( + EnchantmentRadioactivity.INSTANCE, + werkstoff.getStats() + .getEnchantmentlvl()); + werkstoffBridgeMaterial.setEnchantmentForTools( + EnchantmentRadioactivity.INSTANCE, + werkstoff.getStats() + .getEnchantmentlvl()); + } + werkstoff.setBridgeMaterial(werkstoffBridgeMaterial); + } + } + } +} diff --git a/src/main/java/bartworks/system/material/werkstoff_loaders/registration/CasingRegistrator.java b/src/main/java/bartworks/system/material/werkstoff_loaders/registration/CasingRegistrator.java new file mode 100644 index 0000000000..87d89f29af --- /dev/null +++ b/src/main/java/bartworks/system/material/werkstoff_loaders/registration/CasingRegistrator.java @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2018-2020 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 bartworks.system.material.werkstoff_loaders.registration; + +import net.minecraft.item.ItemStack; + +import bartworks.system.material.Werkstoff; +import bartworks.system.material.WerkstoffLoader; +import bartworks.system.material.werkstoff_loaders.IWerkstoffRunnable; +import gregtech.api.enums.OrePrefixes; +import gregtech.api.util.GTOreDictUnificator; + +public class CasingRegistrator implements IWerkstoffRunnable { + + @Override + public void run(Werkstoff werkstoff) { + GTOreDictUnificator.addAssociation( + OrePrefixes.blockCasing, + werkstoff.getBridgeMaterial(), + new ItemStack(WerkstoffLoader.BWBlockCasings, 1, werkstoff.getmID()), + false); + GTOreDictUnificator.addAssociation( + OrePrefixes.blockCasingAdvanced, + werkstoff.getBridgeMaterial(), + new ItemStack(WerkstoffLoader.BWBlockCasingsAdvanced, 1, werkstoff.getmID()), + false); + } +} |