diff options
author | Alkalus <draknyte1@hotmail.com> | 2016-09-19 20:08:42 +1000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-09-19 20:08:42 +1000 |
commit | 9f386c3c2914ba786ece2afddb8eaa6df80a1adc (patch) | |
tree | a46fe4cc2ccd26ff83f3de8eeba7d3abb7aea58c /src/Java/gtPlusPlus/core | |
parent | 6c74b062034508a0ef00a68c5b4c164b3f155fc4 (diff) | |
parent | 2c4e3716a4b72f67be3bde170096394a39c80480 (diff) | |
download | GT5-Unofficial-9f386c3c2914ba786ece2afddb8eaa6df80a1adc.tar.gz GT5-Unofficial-9f386c3c2914ba786ece2afddb8eaa6df80a1adc.tar.bz2 GT5-Unofficial-9f386c3c2914ba786ece2afddb8eaa6df80a1adc.zip |
Merge pull request #13 from draknyte1/NewMatSystem
New Back-end systems for dynamic Material (Alloys) and Tool generation.
Also fixes a few issues with other things, which were noticed during development of the new systems.
Diffstat (limited to 'src/Java/gtPlusPlus/core')
19 files changed, 1577 insertions, 196 deletions
diff --git a/src/Java/gtPlusPlus/core/block/ModBlocks.java b/src/Java/gtPlusPlus/core/block/ModBlocks.java index ceb8880299..de4520fee9 100644 --- a/src/Java/gtPlusPlus/core/block/ModBlocks.java +++ b/src/Java/gtPlusPlus/core/block/ModBlocks.java @@ -1,7 +1,7 @@ package gtPlusPlus.core.block; import gtPlusPlus.core.block.general.LightGlass; -import gtPlusPlus.core.block.general.fluids.FluidRegistryHandler; +import gtPlusPlus.core.fluids.FluidRegistryHandler; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.util.Utils; import gtPlusPlus.xmod.gregtech.common.blocks.GregtechMetaCasingBlocks; @@ -25,10 +25,7 @@ public final class ModBlocks { public static Block MatterFabricatorEffectBlock; public static Fluid fluidJackDaniels = new Fluid("fluidJackDaniels"); - public static Block blockFluidJackDaniels; - public static Block blockGtFrameStaballoy; - public static Block blockGtFrameTantalloy60; - public static Block blockGtFrameTantalloy61; + public static Block blockFluidJackDaniels; diff --git a/src/Java/gtPlusPlus/core/block/base/BasicBlock.java b/src/Java/gtPlusPlus/core/block/base/BasicBlock.java index cd879167ba..c95f37d9c5 100644 --- a/src/Java/gtPlusPlus/core/block/base/BasicBlock.java +++ b/src/Java/gtPlusPlus/core/block/base/BasicBlock.java @@ -8,7 +8,7 @@ import net.minecraft.block.material.Material; public class BasicBlock extends Block { - public BasicBlock(String unlocalizedName, Material material) { + public BasicBlock(final String unlocalizedName, final Material material) { super(material); this.setBlockName(Utils.sanitizeString(unlocalizedName)); this.setBlockTextureName(CORE.MODID + ":" + unlocalizedName); @@ -28,7 +28,7 @@ public class BasicBlock extends Block { private String TEXTURE_NAME; private String HARVEST_TOOL; private SoundType soundOfBlock; - private BlockTypes (String textureName, String harvestTool, SoundType blockSound) + private BlockTypes (final String textureName, final String harvestTool, final SoundType blockSound) { this.TEXTURE_NAME = textureName; this.HARVEST_TOOL = harvestTool; diff --git a/src/Java/gtPlusPlus/core/fluids/BlockFluidBase.java b/src/Java/gtPlusPlus/core/fluids/BlockFluidBase.java new file mode 100644 index 0000000000..ebd84f9654 --- /dev/null +++ b/src/Java/gtPlusPlus/core/fluids/BlockFluidBase.java @@ -0,0 +1,107 @@ +package gtPlusPlus.core.fluids; + +import gtPlusPlus.core.creative.AddToCreativeTab; +import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.material.Material; +import gtPlusPlus.core.util.Utils; +import gtPlusPlus.core.util.math.MathUtils; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.util.IIcon; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; +import net.minecraftforge.fluids.BlockFluidClassic; +import net.minecraftforge.fluids.Fluid; +import cpw.mods.fml.common.registry.LanguageRegistry; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +public class BlockFluidBase extends BlockFluidClassic { + + @SideOnly(Side.CLIENT) + protected IIcon stillIcon; + @SideOnly(Side.CLIENT) + protected IIcon flowingIcon; + + protected int colour; + protected Material fluidMaterial; + final String displayName; + + @SuppressWarnings("deprecation") + public BlockFluidBase(Fluid fluid, Material material) { + super(fluid, net.minecraft.block.material.Material.water); + short[] tempColour = material.getRGBA(); + this.colour = Utils.rgbtoHexValue(tempColour[0], tempColour[1], tempColour[2]); + this.fluidMaterial = material; + setCreativeTab(AddToCreativeTab.tabOther); + this.displayName = material.getLocalizedName(); + LanguageRegistry.addName(this, "Molten "+displayName+" ["+MathUtils.celsiusToKelvin(fluidMaterial.getBoilingPoint_C())+"K]"); + this.setBlockName(GetProperName()); + } + + @SuppressWarnings("deprecation") + public BlockFluidBase(String fluidName, Fluid fluid, short[] colour) { + super(fluid, net.minecraft.block.material.Material.water); + short[] tempColour = colour; + this.colour = Utils.rgbtoHexValue(tempColour[0], tempColour[1], tempColour[2]); + setCreativeTab(AddToCreativeTab.tabOther); + this.displayName = fluidName; + LanguageRegistry.addName(this, "Molten "+displayName); + this.setBlockName(GetProperName()); + } + + @Override + public IIcon getIcon(int side, int meta) { + return (side == 0 || side == 1)? stillIcon : flowingIcon; + } + + @SideOnly(Side.CLIENT) + @Override + public void registerBlockIcons(IIconRegister register) { + stillIcon = register.registerIcon(CORE.MODID+":fluids/fluid.molten.autogenerated"); + flowingIcon = register.registerIcon(CORE.MODID+":fluids/fluid.molten.autogenerated"); + } + + @Override + public boolean canDisplace(IBlockAccess world, int x, int y, int z) { + if (world.getBlock(x, y, z).getMaterial().isLiquid()) return false; + return super.canDisplace(world, x, y, z); + } + + @Override + public boolean displaceIfPossible(World world, int x, int y, int z) { + if (world.getBlock(x, y, z).getMaterial().isLiquid()) return false; + return super.displaceIfPossible(world, x, y, z); + } + + @Override + public int colorMultiplier(IBlockAccess par1IBlockAccess, int par2, int par3, int par4){ + + if (this.colour == 0){ + return MathUtils.generateSingularRandomHexValue(); + } + + return this.colour; + } + + @Override + public int getRenderColor(int aMeta) { + if (this.colour == 0){ + return MathUtils.generateSingularRandomHexValue(); + } + + return this.colour; + } + + public String GetProperName() { + String tempIngot; + + tempIngot = "Molten "+displayName; + + return tempIngot; + } + + public Material getFluidMaterial(){ + return fluidMaterial; + } + +} diff --git a/src/Java/gtPlusPlus/core/block/general/fluids/FluidRegistryHandler.java b/src/Java/gtPlusPlus/core/fluids/FluidRegistryHandler.java index bda2aae35b..477d5da944 100644 --- a/src/Java/gtPlusPlus/core/block/general/fluids/FluidRegistryHandler.java +++ b/src/Java/gtPlusPlus/core/fluids/FluidRegistryHandler.java @@ -1,7 +1,8 @@ -package gtPlusPlus.core.block.general.fluids; +package gtPlusPlus.core.fluids; import static gtPlusPlus.core.block.ModBlocks.blockFluidJackDaniels; import static gtPlusPlus.core.block.ModBlocks.fluidJackDaniels; +import gtPlusPlus.core.block.general.fluids.BlockFluidJackDaniels; import gtPlusPlus.core.lib.CORE; import net.minecraft.block.material.Material; import net.minecraftforge.fluids.FluidRegistry; @@ -29,6 +30,7 @@ public class FluidRegistryHandler { run(); } + @SuppressWarnings("unused") private static void run(){ fluidJackDaniels(); } diff --git a/src/Java/gtPlusPlus/core/fluids/GenericFluid.java b/src/Java/gtPlusPlus/core/fluids/GenericFluid.java new file mode 100644 index 0000000000..1780cb8577 --- /dev/null +++ b/src/Java/gtPlusPlus/core/fluids/GenericFluid.java @@ -0,0 +1,66 @@ +package gtPlusPlus.core.fluids; + +import gtPlusPlus.core.item.base.itemblock.ItemBlockFluid; +import gtPlusPlus.core.material.Material; +import net.minecraft.block.Block; +import net.minecraftforge.fluids.Fluid; +import net.minecraftforge.fluids.FluidRegistry; +import cpw.mods.fml.common.registry.GameRegistry; + +public class GenericFluid extends Fluid{ + + protected final String fluidName; + protected final Fluid fluidFactory; + protected final Block blockFactory; + protected final short[] rgba; + + public GenericFluid(String displayName, String fluidName, int luminosity, int density, int temperature, int viscosity, boolean isGas, short[] rgba) { + super(fluidName); + fluidFactory = this; + this.rgba = rgba; + this.fluidName = fluidName; + fluidFactory.setLuminosity(luminosity); + fluidFactory.setDensity(density); + fluidFactory.setTemperature(temperature); + fluidFactory.setViscosity(viscosity); + fluidFactory.setGaseous(isGas); + fluidFactory.setUnlocalizedName("fluid"+fluidName); + FluidRegistry.registerFluid(fluidFactory); + blockFactory = new BlockFluidBase(displayName, fluidFactory, rgba).setBlockName("fluidblock"+fluidName); + GameRegistry.registerBlock(blockFactory, ItemBlockFluid.class, blockFactory.getUnlocalizedName().substring(5)); + + //fluidFactory.setUnlocalizedName(blockFactory.getUnlocalizedName()); + + } + + public GenericFluid(Material fluidMaterial, int luminosity, int density, int temperature, int viscosity, boolean isGas) { + + super(fluidMaterial.getUnlocalizedName()); + //IC2_ItemFluidCell fullFluidCell = emptyCell.fill(emptyCell, FluidUtils.getFluidStack(getUnlocalizedName(), 1), true); + + fluidFactory = this; + this.rgba = fluidMaterial.getRGBA(); + this.fluidName = fluidMaterial.getUnlocalizedName(); + fluidFactory.setLuminosity(luminosity); + fluidFactory.setDensity(density); + fluidFactory.setTemperature(temperature); + fluidFactory.setViscosity(viscosity); + fluidFactory.setGaseous(isGas); + fluidFactory.setUnlocalizedName("fluid"+fluidName); + FluidRegistry.registerFluid(fluidFactory); + blockFactory = new BlockFluidBase(fluidFactory, fluidMaterial).setBlockName("fluidblock"+fluidName); + GameRegistry.registerBlock(blockFactory, ItemBlockFluid.class, blockFactory.getUnlocalizedName().substring(5)); + //IC2_ItemFluidCell emptyCell = new IC2_ItemFluidCell(fluidName); + /*if (aFullContainer != null && aEmptyContainer != null && !FluidContainerRegistry.registerFluidContainer(new FluidStack(rFluid, aFluidAmount), aFullContainer, aEmptyContainer)) { + GT_Values.RA.addFluidCannerRecipe(aFullContainer, container(aFullContainer, false), null, new FluidStack(rFluid, aFluidAmount)); + }*/ + //fluidFactory.setUnlocalizedName(blockFactory.getUnlocalizedName()); + + } + + @Override + public int getColor() { + return Math.max(0, Math.min(255, this.rgba[0])) << 16 | Math.max(0, Math.min(255, this.rgba[1])) << 8 | Math.max(0, Math.min(255, this.rgba[2])); + } + +} diff --git a/src/Java/gtPlusPlus/core/item/ModItems.java b/src/Java/gtPlusPlus/core/item/ModItems.java index aafe02d470..1737b6ea4a 100644 --- a/src/Java/gtPlusPlus/core/item/ModItems.java +++ b/src/Java/gtPlusPlus/core/item/ModItems.java @@ -2,6 +2,7 @@ package gtPlusPlus.core.item; import static gtPlusPlus.core.creative.AddToCreativeTab.tabMachines; import static gtPlusPlus.core.creative.AddToCreativeTab.tabMisc; import static gtPlusPlus.core.lib.CORE.LOAD_ALL_CONTENT; +import static gtPlusPlus.core.util.item.UtilsItems.generateItemsFromMaterial; import gregtech.api.enums.Materials; import gregtech.api.util.GT_OreDictUnificator; import gtPlusPlus.core.creative.AddToCreativeTab; @@ -25,13 +26,15 @@ import gtPlusPlus.core.item.tool.staballoy.StaballoyPickaxe; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.lib.CORE.configSwitches; import gtPlusPlus.core.lib.LoadedMods; -import gtPlusPlus.core.lib.MaterialInfo; +import gtPlusPlus.core.material.ALLOY; +import gtPlusPlus.core.material.ELEMENT; import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.debug.DEBUG_INIT; import gtPlusPlus.core.util.item.UtilsItems; import net.minecraft.item.Item; import net.minecraft.item.Item.ToolMaterial; import net.minecraft.item.ItemFood; +import net.minecraft.item.ItemStack; import net.minecraftforge.common.util.EnumHelper; import cpw.mods.fml.common.registry.GameRegistry; public final class ModItems { @@ -105,7 +108,9 @@ public final class ModItems { public static Item itemPersonalCloakingDeviceCharged; public static Item itemPersonalHealingDevice; - public static MultiPickaxeBase MP_GTMATERIAL; + public static MultiPickaxeBase MP_GTMATERIAL; + + public static ItemStack FluidCell; public static BaseItemBackpack backpack_Red; public static BaseItemBackpack backpack_Green; @@ -162,53 +167,65 @@ public final class ModItems { //Start meta Item Generation ItemsFoods.load(); - UtilsItems.generateItemsFromMaterial("EnergyCrystal", "Energy Crystal", 8, MaterialInfo.ENERGYCRYSTAL, Utils.rgbtoHexValue(228, 225, 0), true); - UtilsItems.generateItemsFromMaterial("BloodSteel", "Blood Steel", 3, MaterialInfo.BLOODSTEEL, Utils.rgbtoHexValue(142, 28, 0), false); - UtilsItems.generateItemsFromMaterial("Staballoy", "Staballoy", 6, MaterialInfo.STABALLOY, Utils.rgbtoHexValue(68, 75, 66), true); - UtilsItems.generateItemsFromMaterial("Tantalloy60", "Tantalloy-60", 5, MaterialInfo.TANTALLOY60, Utils.rgbtoHexValue(68, 75, 166), true); - UtilsItems.generateItemsFromMaterial("Tantalloy61", "Tantalloy-61", 6, MaterialInfo.TANTALLOY61, Utils.rgbtoHexValue(122, 135, 196), true); - UtilsItems.generateItemsFromMaterial("Bedrockium", "Bedrockium", 9, MaterialInfo.BEDROCKIUM, Utils.rgbtoHexValue(32, 32, 32), false); - UtilsItems.generateItemsFromMaterial("Quantum", "Quantum", 10, MaterialInfo.QUANTUM, Utils.rgbtoHexValue(128, 128, 128), true); + try{ + generateItemsFromMaterial(ALLOY.ENERGYCRYSTAL); + generateItemsFromMaterial(ALLOY.BLOODSTEEL); + generateItemsFromMaterial(ALLOY.STABALLOY); + generateItemsFromMaterial(ALLOY.TANTALLOY_60); + generateItemsFromMaterial(ALLOY.TANTALLOY_61); + generateItemsFromMaterial(ALLOY.BEDROCKIUM); + generateItemsFromMaterial(ALLOY.QUANTUM); - UtilsItems.generateItemsFromMaterial("Inconel625", "Inconel-625", 4, MaterialInfo.INCONEL625, Utils.rgbtoHexValue(128, 200, 128), true); //Inconel 625: Acid resistant, good weldability. The LCF version is typically used in bellows. - UtilsItems.generateItemsFromMaterial("Inconel690", "Inconel-690", 6, MaterialInfo.INCONEL690, Utils.rgbtoHexValue(118, 220, 138), true); //Inconel 690: Low cobalt content for nuclear applications, and low resistivity. - UtilsItems.generateItemsFromMaterial("Inconel792", "Inconel-792", 5, MaterialInfo.INCONEL792, Utils.rgbtoHexValue(108, 240, 118), true); //Inconel 792: Increased aluminium content for improved high temperature corrosion properties, used especially in gas turbines. - + generateItemsFromMaterial(ALLOY.INCONEL_625); + generateItemsFromMaterial(ALLOY.INCONEL_690); + generateItemsFromMaterial(ALLOY.INCONEL_792); if (!CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK){ - UtilsItems.generateItemsFromMaterial("TungstenCarbide", "Tungsten Carbide", 5, MaterialInfo.TUNGSTENCARBIDE, Utils.rgbtoHexValue(44, 44, 44), true); + generateItemsFromMaterial(ALLOY.TUNGSTEN_CARBIDE); } - UtilsItems.generateItemsFromMaterial("SiliconCarbide", "Silicon Carbide", 4, MaterialInfo.SILICONCARBIDE, Utils.rgbtoHexValue(32, 32, 32), false); - UtilsItems.generateItemsFromMaterial("Zeron100", "Zeron-100", 8, MaterialInfo.ZERON100, Utils.rgbtoHexValue(180, 180, 20), true); - UtilsItems.generateItemsFromMaterial("MaragingSteel250", "Maraging Steel 250", 4, MaterialInfo.MARAGING250, Utils.rgbtoHexValue(140, 140, 140), true); - UtilsItems.generateItemsFromMaterial("MaragingSteel300", "Maraging Steel 300", 5, MaterialInfo.MARAGING300, Utils.rgbtoHexValue(150, 150, 150), true); - UtilsItems.generateItemsFromMaterial("MaragingSteel350", "Maraging Steel 350", 6, MaterialInfo.MARAGING350, Utils.rgbtoHexValue(160, 160, 160), true); - UtilsItems.generateItemsFromMaterial("Stellite", "Stellite", 7, MaterialInfo.STELLITE, Utils.rgbtoHexValue(129, 75, 120), true); - UtilsItems.generateItemsFromMaterial("Talonite", "Talonite", 8, MaterialInfo.TALONITE, Utils.rgbtoHexValue(228, 75, 120), false); + generateItemsFromMaterial(ALLOY.SILICON_CARBIDE); + generateItemsFromMaterial(ALLOY.ZERON_100); + generateItemsFromMaterial(ALLOY.MARAGING250); + generateItemsFromMaterial(ALLOY.MARAGING300); + generateItemsFromMaterial(ALLOY.MARAGING350); + generateItemsFromMaterial(ALLOY.STELLITE); + generateItemsFromMaterial(ALLOY.TALONITE); - UtilsItems.generateItemsFromMaterial("Tumbaga", "Tumbaga", 2, MaterialInfo.TUMBAGA, Utils.rgbtoHexValue(255,178,15), false); //Tumbaga was the name given by Spaniards to a non-specific alloy of gold and copper - UtilsItems.generateItemsFromMaterial("Potin", "Potin", 4, MaterialInfo.POTIN, Utils.rgbtoHexValue(201,151,129), false); //Potin is traditionally an alloy of bronze, tin and lead, with varying quantities of each possible + //Tumbaga was the name given by Spaniards to a non-specific alloy of gold and copper + generateItemsFromMaterial(ALLOY.TUMBAGA); + //Potin is traditionally an alloy of bronze, tin and lead, with varying quantities of each possible + generateItemsFromMaterial(ALLOY.POTIN); - UtilsItems.generateItemsFromMaterial("HastelloyW", "Hastelloy-W", 6, MaterialInfo.HASTELLOY_W, Utils.rgbtoHexValue(218, 165, 32), false); - UtilsItems.generateItemsFromMaterial("HastelloyX", "Hastelloy-X", 6, MaterialInfo.HASTELLOY_X, Utils.rgbtoHexValue(255, 193, 37), false); - UtilsItems.generateItemsFromMaterial("HastelloyC276", "Hastelloy-C276", 7, MaterialInfo.HASTELLOY_C276, Utils.rgbtoHexValue(238, 180, 34), true); - UtilsItems.generateItemsFromMaterial("HastelloyN", "Hastelloy-N", 8, MaterialInfo.HASTELLOY_N, Utils.rgbtoHexValue(155, 223, 237), true); + generateItemsFromMaterial(ALLOY.HASTELLOY_W); + generateItemsFromMaterial(ALLOY.HASTELLOY_X); + generateItemsFromMaterial(ALLOY.HASTELLOY_C276); + generateItemsFromMaterial(ALLOY.HASTELLOY_N); + + generateItemsFromMaterial(ALLOY.INCOLOY_020); + generateItemsFromMaterial(ALLOY.INCOLOY_DS); + generateItemsFromMaterial(ALLOY.INCOLOY_MA956); - UtilsItems.generateItemsFromMaterial("Incoloy020", "Incoloy-020", 7, MaterialInfo.INCOLOY020, Utils.rgbtoHexValue(81, 81, 81), false); - UtilsItems.generateItemsFromMaterial("IncoloyDS", "Incoloy-DS", 7, MaterialInfo.INCOLOYDS, Utils.rgbtoHexValue(91, 91, 91), false); - UtilsItems.generateItemsFromMaterial("IncoloyMA956", "Incoloy-MA956", 8, MaterialInfo.INCOLOYMA956, Utils.rgbtoHexValue(101, 101, 101), true); + generateItemsFromMaterial(ELEMENT.ZIRCONIUM); + generateItemsFromMaterial(ALLOY.ZIRCONIUM_CARBIDE); + generateItemsFromMaterial(ALLOY.TANTALUM_CARBIDE); + generateItemsFromMaterial(ALLOY.NIOBIUM_CARBIDE); - UtilsItems.generateItemsFromMaterial("Zirconium", "Zirconium", 6, MaterialInfo.ZIRCONIUM, Utils.rgbtoHexValue(255, 250, 205), false); - UtilsItems.generateItemsFromMaterial("ZirconiumCarbide", "Zirconium Carbide", 7, MaterialInfo.ZIRCONIUMCARBIDE, Utils.rgbtoHexValue(222, 202, 180), true); - UtilsItems.generateItemsFromMaterial("TantalumCarbide", "Tantalum Carbide", 7, MaterialInfo.TANTALUMCARBIDE, Utils.rgbtoHexValue(139, 136, 120), true); - UtilsItems.generateItemsFromMaterial("NiobiumCarbide", "Niobium Carbide", 6, MaterialInfo.NIOMBIUMCARBIDE, Utils.rgbtoHexValue(205, 197, 191), true); + //Uranium-233 is a fissile isotope of uranium that is bred from thorium-232 as part of the thorium fuel cycle. + UtilsItems.generateItemsFromMaterial(ELEMENT.URANIUM233); + + } catch (Throwable r){ + Utils.LOG_INFO("Failed to Generated a Material. "+r.getMessage()); + //Utils.LOG_INFO("Failed to Generated a Material. "+r.getCause().getMessage()); + Utils.LOG_INFO("Failed to Generated a Material. "+r.getStackTrace()[0].getMethodName()); + Utils.LOG_INFO("Failed to Generated a Material. "+r.getStackTrace()[1].getMethodName()); + r.printStackTrace(); + System.exit(1); + } - //Uranium-233if - UtilsItems.generateItemsFromMaterial("Uranium233", "Uranium 233", 4, MaterialInfo.URANIUM233, Utils.rgbtoHexValue(73, 220, 83), false); //Uranium-233 is a fissile isotope of uranium that is bred from thorium-232 as part of the thorium fuel cycle. dustLithiumCarbonate = UtilsItems.generateSpecialUseDusts("LithiumCarbonate", "Lithium Carbonate", Utils.rgbtoHexValue(137, 139, 142))[0]; @@ -382,6 +399,10 @@ public final class ModItems { //GameRegistry.registerItem(FuelRod_Thorium, "itemFuelRod_Thorium"); //GameRegistry.registerItem(FuelRod_Uranium, "itemFuelRod_Uranium"); //GameRegistry.registerItem(FuelRod_Plutonium, "itemFuelRod_Plutonium"); + + //FluidCell = new ItemStack(new IC2_ItemFluidCell("itemGT++FluidCell")); + + } else { Utils.LOG_WARNING("IndustrialCraft2 not Found - Skipping Resources."); diff --git a/src/Java/gtPlusPlus/core/item/base/dusts/BaseItemDust.java b/src/Java/gtPlusPlus/core/item/base/dusts/BaseItemDust.java index 6d12624487..0342f7f104 100644 --- a/src/Java/gtPlusPlus/core/item/base/dusts/BaseItemDust.java +++ b/src/Java/gtPlusPlus/core/item/base/dusts/BaseItemDust.java @@ -5,7 +5,7 @@ import gregtech.api.enums.GT_Values; import gregtech.api.util.GT_ModHandler; import gregtech.api.util.GT_OreDictUnificator; import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.lib.MaterialInfo; +import gtPlusPlus.core.material.Material; import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.item.UtilsItems; import gtPlusPlus.core.util.math.MathUtils; @@ -29,9 +29,10 @@ public class BaseItemDust extends Item{ protected boolean useBlastFurnace; String name = ""; private int mTier; - private MaterialInfo dustInfo; + private Material dustInfo; + private String oredictName; - public BaseItemDust(String unlocalizedName, String materialName, MaterialInfo matInfo, int colour, String pileSize, boolean blastFurnaceRequired, int tier, int sRadioactivity) { + public BaseItemDust(String unlocalizedName, String materialName, Material matInfo, int colour, String pileSize, boolean blastFurnaceRequired, int tier, int sRadioactivity) { setUnlocalizedName(unlocalizedName); this.setUnlocalizedName(unlocalizedName); this.setMaxStackSize(64); @@ -70,6 +71,7 @@ public class BaseItemDust extends Item{ Utils.LOG_WARNING("Generating OreDict Name: "+temp); } if (temp != null && temp != ""){ + oredictName = temp; GT_OreDictUnificator.registerOre(temp, UtilsItems.getSimpleStack(this)); } addMixerRecipe(); @@ -133,109 +135,75 @@ public class BaseItemDust extends Item{ private void addMixerRecipe(){ - ItemStack tempStack = UtilsItems.getSimpleStack(this); - ItemStack tempOutput = null; - ItemStack[] inputStacks = dustInfo.getInputs(); - ItemStack[] outputStacks = dustInfo.getOutputs(); - String temp = ""; - Utils.LOG_WARNING("Unlocalized name for OreDict nameGen: "+getUnlocalizedName()); - if (getUnlocalizedName().contains("item.")){ - temp = getUnlocalizedName().replace("item.", ""); - Utils.LOG_WARNING("Generating OreDict Name: "+temp); + + ItemStack thisItem; + ItemStack normalDust = dustInfo.getDust(1); + ItemStack smallDust = dustInfo.getSmallDust(1); + ItemStack tinyDust = dustInfo.getTinyDust(1); + + ItemStack[] inputStacks = dustInfo.getMaterialComposites(); + ItemStack outputStacks = dustInfo.getDust(10); + + if (oredictName.contains("dustTiny")){ + thisItem = tinyDust; + ItemStack normalStack = dustInfo.getDust(1); + ItemStack tinyStack = dustInfo.getTinyDust(9); + Utils.LOG_INFO("Generating a 9 Tiny dust to 1 Dust recipe for "+materialName); + UtilsRecipe.recipeBuilder( + thisItem, thisItem, thisItem, + thisItem, thisItem, thisItem, + thisItem, thisItem, thisItem, + normalStack); + + Utils.LOG_INFO("Generating a 9 Tiny dust from 1 Dust recipe for "+materialName); + UtilsRecipe.recipeBuilder( + normalStack, null, null, + null, null, null, + null, null, null, + tinyStack); + } - else { - temp = getUnlocalizedName(); - } - if (temp.contains("DustTiny")){ - temp = temp.replace("itemDustTiny", "dust"); - Utils.LOG_WARNING("Generating OreDict Name: "+temp); - } - else if (temp.contains("DustSmall")){ - temp = temp.replace("itemDustSmall", "dust"); - Utils.LOG_WARNING("Generating OreDict Name: "+temp); + else if (oredictName.contains("dustSmall")){ + thisItem = smallDust; + ItemStack normalStack = dustInfo.getDust(1); + ItemStack smallStack = dustInfo.getSmallDust(4); + + Utils.LOG_INFO("Generating a 4 Small dust to 1 Dust recipe for "+materialName); + UtilsRecipe.recipeBuilder( + thisItem, thisItem, null, + thisItem, thisItem, null, + null, null, null, + normalStack); + + Utils.LOG_INFO("Generating a 4 Small dust from 1 Dust recipe for "+materialName); + UtilsRecipe.recipeBuilder( + null, normalStack, null, + null, null, null, + null, null, null, + smallStack); + } else { - temp = temp.replace("itemD", "d"); - Utils.LOG_WARNING("Generating OreDict Name: "+temp); - } - if (temp != null && temp != ""){ - - if (getUnlocalizedName().contains("DustTiny") || getUnlocalizedName().contains("DustSmall")){ - tempOutput = UtilsItems.getItemStackOfAmountFromOreDict(temp, 1); - } - else { - if (outputStacks[0] != null){ - Utils.LOG_WARNING("Getting output dusts for mixer recipe. Checking ENUM, got: "+outputStacks[0].toString()); - tempOutput = outputStacks[0]; + thisItem = normalDust; + } + + if (thisItem == normalDust){ + Utils.LOG_WARNING("Generating a Dust recipe for "+materialName+" in the mixer."); + + if (inputStacks.length != 0){ + GT_Values.RA.addMixerRecipe( + inputStacks[0], inputStacks[1], + inputStacks[2], inputStacks[3], + null, null, + outputStacks, + 8*mTier*20, 8*mTier*2); } else { - Utils.LOG_WARNING("Getting output dusts for mixer recipe. Enum check failed, failback item is: "+temp); - tempOutput = UtilsItems.getItemStackOfAmountFromOreDict(temp, 1); + return; } } - } - if (tempOutput != null){ - if (getUnlocalizedName().contains("DustTiny")){ - Utils.LOG_WARNING("Generating a 9 Tiny dust to 1 Dust recipe for "+materialName); - UtilsRecipe.addShapelessGregtechRecipe(tempOutput, - tempStack, tempStack, tempStack, - tempStack, tempStack, tempStack, - tempStack, tempStack, tempStack); - } - else if (getUnlocalizedName().contains("DustSmall")){ - Utils.LOG_WARNING("Generating a 4 Small dust to 1 Dust recipe for "+materialName); - UtilsRecipe.addShapelessGregtechRecipe(tempOutput, - tempStack, tempStack, null, - tempStack, tempStack, null, - null, null, null); - } - else { - Utils.LOG_WARNING("Generating a Dust recipe for "+materialName+" in the mixer."); - - - int i = 0; - if (inputStacks.length >= 2){ - for (ItemStack is : inputStacks){ - if (is != null){ - Utils.LOG_WARNING("Found "+is.getDisplayName()+" as an input for mixer recipe."); - if (is.getDisplayName().toLowerCase().contains("tell alkalus")){ - ItemStack tempStackForAName = inputStacks[i]; - String[] inputList = dustInfo.getInputItemsAsList(); - int[] inputSizes = dustInfo.getInputStackSizesAsList(); - inputStacks[i] = UtilsItems.getItemStackOfAmountFromOreDict(inputList[i], inputSizes[i]); - Utils.LOG_WARNING("Swapping input slot "+i+" which contains "+tempStackForAName.getDisplayName()+" with "+inputStacks[i].getDisplayName()+"."); - } - - } - - else { - Utils.LOG_WARNING("Input "+i+" was null."); - } - - i++; - } - } - - GT_Values.RA.addMixerRecipe( - inputStacks[0], inputStacks[1], - inputStacks[2], inputStacks[3], - null, null, - tempOutput, - 8*mTier*20, 8*mTier*2); - - /*GT_Values.RA.addMixerRecipe( - GT_Utility.copyAmount(inputStacks[0].stackSize, new Object[]{inputStacks[0]}), GT_Utility.copyAmount(inputStacks[1].stackSize, new Object[]{inputStacks[1]}), - GT_Utility.copyAmount(inputStacks[2].stackSize, new Object[]{inputStacks[2]}), GT_Utility.copyAmount(inputStacks[3].stackSize, new Object[]{inputStacks[3]}), - null, null, - tempOutput, - 8*mTier*20, 8*mTier*2);*/ - - } - } - - } private void addMacerationRecipe(){ Utils.LOG_WARNING("Adding recipe for "+materialName+" Dusts"); @@ -260,15 +228,25 @@ public class BaseItemDust extends Item{ tempIngot = tempIngot.replace("itemDust", "ingot"); Utils.LOG_WARNING("Generating OreDict Name: "+tempIngot); - ItemStack[] outputStacks = dustInfo.getOutputs(); + ItemStack[] outputStacks = {dustInfo.getDust(1)}; if (tempIngot != null && tempIngot != ""){ tempInputStack = UtilsItems.getItemStackOfAmountFromOreDict(tempIngot, 1); tempOutputStack = UtilsItems.getItemStackOfAmountFromOreDict(tempDust, 1); - ItemStack tempStackOutput2; + ItemStack tempStackOutput2 = null; int chance = mTier*10/MathUtils.randInt(10, 20); - if (outputStacks[1] != null && !outputStacks[1].getUnlocalizedName().toLowerCase().contains("aaa_broken")){ - tempStackOutput2 = outputStacks[1]; - tempOutputStack = outputStacks[0]; + if (outputStacks.length != 0){ + if (outputStacks.length == 1){ + tempStackOutput2 = null; + } + else { + if (!outputStacks[1].getUnlocalizedName().toLowerCase().contains("aaa_broken")){ + tempStackOutput2 = outputStacks[1]; + tempOutputStack = outputStacks[0]; + } + else { + tempStackOutput2 = null; + } + } } else { tempStackOutput2 = null; diff --git a/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockFluid.java b/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockFluid.java new file mode 100644 index 0000000000..77af69f809 --- /dev/null +++ b/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockFluid.java @@ -0,0 +1,78 @@ +package gtPlusPlus.core.item.base.itemblock; + +import gtPlusPlus.core.fluids.BlockFluidBase; +import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.material.Material; +import gtPlusPlus.core.util.item.UtilsItems; +import gtPlusPlus.core.util.math.MathUtils; + +import java.util.List; + +import net.minecraft.block.Block; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemBlock; +import net.minecraft.item.ItemStack; + +public class ItemBlockFluid extends ItemBlock{ + + protected final int blockColour; + protected final int sRadiation; + protected Material thisFluid; + final BlockFluidBase baseBlock; + String name; + + public ItemBlockFluid(Block block) { + super(block); + this.baseBlock = (BlockFluidBase) block; + this.blockColour = baseBlock.getRenderColor(1); + this.thisFluid = baseBlock.getFluidMaterial(); + this.sRadiation=UtilsItems.getRadioactivityLevel(baseBlock.getUnlocalizedName()); + this.name = baseBlock.getLocalizedName().replace("tile", "").replace("fluid", "").replace("name", "").replace("block", "").replace(".", ""); + //GT_OreDictUnificator.registerOre("frameGt"+block.getUnlocalizedName().replace("tile.", "").replace("tile.BlockGtFrame", "").replace("-", "").replace("_", "").replace(" ", "").replace("FrameBox", ""), UtilsItems.getSimpleStack(this)); + } + + public final Material setFluidMaterial(Material M){ + return thisFluid=M; + } + + public int getRenderColor(int aMeta) { + return blockColour; + } + + @Override + public String getItemStackDisplayName(ItemStack iStack) { + if (thisFluid != null){ + this.name = "Molten "+thisFluid.getLocalizedName(); + return name; + } + this.name = "Molten "+baseBlock.getLocalizedName().replace("tile", "").replace("fluid", "").replace("name", "").replace("block", "").replace(".", ""); + return name; + } + + @Override + public int getColorFromItemStack(ItemStack stack, int HEX_OxFFFFFF) { + if (blockColour == 0){ + return MathUtils.generateSingularRandomHexValue(); + } + return blockColour; + + } + + @Override + public void addInformation(ItemStack stack, EntityPlayer aPlayer, List list, boolean bool) { + list.add("Temperature: "+MathUtils.celsiusToKelvin(thisFluid.getMeltingPoint_C())+"K"); + if (sRadiation > 0){ + list.add(CORE.GT_Tooltip_Radioactive); + } + super.addInformation(stack, aPlayer, list, bool); + } + + public String GetProperName() { + String tempIngot; + + tempIngot = "Molten "+baseBlock.getLocalizedName(); + + return tempIngot; + } + +} diff --git a/src/Java/gtPlusPlus/core/lib/CORE.java b/src/Java/gtPlusPlus/core/lib/CORE.java index 99ff5b91a7..cb76e9b94a 100644 --- a/src/Java/gtPlusPlus/core/lib/CORE.java +++ b/src/Java/gtPlusPlus/core/lib/CORE.java @@ -21,7 +21,7 @@ public class CORE { public static final String name = "GT++"; public static final String MODID = "miscutils"; - public static final String VERSION = "1.4.7.1-release"; + public static final String VERSION = "1.4.8-prerelease"; public static final String MASTER_VERSION = NetworkUtils.getContentFromURL("https://raw.githubusercontent.com/draknyte1/GTplusplus/master/Recommended.txt").toLowerCase(); public static boolean isModUpToDate = Utils.isModUpToDate(); public static boolean DEBUG = false; diff --git a/src/Java/gtPlusPlus/core/lib/MaterialInfo.java b/src/Java/gtPlusPlus/core/lib/MaterialInfo.java index fdd7ccfa76..455becc2d1 100644 --- a/src/Java/gtPlusPlus/core/lib/MaterialInfo.java +++ b/src/Java/gtPlusPlus/core/lib/MaterialInfo.java @@ -15,36 +15,67 @@ import net.minecraft.item.ItemStack; public enum MaterialInfo { ENERGYCRYSTAL(GTplusplus.randomDust_A, 8, GTplusplus.randomDust_B, 8, GTplusplus.randomDust_C, 8, GTplusplus.randomDust_D, 8, "dustEnergyCrystal", 1, noItem, 0), + BLOODSTEEL(noItem, 0, noItem, 0, noItem, 0, noItem, 0, noItem, 0, noItem, 0), + STABALLOY("dustTitanium", 1, "dustUranium", 8, noItem, 0, noItem, 0, "dustStaballoy", 1, noItem, 0), + TANTALLOY60("dustTungsten", 1, "dustTantalum", 8, "dustTinyTitanium", 5, noItem, 0, "dustTantalloy60", 1, noItem, 0), + TANTALLOY61("dustTungsten", 1, "dustSmallTitanium", 3, "dustSmallYttrium", 2, "dustTantalum", 9, "dustTantalloy61", 1, noItem, 0), + QUANTUM(noItem, 0, noItem, 0, noItem, 0, noItem, 0, noItem, 0, noItem, 0), + TUMBAGA("dustGold", 6, "dustCopper", 3, noItem, 0, noItem, 0, "dustTumbaga", 2, noItem, 0), + POTIN("dustBronze", 3, "dustTin", 2, "dustLead", 4, noItem, 0, "dustPotin", 3, noItem, 0), + BEDROCKIUM(noItem, 0, noItem, 0, noItem, 0, noItem, 0, noItem, 0, noItem, 0), + INCONEL625("dustNickel", 5, "dustChrome", 2, "dustWroughtIron", 1, "dustMolybdenum", 1, "dustInconel625", 4, "dustTinyDarkAsh", 1), + INCONEL690("dustNickel", 5, "dustChrome", 2, "dustNiobium", 1, "dustMolybdenum", 1, "dustInconel690", 2, "dustTinyDarkAsh", 1), + INCONEL792("dustNickel", 5, "dustChrome", 1, "dustAluminium", 2, "dustNiobium", 1, "dustInconel792", 2, "dustTinyDarkAsh", 1), + TUNGSTENCARBIDE("dustTungsten", 16, "dustCarbon", 16, noItem, 0, noItem, 0, "dustTungstenCarbide", 4, noItem, 0), + SILICONCARBIDE("dustSilicon", 16, "dustCarbon", 16, noItem, 0, noItem, 0, "dustSiliconCarbide", 4, noItem, 0), + ZERON100("dustChrome", 5, "dustSmallNickel", 6, "dustSmallMolybdenum", 3, "dustSteel", 14, "dustZeron100", 5, noItem, 0), + MARAGING250("dustSteel", 4, "dustNickel", 2, "dustCobalt", 1, "dustTinyTitanium", 1, "dustMaragingSteel250", 6, noItem, 0), + MARAGING300("dustSteel", 5, "dustNickel", 2, "dustCobalt", 2, "dustSmallTitanium", 1, "dustMaragingSteel300", 5, noItem, 0), + MARAGING350("dustSteel", 6, "dustNickel", 3, "dustCobalt", 3, "dustTitanium", 1, "dustMaragingSteel350", 4, noItem, 0), + STELLITE("dustCobalt", 4, "dustChrome", 4, "dustManganese", 2, "dustTitanium", 1, "dustStellite", 2, noItem, 0), + TALONITE("dustCobalt", 4, "dustChrome", 4, "dustPhosphorus", 1, "dustMolybdenum", 1, "dustTalonite", 2, noItem, 0), + HASTELLOY_W("dustSmallCobalt", 1, "dustSmallChrome", 4, "dustMolybdenum", 2, "dustNickel", 6, "dustHastelloyW", 2, noItem, 0), + HASTELLOY_X("dustTinyCobalt", 6, "dustChrome", 2, "dustMolybdenum", 1, "dustNickel", 5, "dustHastelloyX", 2, noItem, 0), + HASTELLOY_C276("dustSmallCobalt", 1, "dustSmallChrome", 14, "dustSmallMolybdenum", 14, "dustNickel", 5, "dustHastelloyC276", 2, noItem, 0), + INCOLOY020("dustIron", 4, "dustChrome", 2, "dustTinyCarbon", 2, "dustSmallCopper", 4, "dustIncoloy020", 1, noItem, 0), + INCOLOYDS("dustIron", 4, "dustChrome", 2, "dustTinyTitanium", 2, "dustSmallManganese", 1, "dustIncoloyDS", 1, noItem, 0), + INCOLOYMA956("dustIron", 6, "dustChrome", 2, "dustSmallAluminium", 5, "dustTinyYttrium", 1, "dustIncoloyMA956", 1, noItem, 0), + TANTALUMCARBIDE("dustTantalum", 4, "dustCarbon", 2, noItem, 0, noItem, 0, "dustTantalumCarbide", 1, noItem, 0), + ZIRCONIUM(noItem, 0, noItem, 0, noItem, 0, noItem, 0, "dustZirconium", 1, noItem, 0), + ZIRCONIUMCARBIDE("dustZirconium", 2, "dustCarbon", 2, noItem, 0, noItem, 0, "dustZirconiumCarbide", 1, noItem, 0), + NIOMBIUMCARBIDE("dustNiobium", 2, "dustCarbon", 2, noItem, 0, noItem, 0, "dustNiobiumCarbide", 1, noItem, 0), + HASTELLOY_N("dustIron", 1, "dustSmallChrome", 7, "dustSmallMolybdenum", 12, "dustNickel", 4, "dustHastelloyN", 1, noItem, 0), + URANIUM233(noItem, 0, noItem, 0, noItem, 0, noItem, 0, noItem, 0, noItem, 0); diff --git a/src/Java/gtPlusPlus/core/material/ALLOY.java b/src/Java/gtPlusPlus/core/material/ALLOY.java new file mode 100644 index 0000000000..a4cdd77d59 --- /dev/null +++ b/src/Java/gtPlusPlus/core/material/ALLOY.java @@ -0,0 +1,479 @@ +package gtPlusPlus.core.material; + + +public final class ALLOY { + + public static final Material ENERGYCRYSTAL = new Material( + "Energy Crystal", //Material Name + new short[]{228, 255, 0, 0}, //Material Colour + 5660, //Melting Point in C + 0, //Boiling Point in C + 100, //Protons + 100, //Neutrons + true, //Uses Blast furnace? + //Material Stacks with Percentage of required elements. + null); + + public static final Material BLOODSTEEL = new Material( + "Blood Steel", //Material Name + new short[]{142, 28, 0, 0}, //Material Colour + 2500, //Melting Point in C + 0, //Boiling Point in C + 100, //Protons + 100, //Neutrons + false, //Uses Blast furnace? + //Material Stacks with Percentage of required elements. + null); + + public static final Material STABALLOY = new Material( + "Staballoy", //Material Name + new short[]{68, 75, 66, 0}, //Material Colour + 3450, //Melting Point in C + ((ELEMENT.URANIUM.getBoilingPoint_C()*9)+(ELEMENT.TITANIUM.getBoilingPoint_C()*1))/10, //Boiling Point in C + ((ELEMENT.URANIUM.getProtons()*9)+ELEMENT.TITANIUM.getProtons())/10, //Protons + ((ELEMENT.URANIUM.getNeutrons()*9)+ELEMENT.TITANIUM.getNeutrons())/10, //Neutrons + true, //Uses Blast furnace? + //Material Stacks with Percentage of required elements. + new MaterialStack[]{ + new MaterialStack(ELEMENT.URANIUM, 90), + new MaterialStack(ELEMENT.TITANIUM, 10) + }); + + public static final Material TANTALLOY_60 = new Material( + "Tantalloy-60", //Material Name + new short[]{66, 75, 166, 0}, //Material Colour + 3025, //Melting Point in C + ((ELEMENT.TUNGSTEN.getBoilingPoint_C()*1)+(ELEMENT.TANTALUM.getBoilingPoint_C()*8)+(ELEMENT.TITANIUM.getBoilingPoint_C()*1))/10, //Boiling Point in C + ((ELEMENT.TUNGSTEN.getProtons()*1)+(ELEMENT.TANTALUM.getProtons()*8)+(ELEMENT.TITANIUM.getProtons()*1))/10, //Protons + ((ELEMENT.TUNGSTEN.getNeutrons()*1)+(ELEMENT.TANTALUM.getNeutrons()*8)+(ELEMENT.TITANIUM.getNeutrons()*1))/10, //Neutrons + true, //Uses Blast furnace? + //Material Stacks with Percentage of required elements. + new MaterialStack[]{ + new MaterialStack(ELEMENT.TUNGSTEN, 7), + new MaterialStack(ELEMENT.TANTALUM, 90), + new MaterialStack(ELEMENT.TANTALUM, 2) + }); + + public static final Material TANTALLOY_61 = new Material( + "Tantalloy-61", //Material Name + new short[]{122, 135, 196, 0}, //Material Colour + 3030, //Melting Point in C + ((ELEMENT.TUNGSTEN.getBoilingPoint_C()*1)+(ELEMENT.TANTALUM.getBoilingPoint_C()*7)+(ELEMENT.TITANIUM.getBoilingPoint_C()*1)+(ELEMENT.YTTRIUM.getBoilingPoint_C()*1))/10, //Boiling Point in C + ((ELEMENT.TUNGSTEN.getProtons()*1)+(ELEMENT.TANTALUM.getProtons()*7)+(ELEMENT.TITANIUM.getProtons()*1)+(ELEMENT.YTTRIUM.getProtons()*1))/10, //Protons + ((ELEMENT.TUNGSTEN.getNeutrons()*1)+(ELEMENT.TANTALUM.getNeutrons()*7)+(ELEMENT.TITANIUM.getNeutrons()*1)+(ELEMENT.YTTRIUM.getNeutrons()*1))/10, //Neutrons + true, //Uses Blast furnace? + //Material Stacks with Percentage of required elements. + new MaterialStack[]{ + new MaterialStack(ELEMENT.TUNGSTEN, 10), + new MaterialStack(ELEMENT.TANTALUM, 70), + new MaterialStack(ELEMENT.TITANIUM, 10), + new MaterialStack(ELEMENT.YTTRIUM, 10) + }); + + public static final Material QUANTUM = new Material( + "Quantum", //Material Name + new short[]{128, 128, 128, 0}, //Material Colour + 9999, //Melting Point in C + 0, //Boiling Point in C + 100, //Protons + 100, //Neutrons + true, //Uses Blast furnace? + //Material Stacks with Percentage of required elements. + null); + + public static final Material BRONZE = new Material( + "Bronze", //Material Name + new short[]{128, 128, 128, 0}, //Material Colour + ((ELEMENT.TIN.getMeltingPoint_C()*1)+(ELEMENT.COPPER.getMeltingPoint_C()*3))/4, //Melting point in C + ((ELEMENT.TIN.getBoilingPoint_C()*1)+(ELEMENT.COPPER.getBoilingPoint_C()*3))/4, //Boiling Point in C + ((ELEMENT.TIN.getProtons()*1)+(ELEMENT.COPPER.getProtons()*3))/4, //Protons + ((ELEMENT.TIN.getNeutrons()*1)+(ELEMENT.COPPER.getNeutrons()*3))/4, //Neutrons + false, //Uses Blast furnace? + //Material Stacks with Percentage of required elements. + new MaterialStack[]{ + new MaterialStack(ELEMENT.COPPER, 75), + new MaterialStack(ELEMENT.TIN, 25) + }); + + public static final Material TUMBAGA = new Material( + "Tumbaga", //Material Name + new short[]{255,178,15, 0}, //Material Colour + ((ELEMENT.GOLD.getMeltingPoint_C()*7)+(ELEMENT.COPPER.getMeltingPoint_C()*3))/10, //Melting point in C + ((ELEMENT.GOLD.getBoilingPoint_C()*7)+(ELEMENT.COPPER.getBoilingPoint_C()*3))/10, //Boiling Point in C + ((ELEMENT.GOLD.getProtons()*7)+(ELEMENT.COPPER.getProtons()*3))/10, //Protons + ((ELEMENT.GOLD.getNeutrons()*7)+(ELEMENT.COPPER.getNeutrons()*3))/10, //Neutrons + false, //Uses Blast furnace? + //Material Stacks with Percentage of required elements. + new MaterialStack[]{ + new MaterialStack(ELEMENT.GOLD, 70), + new MaterialStack(ELEMENT.COPPER, 30) + }); + + public static final Material POTIN = new Material( + "Potin", //Material Name + new short[]{201,151,129, 0}, //Material Colour + ((ELEMENT.LEAD.getMeltingPoint_C()*4)+(ALLOY.BRONZE.getMeltingPoint_C()*4)+(ELEMENT.TIN.getMeltingPoint_C()*2))/10, //Melting point in C + ((ELEMENT.LEAD.getBoilingPoint_C()*4)+(ALLOY.BRONZE.getBoilingPoint_C()*4)+(ELEMENT.TIN.getBoilingPoint_C()*2))/10, //Boiling Point in C + ((ELEMENT.LEAD.getProtons()*4)+(ALLOY.BRONZE.getProtons()*4)+(ELEMENT.TIN.getProtons()*2))/10, //Protons + ((ELEMENT.LEAD.getNeutrons()*4)+(ALLOY.BRONZE.getNeutrons()*4)+(ELEMENT.TIN.getNeutrons()*2))/10, //Neutrons + false, //Uses Blast furnace? + //Material Stacks with Percentage of required elements. + new MaterialStack[]{ + new MaterialStack(ELEMENT.LEAD, 40), + new MaterialStack(ALLOY.BRONZE, 40), + new MaterialStack(ELEMENT.TIN, 20) + }); + + public static final Material BEDROCKIUM = new Material( + "Bedrockium", //Material Name + new short[]{32, 32, 32, 0}, //Material Colour + 7735, //Melting Point in C + 0, //Boiling Point in C + 100, //Protons + 100, //Neutrons + false, //Uses Blast furnace? + //Material Stacks with Percentage of required elements. + null); + + public static final Material INCONEL_625 = new Material( + "Inconel-625", //Material Name + new short[]{128, 200, 128, 0}, //Material Colour + 1425, //Melting Point in C + ((ELEMENT.NICKEL.getBoilingPoint_C()*6)+(ELEMENT.CHROMIUM.getBoilingPoint_C()*2)+(ELEMENT.IRON.getBoilingPoint_C()*1)+(ELEMENT.MOLYBDENUM.getBoilingPoint_C()*1))/10, //Boiling Point in C + ((ELEMENT.NICKEL.getProtons()*6)+(ELEMENT.CHROMIUM.getProtons()*2)+(ELEMENT.IRON.getProtons()*1)+(ELEMENT.MOLYBDENUM.getProtons()*1))/10, //Protons + ((ELEMENT.NICKEL.getNeutrons()*6)+(ELEMENT.CHROMIUM.getNeutrons()*2)+(ELEMENT.IRON.getNeutrons()*1)+(ELEMENT.MOLYBDENUM.getNeutrons()*1))/10, //Neutrons + true, //Uses Blast furnace? + //Material Stacks with Percentage of required elements. + new MaterialStack[]{ + new MaterialStack(ELEMENT.NICKEL, 60), + new MaterialStack(ELEMENT.CHROMIUM, 20), + new MaterialStack(ELEMENT.IRON, 10), + new MaterialStack(ELEMENT.MOLYBDENUM, 10) + }); + + public static final Material INCONEL_690 = new Material( + "Inconel-690", //Material Name + new short[]{118, 220, 138, 0}, //Material Colour + 1425, //Melting Point in C + ((ELEMENT.NICKEL.getBoilingPoint_C()*6)+(ELEMENT.CHROMIUM.getBoilingPoint_C()*2)+(ELEMENT.NIOBIUM.getBoilingPoint_C()*1)+(ELEMENT.MOLYBDENUM.getBoilingPoint_C()*1))/10, //Boiling Point in C + ((ELEMENT.NICKEL.getProtons()*6)+(ELEMENT.CHROMIUM.getProtons()*2)+(ELEMENT.NIOBIUM.getProtons()*1)+(ELEMENT.MOLYBDENUM.getProtons()*1))/10, //Protons + ((ELEMENT.NICKEL.getNeutrons()*6)+(ELEMENT.CHROMIUM.getNeutrons()*2)+(ELEMENT.NIOBIUM.getNeutrons()*1)+(ELEMENT.MOLYBDENUM.getNeutrons()*1))/10, //Neutrons + true, //Uses Blast furnace? + //Material Stacks with Percentage of required elements. + new MaterialStack[]{ + new MaterialStack(ELEMENT.NICKEL, 60), + new MaterialStack(ELEMENT.CHROMIUM, 20), + new MaterialStack(ELEMENT.NIOBIUM, 10), + new MaterialStack(ELEMENT.MOLYBDENUM, 10) + }); + + public static final Material INCONEL_792 = new Material( + "Inconel-792", //Material Name + new short[]{108, 240, 118, 0}, //Material Colour + 1425, //Melting Point in C + ((ELEMENT.NICKEL.getBoilingPoint_C()*6)+(ELEMENT.CHROMIUM.getBoilingPoint_C()*1)+(ELEMENT.IRON.getBoilingPoint_C()*1)+(ELEMENT.ALUMINIUM.getBoilingPoint_C()*2))/10, //Boiling Point in C + ((ELEMENT.NICKEL.getProtons()*6)+(ELEMENT.CHROMIUM.getProtons()*1)+(ELEMENT.IRON.getProtons()*1)+(ELEMENT.ALUMINIUM.getProtons()*2))/10, //Protons + ((ELEMENT.NICKEL.getNeutrons()*6)+(ELEMENT.CHROMIUM.getNeutrons()*1)+(ELEMENT.IRON.getNeutrons()*1)+(ELEMENT.ALUMINIUM.getNeutrons()*2))/10, //Neutrons + true, //Uses Blast furnace? + //Material Stacks with Percentage of required elements. + new MaterialStack[]{ + new MaterialStack(ELEMENT.NICKEL, 60), + new MaterialStack(ELEMENT.CHROMIUM, 10), + new MaterialStack(ELEMENT.NIOBIUM, 10), + new MaterialStack(ELEMENT.ALUMINIUM, 20) + }); + + public static final Material STEEL = new Material( + "Steel", //Material Name + new short[]{180, 180, 20, 0}, //Material Colour + ((ELEMENT.CARBON.getMeltingPoint_C()*5)+(ELEMENT.IRON.getMeltingPoint_C()*95))/100, //Melting point in C + ((ELEMENT.CARBON.getBoilingPoint_C()*5)+(ELEMENT.IRON.getBoilingPoint_C()*95))/100, //Boiling Point in C + ((ELEMENT.CARBON.getProtons()*5)+(ELEMENT.IRON.getProtons()*95))/100, //Protons + ((ELEMENT.CARBON.getNeutrons()*5)+(ELEMENT.IRON.getNeutrons()*95))/100, //Neutrons + true, //Uses Blast furnace? + //Material Stacks with Percentage of required elements. + new MaterialStack[]{ + new MaterialStack(ELEMENT.CARBON, 05), + new MaterialStack(ELEMENT.IRON, 95) + }); + + public static final Material ZERON_100 = new Material( + "Zeron-100", //Material Name + new short[]{180, 180, 20, 0}, //Material Colour + ((ELEMENT.CHROMIUM.getMeltingPoint_C()*25)+(ELEMENT.NICKEL.getMeltingPoint_C()*6)+(ELEMENT.COBALT.getMeltingPoint_C()*9)+(ALLOY.STEEL.getMeltingPoint_C()*60))/100, //Melting Point in C + ((ELEMENT.CHROMIUM.getBoilingPoint_C()*25)+(ELEMENT.NICKEL.getBoilingPoint_C()*6)+(ELEMENT.COBALT.getBoilingPoint_C()*9)+(ALLOY.STEEL.getBoilingPoint_C()*60))/100, //Boiling Point in C + ((ELEMENT.CHROMIUM.getProtons()*25)+(ELEMENT.NICKEL.getProtons()*6)+(ELEMENT.COBALT.getProtons()*9)+(ALLOY.STEEL.getProtons()*60))/100, //Protons + ((ELEMENT.CHROMIUM.getNeutrons()*25)+(ELEMENT.NICKEL.getNeutrons()*6)+(ELEMENT.COBALT.getNeutrons()*9)+(ALLOY.STEEL.getNeutrons()*60))/100, //Neutrons + true, //Uses Blast furnace? + //Material Stacks with Percentage of required elements. + new MaterialStack[]{ + new MaterialStack(ELEMENT.CHROMIUM, 25), + new MaterialStack(ELEMENT.NICKEL, 6), + new MaterialStack(ELEMENT.COBALT, 9), + new MaterialStack(ALLOY.STEEL, 60) + }); + + public static final Material MARAGING250 = new Material( + "Maraging Steel 250", //Material Name + new short[]{140, 140, 140, 0}, //Material Colour + 1413, //Melting Point in C + ((ELEMENT.TITANIUM.getBoilingPoint_C()*5)+(ELEMENT.NICKEL.getBoilingPoint_C()*16)+(ELEMENT.COBALT.getBoilingPoint_C()*9)+(ALLOY.STEEL.getBoilingPoint_C()*70))/100, //Boiling Point in C + ((ELEMENT.TITANIUM.getProtons()*5)+(ELEMENT.NICKEL.getProtons()*16)+(ELEMENT.COBALT.getProtons()*9)+(ALLOY.STEEL.getProtons()*70))/100, //Protons + ((ELEMENT.TITANIUM.getNeutrons()*5)+(ELEMENT.NICKEL.getNeutrons()*16)+(ELEMENT.COBALT.getNeutrons()*9)+(ALLOY.STEEL.getNeutrons()*70))/100, //Neutrons + true, //Uses Blast furnace? + //Material Stacks with Percentage of required elements. + new MaterialStack[]{ + new MaterialStack(ELEMENT.TITANIUM, 5), + new MaterialStack(ELEMENT.NICKEL, 16), + new MaterialStack(ELEMENT.COBALT, 9), + new MaterialStack(ALLOY.STEEL, 70) + }); + + public static final Material MARAGING300 = new Material( + "Maraging Steel 300", //Material Name + new short[]{150, 150, 150, 0}, //Material Colour + 1413, //Melting Point in C + ((ELEMENT.TITANIUM.getBoilingPoint_C()*10)+(ELEMENT.NICKEL.getBoilingPoint_C()*21)+(ELEMENT.COBALT.getBoilingPoint_C()*14)+(ALLOY.STEEL.getBoilingPoint_C()*55))/100, //Boiling Point in C + ((ELEMENT.TITANIUM.getProtons()*10)+(ELEMENT.NICKEL.getProtons()*21)+(ELEMENT.COBALT.getProtons()*14)+(ALLOY.STEEL.getProtons()*55))/100, //Protons + ((ELEMENT.TITANIUM.getNeutrons()*10)+(ELEMENT.NICKEL.getNeutrons()*21)+(ELEMENT.COBALT.getNeutrons()*14)+(ALLOY.STEEL.getNeutrons()*55))/100, //Neutrons + true, //Uses Blast furnace? + //Material Stacks with Percentage of required elements. + new MaterialStack[]{ + new MaterialStack(ELEMENT.TITANIUM, 10), + new MaterialStack(ELEMENT.NICKEL, 21), + new MaterialStack(ELEMENT.COBALT, 14), + new MaterialStack(ALLOY.STEEL, 55) + }); + + public static final Material MARAGING350 = new Material( + "Maraging Steel 350", //Material Name + new short[]{160, 160, 160, 0}, //Material Colour + 1413, //Melting Point in C + ((ELEMENT.TITANIUM.getBoilingPoint_C()*15)+(ELEMENT.NICKEL.getBoilingPoint_C()*21)+(ELEMENT.COBALT.getBoilingPoint_C()*9)+(ALLOY.STEEL.getBoilingPoint_C()*55))/100, //Boiling Point in C + ((ELEMENT.TITANIUM.getProtons()*15)+(ELEMENT.NICKEL.getProtons()*21)+(ELEMENT.COBALT.getProtons()*9)+(ALLOY.STEEL.getProtons()*55))/100, //Protons + ((ELEMENT.TITANIUM.getNeutrons()*15)+(ELEMENT.NICKEL.getNeutrons()*21)+(ELEMENT.COBALT.getNeutrons()*9)+(ALLOY.STEEL.getNeutrons()*55))/100, //Neutrons + true, //Uses Blast furnace? + //Material Stacks with Percentage of required elements. + new MaterialStack[]{ + new MaterialStack(ELEMENT.TITANIUM, 15), + new MaterialStack(ELEMENT.NICKEL, 21), + new MaterialStack(ELEMENT.COBALT, 9), + new MaterialStack(ALLOY.STEEL, 55) + }); + + public static final Material STELLITE = new Material( + "Stellite", //Material Name + new short[]{129, 75, 120, 0}, //Material Colour + 1310, //Melting Point in C + ((ELEMENT.TITANIUM.getBoilingPoint_C()*10)+(ELEMENT.CHROMIUM.getBoilingPoint_C()*35)+(ELEMENT.COBALT.getBoilingPoint_C()*35)+(ELEMENT.MANGANESE.getBoilingPoint_C()*20))/100, //Boiling Point in C + ((ELEMENT.TITANIUM.getProtons()*10)+(ELEMENT.CHROMIUM.getProtons()*35)+(ELEMENT.COBALT.getProtons()*35)+(ELEMENT.MANGANESE.getProtons()*20))/100, //Protons + ((ELEMENT.TITANIUM.getNeutrons()*10)+(ELEMENT.CHROMIUM.getNeutrons()*35)+(ELEMENT.COBALT.getNeutrons()*35)+(ELEMENT.MANGANESE.getNeutrons()*20))/100, //Neutrons + true, //Uses Blast furnace? + //Material Stacks with Percentage of required elements. + new MaterialStack[]{ + new MaterialStack(ELEMENT.COBALT, 35), + new MaterialStack(ELEMENT.CHROMIUM, 35), + new MaterialStack(ELEMENT.MANGANESE, 20), + new MaterialStack(ELEMENT.TITANIUM, 10) + }); + + public static final Material TALONITE = new Material( + "Talonite", //Material Name + new short[]{228, 75, 120, 0}, //Material Colour + 1454, //Melting Point in C + ((ELEMENT.MOLYBDENUM.getBoilingPoint_C()*10)+(ELEMENT.CHROMIUM.getBoilingPoint_C()*30)+(ELEMENT.COBALT.getBoilingPoint_C()*40)+(ELEMENT.PHOSPHORUS.getBoilingPoint_C()*20))/100, //Boiling Point in C + ((ELEMENT.MOLYBDENUM.getProtons()*10)+(ELEMENT.CHROMIUM.getProtons()*30)+(ELEMENT.COBALT.getProtons()*40)+(ELEMENT.PHOSPHORUS.getProtons()*20))/100, //Protons + ((ELEMENT.MOLYBDENUM.getNeutrons()*10)+(ELEMENT.CHROMIUM.getNeutrons()*30)+(ELEMENT.COBALT.getNeutrons()*40)+(ELEMENT.PHOSPHORUS.getNeutrons()*20))/100, //Neutrons + false, //Uses Blast furnace? + //Material Stacks with Percentage of required elements. + new MaterialStack[]{ + new MaterialStack(ELEMENT.COBALT, 40), + new MaterialStack(ELEMENT.CHROMIUM, 30), + new MaterialStack(ELEMENT.PHOSPHORUS, 20), + new MaterialStack(ELEMENT.MOLYBDENUM, 10) + }); + + public static final Material HASTELLOY_W = new Material( + "Hastelloy-W", //Material Name + new short[]{218, 165, 32, 0}, //Material Colour + 1350, //Melting Point in C + ((ELEMENT.IRON.getBoilingPoint_C()*6)+(ELEMENT.MOLYBDENUM.getBoilingPoint_C()*24)+(ELEMENT.CHROMIUM.getBoilingPoint_C()*5)+(ELEMENT.NICKEL.getBoilingPoint_C()*65))/100, //Boiling Point in C + ((ELEMENT.IRON.getProtons()*6)+(ELEMENT.MOLYBDENUM.getProtons()*24)+(ELEMENT.CHROMIUM.getProtons()*5)+(ELEMENT.NICKEL.getProtons()*65))/100, //Protons + ((ELEMENT.IRON.getNeutrons()*6)+(ELEMENT.MOLYBDENUM.getNeutrons()*24)+(ELEMENT.CHROMIUM.getNeutrons()*5)+(ELEMENT.NICKEL.getNeutrons()*65))/100, //Neutrons + false, //Uses Blast furnace? + //Material Stacks with Percentage of required elements. + new MaterialStack[]{ + new MaterialStack(ELEMENT.IRON, 06), + new MaterialStack(ELEMENT.MOLYBDENUM, 24), + new MaterialStack(ELEMENT.CHROMIUM, 5), + new MaterialStack(ELEMENT.NICKEL, 65) + }); + + public static final Material HASTELLOY_X = new Material( + "Hastelloy-X", //Material Name + new short[]{255, 193, 37, 0}, //Material Colour + 1350, //Melting Point in C + ((ELEMENT.IRON.getBoilingPoint_C()*18)+(ELEMENT.MOLYBDENUM.getBoilingPoint_C()*9)+(ELEMENT.CHROMIUM.getBoilingPoint_C()*22)+(ELEMENT.NICKEL.getBoilingPoint_C()*51))/100, //Boiling Point in C + ((ELEMENT.IRON.getProtons()*18)+(ELEMENT.MOLYBDENUM.getProtons()*9)+(ELEMENT.CHROMIUM.getProtons()*22)+(ELEMENT.NICKEL.getProtons()*51))/100, //Protons + ((ELEMENT.IRON.getNeutrons()*18)+(ELEMENT.MOLYBDENUM.getNeutrons()*9)+(ELEMENT.CHROMIUM.getNeutrons()*22)+(ELEMENT.NICKEL.getNeutrons()*51))/100, //Neutrons + false, //Uses Blast furnace? + //Material Stacks with Percentage of required elements. + new MaterialStack[]{ + new MaterialStack(ELEMENT.IRON, 18), + new MaterialStack(ELEMENT.MOLYBDENUM, 9), + new MaterialStack(ELEMENT.CHROMIUM, 22), + new MaterialStack(ELEMENT.NICKEL, 51) + }); + + public static final Material HASTELLOY_N = new Material( + "Hastelloy-N", //Material Name + new short[]{236, 213, 48, 0}, //Material Colour + 1350, //Melting Point in C + ((ELEMENT.YTTRIUM.getBoilingPoint_C()*5)+(ELEMENT.MOLYBDENUM.getBoilingPoint_C()*16)+(ELEMENT.CHROMIUM.getBoilingPoint_C()*7)+(ELEMENT.NICKEL.getBoilingPoint_C()*72))/100, //Boiling Point in C + ((ELEMENT.YTTRIUM.getProtons()*5)+(ELEMENT.MOLYBDENUM.getProtons()*16)+(ELEMENT.CHROMIUM.getProtons()*7)+(ELEMENT.NICKEL.getProtons()*72))/100, //Protons + ((ELEMENT.YTTRIUM.getNeutrons()*5)+(ELEMENT.MOLYBDENUM.getNeutrons()*16)+(ELEMENT.CHROMIUM.getNeutrons()*7)+(ELEMENT.NICKEL.getNeutrons()*72))/100, //Neutrons + true, //Uses Blast furnace? + //Material Stacks with Percentage of required elements. + new MaterialStack[]{ + new MaterialStack(ELEMENT.YTTRIUM, 05), + new MaterialStack(ELEMENT.MOLYBDENUM, 16), + new MaterialStack(ELEMENT.CHROMIUM, 7), + new MaterialStack(ELEMENT.NICKEL, 72) + }); + + public static final Material HASTELLOY_C276 = new Material( + "Hastelloy-C276", //Material Name + new short[]{238, 180, 34, 0}, //Material Colour + 1350, //Melting Point in C + ((ELEMENT.COBALT.getBoilingPoint_C()*2)+(ELEMENT.MOLYBDENUM.getBoilingPoint_C()*16)+(ELEMENT.CHROMIUM.getBoilingPoint_C()*16)+(ELEMENT.NICKEL.getBoilingPoint_C()*66))/100, //Boiling Point in C + ((ELEMENT.COBALT.getProtons()*2)+(ELEMENT.MOLYBDENUM.getProtons()*16)+(ELEMENT.CHROMIUM.getProtons()*16)+(ELEMENT.NICKEL.getProtons()*66))/100, //Protons + ((ELEMENT.COBALT.getNeutrons()*2)+(ELEMENT.MOLYBDENUM.getNeutrons()*16)+(ELEMENT.CHROMIUM.getNeutrons()*16)+(ELEMENT.NICKEL.getNeutrons()*66))/100, //Neutrons + true, //Uses Blast furnace? + //Material Stacks with Percentage of required elements. + new MaterialStack[]{ + new MaterialStack(ELEMENT.COBALT, 02), + new MaterialStack(ELEMENT.MOLYBDENUM, 16), + new MaterialStack(ELEMENT.CHROMIUM, 16), + new MaterialStack(ELEMENT.NICKEL, 66) + }); + + public static final Material INCOLOY_020 = new Material( + "Incoloy-020", //Material Name + new short[]{101, 81, 71, 0}, //Material Colour + 1425, //Melting Point in C + ((ELEMENT.IRON.getBoilingPoint_C()*40)+(ELEMENT.COPPER.getBoilingPoint_C()*4)+(ELEMENT.CHROMIUM.getBoilingPoint_C()*20)+(ELEMENT.NICKEL.getBoilingPoint_C()*36))/100, //Boiling Point in C + ((ELEMENT.IRON.getProtons()*40)+(ELEMENT.COPPER.getProtons()*4)+(ELEMENT.CHROMIUM.getProtons()*20)+(ELEMENT.NICKEL.getProtons()*36))/100, //Protons + ((ELEMENT.IRON.getNeutrons()*40)+(ELEMENT.COPPER.getNeutrons()*4)+(ELEMENT.CHROMIUM.getNeutrons()*20)+(ELEMENT.NICKEL.getNeutrons()*36))/100, //Neutrons + false, //Uses Blast furnace? + //Material Stacks with Percentage of required elements. + new MaterialStack[]{ + new MaterialStack(ELEMENT.IRON, 40), + new MaterialStack(ELEMENT.COPPER, 4), + new MaterialStack(ELEMENT.CHROMIUM, 20), + new MaterialStack(ELEMENT.NICKEL, 36) + }); + + public static final Material INCOLOY_DS = new Material( + "Incoloy-DS", //Material Name + new short[]{71, 101, 81, 0}, //Material Colour + 1425, //Melting Point in C + ((ELEMENT.IRON.getBoilingPoint_C()*46)+(ELEMENT.COBALT.getBoilingPoint_C()*18)+(ELEMENT.CHROMIUM.getBoilingPoint_C()*18)+(ELEMENT.NICKEL.getBoilingPoint_C()*18))/100, //Boiling Point in C + ((ELEMENT.IRON.getProtons()*46)+(ELEMENT.COBALT.getProtons()*18)+(ELEMENT.CHROMIUM.getProtons()*18)+(ELEMENT.NICKEL.getProtons()*18))/100, //Protons + ((ELEMENT.IRON.getNeutrons()*46)+(ELEMENT.COBALT.getNeutrons()*18)+(ELEMENT.CHROMIUM.getNeutrons()*18)+(ELEMENT.NICKEL.getNeutrons()*18))/100, //Neutrons + false, //Uses Blast furnace? + //Material Stacks with Percentage of required elements. + new MaterialStack[]{ + new MaterialStack(ELEMENT.IRON, 46), + new MaterialStack(ELEMENT.COBALT, 18), + new MaterialStack(ELEMENT.CHROMIUM, 18), + new MaterialStack(ELEMENT.NICKEL, 18) + }); + + public static final Material INCOLOY_MA956 = new Material( + "Incoloy-MA956", //Material Name + new short[]{81, 71, 101, 0}, //Material Colour + 1425, //Melting Point in C + ((ELEMENT.IRON.getBoilingPoint_C()*75)+(ELEMENT.ALUMINIUM.getBoilingPoint_C()*4)+(ELEMENT.CHROMIUM.getBoilingPoint_C()*20)+(ELEMENT.YTTRIUM.getBoilingPoint_C()*1))/100, //Boiling Point in C + ((ELEMENT.IRON.getProtons()*75)+(ELEMENT.ALUMINIUM.getProtons()*4)+(ELEMENT.CHROMIUM.getProtons()*20)+(ELEMENT.YTTRIUM.getProtons()*1))/100, //Protons + ((ELEMENT.IRON.getNeutrons()*75)+(ELEMENT.ALUMINIUM.getNeutrons()*4)+(ELEMENT.CHROMIUM.getNeutrons()*20)+(ELEMENT.YTTRIUM.getNeutrons()*1))/100, //Neutrons + true, //Uses Blast furnace? + //Material Stacks with Percentage of required elements. + new MaterialStack[]{ + new MaterialStack(ELEMENT.IRON, 75), + new MaterialStack(ELEMENT.ALUMINIUM, 4), + new MaterialStack(ELEMENT.CHROMIUM, 20), + new MaterialStack(ELEMENT.YTTRIUM, 1) + }); + + public static final Material TUNGSTEN_CARBIDE = new Material( + "Tungsten Carbide", //Material Name + new short[]{44, 44, 44, 0}, //Material Colour + 3422, //Melting Point in C + ((ELEMENT.TUNGSTEN.getBoilingPoint_C()*5)+(ELEMENT.CARBON.getBoilingPoint_C()*5))/10, //Boiling Point in C + ((ELEMENT.TUNGSTEN.getProtons()*5)+(ELEMENT.CARBON.getProtons()*5))/10, //Protons + ((ELEMENT.TUNGSTEN.getNeutrons()*5)+(ELEMENT.CARBON.getNeutrons()*5))/10, //Neutrons + true, //Uses Blast furnace? + //Material Stacks with Percentage of required elements. + new MaterialStack[]{ + new MaterialStack(ELEMENT.CARBON, 50), + new MaterialStack(ELEMENT.TUNGSTEN, 50) + }); + + public static final Material SILICON_CARBIDE = new Material( + "Silicon Carbide", //Material Name + new short[]{40, 48, 36, 0}, //Material Colour + 1414, //Melting Point in C + ((ELEMENT.SILICON.getBoilingPoint_C()*5)+(ELEMENT.CARBON.getBoilingPoint_C()*5))/10, //Boiling Point in C + ((ELEMENT.SILICON.getProtons()*5)+(ELEMENT.CARBON.getProtons()*5))/10, //Protons + ((ELEMENT.SILICON.getNeutrons()*5)+(ELEMENT.CARBON.getNeutrons()*5))/10, //Neutrons + false, //Uses Blast furnace? + //Material Stacks with Percentage of required elements. + new MaterialStack[]{ + new MaterialStack(ELEMENT.CARBON, 50), + new MaterialStack(ELEMENT.SILICON, 50) + }); + + public static final Material TANTALUM_CARBIDE = new Material( + "Tantalum Carbide", //Material Name + new short[]{139, 136, 120, 0}, //Material Colour + 2980, //Melting Point in C + ((ELEMENT.TANTALUM.getBoilingPoint_C()*5)+(ELEMENT.CARBON.getBoilingPoint_C()*5))/10, //Boiling Point in C + ((ELEMENT.TANTALUM.getProtons()*5)+(ELEMENT.CARBON.getProtons()*5))/10, //Protons + ((ELEMENT.TANTALUM.getNeutrons()*5)+(ELEMENT.CARBON.getNeutrons()*5))/10, //Neutrons + true, //Uses Blast furnace? + //Material Stacks with Percentage of required elements. + new MaterialStack[]{ + new MaterialStack(ELEMENT.CARBON, 50), + new MaterialStack(ELEMENT.TANTALUM, 50) + }); + + public static final Material ZIRCONIUM_CARBIDE = new Material( + "Zirconium Carbide", //Material Name + new short[]{222, 202, 180, 0}, //Material Colour + 1855, //Melting Point in C + ((ELEMENT.ZIRCONIUM.getBoilingPoint_C()*5)+(ELEMENT.CARBON.getBoilingPoint_C()*5))/10, //Boiling Point in C + ((ELEMENT.ZIRCONIUM.getProtons()*5)+(ELEMENT.CARBON.getProtons()*5))/10, //Protons + ((ELEMENT.ZIRCONIUM.getNeutrons()*5)+(ELEMENT.CARBON.getNeutrons()*5))/10, //Neutrons + true, //Uses Blast furnace? + //Material Stacks with Percentage of required elements. + new MaterialStack[]{ + new MaterialStack(ELEMENT.CARBON, 50), + new MaterialStack(ELEMENT.ZIRCONIUM, 50) + }); + + public static final Material NIOBIUM_CARBIDE = new Material( + "Niobium Carbide", //Material Name + new short[]{205, 197, 191, 0}, //Material Colour + 2477, //Melting Point in C + ((ELEMENT.NIOBIUM.getBoilingPoint_C()*5)+(ELEMENT.CARBON.getBoilingPoint_C()*5))/10, //Boiling Point in C + ((ELEMENT.NIOBIUM.getProtons()*5)+(ELEMENT.CARBON.getProtons()*5))/10, //Protons + ((ELEMENT.NIOBIUM.getNeutrons()*5)+(ELEMENT.CARBON.getNeutrons()*5))/10, //Neutrons + true, //Uses Blast furnace? + //Material Stacks with Percentage of required elements. + new MaterialStack[]{ + new MaterialStack(ELEMENT.CARBON, 50), + new MaterialStack(ELEMENT.NIOBIUM, 50) + }); + + +} diff --git a/src/Java/gtPlusPlus/core/material/ELEMENT.java b/src/Java/gtPlusPlus/core/material/ELEMENT.java new file mode 100644 index 0000000000..307105eaf0 --- /dev/null +++ b/src/Java/gtPlusPlus/core/material/ELEMENT.java @@ -0,0 +1,85 @@ +package gtPlusPlus.core.material; + +import gregtech.api.enums.Materials; +import gtPlusPlus.core.util.materials.MaterialUtils; + +public final class ELEMENT { + + + //First 50 Elements + public static final Material HYDROGEN = MaterialUtils.generateMaterialFromGtENUM(Materials.Hydrogen); + public static final Material HELIUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Helium); + public static final Material LITHIUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Lithium); + public static final Material BERYLLIUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Beryllium); + public static final Material BORON = MaterialUtils.generateMaterialFromGtENUM(Materials.Boron); + public static final Material CARBON = MaterialUtils.generateMaterialFromGtENUM(Materials.Carbon); + public static final Material NITROGEN = MaterialUtils.generateMaterialFromGtENUM(Materials.Nitrogen); + public static final Material OXYGEN = MaterialUtils.generateMaterialFromGtENUM(Materials.Oxygen); + public static final Material FLUORINE = MaterialUtils.generateMaterialFromGtENUM(Materials.Fluorine); + //public static final Material NEON = MaterialUtils.generateMaterialFromGtENUM(Materials.Ne); + public static final Material SODIUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Sodium); + public static final Material MAGNESIUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Magnesium); + public static final Material ALUMINIUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Aluminium); + public static final Material SILICON = MaterialUtils.generateMaterialFromGtENUM(Materials.Silicon); + public static final Material PHOSPHORUS = MaterialUtils.generateMaterialFromGtENUM(Materials.Phosphorus); + public static final Material SULFUR = MaterialUtils.generateMaterialFromGtENUM(Materials.Sulfur); + public static final Material CHLORINE = MaterialUtils.generateMaterialFromGtENUM(Materials.Chlorine); + public static final Material ARGON = MaterialUtils.generateMaterialFromGtENUM(Materials.Argon); + public static final Material POTASSIUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Potassium); + public static final Material CALCIUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Calcium); + public static final Material SCANDIUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Scandium); + public static final Material TITANIUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Titanium); + public static final Material VANADIUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Vanadium); + public static final Material CHROMIUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Chrome); + public static final Material MANGANESE = MaterialUtils.generateMaterialFromGtENUM(Materials.Manganese); + public static final Material IRON = MaterialUtils.generateMaterialFromGtENUM(Materials.Iron); + public static final Material COBALT = MaterialUtils.generateMaterialFromGtENUM(Materials.Cobalt); + public static final Material NICKEL = MaterialUtils.generateMaterialFromGtENUM(Materials.Nickel); + public static final Material COPPER = MaterialUtils.generateMaterialFromGtENUM(Materials.Copper); + public static final Material ZINC = MaterialUtils.generateMaterialFromGtENUM(Materials.Zinc); + public static final Material GALLIUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Gallium); + //public static final Material GERMANIUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Germanium); + public static final Material ARSENIC = MaterialUtils.generateMaterialFromGtENUM(Materials.Arsenic); + //public static final Material SELENIUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Selenium); + //public static final Material BROMINE = MaterialUtils.generateMaterialFromGtENUM(Materials.Bromine); + //public static final Material KRYPTON = MaterialUtils.generateMaterialFromGtENUM(Materials.Krypton); + public static final Material RUBIDIUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Rubidium); + public static final Material STRONTIUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Strontium); + public static final Material YTTRIUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Yttrium); + public static final Material ZIRCONIUM = new Material("Zirconium", new short[]{255, 250, 205}, 1855, 4377, 40, 51, false, null);//Not a GT Inherited Material + public static final Material NIOBIUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Niobium); + public static final Material MOLYBDENUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Molybdenum); + //public static final Material TECHNETIUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Technetium); + //public static final Material RUTHENIUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Ruthenium); + //public static final Material RHODIUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Rhodium); + public static final Material PALLADIUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Palladium); + public static final Material SILVER = MaterialUtils.generateMaterialFromGtENUM(Materials.Silver); + public static final Material CADMIUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Cadmium); + public static final Material INDIUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Indium); + public static final Material TIN = MaterialUtils.generateMaterialFromGtENUM(Materials.Tin); + + + + + + + + + + //Second 50 elements + public static final Material TANTALUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Tantalum); + public static final Material TUNGSTEN = MaterialUtils.generateMaterialFromGtENUM(Materials.Tungsten); + public static final Material OSMIUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Osmium); + public static final Material IRIDIUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Iridium); + public static final Material PLATINUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Platinum); + public static final Material GOLD = MaterialUtils.generateMaterialFromGtENUM(Materials.Gold); + public static final Material LEAD = MaterialUtils.generateMaterialFromGtENUM(Materials.Lead); + public static final Material BISMUTH = MaterialUtils.generateMaterialFromGtENUM(Materials.Bismuth); + public static final Material RADON = MaterialUtils.generateMaterialFromGtENUM(Materials.Radon); + public static final Material THORIUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Thorium); + public static final Material URANIUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Uranium); + public static final Material PLUTONIUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Plutonium); + public static final Material URANIUM233 = new Material("Uranium-233", new short[]{73, 220, 83, 0}, 1132, 4131, 92, 141, false, null);//Not a GT Inherited Material + + +} diff --git a/src/Java/gtPlusPlus/core/material/Material.java b/src/Java/gtPlusPlus/core/material/Material.java new file mode 100644 index 0000000000..2939016798 --- /dev/null +++ b/src/Java/gtPlusPlus/core/material/Material.java @@ -0,0 +1,154 @@ +package gtPlusPlus.core.material; + +import gtPlusPlus.core.util.Utils; +import gtPlusPlus.core.util.item.UtilsItems; +import gtPlusPlus.core.util.math.MathUtils; +import net.minecraft.item.ItemStack; + +public class Material { + + final String unlocalizedName; + final String localizedName; + + private MaterialStack[] materialInput = new MaterialStack[4]; + + final short[] RGBA; + + final boolean usesBlastFurnace; + + final int meltingPointK; + final int boilingPointK; + final int meltingPointC; + final int boilingPointC; + final long vProtons; + final long vNeutrons; + final long vMass; + + public Material(String materialName, short[] rgba, int meltingPoint, int boilingPoint, long protons, long neutrons, boolean blastFurnace, MaterialStack[] inputs){ + + this.unlocalizedName = Utils.sanitizeString(materialName); + this.localizedName = materialName; + this.RGBA = rgba; + this.meltingPointC = meltingPoint; + if (boilingPoint == 0){ + boilingPoint = meltingPoint*4; + } + this.boilingPointC = boilingPoint; + this.meltingPointK = (int) MathUtils.celsiusToKelvin(meltingPointC); + this.boilingPointK = (int) MathUtils.celsiusToKelvin(boilingPointC); + this.vProtons = protons; + this.vNeutrons = neutrons; + this.vMass = getMass(); + this.usesBlastFurnace = blastFurnace; + + if (inputs == null){ + this.materialInput = null; + } + else { + if (inputs.length != 0){ + for (int i=0; i < inputs.length; i++){ + if (inputs[i] != null){ + this.materialInput[i] = inputs[i]; + } + } + } + } + Utils.LOG_INFO("Creating a Material instance for "+materialName); + Utils.LOG_INFO("Protons: "+vProtons); + Utils.LOG_INFO("Neutrons: "+vNeutrons); + Utils.LOG_INFO("Mass: "+vMass+"/units"); + Utils.LOG_INFO("Melting Point: "+meltingPointC+"C."); + Utils.LOG_INFO("Boiling Point: "+boilingPointC+"C."); + } + + public String getLocalizedName(){ + return localizedName; + } + + public String getUnlocalizedName(){ + return unlocalizedName; + } + + public short[] getRGBA(){ + return RGBA; + } + + public long getProtons() { + return vProtons; + } + + public long getNeutrons() { + return vNeutrons; + } + + public long getMass() { + return vProtons + vNeutrons; + } + + public int getMeltingPoint_C() { + return meltingPointC; + } + + public int getBoilingPoint_C() { + return boilingPointC; + } + + public boolean requiresBlastFurnace(){ + return usesBlastFurnace; + } + + public ItemStack getDust(int stacksize){ + return UtilsItems.getItemStackOfAmountFromOreDictNoBroken("dust"+unlocalizedName, stacksize); + } + + public ItemStack getSmallDust(int stacksize){ + return UtilsItems.getItemStackOfAmountFromOreDictNoBroken("dustSmall"+unlocalizedName, stacksize); + } + + public ItemStack getTinyDust(int stacksize){ + return UtilsItems.getItemStackOfAmountFromOreDictNoBroken("dustTiny"+unlocalizedName, stacksize); + } + + public ItemStack[] getValidInputStacks(){ + return UtilsItems.validItemsForOreDict(unlocalizedName); + } + + public ItemStack[] getMaterialComposites(){ + //Utils.LOG_INFO("Something requested the materials needed for "+localizedName); + if (materialInput != null && materialInput.length >= 1){ + ItemStack[] temp = new ItemStack[materialInput.length]; + for (int i=0;i<materialInput.length;i++){ + //Utils.LOG_INFO("i:"+i); + ItemStack testNull = null; + try { + testNull = materialInput[i].getDustStack(); + } catch (Throwable r){ + Utils.LOG_INFO("Failed gathering material stack for "+localizedName+"."); + Utils.LOG_INFO("What Failed: Length:"+materialInput.length+" current:"+i); + } + try { + if (testNull != null){ + //Utils.LOG_INFO("not null"); + temp[i] = materialInput[i].getDustStack(); + } + } catch (Throwable r){ + Utils.LOG_INFO("Failed setting slot "+i+", using "+localizedName); + } + } + return temp; + } + return new ItemStack[]{}; + } + + public int[] getMaterialCompositeStackSizes(){ + if (materialInput != null && materialInput.length >= 1){ + int[] temp = new int[materialInput.length]; + for (int i=0;i<materialInput.length;i++){ + temp[i] = materialInput[i].getDustStack().stackSize; + } + return temp; + } + return new int[]{}; + } + +} diff --git a/src/Java/gtPlusPlus/core/material/MaterialStack.java b/src/Java/gtPlusPlus/core/material/MaterialStack.java new file mode 100644 index 0000000000..f8b9b35bd8 --- /dev/null +++ b/src/Java/gtPlusPlus/core/material/MaterialStack.java @@ -0,0 +1,72 @@ +package gtPlusPlus.core.material; + +import gtPlusPlus.core.util.item.UtilsItems; +import net.minecraft.item.ItemStack; + +public class MaterialStack { + + final Material materialInput; + final double percentageToUse; + + public MaterialStack(Material inputs, double percentage){ + + this.materialInput = inputs; + this.percentageToUse = percentage; + + + } + + public ItemStack getDustStack(){ + int caseStatus = 0; + int amount = 0; + if (percentageToUse >= 0 && percentageToUse <= 0.99){ + caseStatus = 1; + amount = (int) (1/percentageToUse); + //amount = Integer.valueOf(String.valueOf(percentageToUse).charAt(2)); + } + else if (percentageToUse >= 1 && percentageToUse <= 9.99){ + caseStatus = 2; + amount = (int) (percentageToUse); + //amount = Integer.valueOf(String.valueOf(percentageToUse).charAt(0)); + } + else if (percentageToUse >= 10 && percentageToUse <= 99.99){ + caseStatus = 3; + amount = (int) (percentageToUse/10); + //amount = Integer.valueOf(String.valueOf(percentageToUse).charAt(0)); + } + else if (percentageToUse == 100){ + caseStatus = 4; + amount = 10; + } + else { + amount = 0; + } + switch (caseStatus) { + case 1: { + return UtilsItems.getItemStackOfAmountFromOreDictNoBroken("dustTiny"+materialInput.unlocalizedName, amount); + } + case 2: { + return UtilsItems.getItemStackOfAmountFromOreDictNoBroken("dustSmall"+materialInput.unlocalizedName, amount); + } + case 3: { + return UtilsItems.getItemStackOfAmountFromOreDictNoBroken("dust"+materialInput.unlocalizedName, amount); + } + case 4: { + return UtilsItems.getItemStackOfAmountFromOreDictNoBroken("dust"+materialInput.unlocalizedName, amount); + } + default: + return null; + } + + } + + public ItemStack[] getValidItemStacks(){ + return UtilsItems.validItemsForOreDict(materialInput.unlocalizedName); + } + + + + + + +} diff --git a/src/Java/gtPlusPlus/core/proxy/ClientProxy.java b/src/Java/gtPlusPlus/core/proxy/ClientProxy.java index 3019a71266..3b3c257ffa 100644 --- a/src/Java/gtPlusPlus/core/proxy/ClientProxy.java +++ b/src/Java/gtPlusPlus/core/proxy/ClientProxy.java @@ -33,6 +33,7 @@ public class ClientProxy extends CommonProxy{ @Override public void registerRenderThings(){ + //MinecraftForgeClient.registerItemRenderer(ModItems.FluidCell.getItem(), new RenderLiquidCell()); //RenderingRegistry.registerEntityRenderingHandler(EntityBloodSteelMob.class, new RenderBloodSteelMob(new ModelBloodSteelMob(), 0)); //RenderingRegistry.registerEntityRenderingHandler(EntityBloodSteelHostileMob.class, new RenderBloodSteelMobHostile(new ModelBloodSteelMob(), 0)); //RenderingRegistry.registerEntityRenderingHandler(EntityGrenade.class, new RenderSnowball(ModItems.tutGrenade)); diff --git a/src/Java/gtPlusPlus/core/util/Utils.java b/src/Java/gtPlusPlus/core/util/Utils.java index 72c4632df2..42d6dc4ad4 100644 --- a/src/Java/gtPlusPlus/core/util/Utils.java +++ b/src/Java/gtPlusPlus/core/util/Utils.java @@ -213,10 +213,10 @@ public class Utils { /** * - * @param colorStr e.g. "#FFFFFF" + * @param colourStr e.g. "#FFFFFF" * @return String - formatted "rgb(0,0,0)" */ - public static String hex2Rgb(String hexString) { + public static String hex2RgbFormatted(String hexString) { Color c = new Color( Integer.valueOf(hexString.substring(1, 3), 16), Integer.valueOf(hexString.substring(3, 5), 16), @@ -232,6 +232,38 @@ public class Utils { sb.append(")"); return sb.toString(); } + + /** + * + * @param colourStr e.g. "#FFFFFF" + * @return + */ + public static Color hex2Rgb(String colorStr) { + return new Color( + Integer.valueOf( colorStr.substring( 1, 3 ), 16 ), + Integer.valueOf( colorStr.substring( 3, 5 ), 16 ), + Integer.valueOf( colorStr.substring( 5, 7 ), 16 ) ); + } + + /** + * + * @param colourInt e.g. 0XFFFFFF + * @return Colour + */ + public static Color hex2Rgb(int colourInt) { + return Color.decode(String.valueOf(colourInt)); + } + + /** + * + * @param colourInt e.g. 0XFFFFFF + * @return short[] + */ + public static short[] hex2RgbShort(int colourInt) { + Color rgb = Color.decode(String.valueOf(colourInt)); + short[] rgba = {(short) rgb.getRed(), (short) rgb.getGreen(), (short) rgb.getBlue(), (short) rgb.getAlpha()}; + return rgba; + } public static Timer ShortTimer(int seconds) { Timer timer; @@ -259,6 +291,11 @@ public class Utils { List<Object> targetList = new ArrayList<Object>(Arrays.asList(sourceArray)); return targetList; } + + public static List<Object> convertArrayListToList(ArrayList sourceArray) { + List<Object> targetList = new ArrayList<Object>(Arrays.asList(sourceArray)); + return targetList; + } public static EntityPlayer getPlayerOnServerFromUUID(UUID parUUID){ if (parUUID == null) @@ -524,6 +561,7 @@ public class Utils { temp = temp.replace("}", ""); temp = temp.replace("[", ""); temp = temp.replace("]", ""); + temp = temp.replace(" ", ""); output = temp; return output; diff --git a/src/Java/gtPlusPlus/core/util/fluid/FluidUtils.java b/src/Java/gtPlusPlus/core/util/fluid/FluidUtils.java index 53873c6e4e..e576eba8f5 100644 --- a/src/Java/gtPlusPlus/core/util/fluid/FluidUtils.java +++ b/src/Java/gtPlusPlus/core/util/fluid/FluidUtils.java @@ -1,8 +1,20 @@ package gtPlusPlus.core.util.fluid; +import gregtech.api.enums.Dyes; +import gregtech.api.enums.GT_Values; +import gregtech.api.enums.ItemList; +import gregtech.api.util.GT_LanguageManager; +import gtPlusPlus.core.fluids.GenericFluid; +import gtPlusPlus.core.material.Material; import gtPlusPlus.core.util.Utils; +import gtPlusPlus.xmod.gregtech.api.enums.GregtechOrePrefixes.GT_Materials; +import net.minecraft.init.Items; +import net.minecraft.item.ItemStack; +import net.minecraftforge.fluids.Fluid; +import net.minecraftforge.fluids.FluidContainerRegistry; import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.fluids.FluidStack; +import net.minecraftforge.fluids.IFluidContainerItem; public class FluidUtils { @@ -16,7 +28,7 @@ public class FluidUtils { } } - + public static FluidStack[] getFluidStackArray(String fluidName, int amount){ Utils.LOG_WARNING("Trying to get a fluid stack of "+fluidName); try { @@ -28,7 +40,7 @@ public class FluidUtils { } } - + public static FluidStack[] getFluidStackArray(FluidStack fluidName, int amount){ Utils.LOG_WARNING("Trying to get a fluid stack of "+fluidName); try { @@ -41,4 +53,235 @@ public class FluidUtils { } + + /** + * @param String displayName + * @param String fluidName + * @param int meltingPointC Temp + * @param short[] rgba + * @param byte state + * States: 0 (Solid), 1 (Fluid), 2(Gas), 3(Plasma) 4(Fuel I think? Don't use.) + * + * @return short[] + */ + public static Fluid generateFluid(String displayName, String fluidName, int tempK, short[] rgba ,int aState){ + Fluid generatedFluid = null; + switch (aState) { + case 0: { + generatedFluid = new GenericFluid(displayName, fluidName, 0, 100, tempK, 10000, false, rgba); + break; + } + default: + case 1: + case 4: { + generatedFluid = new GenericFluid(displayName, fluidName, 0, 100, tempK, 1000, false, rgba); + break; + } + case 2: { + generatedFluid = new GenericFluid(displayName, fluidName, 0, -100, tempK, 200, true, rgba); + break; + } + case 3: { + generatedFluid = new GenericFluid(displayName, fluidName, 15, -10000, tempK, 10, true, rgba); + break; + } + } + return generatedFluid; + } + /** + * + * @param String fluidName + * @param int meltingPointC Temp + * @param short[] rgba + * @param byte state + * States: 0 (Solid), 1 (Fluid), 2(Gas), 3(Plasma) 4(Fuel I think? Don't use.) + * + * @return short[] + */ + public static Fluid generateFluid(Material material ,int aState){ + int tempK = material.getMeltingPoint_C(); + Fluid generatedFluid = null; + switch (aState) { + case 0: { + generatedFluid = new GenericFluid(material, 0, 100, tempK, 10000, false); + break; + } + default: + case 1: + case 4: { + generatedFluid = new GenericFluid(material, 0, 100, tempK, 1000, false); + break; + } + case 2: { + generatedFluid = new GenericFluid(material, 0, -100, tempK, 200, true); + break; + } + case 3: { + generatedFluid = new GenericFluid(material, 15, -10000, tempK, 10, true); + break; + } + } + return generatedFluid; + } + + + public static Fluid addAutogeneratedMoltenFluid(String materialNameFormatted, short[] rgba, int MeltingPoint) { + return addFluid("molten." + materialNameFormatted.toLowerCase(), "molten.autogenerated", "Molten " + materialNameFormatted, null, rgba, 1, (MeltingPoint <= 0L) ? 1000L : MeltingPoint, null, null, 0); + } + + public static Fluid addAutogeneratedMoltenFluid(final GT_Materials aMaterial) { + return addFluid("molten." + aMaterial.name().toLowerCase(), "molten.autogenerated", "Molten " + aMaterial.name(), aMaterial, aMaterial.mMoltenRGBa, 1, (aMaterial.mMeltingPoint <= 0L) ? 1000L : aMaterial.mMeltingPoint, null, null, 0); + } + + public static Fluid addFluid(final String aName, final String aLocalized, final GT_Materials aMaterial, final int aState, final long aTemperatureK) { + return addFluid(aName, aLocalized, aMaterial, aState, aTemperatureK, null, null, 0); + } + + public static Fluid addFluid(final String aName, final String aLocalized, final GT_Materials aMaterial, final int aState, final long aTemperatureK, final ItemStack aFullContainer, final ItemStack aEmptyContainer, final int aFluidAmount) { + return addFluid(aName, aName.toLowerCase(), aLocalized, aMaterial, null, aState, aTemperatureK, aFullContainer, aEmptyContainer, aFluidAmount); + } + + public static Fluid addFluid(String aName, final String aTexture, final String aLocalized, final GT_Materials aMaterial, final short[] aRGBa, final int aState, final long aTemperatureK, final ItemStack aFullContainer, final ItemStack aEmptyContainer, final int aFluidAmount) { + aName = Utils.sanitizeString(aName.toLowerCase()); + Fluid rFluid = new FluidGT6(aName, aTexture, (aRGBa != null) ? aRGBa : Dyes._NULL.getRGBA()); + GT_LanguageManager.addStringLocalization(rFluid.getUnlocalizedName(), (aLocalized == null) ? aName : aLocalized); + if (FluidRegistry.registerFluid(rFluid)) { + switch (aState) { + case 0: { + rFluid.setGaseous(false); + rFluid.setViscosity(10000); + break; + } + case 1: + case 4: { + rFluid.setGaseous(false); + rFluid.setViscosity(1000); + break; + } + case 2: { + rFluid.setGaseous(true); + rFluid.setDensity(-100); + rFluid.setViscosity(200); + break; + } + case 3: { + rFluid.setGaseous(true); + rFluid.setDensity(-10000); + rFluid.setViscosity(10); + rFluid.setLuminosity(15); + break; + } + } + } + else { + rFluid = FluidRegistry.getFluid(aName); + } + if (rFluid.getTemperature() == new Fluid("test").getTemperature() || rFluid.getTemperature() <= 0) { + rFluid.setTemperature((int) (aTemperatureK)); + } + if (aMaterial != null) { + switch (aState) { + case 1: { + aMaterial.mFluid = (rFluid); + break; + } + case 2: { + aMaterial.mGas = (rFluid); + break; + } + case 3: { + aMaterial.mPlasma = (rFluid); + break; + } + } + } + if (aFullContainer != null && aEmptyContainer != null && !FluidContainerRegistry.registerFluidContainer(new FluidStack(rFluid, aFluidAmount), aFullContainer, aEmptyContainer)) { + GT_Values.RA.addFluidCannerRecipe(aFullContainer, container(aFullContainer, false), null, new FluidStack(rFluid, aFluidAmount)); + } + return rFluid; + } + + public static boolean valid(final Object aStack) { + return aStack != null && aStack instanceof ItemStack && ((ItemStack)aStack).getItem() != null && ((ItemStack)aStack).stackSize >= 0; + } + + public static boolean invalid(final Object aStack) { + return aStack == null || !(aStack instanceof ItemStack) || ((ItemStack)aStack).getItem() == null || ((ItemStack)aStack).stackSize < 0; + } + + public static boolean equal(final ItemStack aStack1, final ItemStack aStack2) { + return equal(aStack1, aStack2, false); + } + + public static boolean equal(final ItemStack aStack1, final ItemStack aStack2, final boolean aIgnoreNBT) { + return aStack1 != null && aStack2 != null && equal_(aStack1, aStack2, aIgnoreNBT); + } + + public static boolean equal_(final ItemStack aStack1, final ItemStack aStack2, final boolean aIgnoreNBT) { + return aStack1.getItem() == aStack2.getItem() && (aIgnoreNBT || (aStack1.getTagCompound() == null == (aStack2.getTagCompound() == null) && (aStack1.getTagCompound() == null || aStack1.getTagCompound().equals((Object)aStack2.getTagCompound())))) && (meta(aStack1) == meta(aStack2) || meta(aStack1) == 32767 || meta(aStack2) == 32767); + } + + public static ItemStack copy(final Object... aStacks) { + for (final Object tStack : aStacks) { + if (valid(tStack)) { + return ((ItemStack)tStack).copy(); + } + } + return null; + } + + public static ItemStack copyMeta(final long aMetaData, final Object... aStacks) { + final ItemStack rStack = copy(aStacks); + if (invalid(rStack)) { + return null; + } + return meta(rStack, aMetaData); + } + + public static short meta(final ItemStack aStack) { + return (short)Items.feather.getDamage(aStack); + } + + public static ItemStack meta(final ItemStack aStack, final long aMeta) { + Items.feather.setDamage(aStack, (int)(short)aMeta); + return aStack; + } + + public static ItemStack amount(final long aAmount, final Object... aStacks) { + final ItemStack rStack = copy(aStacks); + if (invalid(rStack)) { + return null; + } + rStack.stackSize = (int)aAmount; + return rStack; + } + + public static ItemStack container(final ItemStack aStack, final boolean aCheckIFluidContainerItems) { + if (invalid(aStack)) { + return null; + } + if (aStack.getItem().hasContainerItem(aStack)) { + return aStack.getItem().getContainerItem(aStack); + } + if (equal(aStack, ItemList.Cell_Empty.get(1), true)) { + return null; + } + if (aCheckIFluidContainerItems && aStack.getItem() instanceof IFluidContainerItem && ((IFluidContainerItem)aStack.getItem()).getCapacity(aStack) > 0) { + final ItemStack tStack = amount(1L, aStack); + ((IFluidContainerItem)aStack.getItem()).drain(tStack, Integer.MAX_VALUE, true); + if (!equal(aStack, tStack)) { + return tStack; + } + return null; + } + if (equal(aStack, ItemList.IC2_ForgeHammer.get(1)) || equal(aStack, ItemList.IC2_WireCutter.get(1))) { + return copyMeta(meta(aStack) + 1, aStack); + } + return null; + } + + public static ItemStack container(final ItemStack aStack, final boolean aCheckIFluidContainerItems, final int aStacksize) { + return amount(aStacksize, container(aStack, aCheckIFluidContainerItems)); + } + } diff --git a/src/Java/gtPlusPlus/core/util/item/UtilsItems.java b/src/Java/gtPlusPlus/core/util/item/UtilsItems.java index d68174f7bb..7a70b41f96 100644 --- a/src/Java/gtPlusPlus/core/util/item/UtilsItems.java +++ b/src/Java/gtPlusPlus/core/util/item/UtilsItems.java @@ -22,11 +22,14 @@ import gtPlusPlus.core.item.base.screws.BaseItemScrew; import gtPlusPlus.core.item.tool.staballoy.MultiPickaxeBase; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.lib.LoadedMods; -import gtPlusPlus.core.lib.MaterialInfo; +import gtPlusPlus.core.material.Material; import gtPlusPlus.core.util.Utils; +import gtPlusPlus.core.util.fluid.FluidUtils; +import gtPlusPlus.core.util.materials.MaterialUtils; import gtPlusPlus.core.util.wrapper.var; import java.util.ArrayList; +import java.util.List; import net.minecraft.block.Block; import net.minecraft.client.Minecraft; @@ -39,34 +42,9 @@ import cpw.mods.fml.common.registry.GameRegistry; public class UtilsItems { - public static ItemStack getItemStackOfItem(Boolean modToCheck, String mod_itemname_meta){ - if (modToCheck){ - try{ - Item em = null; - - Item em1 = getItem(mod_itemname_meta); - Utils.LOG_WARNING("Found: "+em1.toString()); - if (em1 != null){ - em = em1; - } - if (em != null ){ - ItemStack returnStack = new ItemStack(em,1); - return returnStack; - } - Utils.LOG_WARNING(mod_itemname_meta+" not found."); - return null; - } catch (NullPointerException e) { - Utils.LOG_ERROR(mod_itemname_meta+" not found. [NULL]"); - return null; - } - } - return null; - } - public static ItemStack getSimpleStack(Item x){ return getSimpleStack(x, 1); } - public static ItemStack getSimpleStack(Item x, int i){ try { ItemStack r = new ItemStack(x, i); @@ -75,7 +53,6 @@ public class UtilsItems { return null; } } - public static ItemStack getSimpleStack(ItemStack x, int i){ try { ItemStack r = x.copy(); @@ -252,6 +229,16 @@ public class UtilsItems { Item itemSpawnEgg = new BasicSpawnEgg(entityModID, parSpawnName, colourEgg, colourOverlay).setUnlocalizedName("spawn_egg_"+parSpawnName.toLowerCase()).setTextureName(CORE.MODID+":spawn_egg"); GameRegistry.registerItem(itemSpawnEgg, "spawnEgg"+parSpawnName); } + + + public static ItemStack[] validItemsForOreDict(String oredictName){ + List<?> validNames = MaterialUtils.oreDictValuesForEntry(oredictName); + ItemStack[] inputs = null; + for (int i=0; i<validNames.size();i++){ + inputs[i] = (ItemStack) validNames.get(i); + } + return inputs; + } public static ItemStack getItemStackOfAmountFromOreDict(String oredictName, int amount){ ArrayList<ItemStack> oreDictList = OreDictionary.getOres(oredictName); @@ -269,25 +256,30 @@ public class UtilsItems { if (returnValue.getItem().getClass() != ModItems.AAA_Broken.getClass() || returnValue.getItem() != ModItems.AAA_Broken){ return returnValue; } - + Utils.LOG_INFO(oredictName+" was not valid."); return null; } - public static void generateItemsFromMaterial(String unlocalizedName, String materialName, int materialTier, MaterialInfo matInfo, int Colour, boolean hotIngot){ + public static void generateItemsFromMaterial(Material matInfo){ + + String unlocalizedName = matInfo.getUnlocalizedName(); + String materialName = matInfo.getLocalizedName(); + short[] C = matInfo.getRGBA(); + int Colour = Utils.rgbtoHexValue(C[0], C[1], C[2]); + boolean hotIngot = matInfo.requiresBlastFurnace(); + int materialTier = 0; //TODO + if (materialTier > 10 || materialTier <= 0){ materialTier = 2; } - int sRadiation = 0; - if (materialName.toLowerCase().contains("uranium")){ - sRadiation = 2; - } - else if (materialName.toLowerCase().contains("plutonium")){ - sRadiation = 4; - } - else if (materialName.toLowerCase().contains("thorium")){ - sRadiation = 1; + + + int sRadiation = 0; + if (isRadioactive(materialName)){ + sRadiation = getRadioactivityLevel(materialName); } + if (sRadiation >= 1){ Item temp; Block tempBlock; @@ -326,11 +318,13 @@ public class UtilsItems { temp = new BaseItemScrew("itemScrew"+unlocalizedName, materialName, Colour, materialTier); temp = new BaseItemRotor("itemRotor"+unlocalizedName, materialName, Colour); temp = new BaseItemGear("itemGear"+unlocalizedName, materialName, Colour, materialTier); - } + } + + FluidUtils.generateFluid(matInfo, 1); } - public static Item[] generateDusts(String unlocalizedName, String materialName, int materialTier, MaterialInfo matInfo, int Colour, boolean hotIngot){ + public static Item[] generateDusts(String unlocalizedName, String materialName, int materialTier, Material matInfo, int Colour, boolean hotIngot){ int radioactive = getRadioactivityLevel(materialName); Item[] output = { new BaseItemDust("itemDust"+unlocalizedName, materialName, matInfo, Colour, "Dust", hotIngot, materialTier, radioactive), @@ -420,6 +414,17 @@ public class UtilsItems { } + public static String[] getArrayStackNamesAsArray(ItemStack[] aStack){ + String[] itemNames = {}; + int arpos = 0; + for (ItemStack alph : aStack){ + itemNames[arpos] = alph.getDisplayName(); + arpos++; + } + return itemNames; + + } + public static String getFluidArrayStackNames(FluidStack[] aStack){ String itemNames = "Fluid Array: "; for (FluidStack alph : aStack){ diff --git a/src/Java/gtPlusPlus/core/util/materials/MaterialUtils.java b/src/Java/gtPlusPlus/core/util/materials/MaterialUtils.java index 69548eb49a..0eae02d827 100644 --- a/src/Java/gtPlusPlus/core/util/materials/MaterialUtils.java +++ b/src/Java/gtPlusPlus/core/util/materials/MaterialUtils.java @@ -5,12 +5,15 @@ import gregtech.api.enums.Materials; import gregtech.api.enums.TC_Aspects.TC_AspectStack; import gregtech.api.enums.TextureSet; import gregtech.api.objects.MaterialStack; -import gtPlusPlus.core.lib.MaterialInfo; +import gtPlusPlus.core.material.Material; import gtPlusPlus.core.util.Utils; +import java.util.ArrayList; import java.util.List; +import net.minecraft.item.ItemStack; import net.minecraftforge.common.util.EnumHelper; +import net.minecraftforge.oredict.OreDictionary; public class MaterialUtils { @@ -31,6 +34,27 @@ public class MaterialUtils { aColor, aExtraData, aMaterialList, aAspects); } + public static List<?> oreDictValuesForEntry(String oredictName){ + List<?> oredictItemNames; + if(OreDictionary.doesOreNameExist(oredictName)){ + ArrayList<ItemStack> oredictItems = OreDictionary.getOres(oredictName); + oredictItemNames = Utils.convertArrayListToList(oredictItems); + return oredictItemNames; + } + return null; + } + + public static Material generateMaterialFromGtENUM(Materials material){ + String name = material.name(); + short[] rgba = material.mRGBa; + int melting = material.mMeltingPoint; + int boiling = material.mBlastFurnaceTemp; + long protons = material.getProtons(); + long neutrons = material.getNeutrons(); + boolean blastFurnace = material.mBlastFurnaceRequired; + return new Material(name, rgba, melting, boiling, protons, neutrons, blastFurnace, null); + } + /* * That's shown, many times, in the EnumHelper code, all the add functions just wrap the addEnum function. @@ -50,7 +74,7 @@ public class MaterialUtils { - public static Materials GenerateGtMaterialForSingleUse(MaterialInfo s){ + /*public static Materials GenerateGtMaterialForSingleUse(MaterialInfo s){ Materials yourName = EnumHelper.addEnum( @@ -66,10 +90,10 @@ public class MaterialUtils { - /*Class<? extends ItemCell> clz = item.getClass(); + Class<? extends ItemCell> clz = item.getClass(); Method methode = clz.getDeclaredMethod("addCell", int.class, InternalName.class, Block[].class); methode.setAccessible(true); - ItemStack temp = (ItemStack) methode.invoke(item, cellID++, yourName, new Block[0]);*/ + ItemStack temp = (ItemStack) methode.invoke(item, cellID++, yourName, new Block[0]); @@ -82,6 +106,6 @@ public class MaterialUtils { e.printStackTrace(); } return null; - } + }*/ } |