From 2855aaffb538f5dae1fcbbbd051bfb4e3a5951c8 Mon Sep 17 00:00:00 2001 From: Alkalus <3060479+draknyte1@users.noreply.github.com> Date: Thu, 1 Nov 2018 14:58:08 +0000 Subject: + Added new Radioactive ore. + Added Custom Nuclear Texture Set. % More material work. $ Fixed issue allowing Multiblocks to have > 1 Control Core Hatch. $ Fixed Broken Ore texture for ENRICHED TextureSet. $ Fixed a few fluid recipes broken in the refactor. --- .../gtPlusPlus/core/block/base/BasicBlock.java | 4 +- .../core/block/base/BlockBaseModular.java | 8 +- .../gtPlusPlus/core/block/base/BlockBaseOre.java | 7 +- .../gtPlusPlus/core/client/CustomTextureSet.java | 3 +- src/Java/gtPlusPlus/core/item/ModItems.java | 4 +- .../core/item/base/BaseItemComponent.java | 8 +- .../core/item/base/itemblock/ItemBlockGtBlock.java | 108 +++-- .../core/item/base/itemblock/ItemBlockOre.java | 26 +- src/Java/gtPlusPlus/core/material/ALLOY.java | 42 +- src/Java/gtPlusPlus/core/material/ELEMENT.java | 55 +-- src/Java/gtPlusPlus/core/material/Material.java | 221 +++++---- src/Java/gtPlusPlus/core/material/ORES.java | 509 +++++++++++++-------- .../core/material/nuclear/FLUORIDES.java | 148 +++--- .../gtPlusPlus/core/material/nuclear/NUCLIDE.java | 30 +- .../gtPlusPlus/core/recipe/RECIPES_GREGTECH.java | 20 +- src/Java/gtPlusPlus/core/util/Utils.java | 28 +- src/Java/gtPlusPlus/core/util/math/MathUtils.java | 270 +++++++++-- .../gtPlusPlus/core/util/minecraft/ItemUtils.java | 13 + .../core/util/minecraft/MaterialUtils.java | 270 ++++++++--- 19 files changed, 1171 insertions(+), 603 deletions(-) (limited to 'src/Java/gtPlusPlus/core') diff --git a/src/Java/gtPlusPlus/core/block/base/BasicBlock.java b/src/Java/gtPlusPlus/core/block/base/BasicBlock.java index 34da346ff2..6014388cda 100644 --- a/src/Java/gtPlusPlus/core/block/base/BasicBlock.java +++ b/src/Java/gtPlusPlus/core/block/base/BasicBlock.java @@ -29,10 +29,10 @@ public class BasicBlock extends BlockContainer { this.setBlockTextureName(CORE.MODID + ":" + unlocalizedName); } - this.setCreativeTab(AddToCreativeTab.tabBlock); - this.setHardness(2.0F); + this.setCreativeTab(AddToCreativeTab.tabBlock); this.setResistance(6.0F); this.setLightLevel(0.0F); + this.setHardness(1.0f*harvestLevel); this.setHarvestLevel("pickaxe", harvestLevel); this.setStepSound(soundTypeMetal); } diff --git a/src/Java/gtPlusPlus/core/block/base/BlockBaseModular.java b/src/Java/gtPlusPlus/core/block/base/BlockBaseModular.java index 634dc4c022..b089688193 100644 --- a/src/Java/gtPlusPlus/core/block/base/BlockBaseModular.java +++ b/src/Java/gtPlusPlus/core/block/base/BlockBaseModular.java @@ -32,14 +32,14 @@ public class BlockBaseModular extends BasicBlock { public BlockBaseModular(final Material material, final BlockTypes blockType, final int colour) { this(material.getUnlocalizedName(), material.getLocalizedName(), net.minecraft.block.material.Material.iron, - blockType, colour, Math.min(Math.max(material.vTier, 1), 5)); + blockType, colour, Math.min(Math.max(material.vTier, 1), 6)); blockMaterial = material; } protected BlockBaseModular(final String unlocalizedName, final String blockMaterial, final net.minecraft.block.material.Material vanillaMaterial, final BlockTypes blockType, final int colour, final int miningLevel) { - super(unlocalizedName, vanillaMaterial); + super(blockType, unlocalizedName, vanillaMaterial, miningLevel); this.setHarvestLevel(blockType.getHarvestTool(), miningLevel); this.setBlockTextureName(CORE.MODID + ":" + blockType.getTexture()); this.blockColour = colour; @@ -130,8 +130,8 @@ public class BlockBaseModular extends BasicBlock { } metType = (metType.equals("9j4852jyo3rjmh3owlhw9oe") ? "METALLIC" : metType); int tier = this.blockMaterial.vTier; - String aType = (this.thisBlock == BlockTypes.FRAME) ? "frameGt" : (tier < 3 ? "block1" : tier < 6 ? "block6" : "block5"); - this.blockIcon = iIcon.registerIcon("gregtech" + ":" + "materialicons/"+ "METALLIC" +"/" + aType); + String aType = (this.thisBlock == BlockTypes.FRAME) ? "frameGt" : (tier <= 4 ? "block1" : "block5"); + this.blockIcon = iIcon.registerIcon("gregtech" + ":" + "materialicons/"+ metType +"/" + aType); } @Override diff --git a/src/Java/gtPlusPlus/core/block/base/BlockBaseOre.java b/src/Java/gtPlusPlus/core/block/base/BlockBaseOre.java index 526f2b245c..4d7478dbdd 100644 --- a/src/Java/gtPlusPlus/core/block/base/BlockBaseOre.java +++ b/src/Java/gtPlusPlus/core/block/base/BlockBaseOre.java @@ -30,12 +30,13 @@ public class BlockBaseOre extends BasicBlock implements ITexturedBlock { private final Material blockMaterial; public BlockBaseOre(final Material material, final BlockTypes blockType, final int colour) { - super(blockType, Utils.sanitizeString(material.getUnlocalizedName()), net.minecraft.block.material.Material.rock); + super(blockType, Utils.sanitizeString(material.getUnlocalizedName()), net.minecraft.block.material.Material.rock, Math.min(Math.max(material.vTier, 1), 6)); + int aMaterialTierForMining = Math.min(Math.max(material.vTier, 1), 6); this.blockMaterial = material; - this.setHardness(2.0f); + this.setHardness(1.0f*aMaterialTierForMining); this.setResistance(6.0F); this.setLightLevel(0.0F); - this.setHarvestLevel("pickaxe", Math.min(Math.max(material.vTier, 1), 5)); + this.setHarvestLevel("pickaxe", aMaterialTierForMining); this.setStepSound(soundTypeStone); this.setBlockName("Ore"+Utils.sanitizeString(Utils.sanitizeString(material.getUnlocalizedName()))); this.setBlockTextureName("stone"); diff --git a/src/Java/gtPlusPlus/core/client/CustomTextureSet.java b/src/Java/gtPlusPlus/core/client/CustomTextureSet.java index d7bbecd6c7..400503b2fa 100644 --- a/src/Java/gtPlusPlus/core/client/CustomTextureSet.java +++ b/src/Java/gtPlusPlus/core/client/CustomTextureSet.java @@ -8,7 +8,8 @@ public class CustomTextureSet extends TextureSet { REFINED(), GEM_A(), - ENRICHED(); + ENRICHED(), + NUCLEAR; private final CustomTextureSet A; diff --git a/src/Java/gtPlusPlus/core/item/ModItems.java b/src/Java/gtPlusPlus/core/item/ModItems.java index 0e21e9b154..c86c10bb53 100644 --- a/src/Java/gtPlusPlus/core/item/ModItems.java +++ b/src/Java/gtPlusPlus/core/item/ModItems.java @@ -280,6 +280,8 @@ public final class ModItems { public static ItemStack itemHotTitaniumIngot; + public static Fluid fluidZrF4; + static { Logger.INFO("Items!"); //Default item used when recipes fail, handy for debugging. Let's make sure they exist when this class is called upon. @@ -621,7 +623,7 @@ public final class ModItems { //Zirconium Tetrafluoride GT_OreDictUnificator.registerOre("cellZrF4", ItemUtils.getItemStackOfAmountFromOreDict("cellZirconiumTetrafluoride", 1)); GT_OreDictUnificator.registerOre("dustZrF4", ItemUtils.getItemStackOfAmountFromOreDict("dustZirconiumTetrafluoride", 1)); - FluidUtils.generateFluidNoPrefix("ZirconiumTetrafluoride", "Zirconium Tetrafluoride", 500, new short[]{170, 170, 140, 100}); //https://en.wikipedia.org/wiki/Zirconium_tetrafluoride + fluidZrF4 = FluidUtils.generateFluidNoPrefix("ZirconiumTetrafluoride", "Zirconium Tetrafluoride", 500, new short[]{170, 170, 140, 100}); //https://en.wikipedia.org/wiki/Zirconium_tetrafluoride //Coolant Salt //NaBF4 - NaF - 621C diff --git a/src/Java/gtPlusPlus/core/item/base/BaseItemComponent.java b/src/Java/gtPlusPlus/core/item/base/BaseItemComponent.java index ea0a2bb5eb..b07815fa60 100644 --- a/src/Java/gtPlusPlus/core/item/base/BaseItemComponent.java +++ b/src/Java/gtPlusPlus/core/item/base/BaseItemComponent.java @@ -97,14 +97,14 @@ public class BaseItemComponent extends Item{ return false; } //Register Component - Map aMap = Material.mComponentMap.get(componentMaterial.getUnlocalizedName()); + Map aMap = Material.mComponentMap.get(componentMaterial.getUnlocalizedName()); if (aMap == null) { - aMap = new HashMap(); + aMap = new HashMap(); } String aKey = componentType.getGtOrePrefix().name(); - BaseItemComponent x = aMap.get(aKey); + ItemStack x = aMap.get(aKey); if (x == null) { - aMap.put(aKey, this); + aMap.put(aKey, ItemUtils.getSimpleStack(this)); Material.mComponentMap.put(componentMaterial.getUnlocalizedName(), aMap); return true; } diff --git a/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockGtBlock.java b/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockGtBlock.java index 56d2aabdba..517e3f7c1f 100644 --- a/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockGtBlock.java +++ b/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockGtBlock.java @@ -18,12 +18,12 @@ import gtPlusPlus.core.material.MaterialStack; import gtPlusPlus.core.util.minecraft.EntityUtils; import gtPlusPlus.core.util.sys.KeyboardUtils; -public class ItemBlockGtBlock extends ItemBlock{ +public class ItemBlockGtBlock extends ItemBlock { protected final int blockColour; - protected final int sRadiation; + private int sRadiation; - private final Material mMaterial; + private Material mMaterial; private final Block thisBlock; private boolean isOre = false; @@ -32,46 +32,23 @@ public class ItemBlockGtBlock extends ItemBlock{ public ItemBlockGtBlock(final Block block) { super(block); this.thisBlock = block; - if (block instanceof BlockBaseOre){ + if (block instanceof BlockBaseOre) { this.isOre = true; - } - else if (block instanceof BlockBaseModular) { + } else if (block instanceof BlockBaseModular) { this.isModular = true; } - else { - - } - if (!isModular && !isOre) { - mMaterial = null; - } - else { - if (isOre) { - mMaterial = ((BlockBaseOre) block).getMaterialEx(); - } - else { - mMaterial = ((BlockBaseModular) block).getMaterialEx(); - } - } - final BlockBaseModular baseBlock = (BlockBaseModular) block; if (isModular) { this.blockColour = baseBlock.getRenderColor(0); - } - else if (isOre) { + } else if (isOre) { this.blockColour = block.getBlockColor(); - } - else { + } else { this.blockColour = block.getBlockColor(); } - if (this.mMaterial != null) { - this.sRadiation = mMaterial.vRadiationLevel; - } - else { - this.sRadiation = 0; - } - - - //GT_OreDictUnificator.registerOre("block"+block.getUnlocalizedName().replace("tile.block", "").replace("tile.", "").replace("of", "").replace("Of", "").replace("Block", "").replace("-", "").replace("_", "").replace(" ", ""), ItemUtils.getSimpleStack(this)); + // GT_OreDictUnificator.registerOre("block"+block.getUnlocalizedName().replace("tile.block", + // "").replace("tile.", "").replace("of", "").replace("Of", "").replace("Block", + // "").replace("-", "").replace("_", "").replace(" ", ""), + // ItemUtils.getSimpleStack(this)); } public int getRenderColor(final int aMeta) { @@ -80,45 +57,66 @@ public class ItemBlockGtBlock extends ItemBlock{ @Override public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) { - - if (this.mMaterial != null){ - list.add(this.mMaterial.vChemicalFormula); - } - - if (this.sRadiation > 0){ - list.add(CORE.GT_Tooltip_Radioactive); + + if (this.mMaterial != null) { + list.add(this.mMaterial.vChemicalFormula); + if (this.mMaterial.vRadiationLevel > 0) { + list.add(CORE.GT_Tooltip_Radioactive); + } + } else { + list.add("Material is Null."); } - + if (KeyboardUtils.isCtrlKeyDown()) { Block b = Block.getBlockFromItem(stack.getItem()); if (b != null) { - + String aTool = b.getHarvestTool(stack.getItemDamage()); int aMiningLevel1 = b.getHarvestLevel(stack.getItemDamage()); - list.add("Mining Level: "+Math.min(Math.max(aMiningLevel1, 0), 5)); - + list.add("Mining Level: " + Math.min(Math.max(aMiningLevel1, 0), 5)); + if (this.mMaterial != null) { - list.add("Ore contains: "); + list.add("Ore contains: "); if (mMaterial.getComposites().isEmpty()) { - list.add("- "+mMaterial.getLocalizedName()); - } - else { + list.add("- " + mMaterial.getLocalizedName()); + } else { for (MaterialStack m : mMaterial.getComposites()) { - list.add("- "+m.getStackMaterial().getLocalizedName()+" x"+m.getPartsPerOneHundred()); + list.add("- " + m.getStackMaterial().getLocalizedName() + " x" + m.getPartsPerOneHundred()); } } } } - } - else { - list.add(EnumChatFormatting.DARK_GRAY+"Hold Ctrl to show additional info."); + } else { + list.add(EnumChatFormatting.DARK_GRAY + "Hold Ctrl to show additional info."); } super.addInformation(stack, aPlayer, list, bool); } @Override - public void onUpdate(final ItemStack iStack, final World world, final Entity entityHolding, final int p_77663_4_, final boolean p_77663_5_) { - EntityUtils.applyRadiationDamageToEntity(iStack.stackSize, this.sRadiation, world, entityHolding); + public void onUpdate(final ItemStack iStack, final World world, final Entity entityHolding, final int p_77663_4_, + final boolean p_77663_5_) { + + if (!isModular && !isOre) { + mMaterial = null; + } else { + if (this.mMaterial == null) { + Block b = Block.getBlockFromItem(iStack.getItem()); + if (isOre) { + mMaterial = ((BlockBaseOre) b).getMaterialEx(); + } else { + mMaterial = ((BlockBaseModular) b).getMaterialEx(); + } + if (mMaterial != null) { + this.sRadiation = mMaterial.vRadiationLevel; + } else { + this.sRadiation = 0; + } + } + if (this.sRadiation > 0) { + EntityUtils.applyRadiationDamageToEntity(iStack.stackSize, this.sRadiation, world, entityHolding); + } + } + } } diff --git a/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockOre.java b/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockOre.java index 791d861414..e4079521d4 100644 --- a/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockOre.java +++ b/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockOre.java @@ -57,12 +57,7 @@ public class ItemBlockOre extends ItemBlock{ @Override public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) { - if (!mInitOres_Everglades || mMapOreBlockItemToDimName.size() == 0 || (aPlayer != null ? aPlayer.worldObj.getWorldTime() % 200 == 0 : false)) { - - //mMapOreBlockItemToDimName.clear(); - mDimsForThisOre.clear(); - - + if (!mInitOres_Everglades) { for (WorldGen_GT_Ore_Layer f : gtPlusPlus.everglades.gen.gt.WorldGen_Ores.validOreveins.values()) { Material[] m2 = new Material[] {f.mPrimary, f.mSecondary, f.mBetween, f.mSporadic}; for (Material m1 : m2) { @@ -70,8 +65,9 @@ public class ItemBlockOre extends ItemBlock{ if (aMap == null) { aMap = new AutoMap(); } - if (!aMap.containsValue("Everglades")) { - aMap.put("Everglades"); + String aDimName = "Everglades"; + if (!aMap.containsValue(aDimName)) { + aMap.put(aDimName); } mMapOreBlockItemToDimName.put(m1.getUnlocalizedName().toLowerCase(), aMap); } @@ -120,21 +116,21 @@ public class ItemBlockOre extends ItemBlock{ } if (mDimsForThisOre.isEmpty()) { - AutoMap A = mMapOreBlockItemToDimName.get(this.mThisMaterial.getUnlocalizedName().toLowerCase()); + AutoMap A = mMapOreBlockItemToDimName.get(this.mThisMaterial.getUnlocalizedName().toLowerCase()); if (A != null) { mDimsForThisOre = A; - } - else { - mDimsForThisOre.put("Unknown"); - } + } } - + + list.add("Found: "); if (!mDimsForThisOre.isEmpty()) { - list.add("Found: "); for (String m : mDimsForThisOre) { list.add("- "+m); } } + else { + list.add("- Unknown"); + } } else { diff --git a/src/Java/gtPlusPlus/core/material/ALLOY.java b/src/Java/gtPlusPlus/core/material/ALLOY.java index 53f778455c..f52856b824 100644 --- a/src/Java/gtPlusPlus/core/material/ALLOY.java +++ b/src/Java/gtPlusPlus/core/material/ALLOY.java @@ -212,7 +212,7 @@ public final class ALLOY { public static final Material MARAGING250 = new Material( "Maraging Steel 250", //Material Name MaterialState.SOLID, //State - new short[]{140, 140, 140, 0}, //Material Colour + null, //Material Colour 2413, //Melting Point in C 4555, -1, @@ -230,7 +230,7 @@ public final class ALLOY { public static final Material MARAGING300 = new Material( "Maraging Steel 300", //Material Name MaterialState.SOLID, //State - new short[]{150, 150, 150, 0}, //Material Colour + null, //Material Colour 2413, //Melting Point in C 4555, -1, @@ -248,7 +248,7 @@ public final class ALLOY { public static final Material MARAGING350 = new Material( "Maraging Steel 350", //Material Name MaterialState.SOLID, //State - new short[]{160, 160, 160, 0}, //Material Colour + null, //Material Colour 2413, //Melting Point in C 4555, -1, @@ -266,7 +266,7 @@ public final class ALLOY { public static final Material STELLITE = new Material( "Stellite", //Material Name MaterialState.SOLID, //State - new short[]{129, 75, 120, 0}, //Material Colour + null, //Material Colour 4310, //Melting Point in C 6250, -1, @@ -283,7 +283,7 @@ public final class ALLOY { public static final Material TALONITE = new Material( "Talonite", //Material Name MaterialState.SOLID, //State - new short[]{228, 75, 120, 0}, //Material Colour + null, //Material Colour 3454, //Melting Point in C 5500, -1, @@ -300,7 +300,7 @@ public final class ALLOY { public static final Material HASTELLOY_W = new Material( "Hastelloy-W", //Material Name MaterialState.SOLID, //State - new short[]{218, 165, 32, 0}, //Material Colour + null, //Material Colour 3350, //Melting Point in C 5755, -1, @@ -318,7 +318,7 @@ public final class ALLOY { public static final Material HASTELLOY_X = new Material( "Hastelloy-X", //Material Name MaterialState.SOLID, //State - new short[]{255, 193, 37, 0}, //Material Colour + null, //Material Colour 3350, //Melting Point in C 5755, -1, @@ -337,7 +337,7 @@ public final class ALLOY { public static final Material HASTELLOY_N = new Material( "Hastelloy-N", //Material Name MaterialState.SOLID, //State - new short[]{236, 213, 48, 0}, //Material Colour + null, //Material Colour 4350, //Melting Point in C 6875, -1, @@ -355,7 +355,7 @@ public final class ALLOY { public static final Material HASTELLOY_C276 = new Material( "Hastelloy-C276", //Material Name MaterialState.SOLID, //State - new short[]{238, 180, 34, 0}, //Material Colour + null, //Material Colour 4350, //Melting Point in C 6520, -1, @@ -374,7 +374,7 @@ public final class ALLOY { public static final Material INCOLOY_020 = new Material( "Incoloy-020", //Material Name MaterialState.SOLID, //State - new short[]{101, 81, 71, 0}, //Material Colour + null, //Material Colour 3425, //Melting Point in C 5420, -1, @@ -391,7 +391,7 @@ public final class ALLOY { public static final Material INCOLOY_DS = new Material( "Incoloy-DS", //Material Name MaterialState.SOLID, //State - new short[]{71, 101, 81, 0}, //Material Colour + null, //Material Colour 3425, //Melting Point in C 5420, -1, @@ -408,7 +408,7 @@ public final class ALLOY { public static final Material INCOLOY_MA956 = new Material( "Incoloy-MA956", //Material Name MaterialState.SOLID, //State - new short[]{81, 71, 101, 0}, //Material Colour + null, //Material Colour 4425, //Melting Point in C 6875, -1, @@ -523,7 +523,7 @@ public final class ALLOY { public static final Material EGLIN_STEEL_BASE = new Material( "Eglin Steel Base Compound", //Material Name MaterialState.SOLID, //State - new short[]{139,69,19, 0}, //Material Colour + null, //Material Colour -1, //Melting Point in C -1, //Boiling Point in C -1, @@ -579,7 +579,7 @@ public final class ALLOY { public static final Material TRINIUM_TITANIUM = new Material( "Trinium Titanium Alloy", //Material Name MaterialState.SOLID, //State - new short[]{239,210,200, 0}, //Material Colour + null, //Material Colour 3750, //Melting Point in C 7210, //Boiling Point in C -1, @@ -592,7 +592,7 @@ public final class ALLOY { public static final Material TRINIUM_NAQUADAH = new Material( "Trinium Naquadah Alloy", //Material Name MaterialState.SOLID, //State - new short[]{255, 243, 117, 0}, //Material Colour + null, //Material Colour 4200, //Melting Point in C 7400, //Boiling Point in C -1, @@ -605,7 +605,7 @@ public final class ALLOY { public static final Material TRINIUM_NAQUADAH_CARBON = new Material( "Trinium Naquadah Carbonite", //Material Name MaterialState.SOLID, //State - new short[]{255, 233, 0, 0}, //Material Colour + null, //Material Colour 6500, //Melting Point in C 9000, //Boiling Point in C -1, @@ -645,7 +645,7 @@ public final class ALLOY { public static final Material LAFIUM = new Material( "Lafium Compound", //Material Name MaterialState.SOLID, //State - new short[]{75,180,255, 0}, //Material Colour + null, //Material Colour 6750, //Melting Point in C 9865, //Boiling Point in C -1, @@ -667,7 +667,7 @@ public final class ALLOY { public static final Material CINOBITE = new Material( "Cinobite A243", //Material Name MaterialState.SOLID, //State - new short[]{255,75,45, 0}, //Material Colour + null, //Material Colour 7350, //Melting Point in C 12565, //Boiling Point in C -1, @@ -689,7 +689,7 @@ public final class ALLOY { public static final Material PIKYONIUM = new Material( "Pikyonium 64B", //Material Name MaterialState.SOLID, //State - new short[]{110,255,20, 0}, //Material Colour + null, //Material Colour 7850, //Melting Point in C 11765, //Boiling Point in C -1, @@ -711,7 +711,7 @@ public final class ALLOY { public static final Material ABYSSAL = new Material( "Abyssal Alloy", //Material Name MaterialState.SOLID, //State - new short[]{85,0,85, 0}, //Material Colour + null, //Material Colour 9650, //Melting Point in C 13765, //Boiling Point in C -1, @@ -733,7 +733,7 @@ public final class ALLOY { public static final Material QUANTUM = new Material( "Quantum", //Material Name MaterialState.SOLID, //State - new short[]{128, 128, 255, 50}, //Material Colour + null, //Material Colour 9500, //Melting Point in C 25000, //Boiling Point in C 150, //Protons diff --git a/src/Java/gtPlusPlus/core/material/ELEMENT.java b/src/Java/gtPlusPlus/core/material/ELEMENT.java index 5ff593da3f..675b04c14f 100644 --- a/src/Java/gtPlusPlus/core/material/ELEMENT.java +++ b/src/Java/gtPlusPlus/core/material/ELEMENT.java @@ -3,6 +3,7 @@ package gtPlusPlus.core.material; import gregtech.api.enums.Materials; import gregtech.api.enums.TextureSet; import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.core.client.CustomTextureSet.TextureSets; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.material.state.MaterialState; import gtPlusPlus.core.util.data.StringUtils; @@ -53,7 +54,7 @@ public final class ELEMENT { public final Material ZIRCONIUM = new Material("Zirconium", MaterialState.SOLID, new short[]{255, 250, 205}, 1855, 4377, 40, 51, false, "Zr", 0);//Not a GT Inherited Material public final Material NIOBIUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Niobium); public final Material MOLYBDENUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Molybdenum); - public final Material TECHNETIUM = new Material("Technetium", MaterialState.SOLID, new short[]{220, 220, 220}, 2200, 4877, 43, 55, false, "Tc", 2);//Not a GT Inherited Material + public final Material TECHNETIUM = new Material("Technetium", MaterialState.SOLID, TextureSets.NUCLEAR.get(), new short[]{220, 220, 220}, 2200, 4877, 43, 55, false, "Tc", 2);//Not a GT Inherited Material public final Material RUTHENIUM = new Material("Ruthenium", MaterialState.SOLID, new short[]{220, 220, 220}, 2250, 3900, 44, 57, false, "Ru", 0);//Not a GT Inherited Material public final Material RHODIUM = new Material("Rhodium", MaterialState.SOLID, new short[]{220, 220, 220}, 1966, 3727, 45, 58, false, "Rh", 0);//Not a GT Inherited Material public final Material PALLADIUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Palladium); @@ -96,34 +97,34 @@ public final class ELEMENT { public final Material THALLIUM = new Material("Thallium", MaterialState.SOLID, new short[]{175, 175, 175}, 304, 1457, 81, 123, false, "Tl", 0);//Not a GT Inherited Material public final Material LEAD = MaterialUtils.generateMaterialFromGtENUM(Materials.Lead); public final Material BISMUTH = MaterialUtils.generateMaterialFromGtENUM(Materials.Bismuth); - public final Material POLONIUM = new Material("Polonium", MaterialState.SOLID, new short[]{180, 170, 180}, 254, 962, 84, 125, false, "Po", 1);//Not a GT Inherited Material - public final Material ASTATINE = new Material("Astatine", MaterialState.SOLID, new short[]{170, 180, 170}, 302, 337, 85, 125, false, "At", 1);//Not a GT Inherited Material + public final Material POLONIUM = new Material("Polonium", MaterialState.SOLID, TextureSets.NUCLEAR.get(), new short[]{180, 170, 180}, 254, 962, 84, 125, false, "Po", 1);//Not a GT Inherited Material + public final Material ASTATINE = new Material("Astatine", MaterialState.SOLID, TextureSets.NUCLEAR.get(), new short[]{170, 180, 170}, 302, 337, 85, 125, false, "At", 1);//Not a GT Inherited Material public final Material RADON = MaterialUtils.generateMaterialFromGtENUM(Materials.Radon); - public final Material FRANCIUM = new Material("Francium", MaterialState.SOLID, new short[]{170, 160, 170}, 27, 677, 87, 136, false, "Fr", 1);//Not a GT Inherited Material - public final Material RADIUM = new Material("Radium", MaterialState.SOLID, new short[]{165, 165, 165}, 700, 1737, 88, 138, false, "Ra", 1);//Not a GT Inherited Material - public final Material ACTINIUM = new Material("Actinium", MaterialState.SOLID, new short[]{150, 165, 165}, 1050, 3200, 89, 138, false, "Ac", 1);//Not a GT Inherited Material + public final Material FRANCIUM = new Material("Francium", MaterialState.SOLID, TextureSets.NUCLEAR.get(), new short[]{170, 160, 170}, 27, 677, 87, 136, false, "Fr", 1);//Not a GT Inherited Material + public final Material RADIUM = new Material("Radium", MaterialState.SOLID, TextureSets.NUCLEAR.get(), new short[]{165, 165, 165}, 700, 1737, 88, 138, false, "Ra", 1);//Not a GT Inherited Material + public final Material ACTINIUM = new Material("Actinium", MaterialState.SOLID, TextureSets.NUCLEAR.get(), new short[]{150, 165, 165}, 1050, 3200, 89, 138, false, "Ac", 1);//Not a GT Inherited Material public final Material THORIUM = new Material("Thorium", MaterialState.SOLID, Materials.Thorium.mRGBa, Materials.Thorium.mMeltingPoint, Materials.Thorium.mBlastFurnaceTemp, 90, 142, false, StringUtils.superscript("Th"), 1); - public final Material PROTACTINIUM = new Material("Protactinium", MaterialState.SOLID, new short[]{190, 150, 170}, 1568, 4027, 91, 140, false, "Pa", 1);//Not a GT Inherited Material + public final Material PROTACTINIUM = new Material("Protactinium", MaterialState.SOLID, TextureSets.NUCLEAR.get(), new short[]{190, 150, 170}, 1568, 4027, 91, 140, false, "Pa", 1);//Not a GT Inherited Material public final Material URANIUM238 = MaterialUtils.generateMaterialFromGtENUM(Materials.Uranium); public final Material URANIUM235 = MaterialUtils.generateMaterialFromGtENUM(Materials.Uranium235); - public final Material NEPTUNIUM = new Material("Neptunium", MaterialState.SOLID, new short[]{200, 220, 205}, 640, 3902, 93, 144, false, "Np", 2);//Not a GT Inherited Material + public final Material NEPTUNIUM = new Material("Neptunium", MaterialState.SOLID, TextureSets.NUCLEAR.get(), new short[]{200, 220, 205}, 640, 3902, 93, 144, false, "Np", 2);//Not a GT Inherited Material public final Material PLUTONIUM244 = MaterialUtils.generateMaterialFromGtENUM(Materials.Plutonium); public final Material PLUTONIUM241 = MaterialUtils.generateMaterialFromGtENUM(Materials.Plutonium241); public final Material AMERICIUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Americium); //Americium - public final Material CURIUM = new Material("Curium", MaterialState.SOLID, TextureSet.SET_SHINY, new short[]{175, 85, 110}, 1340, 3110, 96, 151, false, "Cm", 3);//Not a GT Inherited Material - public final Material BERKELIUM = new Material("Berkelium", MaterialState.SOLID, new short[]{110, 250, 85}, 985, 710, 97, 150, false, "Bk", 4);//Not a GT Inherited Material - public final Material CALIFORNIUM = new Material("Californium", MaterialState.SOLID, new short[]{85, 110, 205}, 899, 1472, 98, 153, false, "Cf", 4);//Not a GT Inherited Material - public final Material EINSTEINIUM = new Material("Einsteinium", MaterialState.SOLID, new short[]{255, 85, 110}, 860, 3500, 99, 153, false, "Es", 5);//Not a GT Inherited Material //Boiling Point is made up - public final Material FERMIUM = new Material("Fermium", MaterialState.LIQUID, new short[]{75, 90, 25}, 1527, 3850, 100, 157, false, "Fm", 5);//Not a GT Inherited Material //Boiling Point is made up + public final Material CURIUM = new Material("Curium", MaterialState.SOLID, TextureSets.NUCLEAR.get(), new short[]{175, 85, 110}, 1340, 3110, 96, 151, false, "Cm", 3);//Not a GT Inherited Material + public final Material BERKELIUM = new Material("Berkelium", MaterialState.SOLID, TextureSets.NUCLEAR.get(), new short[]{110, 250, 85}, 985, 710, 97, 150, false, "Bk", 4);//Not a GT Inherited Material + public final Material CALIFORNIUM = new Material("Californium", MaterialState.SOLID, TextureSets.NUCLEAR.get(), new short[]{85, 110, 205}, 899, 1472, 98, 153, false, "Cf", 4);//Not a GT Inherited Material + public final Material EINSTEINIUM = new Material("Einsteinium", MaterialState.SOLID, TextureSets.NUCLEAR.get(), new short[]{255, 85, 110}, 860, 3500, 99, 153, false, "Es", 5);//Not a GT Inherited Material //Boiling Point is made up + public final Material FERMIUM = new Material("Fermium", MaterialState.LIQUID, TextureSets.NUCLEAR.get(), new short[]{75, 90, 25}, 1527, 3850, 100, 157, false, "Fm", 5);//Not a GT Inherited Material //Boiling Point is made up //Misc - public final Material AER = MaterialUtils.generateMaterialFromGtENUM(Materials.InfusedAir); - public final Material IGNIS = MaterialUtils.generateMaterialFromGtENUM(Materials.InfusedFire); - public final Material TERRA = MaterialUtils.generateMaterialFromGtENUM(Materials.InfusedEarth); - public final Material AQUA = MaterialUtils.generateMaterialFromGtENUM(Materials.InfusedWater); + public final Material AER = MaterialUtils.generateMaterialFromGtENUM(Materials.InfusedAir, TextureSets.GEM_A.get()); + public final Material IGNIS = MaterialUtils.generateMaterialFromGtENUM(Materials.InfusedFire, TextureSets.GEM_A.get()); + public final Material TERRA = MaterialUtils.generateMaterialFromGtENUM(Materials.InfusedEarth, TextureSets.GEM_A.get()); + public final Material AQUA = MaterialUtils.generateMaterialFromGtENUM(Materials.InfusedWater, TextureSets.GEM_A.get()); //Fictional - public final Material YELLORIUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Yellorium, new short[] {255, 242, 10}); + public final Material YELLORIUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Yellorium, new short[] {255, 242, 10}, TextureSets.NUCLEAR.get()); public final Material NAQUADAH = MaterialUtils.generateMaterialFromGtENUM(Materials.Naquadah); public final Material NAQUADAH_ENRICHED = MaterialUtils.generateMaterialFromGtENUM(Materials.NaquadahEnriched); public final Material NAQUADRIA = MaterialUtils.generateMaterialFromGtENUM(Materials.Naquadria); @@ -134,15 +135,15 @@ public final class ELEMENT { //Custom Isotopes public final Material LITHIUM7 = new Material("Lithium 7", MaterialState.LIQUID, TextureSet.SET_SHINY, Materials.Lithium.mRGBa, Materials.Lithium.mMeltingPoint, Materials.Lithium.mBlastFurnaceTemp, Materials.Lithium.getProtons(), Materials.Lithium.getNeutrons(), Materials.Lithium.mBlastFurnaceRequired, StringUtils.superscript("7Li"), 0, false);//Not a GT Inherited Material - public final Material URANIUM232 = new Material("Uranium 232", MaterialState.SOLID, TextureSet.SET_SHINY, new short[]{88, 220, 103, 0}, 1132, 4131, 92, 140, false, StringUtils.superscript("232U"), 4);//Not a GT Inherited Material - public final Material URANIUM233 = new Material("Uranium 233", MaterialState.SOLID, TextureSet.SET_SHINY, new short[]{73, 220, 83, 0}, 1132, 4131, 92, 141, false, StringUtils.superscript("233U"), 2);//Not a GT Inherited Material - public final Material THORIUM232 = new Material("Thorium 232", MaterialState.SOLID, TextureSet.SET_SHINY, new short[]{15, 60, 15, 0}, Materials.Thorium.mMeltingPoint, Materials.Thorium.mBlastFurnaceTemp, 90, 142, false, StringUtils.superscript("232Th"), 1, false);//Not a GT Inherited Material - public final Material PLUTONIUM239 = new Material("Plutonium-239", MaterialState.SOLID, Materials.Plutonium.mIconSet, Materials.Plutonium.mDurability, Materials.Plutonium.mRGBa, Materials.Plutonium.mMeltingPoint, Materials.Plutonium.mBlastFurnaceTemp, 94, 145, false, StringUtils.superscript("239Pu"), 4, true);//Not a GT Inherited Material + public final Material URANIUM232 = new Material("Uranium 232", MaterialState.SOLID, TextureSets.NUCLEAR.get(), new short[]{88, 220, 103, 0}, 1132, 4131, 92, 140, false, StringUtils.superscript("232U"), 4);//Not a GT Inherited Material + public final Material URANIUM233 = new Material("Uranium 233", MaterialState.SOLID, TextureSets.NUCLEAR.get(), new short[]{73, 220, 83, 0}, 1132, 4131, 92, 141, false, StringUtils.superscript("233U"), 2);//Not a GT Inherited Material + public final Material THORIUM232 = new Material("Thorium 232", MaterialState.SOLID, TextureSets.NUCLEAR.get(), new short[]{15, 60, 15, 0}, Materials.Thorium.mMeltingPoint, Materials.Thorium.mBlastFurnaceTemp, 90, 142, false, StringUtils.superscript("232Th"), 1, false);//Not a GT Inherited Material + public final Material PLUTONIUM239 = new Material("Plutonium-239", MaterialState.SOLID, TextureSets.NUCLEAR.get(), Materials.Plutonium.mDurability, Materials.Plutonium.mRGBa, Materials.Plutonium.mMeltingPoint, Materials.Plutonium.mBlastFurnaceTemp, 94, 145, false, StringUtils.superscript("239Pu"), 4, true);//Not a GT Inherited Material //RTG Fuels - public final Material PLUTONIUM238 = new Material("Plutonium-238", MaterialState.SOLID, Materials.Plutonium241.mIconSet, Materials.Plutonium241.mDurability, Materials.Plutonium241.mRGBa, Materials.Plutonium241.mMeltingPoint, Materials.Plutonium241.mBlastFurnaceTemp, 94, 144, false, StringUtils.superscript("238Pu"), 2, false);//Not a GT Inherited Material - public final Material STRONTIUM90 = new Material("Strontium-90", MaterialState.SOLID, Materials.Strontium.mIconSet, Materials.Strontium.mDurability, Materials.Strontium.mRGBa, Materials.Strontium.mMeltingPoint, Materials.Strontium.mBlastFurnaceTemp, 38, 52, false, StringUtils.superscript("90Sr"), 2, false);//Not a GT Inherited Material - public final Material POLONIUM210 = new Material("Polonium-210", MaterialState.SOLID, Materials.Plutonium241.mIconSet, POLONIUM.vDurability, POLONIUM.getRGBA(), POLONIUM.getMeltingPointK(), POLONIUM.getBoilingPointK(), 84, 126, false, StringUtils.superscript("210Po"), 2, false);//Not a GT Inherited Material - public final Material AMERICIUM241 = new Material("Americium-241", MaterialState.SOLID, Materials.Americium.mIconSet, Materials.Americium.mDurability, Materials.Americium.mRGBa, Materials.Americium.mMeltingPoint, Materials.Americium.mBlastFurnaceTemp, 95, 146, false, StringUtils.superscript("241Am"), 2, false);//Not a GT Inherited Material + public final Material PLUTONIUM238 = new Material("Plutonium-238", MaterialState.SOLID, TextureSets.NUCLEAR.get(), Materials.Plutonium241.mDurability, Materials.Plutonium241.mRGBa, Materials.Plutonium241.mMeltingPoint, Materials.Plutonium241.mBlastFurnaceTemp, 94, 144, false, StringUtils.superscript("238Pu"), 2, false);//Not a GT Inherited Material + public final Material STRONTIUM90 = new Material("Strontium-90", MaterialState.SOLID, TextureSets.NUCLEAR.get(), Materials.Strontium.mDurability, Materials.Strontium.mRGBa, Materials.Strontium.mMeltingPoint, Materials.Strontium.mBlastFurnaceTemp, 38, 52, false, StringUtils.superscript("90Sr"), 2, false);//Not a GT Inherited Material + public final Material POLONIUM210 = new Material("Polonium-210", MaterialState.SOLID, TextureSets.NUCLEAR.get(), POLONIUM.vDurability, POLONIUM.getRGBA(), POLONIUM.getMeltingPointK(), POLONIUM.getBoilingPointK(), 84, 126, false, StringUtils.superscript("210Po"), 2, false);//Not a GT Inherited Material + public final Material AMERICIUM241 = new Material("Americium-241", MaterialState.SOLID, TextureSets.NUCLEAR.get(), Materials.Americium.mDurability, Materials.Americium.mRGBa, Materials.Americium.mMeltingPoint, Materials.Americium.mBlastFurnaceTemp, 95, 146, false, StringUtils.superscript("241Am"), 2, false);//Not a GT Inherited Material public final Material MAGIC = MaterialUtils.generateMaterialFromGtENUM(Materials.Magic, new short[] {10, 185, 140}); public final Material THAUMIUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Thaumium); @@ -194,7 +195,7 @@ public final class ELEMENT { } else { TRINIUM = new Material("Trinium", MaterialState.SOLID, TextureSet.SET_FINE, new short[]{70, 110, 30}, 604, 4057, 181, 133, false, "Ke", 0, false);//Not a GT Inherited Material - TRINIUM_REFINED = new Material("Refined Trinium", MaterialState.SOLID, TextureSet.SET_SHINY, new short[]{210, 255, 170}, 4304, 14057, 181, 133, false, "Ke", 0, new MaterialStack[]{new MaterialStack(TRINIUM, 1)});//Not a GT Inherited Material + TRINIUM_REFINED = new Material("Refined Trinium", MaterialState.SOLID, TextureSets.REFINED.get(), new short[]{210, 255, 170}, 4304, 14057, 181, 133, false, "Ke", 0, new MaterialStack[]{new MaterialStack(TRINIUM, 1)});//Not a GT Inherited Material } } diff --git a/src/Java/gtPlusPlus/core/material/Material.java b/src/Java/gtPlusPlus/core/material/Material.java index e5cacfdce7..c863da8064 100644 --- a/src/Java/gtPlusPlus/core/material/Material.java +++ b/src/Java/gtPlusPlus/core/material/Material.java @@ -5,8 +5,11 @@ import static gregtech.api.enums.GT_Values.M; import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; +import java.util.Iterator; +import java.util.List; import java.util.Map; import java.util.Set; +import java.util.concurrent.ConcurrentSkipListSet; import net.minecraft.block.Block; import net.minecraft.init.Blocks; @@ -34,8 +37,8 @@ import net.minecraftforge.fluids.FluidStack; public class Material { public static final Set mMaterialMap = new HashSet(); - - public static final Map> mComponentMap = new HashMap>(); + + public static final Map> mComponentMap = new HashMap>(); private String unlocalizedName; private String localizedName; @@ -117,7 +120,7 @@ public class Material { public Material(final String materialName, final MaterialState defaultState,final short[] rgba, final int meltingPoint, final int boilingPoint, final long protons, final long neutrons, final boolean blastFurnace, final String chemicalSymbol, final int radiationLevel, boolean addCells,final MaterialStack... inputs) { this (materialName, defaultState, null, 0, rgba, meltingPoint, boilingPoint, protons, neutrons, blastFurnace, chemicalSymbol, radiationLevel, addCells, true, inputs); } - + public Material(final String materialName, final MaterialState defaultState, TextureSet textureSet,final short[] rgba, final int meltingPoint, final int boilingPoint, final long protons, final long neutrons, final boolean blastFurnace, final String chemicalSymbol, final int radiationLevel, final MaterialStack... inputs){ this (materialName, defaultState, textureSet, 0, rgba, meltingPoint, boilingPoint, protons, neutrons, blastFurnace, chemicalSymbol, radiationLevel, true, true, inputs); } @@ -134,13 +137,17 @@ public class Material { this (materialName, defaultState, set, durability, rgba, meltingPoint, boilingPoint, protons, neutrons, blastFurnace, chemicalSymbol, radiationLevel, true, true, inputs); } - public Material(final String materialName, final MaterialState defaultState, final TextureSet set, final long durability, final short[] rgba, final int meltingPoint, final int boilingPoint, final long protons, final long neutrons, final boolean blastFurnace, final String chemicalSymbol, final int radiationLevel, boolean generateCells, boolean generateFluid, final MaterialStack... inputs){ + public Material(final String materialName, final MaterialState defaultState, final TextureSet set, final long durability, short[] rgba, final int meltingPoint, final int boilingPoint, final long protons, final long neutrons, final boolean blastFurnace, final String chemicalSymbol, final int radiationLevel, boolean generateCells, boolean generateFluid, final MaterialStack... inputs){ if (mMaterialMap.add(this)) { } + + if (defaultState == MaterialState.ORE) { + rgba = null; + } - mComponentMap.put(unlocalizedName, new HashMap()); + mComponentMap.put(unlocalizedName, new HashMap()); try { this.unlocalizedName = Utils.sanitizeString(materialName); @@ -150,7 +157,6 @@ public class Material { Logger.MATERIALS(this.getLocalizedName()+" is "+defaultState.name()+"."); - this.RGBA = rgba; this.vGenerateCells = generateCells; //Add Components to an array. @@ -167,6 +173,103 @@ public class Material { } } + //set RGB + + if (rgba == null) { + if (vMaterialInput.size() > 0) { + + try { + Short[] mMixedRGB = new Short[3]; + AutoMap mMaterialSet = MaterialUtils.getCompoundMaterialsRecursively(this); + for (int mnh = 0; mnh < 3; mnh++) { + AutoMap aDataSet = new AutoMap(); + Set set4 = new HashSet(); + for (Material u : mMaterialSet) { + //if (u.getState() == MaterialState.ORE || u.getState() == MaterialState.SOLID) + set4.add(u); + } + for(Material e : set4){ + aDataSet.put(e.getRGB()[mnh]); + } + + Short aAverage = MathUtils.getShortAverage(aDataSet); + if (aAverage > Short.MAX_VALUE || aAverage < Short.MIN_VALUE || aAverage < 0 || aAverage > 255) { + if (aAverage > 255) { + while (aAverage > 255) { + aAverage = (short) (aAverage/2); + } + } + aAverage = (short) Math.max(Math.min(aAverage, 255), 0); + } + mMixedRGB[mnh] = aAverage; + } + + if (mMixedRGB != null && mMixedRGB[0] != null && mMixedRGB[1] != null && mMixedRGB[2] != null) { + this.RGBA = new short[] {mMixedRGB[0], mMixedRGB[1], mMixedRGB[2], 0}; + } + else { + this.RGBA = Materials.Steel.mRGBa; + } + } + catch (Throwable t) { + t.printStackTrace(); + this.RGBA = Materials.Steel.mRGBa; + } + } + else { + //Boring Grey Material + + int aValueForGen = this.getUnlocalizedName().hashCode(); + int hashSize = MathUtils.howManyPlaces(aValueForGen); + + String a = String.valueOf(aValueForGen); + String b = null; + + if (hashSize < 9) { + int aSecondHash = this.materialState.hashCode(); + int hashSize2 = MathUtils.howManyPlaces(aSecondHash); + if (hashSize2 + hashSize >= 9) { + b = String.valueOf(aValueForGen); + } + else { + String c = b; + while (MathUtils.howManyPlaces(hashSize + c.length()) < 9) { + c = c + c.hashCode(); + } + b = c; + } + } + + String valueR; + if (b != null) { + valueR = a+b; + } + else { + valueR = a; + } + short fc[] = new short[3]; + int aIndex = 0; + for (char gg : valueR.toCharArray()) { + short ui = Short.parseShort(""+gg); + if (ui > 255 || ui < 0) { + if (ui > 255) { + while (ui > 255) { + ui = (short) (ui / 2); + } + } + else { + ui = 0; + } + } + fc[aIndex++] = ui; + + } + this.RGBA = fc; + } + } + else { + this.RGBA = rgba; + } //Set Melting/Boiling point, if value is -1 calculate it from compound inputs. if (meltingPoint != -1){ @@ -300,15 +403,15 @@ public class Material { if (vMaterialInput.size() > 0) { AutoMap aDataSet = new AutoMap(); - + int bonus = 0; bonus += this.vMaterialInput.size(); bonus += MathUtils.roundToClosestInt(meltingPointC/1000); - - - + + + aDataSet.put(bonus); - + for (MaterialStack m : this.vMaterialInput) { aDataSet.put(m.getStackMaterial().vTier); } @@ -326,8 +429,8 @@ public class Material { else { this.vTier = MaterialUtils.getTierOfMaterial((int) MathUtils.celsiusToKelvin(meltingPoint)); } - - + + //Sets the materials 'tier'. Will probably replace this logic. this.usesBlastFurnace = blastFurnace; @@ -413,6 +516,7 @@ public class Material { Logger.MATERIALS("Boiling Point: "+this.boilingPointC+"C."); } catch (Throwable t){ + Logger.MATERIALS("Stack Trace for "+materialName); t.printStackTrace(); } } @@ -432,7 +536,7 @@ public class Material { public TextureSet setTextureSet(TextureSet set) { return setTextureSet(set, vTier); } - + public TextureSet setTextureSet(TextureSet set, int aTier) { if (set != null) { Logger.MATERIALS("Set textureset for "+this.localizedName+" to be "+set.mSetName+". This textureSet was supplied."); @@ -462,9 +566,6 @@ public class Material { else if (m.getStackMaterial() == ELEMENT.getInstance().MAGIC) { aGem++; } - else if (m.getStackMaterial() == ELEMENT.getInstance().FLUORINE) { - aGem++; - } //Shiny Materials if (m.getStackMaterial() == ELEMENT.getInstance().GOLD) { aShiny++; @@ -520,66 +621,26 @@ public class Material { return TextureSet.SET_SHINY; } } -/* - if (aTier <= 2) { - aSet = TextureSet.SET_DULL; - } - else if (aTier <= 4) { - aSet = TextureSet.SET_ROUGH; - } - else if (aTier <= 7) { - aSet = TextureSet.SET_METALLIC; - } - else if (aTier <= 10) { - aSet = TextureSet.SET_FINE; - } - else { - aSet = TextureSet.SET_METALLIC; - }*/ - - - /*int aPoint = this.getMeltingPointC(); - if (aPoint <= 300 && !this.requiresBlastFurnace()) { - aSet = TextureSet.SET_DULL; - } - else if (aPoint <= 1500) { - aSet = TextureSet.SET_ROUGH; - } - else if (aPoint <= 4000) { - aSet = TextureSet.SET_METALLIC; - } - else { - aSet = TextureSet.SET_FINE; - } - if (aSet == null) { - aSet = TextureSet.SET_METALLIC; - }*/ - - - // build hash table with count AutoMap sets = new AutoMap(); - if (this.vMaterialInput != null) { - for (MaterialStack r : this.vMaterialInput) { - if (r.getStackMaterial().getTextureSet().mSetName.toLowerCase().contains("fluid")) { - sets.put(ELEMENT.getInstance().GOLD); - } - else { - sets.put(r.getStackMaterial()); - } + if (this.vMaterialInput != null) { + for (MaterialStack r : this.vMaterialInput) { + if (r.getStackMaterial().getTextureSet().mSetName.toLowerCase().contains("fluid")) { + sets.put(ELEMENT.getInstance().GOLD); } - TextureSet mostUsedTypeTextureSet = MaterialUtils.getMostCommonTextureSet(new ArrayList(sets.values())); - if (mostUsedTypeTextureSet != null && mostUsedTypeTextureSet instanceof TextureSet) { - Logger.MATERIALS("Set textureset for "+this.localizedName+" to be "+mostUsedTypeTextureSet.mSetName+"."); - return mostUsedTypeTextureSet; + else { + sets.put(r.getStackMaterial()); } - } + } + TextureSet mostUsedTypeTextureSet = MaterialUtils.getMostCommonTextureSet(new ArrayList(sets.values())); + if (mostUsedTypeTextureSet != null && mostUsedTypeTextureSet instanceof TextureSet) { + Logger.MATERIALS("Set textureset for "+this.localizedName+" to be "+mostUsedTypeTextureSet.mSetName+"."); + return mostUsedTypeTextureSet; + } + } Logger.MATERIALS("Set textureset for "+this.localizedName+" to be "+Materials.Iron.mIconSet.mSetName+". [Fallback]"); return Materials.Gold.mIconSet; - - - } public final String getLocalizedName(){ @@ -659,21 +720,24 @@ public class Material { public final boolean requiresBlastFurnace(){ return this.usesBlastFurnace; } - + public final ItemStack getComponentByPrefix(OrePrefixes aPrefix, int stacksize) { - Map g = mComponentMap.get(this.unlocalizedName); + Map g = mComponentMap.get(this.unlocalizedName); if (g == null) { - Map aMap = new HashMap(); + Map aMap = new HashMap(); mComponentMap.put(unlocalizedName, aMap); g = aMap; } - Item i = g.get(aPrefix.name()); + ItemStack i = g.get(aPrefix.name()); if (i != null) { return ItemUtils.getSimpleStack(i, stacksize); } else { ItemStack u = ItemUtils.getItemStackOfAmountFromOreDictNoBroken(aPrefix.name()+this.unlocalizedName, stacksize); + String aKey = aPrefix.name(); if (u != null) { + g.put(aKey, u); + mComponentMap.put(unlocalizedName, g); return u; } else { @@ -1188,15 +1252,15 @@ public class Material { final public int calculateMeltingPoint(){ try { - AutoMap aDataSet = new AutoMap(); for (MaterialStack m : this.vMaterialInput) { aDataSet.put(m.getStackMaterial().getMeltingPointC()); } - long aAverage = MathUtils.getLongAverage(aDataSet); + long aAverage = MathUtils.getIntAverage(aDataSet); return MathUtils.safeInt(aAverage); } catch (Throwable r){ + r.printStackTrace(); return 500; } } @@ -1208,10 +1272,11 @@ public class Material { for (MaterialStack m : this.vMaterialInput) { aDataSet.put(m.getStackMaterial().getBoilingPointC()); } - long aAverage = MathUtils.getLongAverage(aDataSet); + long aAverage = MathUtils.getIntAverage(aDataSet); return MathUtils.safeInt(aAverage); } catch (Throwable r){ + r.printStackTrace(); return 2500; } } @@ -1227,6 +1292,7 @@ public class Material { return MathUtils.safeInt(aAverage); } catch (Throwable r){ + r.printStackTrace(); return 50; } } @@ -1242,6 +1308,7 @@ public class Material { return MathUtils.safeInt(aAverage); } catch (Throwable r){ + r.printStackTrace(); return 75; } } diff --git a/src/Java/gtPlusPlus/core/material/ORES.java b/src/Java/gtPlusPlus/core/material/ORES.java index a99cdc476d..d8ac82d724 100644 --- a/src/Java/gtPlusPlus/core/material/ORES.java +++ b/src/Java/gtPlusPlus/core/material/ORES.java @@ -11,11 +11,13 @@ public final class ORES { MaterialState.ORE, //State TextureSets.GEM_A.get(), //Texture Set new short[]{187, 193, 204, 0}, //Material Colour - 500, - 1500, - 50, - 75, - 0, //Radiation + -1, + -1, + -1, + -1, + false, + "(IrRuRhPt)SAs", + -1, //Radiation new MaterialStack[]{ new MaterialStack(ELEMENT.getInstance().MAGNESIUM, 1), new MaterialStack(ELEMENT.getInstance().TITANIUM, 1), @@ -27,11 +29,13 @@ public final class ORES { MaterialState.ORE, //State TextureSet.SET_FINE, //Texture Set new short[]{193, 187, 131, 0}, //Material Colour - 500, - 1500, - 50, - 75, - 0, //Radiation + -1, + -1, + -1, + -1, + false, + "(IrRuRhPt)SAs", + -1, //Radiation new MaterialStack[]{ new MaterialStack(ELEMENT.getInstance().CALCIUM, 2), new MaterialStack(ELEMENT.getInstance().POTASSIUM, 2), @@ -48,11 +52,13 @@ public final class ORES { MaterialState.ORE, //State TextureSet.SET_METALLIC, //Texture Set new short[]{184, 198, 105, 0}, //Material Colour - 500, - 1500, - 50, - 75, - 0, //Radiation + -1, + -1, + -1, + -1, + false, + "(IrRuRhPt)SAs", + -1, //Radiation new MaterialStack[]{ new MaterialStack(ELEMENT.getInstance().CALCIUM, 2), new MaterialStack(ELEMENT.getInstance().TITANIUM, 2), @@ -66,11 +72,13 @@ public final class ORES { MaterialState.ORE, //State TextureSet.SET_FINE, //Texture Set new short[]{45, 26, 0, 0}, //Material Colour - 500, - 1500, - 50, - 75, - 0, //Radiation + -1, + -1, + -1, + -1, + false, + "(IrRuRhPt)SAs", + -1, //Radiation new MaterialStack[]{ new MaterialStack(ELEMENT.getInstance().CALCIUM, 2), new MaterialStack(ELEMENT.getInstance().ZIRCONIUM, 2), @@ -84,11 +92,13 @@ public final class ORES { MaterialState.ORE, //State TextureSet.SET_GEM_VERTICAL, //Texture Set new short[]{255, 143, 84, 0}, //Material Colour - 500, - 1500, - 50, - 75, - 0, //Radiation + -1, + -1, + -1, + -1, + false, + "(IrRuRhPt)SAs", + -1, //Radiation new MaterialStack[]{ new MaterialStack(ELEMENT.getInstance().LEAD, 1), new MaterialStack(ELEMENT.getInstance().CHROMIUM, 1), @@ -100,11 +110,13 @@ public final class ORES { MaterialState.ORE, //State TextureSet.SET_METALLIC, //Texture Set new short[]{22, 19, 19, 0}, //Material Colour - 500, - 1500, - 50, - 75, - 0, //Radiation + -1, + -1, + -1, + -1, + false, + "(IrRuRhPt)SAs", + -1, //Radiation new MaterialStack[]{ new MaterialStack(ELEMENT.getInstance().NICKEL, 1), new MaterialStack(ELEMENT.getInstance().COBALT, 1), @@ -119,11 +131,13 @@ public final class ORES { MaterialState.ORE, //State TextureSet.SET_METALLIC, //Texture Set new short[]{255, 143, 84, 0}, //Material Colour - 500, - 1500, - 50, - 75, - 0, //Radiation + -1, + -1, + -1, + -1, + false, + "(IrRuRhPt)SAs", + -1, //Radiation new MaterialStack[]{ new MaterialStack(ELEMENT.getInstance().YTTRIUM, 1), //Y not YT/YB new MaterialStack(ELEMENT.getInstance().OXYGEN, 3) @@ -135,11 +149,13 @@ public final class ORES { MaterialState.ORE, //State TextureSets.ENRICHED.get(), //Texture Set new short[]{65, 163, 164, 0}, //Material Colour - 500, - 1500, - 50, - 75, - 1, //Radiation + -1, + -1, + -1, + -1, + false, + "(IrRuRhPt)SAs", + -1, //Radiation new MaterialStack[]{ new MaterialStack(ELEMENT.getInstance().YTTRIUM, 2), //Y not YT/YB new MaterialStack(ELEMENT.getInstance().IRON, 10), @@ -155,11 +171,13 @@ public final class ORES { MaterialState.ORE, //State TextureSets.ENRICHED.get(), //Texture Set new short[]{95, 193, 194, 0}, //Material Colour - 500, - 1500, - 50, - 75, - 1, //Radiation + -1, + -1, + -1, + -1, + false, + "(IrRuRhPt)SAs", + -1, //Radiation new MaterialStack[]{ new MaterialStack(ELEMENT.getInstance().YTTERBIUM, 2), //Y not YT/YB new MaterialStack(ELEMENT.getInstance().IRON, 9), @@ -174,11 +192,13 @@ public final class ORES { MaterialState.ORE, //State TextureSets.GEM_A.get(), //Texture Set new short[]{195, 19, 19, 0}, //Material Colour - 500, - 1500, - 50, - 75, - 0, //Radiation + -1, + -1, + -1, + -1, + false, + "(IrRuRhPt)SAs", + -1, //Radiation new MaterialStack[]{ new MaterialStack(ELEMENT.getInstance().ZIRCONIUM, 1), new MaterialStack(ELEMENT.getInstance().SILICON, 1), @@ -191,11 +211,13 @@ public final class ORES { MaterialState.ORE, //State TextureSets.REFINED.get(), //Texture Set new short[]{15, 159, 59, 0}, //Material Colour - 500, - 1500, - 50, - 75, - 0, //Radiation + -1, + -1, + -1, + -1, + false, + "(IrRuRhPt)SAs", + -1, //Radiation new MaterialStack[]{ new MaterialStack(ELEMENT.getInstance().CERIUM, 4), new MaterialStack(ELEMENT.getInstance().LANTHANUM, 2), @@ -213,11 +235,13 @@ public final class ORES { MaterialState.ORE, //State TextureSets.REFINED.get(), //Texture Set new short[]{35, 189, 99, 0}, //Material Colour - 500, - 1500, - 50, - 75, - 0, //Radiation + -1, + -1, + -1, + -1, + false, + "(IrRuRhPt)SAs", + -1, //Radiation new MaterialStack[]{ new MaterialStack(ELEMENT.getInstance().CERIUM, 2), new MaterialStack(ELEMENT.getInstance().LANTHANUM, 2), @@ -234,11 +258,13 @@ public final class ORES { MaterialState.ORE, //State TextureSet.SET_EMERALD, //Texture Set new short[]{175, 175, 20, 0}, //Material Colour - 500, - 1500, - 50, - 75, - 1, //Radiation + -1, + -1, + -1, + -1, + false, + "(IrRuRhPt)SAs", + -1, //Radiation new MaterialStack[]{ new MaterialStack(ELEMENT.getInstance().CALCIUM, 1), new MaterialStack(ELEMENT.getInstance().GADOLINIUM, 2), @@ -253,11 +279,13 @@ public final class ORES { MaterialState.ORE, //State TextureSet.SET_OPAL, //Texture Set new short[]{235, 89, 199, 0}, //Material Colour - 500, - 1500, - 50, - 75, - 0, //Radiation + -1, + -1, + -1, + -1, + false, + "(IrRuRhPt)SAs", + -1, //Radiation new MaterialStack[]{ new MaterialStack(ELEMENT.getInstance().YTTRIUM, 1), new MaterialStack(ELEMENT.getInstance().PHOSPHORUS, 1), @@ -269,11 +297,13 @@ public final class ORES { MaterialState.ORE, //State TextureSet.SET_RUBY, //Texture Set new short[]{35, 189, 99, 0}, //Material Colour - 500, - 1500, - 50, - 75, - 0, //Radiation + -1, + -1, + -1, + -1, + false, + "(IrRuRhPt)SAs", + -1, //Radiation new MaterialStack[]{ new MaterialStack(ELEMENT.getInstance().YTTRIUM, 2), new MaterialStack(ELEMENT.getInstance().THORIUM, 2), @@ -286,11 +316,13 @@ public final class ORES { MaterialState.ORE, //State TextureSet.SET_DIAMOND, //Texture Set new short[]{35, 19, 199, 0}, //Material Colour - 500, - 1500, - 50, - 75, - 0, //Radiation + -1, + -1, + -1, + -1, + false, + "(IrRuRhPt)SAs", + -1, //Radiation new MaterialStack[]{ new MaterialStack(ELEMENT.getInstance().CERIUM, 1), new MaterialStack(ELEMENT.getInstance().CALCIUM, 1), @@ -303,11 +335,13 @@ public final class ORES { MaterialState.ORE, //State TextureSet.SET_ROUGH, //Texture Set new short[]{51, 0, 11, 0}, //Material Colour - 500, - 1500, - 50, - 75, - 1, //Radiation + -1, + -1, + -1, + -1, + false, + "(IrRuRhPt)SAs", + -1, //Radiation new MaterialStack[]{ new MaterialStack(ELEMENT.getInstance().YTTRIUM, 1), new MaterialStack(ELEMENT.getInstance().CALCIUM, 1), @@ -325,11 +359,13 @@ public final class ORES { MaterialState.ORE, //State TextureSets.REFINED.get(), //Texture Set new short[]{30, 0, 6, 0}, //Material Colour - 500, - 1500, - 50, - 75, - 0, //Radiation + -1, + -1, + -1, + -1, + false, + "(IrRuRhPt)SAs", + -1, //Radiation new MaterialStack[]{ new MaterialStack(ELEMENT.getInstance().POTASSIUM, 3), new MaterialStack(ELEMENT.getInstance().SODIUM, 3), @@ -348,11 +384,13 @@ public final class ORES { MaterialState.ORE, //State TextureSets.GEM_A.get(), //Texture Set new short[]{229, 208, 48, 0}, //Material Colour - 500, - 1500, - 50, - 75, - 0, //Radiation + -1, + -1, + -1, + -1, + false, + "(IrRuRhPt)SAs", + -1, //Radiation new MaterialStack[]{// (Ca,Th,Ce)Zr(Ti,Nb)2O7 new MaterialStack(ELEMENT.getInstance().CALCIUM, 1), new MaterialStack(ELEMENT.getInstance().THORIUM, 1), @@ -368,11 +406,13 @@ public final class ORES { MaterialState.ORE, //State TextureSets.REFINED.get(), //Texture Set new short[]{219, 160, 214, 0}, //Material Colour - 500, - 1500, - 50, - 75, - 0, //Radiation + -1, + -1, + -1, + -1, + false, + "(IrRuRhPt)SAs", + -1, //Radiation new MaterialStack[]{// (La)2(CO3)3·8(H2O) new MaterialStack(ELEMENT.getInstance().LANTHANUM, 2), new MaterialStack(ELEMENT.getInstance().OXYGEN, 3), @@ -386,11 +426,13 @@ public final class ORES { MaterialState.ORE, //State TextureSet.SET_METALLIC, //Texture Set new short[]{186, 113, 179, 0}, //Material Colour - 500, - 1500, - 50, - 75, - 0, //Radiation + -1, + -1, + -1, + -1, + false, + "(IrRuRhPt)SAs", + -1, //Radiation new MaterialStack[]{// (Ce)2(CO3)3·8(H2O) new MaterialStack(ELEMENT.getInstance().CERIUM, 2), new MaterialStack(ELEMENT.getInstance().OXYGEN, 3), @@ -404,11 +446,13 @@ public final class ORES { MaterialState.ORE, //State TextureSet.SET_METALLIC, //Texture Set new short[]{153, 76, 145, 0}, //Material Colour - 500, - 1500, - 50, - 75, - 0, //Radiation + -1, + -1, + -1, + -1, + false, + "(IrRuRhPt)SAs", + -1, //Radiation new MaterialStack[]{// (Nd)2(CO3)3·8(H2O) new MaterialStack(ELEMENT.getInstance().NEODYMIUM, 2), new MaterialStack(ELEMENT.getInstance().OXYGEN, 3), @@ -422,11 +466,13 @@ public final class ORES { MaterialState.ORE, //State TextureSet.SET_METALLIC, //Texture Set new short[]{58, 31, 0, 0}, //Material Colour - 500, - 1500, - 50, - 75, - 0, //Radiation + -1, + -1, + -1, + -1, + false, + "(IrRuRhPt)SAs", + -1, //Radiation new MaterialStack[]{// ((Ca,Ce)(Al,Ti,Mg)12O19) new MaterialStack(ELEMENT.getInstance().CALCIUM, 1), new MaterialStack(ELEMENT.getInstance().CERIUM, 1), @@ -441,11 +487,13 @@ public final class ORES { MaterialState.ORE, //State TextureSets.REFINED.get(), //Texture Set new short[]{68, 13, 0, 0}, //Material Colour - 500, - 1500, - 50, - 75, - 0, //Radiation + -1, + -1, + -1, + -1, + false, + "(IrRuRhPt)SAs", + -1, //Radiation new MaterialStack[]{// (Ce,La,Ca)9(Mg,Fe+3)(SiO4)6(SiO3OH)(OH)3 new MaterialStack(ELEMENT.getInstance().CERIUM, 9), new MaterialStack(ELEMENT.getInstance().LANTHANUM, 9), @@ -462,11 +510,13 @@ public final class ORES { MaterialState.ORE, //State TextureSet.SET_METALLIC, //Texture Set new short[]{210, 232, 44, 0}, //Material Colour - 500, - 1500, - 50, - 75, - 0, //Radiation + -1, + -1, + -1, + -1, + false, + "(IrRuRhPt)SAs", + -1, //Radiation new MaterialStack[]{// (YCa)Cu5(As2O4)3(OH)6·3H2O new MaterialStack(ELEMENT.getInstance().YTTRIUM, 1), new MaterialStack(ELEMENT.getInstance().CALCIUM, 1), @@ -481,11 +531,13 @@ public final class ORES { MaterialState.ORE, //State TextureSet.SET_METALLIC, //Texture Set new short[]{170, 188, 33, 0}, //Material Colour - 500, - 1500, - 50, - 75, - 0, //Radiation + -1, + -1, + -1, + -1, + false, + "(IrRuRhPt)SAs", + -1, //Radiation new MaterialStack[]{// (CdCa)Cu7(AsO2)4(O2H)5·3H2O new MaterialStack(ELEMENT.getInstance().CADMIUM, 1), new MaterialStack(ELEMENT.getInstance().CALCIUM, 1), @@ -500,11 +552,13 @@ public final class ORES { MaterialState.ORE, //State TextureSet.SET_FINE, //Texture Set new short[]{206, 232, 9, 0}, //Material Colour - 500, - 1500, - 50, - 75, - 0, //Radiation + -1, + -1, + -1, + -1, + false, + "(IrRuRhPt)SAs", + -1, //Radiation new MaterialStack[]{// (LaCa)Cu5(AsO6)2(OH)4·3H2O new MaterialStack(ELEMENT.getInstance().LANTHANUM, 1), new MaterialStack(ELEMENT.getInstance().CALCIUM, 1), @@ -519,11 +573,13 @@ public final class ORES { MaterialState.ORE, //State TextureSet.SET_METALLIC, //Texture Set new short[]{225, 244, 78, 0}, //Material Colour - 500, - 1500, - 50, - 75, - 0, //Radiation + -1, + -1, + -1, + -1, + false, + "(IrRuRhPt)SAs", + -1, //Radiation new MaterialStack[]{// (NdCa)Cu6(As3O3)2(O2H)6·3H2O new MaterialStack(ELEMENT.getInstance().NEODYMIUM, 1), new MaterialStack(ELEMENT.getInstance().CALCIUM, 1), @@ -538,11 +594,13 @@ public final class ORES { MaterialState.ORE, //State TextureSet.SET_FINE, //Texture Set new short[]{255, 255, 30, 0}, //Material Colour - 500, - 1500, - 50, - 75, - 0, //Radiation + -1, + -1, + -1, + -1, + false, + "(IrRuRhPt)SAs", + -1, //Radiation new MaterialStack[]{// (Ca,Sr,Ce,Na)5(PO4)3F new MaterialStack(ELEMENT.getInstance().CALCIUM, 5), new MaterialStack(ELEMENT.getInstance().STRONTIUM, 5), @@ -558,11 +616,13 @@ public final class ORES { MaterialState.ORE, //State TextureSet.SET_METALLIC, //Texture Set new short[]{249, 249, 124, 0}, //Material Colour - 500, - 1500, - 50, - 75, - 0, //Radiation + -1, + -1, + -1, + -1, + false, + "(IrRuRhPt)SAs", + -1, //Radiation new MaterialStack[]{// SmAl3(PO4)2(OH)6 new MaterialStack(ELEMENT.getInstance().SAMARIUM, 1), new MaterialStack(ELEMENT.getInstance().ALUMINIUM, 3), @@ -576,11 +636,13 @@ public final class ORES { MaterialState.ORE, //State TextureSet.SET_SHINY, //Texture Set new short[]{205, 205, 255, 0}, //Material Colour - 500, - 1500, - 50, - 75, - 0, //Radiation + -1, + -1, + -1, + -1, + false, + "(IrRuRhPt)SAs", + -1, //Radiation new MaterialStack[]{// Na3AlF6 new MaterialStack(ELEMENT.getInstance().SODIUM, 3), new MaterialStack(ELEMENT.getInstance().ALUMINIUM, 1), @@ -593,11 +655,13 @@ public final class ORES { MaterialState.ORE, //State TextureSet.SET_FINE, //Texture Set new short[]{165, 105, 205, 0}, //Material Colour - 500, - 1500, - 50, - 75, - 0, //Radiation + -1, + -1, + -1, + -1, + false, + "(IrRuRhPt)SAs", + -1, //Radiation new MaterialStack[]{// Na3AlF6 new MaterialStack(ELEMENT.getInstance().CALCIUM, 1), new MaterialStack(ELEMENT.getInstance().IODINE, 2), @@ -610,11 +674,13 @@ public final class ORES { MaterialState.ORE, //State TextureSets.REFINED.get(), //Texture Set new short[]{165, 105, 205, 0}, //Material Colour - 500, - 1500, - 50, - 75, - 0, //Radiation + -1, + -1, + -1, + -1, + false, + "(IrRuRhPt)SAs", + -1, //Radiation new MaterialStack[]{// Na3AlF6 new MaterialStack(ELEMENT.getInstance().CHLORINE, 1), new MaterialStack(ELEMENT.getInstance().BROMINE, 1), @@ -628,11 +694,13 @@ public final class ORES { MaterialState.ORE, //State TextureSet.SET_SHINY, //Texture Set new short[]{165, 75, 75, 0}, //Material Colour - 500, - 1500, - 50, - 75, - 0, //Radiation + -1, + -1, + -1, + -1, + false, + "(IrRuRhPt)SAs", + -1, //Radiation new MaterialStack[]{// Na3AlF6 new MaterialStack(ELEMENT.getInstance().BISMUTH, 13), new MaterialStack(ELEMENT.getInstance().SULFUR, 11), @@ -646,10 +714,12 @@ public final class ORES { MaterialState.ORE, //State TextureSets.REFINED.get(), //Texture Set new short[]{65, 205, 105, 0}, //Material Colour - 500, - 1500, - 50, - 75, + -1, + -1, + -1, + -1, + false, + "(IrRuRhPt)SAs", 0, //Radiation new MaterialStack[]{// Na3AlF6 new MaterialStack(ELEMENT.getInstance().MERCURY, 54/4), @@ -667,10 +737,12 @@ public final class ORES { MaterialState.ORE, //State TextureSet.SET_METALLIC, //Texture Set new short[]{77, 165, 174, 0}, //Material Colour - 500, - 1500, - 50, - 75, + -1, + -1, + -1, + -1, + false, + "(IrRuRhPt)SAs", 0, //Radiation new MaterialStack[]{ new MaterialStack(ELEMENT.getInstance().SULFUR, 5), @@ -688,10 +760,12 @@ public final class ORES { MaterialState.ORE, //State TextureSet.SET_FINE, //Texture Set new short[]{165, 165, 5, 0}, //Material Colour - 500, - 1500, - 50, - 75, + -1, + -1, + -1, + -1, + false, + "(IrRuRhPt)SAs", 0, //Radiation new MaterialStack[]{// Na3AlF6 new MaterialStack(ELEMENT.getInstance().GOLD, 3), @@ -706,10 +780,12 @@ public final class ORES { MaterialState.ORE, //State TextureSet.SET_METALLIC, //Texture Set new short[]{16, 5, 105, 0}, //Material Colour - 500, - 1500, - 50, - 75, + -1, + -1, + -1, + -1, + false, + "(IrRuRhPt)SAs", 0, //Radiation new MaterialStack[]{// Na3AlF6 new MaterialStack(ELEMENT.getInstance().GOLD, 8), @@ -725,10 +801,12 @@ public final class ORES { MaterialState.ORE, //State TextureSet.SET_FINE, //Texture Set new short[]{75, 75, 75, 0}, //Material Colour - 500, - 1500, - 50, - 75, + -1, + -1, + -1, + -1, + false, + "(IrRuRhPt)SAs", 0, //Radiation new MaterialStack[]{// Na3AlF6 new MaterialStack(ELEMENT.getInstance().PALLADIUM, 11), @@ -743,10 +821,12 @@ public final class ORES { MaterialState.ORE, //State TextureSet.SET_SHINY, //Texture Set new short[]{75, 105, 75, 0}, //Material Colour - 500, - 1500, - 50, - 75, + -1, + -1, + -1, + -1, + false, + "(IrRuRhPt)SAs", 0, //Radiation new MaterialStack[]{// Na3AlF6 new MaterialStack(ELEMENT.getInstance().IRIDIUM, 2), @@ -761,10 +841,12 @@ public final class ORES { MaterialState.ORE, //State TextureSets.ENRICHED.get(), //Texture Set new short[]{125, 105, 105, 0}, //Material Colour - 500, - 1500, - 50, - 75, + -1, + -1, + -1, + -1, + false, + "(IrRuRhPt)SAs", 0, //Radiation new MaterialStack[]{// Na3AlF6 new MaterialStack(ELEMENT.getInstance().IRIDIUM, 1), @@ -783,10 +865,10 @@ public final class ORES { MaterialState.ORE, //State TextureSet.SET_FLINT, //Texture Set new short[]{205, 205, 205, 0}, //Material Colour - 500, - 1500, - 50, - 75, + -1, + -1, + -1, + -1, 0, //Radiation new MaterialStack[]{// Na3AlF6 new MaterialStack(ELEMENT.getInstance().BARIUM, 32), @@ -795,6 +877,29 @@ public final class ORES { new MaterialStack(ELEMENT.getInstance().OXYGEN, 15) }); + + public static final Material DEEP_EARTH_REACTOR_FUEL_DEPOSIT = new Material( + "Radioactive Minerial Mix", //Material Name + MaterialState.ORE, //State + TextureSets.NUCLEAR.get(), //Texture Set + null, //Material Colour + -1, + -1, + -1, + -1, + 4, //Radiation + new MaterialStack[]{// Na3AlF6 + new MaterialStack(ELEMENT.getInstance().RADON, 3), + new MaterialStack(ELEMENT.getInstance().RADIUM, 2), + new MaterialStack(ELEMENT.getInstance().URANIUM235, 1), + new MaterialStack(ELEMENT.getInstance().URANIUM238, 13), + new MaterialStack(ELEMENT.getInstance().THORIUM, 28), + new MaterialStack(ELEMENT.getInstance().THORIUM232, 5), + new MaterialStack(FLUORCAPHITE, 4), + new MaterialStack(SAMARSKITE_Y, 6), + new MaterialStack(TITANITE, 2) + }); + diff --git a/src/Java/gtPlusPlus/core/material/nuclear/FLUORIDES.java b/src/Java/gtPlusPlus/core/material/nuclear/FLUORIDES.java index c00ba42c68..b7a5f6074d 100644 --- a/src/Java/gtPlusPlus/core/material/nuclear/FLUORIDES.java +++ b/src/Java/gtPlusPlus/core/material/nuclear/FLUORIDES.java @@ -1,7 +1,7 @@ package gtPlusPlus.core.material.nuclear; import gregtech.api.enums.Materials; - +import gregtech.api.enums.TextureSet; import gtPlusPlus.core.material.ELEMENT; import gtPlusPlus.core.material.Material; import gtPlusPlus.core.material.MaterialStack; @@ -11,12 +11,12 @@ public class FLUORIDES { public static final Material FLUORITE = new Material( "Fluorite", //Material Name - MaterialState.SOLID, //State - new short[]{75, 70, 25, 0}, //Material Colour + MaterialState.ORE, //State + null, //Material Colour Materials.Fluorine.mMeltingPoint, //Melting Point in C Materials.Fluorine.mBlastFurnaceTemp, //Boiling Point in C - ((ELEMENT.getInstance().CALCIUM.getProtons()+(ELEMENT.getInstance().FLUORINE.getProtons()*2))/3), //Protons - ((ELEMENT.getInstance().CALCIUM.getNeutrons()+(ELEMENT.getInstance().FLUORINE.getNeutrons()*2))/3), //Neutrons + -1, //Protons + -1, //Neutrons false, //Uses Blast furnace? false, //Generate cells //Material Stacks with Percentage of required elements. @@ -24,19 +24,18 @@ public class FLUORIDES { new MaterialStack(ELEMENT.getInstance().CALCIUM, 16), new MaterialStack(ELEMENT.getInstance().FLUORINE, 32), new MaterialStack(ELEMENT.getInstance().IRON, 4), - new MaterialStack(ELEMENT.getInstance().CARBON, 2), - new MaterialStack(ELEMENT.getInstance().COBALT, 2) + new MaterialStack(ELEMENT.getInstance().CARBON, 2) }); //ThF4 public static final Material THORIUM_TETRAFLUORIDE = new Material( "Thorium Tetrafluoride", //Material Name MaterialState.LIQUID, //State - new short[]{25, 70, 25, 0}, //Material Colour - Materials.Thorium.mMeltingPoint, //Melting Point in C - Materials.Thorium.mBlastFurnaceTemp, //Boiling Point in C - ((ELEMENT.getInstance().THORIUM232.getProtons()+(ELEMENT.getInstance().FLUORINE.getProtons()*4))/5), //Protons - ((ELEMENT.getInstance().THORIUM232.getNeutrons()+(ELEMENT.getInstance().FLUORINE.getNeutrons()*4))/5), //Neutrons + null, //Material Colour + -1, //Melting Point in C + -1, //Boiling Point in C + -1, //Protons + -1, //Neutrons false, //Uses Blast furnace? //Material Stacks with Percentage of required elements. new MaterialStack[]{ @@ -48,11 +47,11 @@ public class FLUORIDES { public static final Material THORIUM_HEXAFLUORIDE = new Material( "Thorium Hexafluoride", //Material Name MaterialState.LIQUID, //State - new short[]{10, 50, 10, 0}, //Material Colour - Materials.Thorium.mMeltingPoint, //Melting Point in C - Materials.Thorium.mBlastFurnaceTemp, //Boiling Point in C - ((ELEMENT.getInstance().THORIUM232.getProtons()+ELEMENT.getInstance().THORIUM232.getProtons()+(ELEMENT.getInstance().FLUORINE.getProtons()*6))/8), //Protons - ((ELEMENT.getInstance().THORIUM232.getNeutrons()+ELEMENT.getInstance().THORIUM232.getNeutrons()+(ELEMENT.getInstance().FLUORINE.getNeutrons()*6))/8), //Neutrons + null, //Material Colour + -1, //Melting Point in C + -1, //Boiling Point in C + -1, //Protons + -1, //Neutrons false, //Uses Blast furnace? //Material Stacks with Percentage of required elements. new MaterialStack[]{ @@ -65,11 +64,11 @@ public class FLUORIDES { public static final Material URANIUM_TETRAFLUORIDE = new Material( "Uranium Tetrafluoride", //Material Name MaterialState.LIQUID, //State - new short[]{50, 240, 50, 0}, //Material Colour - Materials.Uranium235.mMeltingPoint, //Melting Point in C - Materials.Uranium235.mBlastFurnaceTemp, //Boiling Point in C - ((ELEMENT.getInstance().URANIUM233.getProtons()+(ELEMENT.getInstance().FLUORINE.getProtons()*4))/5), //Protons - ((ELEMENT.getInstance().URANIUM233.getNeutrons()+(ELEMENT.getInstance().FLUORINE.getNeutrons()*4))/5), //Neutrons + null, //Material Colour + -1, //Melting Point in C + -1, //Boiling Point in C + -1, //Protons + -1, //Neutrons false, //Uses Blast furnace? //Material Stacks with Percentage of required elements. new MaterialStack[]{ @@ -81,11 +80,11 @@ public class FLUORIDES { public static final Material URANIUM_HEXAFLUORIDE = new Material( "Uranium Hexafluoride", //Material Name MaterialState.LIQUID, //State - new short[]{70, 250, 70, 0}, //Material Colour - Materials.Uranium235.mMeltingPoint, //Melting Point in C - Materials.Uranium235.mBlastFurnaceTemp, //Boiling Point in C - ((FLUORIDES.URANIUM_TETRAFLUORIDE.getProtons()+(ELEMENT.getInstance().FLUORINE.getProtons()*2))/3), //Protons - ((FLUORIDES.URANIUM_TETRAFLUORIDE.getNeutrons()+(ELEMENT.getInstance().FLUORINE.getNeutrons()*2))/3), //Neutrons + null, //Material Colour + -1, //Melting Point in C + -1, //Boiling Point in C + -1, //Protons + -1, //Neutrons false, //Uses Blast furnace? //Material Stacks with Percentage of required elements. new MaterialStack[]{ @@ -94,26 +93,49 @@ public class FLUORIDES { }); //ZrF4 + public static final Material ZIRCONIUM_TETRAFLUORIDE = new Material( "Zirconium Tetrafluoride", //Material Name MaterialState.LIQUID, //State - ELEMENT.getInstance().ZIRCONIUM.getRGBA(), //Material Colour - ELEMENT.getInstance().ZIRCONIUM.getMeltingPointC(), //Melting Point in C - ELEMENT.getInstance().ZIRCONIUM.getBoilingPointC(), //Boiling Point in C - ((ELEMENT.getInstance().ZIRCONIUM.getProtons()+(ELEMENT.getInstance().FLUORINE.getProtons()*4))/5), //Protons - ((ELEMENT.getInstance().ZIRCONIUM.getNeutrons()+(ELEMENT.getInstance().FLUORINE.getNeutrons()*4))/5), //Neutrons + null, //Texture Set (Autogenerated) + 0, + null, //Material Colour + -1, + -1, + -1, + -1, + false, + "ZrF4", + -1, + true, + false, + new MaterialStack[]{ + new MaterialStack(ELEMENT.getInstance().ZIRCONIUM, 1), + new MaterialStack(ELEMENT.getInstance().FLUORINE, 4) + }); + + + +/* public static final Material ZIRCONIUM_TETRAFLUORIDE = new Material( + "Zirconium Tetrafluoride", //Material Name + MaterialState.LIQUID, //State + null, //Material Colour + -1, //Melting Point in C + -1, //Boiling Point in C + -1, //Protons + -1, //Neutrons false, //Uses Blast furnace? //Material Stacks with Percentage of required elements. new MaterialStack[]{ new MaterialStack(ELEMENT.getInstance().ZIRCONIUM, 1), new MaterialStack(ELEMENT.getInstance().FLUORINE, 4) - }); + });*/ //BeF2 public static final Material BERYLLIUM_FLUORIDE = new Material( "Beryllium Fluoride", //Material Name MaterialState.LIQUID, //State - new short[]{120, 210, 120, 0}, //Material Colour + null, //Material Colour -1, -1, -1, @@ -129,11 +151,11 @@ public class FLUORIDES { public static final Material LITHIUM_FLUORIDE = new Material( "Lithium Fluoride", //Material Name MaterialState.LIQUID, //State - new short[]{225, 220, 255, 0}, //Material Colour - Materials.Lithium.mMeltingPoint, //Melting Point in C - Materials.Lithium.mBlastFurnaceTemp, //Boiling Point in C - ((ELEMENT.getInstance().LITHIUM7.getProtons()+(ELEMENT.getInstance().FLUORINE.getProtons()))/2), //Protons - ((ELEMENT.getInstance().LITHIUM7.getNeutrons()+(ELEMENT.getInstance().FLUORINE.getNeutrons()))/2), //Neutrons + null, //Material Colour + -1, //Melting Point in C + -1, //Boiling Point in C + -1, //Protons + -1, //Neutrons false, //Uses Blast furnace? //Material Stacks with Percentage of required elements. new MaterialStack[]{ @@ -148,7 +170,7 @@ public class FLUORIDES { public static final Material HYDROXIDE = new Material( "Hydroxide", //Material Name MaterialState.PURE_LIQUID, //State - new short[]{240, 220, 240, 0}, //Material Colour + null, //Material Colour -1, //Melting Point in C -1, //Boiling Point in C -1, //Protons @@ -164,7 +186,7 @@ public class FLUORIDES { public static final Material AMMONIA = new Material( "Ammonia", //Material Name MaterialState.PURE_LIQUID, //State - new short[]{240, 220, 240, 0}, //Material Colour + null, //Material Colour -77, //Melting Point in C -33, //Boiling Point in C -1, //Protons @@ -180,7 +202,7 @@ public class FLUORIDES { public static final Material AMMONIUM = new Material( "Ammonium", //Material Name MaterialState.PURE_LIQUID, //State - new short[]{240, 220, 240, 0}, //Material Colour + null, //Material Colour -1, //Melting Point in C -1, //Boiling Point in C -1, //Protons @@ -196,7 +218,7 @@ public class FLUORIDES { public static final Material AMMONIUM_BIFLUORIDE = new Material( "Ammonium Bifluoride", //Material Name MaterialState.PURE_LIQUID, //State - new short[]{240, 220, 240, 0}, //Material Colour + null, //Material Colour 126, //Melting Point in C 240, //Boiling Point in C -1, //Protons @@ -213,11 +235,11 @@ public class FLUORIDES { public static final Material BERYLLIUM_HYDROXIDE = new Material( "Beryllium Hydroxide", //Material Name MaterialState.PURE_LIQUID, //State - new short[]{180, 250, 180, 0}, //Material Colour - 1000, //Melting Point in C + null, //Material Colour + -1, //Melting Point in C -1, //Boiling Point in C - -1, - -1, + -1, //Protons + -1, //Neutrons false, //Uses Blast furnace? //Material Stacks with Percentage of required elements. new MaterialStack[]{ @@ -229,7 +251,7 @@ public class FLUORIDES { public static final Material AMMONIUM_TETRAFLUOROBERYLLATE = new Material( "Ammonium Tetrafluoroberyllate", //Material Name MaterialState.PURE_LIQUID, //State - new short[]{140, 220, 140, 0}, //Material Colour + null, //Material Colour 280, //Melting Point in C -1, //Boiling Point in C -1, //Protons @@ -247,11 +269,11 @@ public class FLUORIDES { public static final Material NEPTUNIUM_HEXAFLUORIDE = new Material( "Neptunium Hexafluoride", //Material Name MaterialState.GAS, //State - ELEMENT.getInstance().NEPTUNIUM.getRGBA(), //Material Colour - ELEMENT.getInstance().NEPTUNIUM.getMeltingPointC(), //Melting Point in C - ELEMENT.getInstance().NEPTUNIUM.getBoilingPointC(), //Boiling Point in C - ((ELEMENT.getInstance().NEPTUNIUM.getProtons()+(ELEMENT.getInstance().FLUORINE.getProtons()*6))/7), //Protons - ((ELEMENT.getInstance().NEPTUNIUM.getNeutrons()+(ELEMENT.getInstance().FLUORINE.getNeutrons()*6))/7), //Neutrons + null, //Material Colour + -1, //Melting Point in C + -1, //Boiling Point in C + -1, //Protons + -1, //Neutrons false, //Uses Blast furnace? //Material Stacks with Percentage of required elements. new MaterialStack[]{ @@ -262,11 +284,11 @@ public class FLUORIDES { public static final Material TECHNETIUM_HEXAFLUORIDE = new Material( "Technetium Hexafluoride", //Material Name MaterialState.GAS, //State - ELEMENT.getInstance().TECHNETIUM.getRGBA(), //Material Colour - ELEMENT.getInstance().TECHNETIUM.getMeltingPointC(), //Melting Point in C - ELEMENT.getInstance().TECHNETIUM.getBoilingPointC(), //Boiling Point in C - ((ELEMENT.getInstance().TECHNETIUM.getProtons()+(ELEMENT.getInstance().FLUORINE.getProtons()*6))/7), //Protons - ((ELEMENT.getInstance().TECHNETIUM.getNeutrons()+(ELEMENT.getInstance().FLUORINE.getNeutrons()*6))/7), //Neutrons + null, //Material Colour + -1, //Melting Point in C + -1, //Boiling Point in C + -1, //Protons + -1, //Neutrons false, //Uses Blast furnace? //Material Stacks with Percentage of required elements. new MaterialStack[]{ @@ -277,11 +299,11 @@ public class FLUORIDES { public static final Material SELENIUM_HEXAFLUORIDE = new Material( "Selenium Hexafluoride", //Material Name MaterialState.GAS, //State - ELEMENT.getInstance().SELENIUM.getRGBA(), //Material Colour - ELEMENT.getInstance().SELENIUM.getMeltingPointC(), //Melting Point in C - ELEMENT.getInstance().SELENIUM.getBoilingPointC(), //Boiling Point in C - ((ELEMENT.getInstance().SELENIUM.getProtons()+(ELEMENT.getInstance().FLUORINE.getProtons()*6))/7), //Protons - ((ELEMENT.getInstance().SELENIUM.getNeutrons()+(ELEMENT.getInstance().FLUORINE.getNeutrons()*6))/7), //Neutrons + null, //Material Colour + -1, //Melting Point in C + -1, //Boiling Point in C + -1, //Protons + -1, //Neutrons false, //Uses Blast furnace? //Material Stacks with Percentage of required elements. new MaterialStack[]{ diff --git a/src/Java/gtPlusPlus/core/material/nuclear/NUCLIDE.java b/src/Java/gtPlusPlus/core/material/nuclear/NUCLIDE.java index 45d35d1022..d2e24b04a1 100644 --- a/src/Java/gtPlusPlus/core/material/nuclear/NUCLIDE.java +++ b/src/Java/gtPlusPlus/core/material/nuclear/NUCLIDE.java @@ -1,5 +1,6 @@ package gtPlusPlus.core.material.nuclear; +import gtPlusPlus.core.client.CustomTextureSet.TextureSets; import gtPlusPlus.core.material.ELEMENT; import gtPlusPlus.core.material.Material; import gtPlusPlus.core.material.MaterialStack; @@ -12,12 +13,13 @@ public final class NUCLIDE { public static final Material LiFBeF2ThF4UF4 = new Material( "LiFBeF2ThF4UF4", //Material Name MaterialState.LIQUID, //State - new short[]{40, 90, 25, 0}, //Material Colour + TextureSets.NUCLEAR.get(), + null, //Material Colour 566, //Melting Point in C 870, //Boiling Point in C - 150, //Protons - 150, //Neutrons - true, //Uses Blast furnace? + -1, //Protons + -1, //Neutrons + false, //Uses Blast furnace? StringUtils.subscript(StringUtils.superscript("7")+"LiFBeF2ThF4UF4"), //Chemical Formula 5, //Radioactivity Level //Material Stacks with Percentage of required elements. @@ -27,16 +29,17 @@ public final class NUCLIDE { new MaterialStack(FLUORIDES.THORIUM_TETRAFLUORIDE, 1), new MaterialStack(FLUORIDES.URANIUM_TETRAFLUORIDE, 1) }); - + public static final Material LiFBeF2ZrF4UF4 = new Material( "LiFBeF2ZrF4UF4", //Material Name MaterialState.LIQUID, //State - new short[]{20, 70, 45, 0}, //Material Colour + TextureSets.NUCLEAR.get(), + null, //Material Colour 650, //Melting Point in C 940, //Boiling Point in C - 150, //Protons - 150, //Neutrons - true, //Uses Blast furnace? + -1, //Protons + -1, //Neutrons + false, //Uses Blast furnace? StringUtils.subscript(StringUtils.superscript("7")+"LiFBeF2ZrF4UF4"), //Chemical Formula 5, //Radioactivity Level //Material Stacks with Percentage of required elements. @@ -50,12 +53,13 @@ public final class NUCLIDE { public static final Material LiFBeF2ZrF4U235 = new Material( "LiFBeF2ZrF4U235", //Material Name MaterialState.LIQUID, //State - new short[]{50, 70, 15, 0}, //Material Colour + TextureSets.NUCLEAR.get(), + null, //Material Colour 590, //Melting Point in C 890, //Boiling Point in C - 150, //Protons - 150, //Neutrons - true, //Uses Blast furnace? + -1, //Protons + -1, //Neutrons + false, //Uses Blast furnace? StringUtils.subscript(StringUtils.superscript("7")+"LiFBeF2ZrF4")+StringUtils.superscript("235U"), //Chemical Formula 5, //Radioactivity Level //Material Stacks with Percentage of required elements. diff --git a/src/Java/gtPlusPlus/core/recipe/RECIPES_GREGTECH.java b/src/Java/gtPlusPlus/core/recipe/RECIPES_GREGTECH.java index 219dbc2ca5..22ef27e8cd 100644 --- a/src/Java/gtPlusPlus/core/recipe/RECIPES_GREGTECH.java +++ b/src/Java/gtPlusPlus/core/recipe/RECIPES_GREGTECH.java @@ -15,6 +15,7 @@ import gtPlusPlus.core.lib.LoadedMods; import gtPlusPlus.core.material.ALLOY; import gtPlusPlus.core.material.ELEMENT; import gtPlusPlus.core.material.nuclear.FLUORIDES; +import gtPlusPlus.core.material.nuclear.NUCLIDE; import gtPlusPlus.core.recipe.common.CI; import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.minecraft.FluidUtils; @@ -905,16 +906,29 @@ public class RECIPES_GREGTECH { private static void fluidExtractorRecipes() { //FLiBe fuel GT_Values.RA.addFluidExtractionRecipe(ItemUtils.getItemStackOfAmountFromOreDict("dustLi2BeF4", 1), null, - FluidUtils.getFluidStack("molten.li2bef4", 144), 10000, 100, 500); + FluidUtils.getFluidStack("li2bef4", 144), 10000, 100, 500); //LFTR Fuel 1 - GT_Values.RA.addFluidExtractionRecipe(ItemUtils.getItemStackOfAmountFromOreDict("dustLiBeF2ZrF4U235", 1), null, + GT_Values.RA.addFluidExtractionRecipe(NUCLIDE.LiFBeF2ZrF4U235.getDust(1), null, + NUCLIDE.LiFBeF2ZrF4U235.getFluid(144), 10000, 250, 1000); + GT_Values.RA.addFluidExtractionRecipe(NUCLIDE.LiFBeF2ZrF4UF4.getDust(1), null, + NUCLIDE.LiFBeF2ZrF4UF4.getFluid(144), 10000, 150, 2000); + GT_Values.RA.addFluidExtractionRecipe(NUCLIDE.LiFBeF2ThF4UF4.getDust(1), null, + NUCLIDE.LiFBeF2ThF4UF4.getFluid(144), 10000, 200, 1500); + + //ZIRCONIUM_TETRAFLUORIDE + GT_Values.RA.addFluidExtractionRecipe(FLUORIDES.ZIRCONIUM_TETRAFLUORIDE.getDust(1), null, + FluidUtils.getFluidStack(ModItems.fluidZrF4, 144), 10000, 200, 512+256); + + + +/* GT_Values.RA.addFluidExtractionRecipe(ItemUtils.getItemStackOfAmountFromOreDict("dustLiBeF2ZrF4U235", 1), null, FluidUtils.getFluidStack("molten.libef2zrf4u235", 144), 10000, 250, 1000); //LFTR Fuel 2 GT_Values.RA.addFluidExtractionRecipe(ItemUtils.getItemStackOfAmountFromOreDict("dustLiBeF2ZrF4UF4", 1), null, FluidUtils.getFluidStack("molten.libef2zrf4uf4", 144), 10000, 150, 2000); //LFTR Fuel 2 GT_Values.RA.addFluidExtractionRecipe(ItemUtils.getItemStackOfAmountFromOreDict("dustLiBeF2ThF4UF4", 1), null, - FluidUtils.getFluidStack("molten.libef2thf4uf4", 144), 10000, 200, 1500); + FluidUtils.getFluidStack("molten.libef2thf4uf4", 144), 10000, 200, 1500);*/ } private static void chemicalBathRecipes() { diff --git a/src/Java/gtPlusPlus/core/util/Utils.java b/src/Java/gtPlusPlus/core/util/Utils.java index c600e48f3c..624ed35b60 100644 --- a/src/Java/gtPlusPlus/core/util/Utils.java +++ b/src/Java/gtPlusPlus/core/util/Utils.java @@ -374,7 +374,7 @@ public class Utils { /* * http://javadevnotes.com/java-left-pad-string-with-zeros-examples */ - public static String leftPadWithZeroes(final String originalString, final int length) { + public static String padWithZerosLefts(final String originalString, final int length) { final StringBuilder sb = new StringBuilder(); while ((sb.length() + originalString.length()) < length) { sb.append('0'); @@ -383,6 +383,19 @@ public class Utils { final String paddedString = sb.toString(); return paddedString; } + + public static String padWithZerosRight(final int value, final int length) { + String originalString = String.valueOf(value); + final StringBuilder sb = new StringBuilder(); + while ((sb.length() + originalString.length()) < length) { + sb.append('0'); + } + //sb.append(originalString); + if (sb.length() > 0) + originalString = (originalString + sb.toString()); + final String paddedString = sb.toString(); + return originalString; + } /* * Original Code by Chandana Napagoda - @@ -429,17 +442,20 @@ public class Utils { if (hexAsStringOrInt.getClass() == String.class) { if (((String) hexAsStringOrInt).length() != 6) { - final String temp = leftPadWithZeroes((String) hexAsStringOrInt, 6); + final String temp = padWithZerosLefts((String) hexAsStringOrInt, 6); result = temp; } result = hexChar + hexAsStringOrInt; return result; - } else if (hexAsStringOrInt.getClass() == Integer.class) { - if (((String) hexAsStringOrInt).length() != 6) { - final String temp = leftPadWithZeroes((String) hexAsStringOrInt, 6); + } else if (hexAsStringOrInt.getClass() == Integer.class || hexAsStringOrInt.getClass() == int.class) { + String aa = String.valueOf(hexAsStringOrInt); + if (aa.length() != 6) { + final String temp = padWithZerosLefts(aa, 6); result = temp; } - result = hexChar + String.valueOf(hexAsStringOrInt); + else { + result = hexChar + String.valueOf(hexAsStringOrInt); + } return result; } else { return null; diff --git a/src/Java/gtPlusPlus/core/util/math/MathUtils.java b/src/Java/gtPlusPlus/core/util/math/MathUtils.java index 48d56b3aa8..40ac23a1b8 100644 --- a/src/Java/gtPlusPlus/core/util/math/MathUtils.java +++ b/src/Java/gtPlusPlus/core/util/math/MathUtils.java @@ -127,7 +127,7 @@ public class MathUtils { public static double findPercentage(final double current, final double max){ return Math.round(((current / max) * 100) * 100.00) / 100.00; } - + public static int findPercentageOfInt(long input, float percentage){ return (int)(input*(percentage/100.0f)); } @@ -185,20 +185,20 @@ public class MathUtils { } return result; } - - + + //Smooth Rounding Function - /** - * Returns a long. - * The returned number is d rounded to the nearest flat long. - * Supports Doubles as input. - * - * @param current Current value. - * @return long Rounded value. - */ - public static long roundToClosestLong(final double d) { - return (long) (Math.round(d * 2) / 2.0); - } + /** + * Returns a long. + * The returned number is d rounded to the nearest flat long. + * Supports Doubles as input. + * + * @param current Current value. + * @return long Rounded value. + */ + public static long roundToClosestLong(final double d) { + return (long) (Math.round(d * 2) / 2.0); + } /** @@ -360,11 +360,11 @@ public class MathUtils { public static byte safeByte(long number){ return number>Byte.MAX_VALUE ? Byte.MAX_VALUE :(byte)number; } - + public static short safeShort(long number){ return number>Short.MAX_VALUE ? Short.MAX_VALUE :(short)number; } - + public static int safeInt(long number, int margin){ return number>Integer.MAX_VALUE-margin ? Integer.MAX_VALUE-margin :(int)number; } @@ -381,65 +381,74 @@ public class MathUtils { mLargeChanceArray[g] = mValues[mValueSelection]; } return mLargeChanceArray[randInt(0, mLargeChanceArray.length-1)]; - + } - - + + /* * Averages */ - - public static byte getByteAverage(AutoMap aDataSet) { + + public static byte getByteAverage(AutoMap aDataSet) { byte[] aNewSet = new byte[aDataSet.size()]; for (int u=0;u aDataSet) { short[] aNewSet = new short[aDataSet.size()]; for (int u=0;u aDataSet) { int[] aNewSet = new int[aDataSet.size()]; for (int u=0;u aDataSet) { float[] aNewSet = new float[aDataSet.size()]; for (int u=0;u aDataSet) { long[] aNewSet = new long[aDataSet.size()]; for (int u=0;u aDataSet) { double[] aNewSet = new double[aDataSet.size()]; for (int u=0;u 0) { + return -aPositive; + } + else if (aPositive < 0) { + return +aPositive; + } + else { + return 0; + } + } + + public static V safeCast(Object aNumberType) { + long a1; + double a2; + a1 = Long.parseLong(aNumberType.toString()); + a2 = Double.parseDouble(aNumberType.toString()); + + if ((aNumberType.getClass() == byte.class) || (aNumberType instanceof Byte)){ + if (a1 >= Byte.MIN_VALUE && a1 <= Byte.MAX_VALUE) { + String s = ""+a1; + Byte s1 = Byte.valueOf(s); + return (V) s1; + } + } + else if ((aNumberType.getClass() == short.class) || (aNumberType instanceof Short)){ + if (a1 >= Short.MIN_VALUE && a1 <= Short.MAX_VALUE) { + String s = ""+a1; + Short s1 = Short.valueOf(s); + return (V) s1; + + } + } + else if ((aNumberType.getClass() == int.class) || (aNumberType instanceof Integer)){ + if (a1 >= Integer.MIN_VALUE && a1 <= Integer.MAX_VALUE) { + String s = ""+a1; + Integer s1 = Integer.valueOf(s); + return (V) s1; + + } + } + else if ((aNumberType.getClass() == long.class) || (aNumberType instanceof Long)){ + if (a1 >= Long.MIN_VALUE && a1 <= Long.MAX_VALUE) { + String s = ""+a1; + Long s1 = Long.valueOf(s); + return (V) s1; + } + } + else if ((aNumberType.getClass() == float.class) || (aNumberType instanceof Float)){ + if (a2 >= Float.MIN_VALUE && a2 <= Float.MAX_VALUE) { + String s = ""+a1; + Float s1 = Float.valueOf(s); + return (V) s1; + + } + } + else if ((aNumberType.getClass() == double.class) || (aNumberType instanceof Double)){ + if (a2 >= Double.MIN_VALUE && a2 <= Double.MAX_VALUE) { + String s = ""+a1; + Double s1 = Double.valueOf(s); + return (V) s1; + + } + } + + Integer o = 0; + return (V) o; + + } + + public static byte getSafeByte(Byte b) { + Byte a = safeCast(b); + return a.byteValue(); + } + + public static short getSafeShort(Short b) { + Short a = safeCast(b); + return a.shortValue(); + } + + public static int getSafeInt(Integer b) { + Integer a = safeCast(b); + return a.intValue(); + } + + public static long getSafeLong(Long b) { + Long a = safeCast(b); + return a.longValue(); + } + + public static float getSafeFloat(Float b) { + Float a = safeCast(b); + return a.floatValue(); + } + + public static double getSafeDouble(Double b) { + Double a = safeCast(b); + return a.doubleValue(); + } + + + public static long safeCast_IntToLong(int o) { + long i = o; + return i; + } + + public static int safeCast_LongToInt(long o) { + if (o > Integer.MAX_VALUE) { + return Integer.MAX_VALUE; + } + else { + int i = (int) o; + return i; + } + } + + public static short safeCast_IntToShort(int o) { + if (o > Short.MAX_VALUE) { + return Short.MAX_VALUE; + } + else { + short i = (short) o; + return i; + } + } + + public static int safeCast_ShortToInt(short o) { + int i = (int) o; + return i; + } + + public static byte safeCast_ShortToByte(short o) { + if (o > Byte.MAX_VALUE) { + return Byte.MAX_VALUE; + } + else { + byte i = (byte) o; + return i; + } + } + + public static short safeCast_ByteToshort(byte o) { + short i = (short) o; + return i; + } + } diff --git a/src/Java/gtPlusPlus/core/util/minecraft/ItemUtils.java b/src/Java/gtPlusPlus/core/util/minecraft/ItemUtils.java index 165a7931cb..c7c38eab7d 100644 --- a/src/Java/gtPlusPlus/core/util/minecraft/ItemUtils.java +++ b/src/Java/gtPlusPlus/core/util/minecraft/ItemUtils.java @@ -724,7 +724,20 @@ public class ItemUtils { } return (gregstack); } + + public static ItemStack getOrePrefixStack(OrePrefixes mPrefix, Materials mMat, int mAmount) { + ItemStack aGtStack = GT_OreDictUnificator.get(mPrefix, mMat, mAmount); + if (aGtStack == null) { + return getErrorStack(mAmount); + } + else { + return aGtStack; + } + } + public static ItemStack getErrorStack(int mAmount) { + return getSimpleStack(ModItems.AAA_Broken, mAmount); + } public static ItemStack[] getStackOfAllOreDictGroup(String oredictname){ final ArrayList oreDictList = OreDictionary.getOres(oredictname); if (!oreDictList.isEmpty()){ diff --git a/src/Java/gtPlusPlus/core/util/minecraft/MaterialUtils.java b/src/Java/gtPlusPlus/core/util/minecraft/MaterialUtils.java index 0eb888209a..32607e1247 100644 --- a/src/Java/gtPlusPlus/core/util/minecraft/MaterialUtils.java +++ b/src/Java/gtPlusPlus/core/util/minecraft/MaterialUtils.java @@ -1,25 +1,39 @@ package gtPlusPlus.core.util.minecraft; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.LinkedList; import java.util.List; +import java.util.ListIterator; import java.util.Map; import java.util.Optional; +import java.util.Set; +import java.util.concurrent.ConcurrentSkipListSet; import java.util.function.Function; import java.util.stream.Collectors; import org.apache.commons.lang3.reflect.FieldUtils; +import com.google.common.collect.Lists; + import net.minecraft.item.ItemStack; import gregtech.api.enums.*; - +import gregtech.api.util.GT_Utility; import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.api.objects.data.AutoMap; import gtPlusPlus.api.objects.data.TypeCounter; +import gtPlusPlus.core.client.CustomTextureSet.TextureSets; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.material.Material; +import gtPlusPlus.core.material.MaterialStack; import gtPlusPlus.core.material.state.MaterialState; import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.data.EnumUtils; import gtPlusPlus.core.util.data.StringUtils; +import gtPlusPlus.core.util.math.MathUtils; import gtPlusPlus.core.util.reflect.ReflectionUtils; import net.minecraftforge.oredict.OreDictionary; @@ -45,88 +59,139 @@ public class MaterialUtils { return null; } + private static Map mGeneratedMaterialMap = new HashMap(); public static Material generateMaterialFromGtENUM(final Materials material){ - return generateMaterialFromGtENUM(material, null); + return generateMaterialFromGtENUM(material, null, null); + } + + public static Material generateMaterialFromGtENUM(final Materials material, TextureSet aCustomTextures){ + return generateMaterialFromGtENUM(material, null, aCustomTextures); } public static Material generateMaterialFromGtENUM(final Materials material, short[] customRGB){ - @SuppressWarnings("deprecation") - String name = material.name(); - final short[] rgba = (customRGB == null ? material.mRGBa : customRGB); - final int melting = material.mMeltingPoint; - final int boiling = material.mBlastFurnaceTemp; - final long protons = material.getProtons(); - final long neutrons = material.getNeutrons(); - final boolean blastFurnace = material.mBlastFurnaceRequired; - final TextureSet iconSet = material.mIconSet; - final int durability = material.mDurability; - boolean mGenerateCell = false; - boolean mGenerateFluid = true; - MaterialState materialState; - String chemicalFormula = StringUtils.subscript(Utils.sanitizeString(material.mChemicalFormula)); - final Element element = material.mElement; - int radioactivity = 0; - if (material.isRadioactive()){ - radioactivity = 1; - } - - //Weird Blacklist of Bad Chemical Strings - if (material.mElement == Element.Pb || material.mElement == Element.Na || material.mElement == Element.Ar){ - chemicalFormula = StringUtils.subscript(Utils.sanitizeString(material.mElement.name())); - } - - //Determine default state - Logger.MATERIALS("[Debug] Setting State of GT generated material. "+material.mDefaultLocalName); - if (material.getMolten(1) != null || material.getSolid(1) != null){ - materialState = MaterialState.SOLID; - Logger.MATERIALS("[Debug] Molten or Solid was not null."); - if (material.getMolten(1) == null && material.getSolid(1) != null){ - Logger.MATERIALS("[Debug] Molten is Null, Solid is not. Enabling cell generation."); - mGenerateCell = true; + return generateMaterialFromGtENUM(material, customRGB, null); + } + + public static Material generateMaterialFromGtENUM(final Materials material, short[] customRGB, TextureSet aCustomTextures){ + String aMaterialKey = getMaterialName(material).toLowerCase(); + if (mGeneratedMaterialMap.containsKey(aMaterialKey)) { + return mGeneratedMaterialMap.get(aMaterialKey); + } + + try { + @SuppressWarnings("deprecation") + String name = material.name(); + final short[] rgba = (customRGB == null ? material.mRGBa : customRGB); + final int melting = material.mMeltingPoint; + final int boiling = material.mBlastFurnaceTemp; + final long protons = material.getProtons(); + final long neutrons = material.getNeutrons(); + final boolean blastFurnace = material.mBlastFurnaceRequired; + Integer radioactivity = 0; + if (material.isRadioactive()){ + ItemStack aDustStack = ItemUtils.getOrePrefixStack(OrePrefixes.dust, material, 1); + radioactivity = aDustStack != null ? GT_Utility.getRadioactivityLevel(aDustStack) : 0; + if (radioactivity == 0) { + long aProtons = material.getProtons(); + radioactivity = (int) Math.min(Math.max((aProtons / 30), 1), 9); + } } - else if (material.getMolten(1) != null && material.getSolid(1) == null){ - Logger.MATERIALS("[Debug] Molten is not Null, Solid is null. Not enabling cell generation."); - //mGenerateCell = true; + Logger.MATERIALS("[Debug] Calculated Radiation level to be "+radioactivity.intValue()+"."); + TextureSet iconSet = null; + if (aCustomTextures == null) { + if (material.isRadioactive()) { + iconSet = TextureSets.NUCLEAR.get(); + } + else { + iconSet = material.mIconSet; + } } - Logger.MATERIALS("[Debug] State set as solid."); - } - else if (material.getFluid(1) != null){ - Logger.MATERIALS("[Debug] State set as liquid."); - materialState = MaterialState.LIQUID; - } - else if (material.getGas(1) != null){ - Logger.MATERIALS("[Debug] State set as gas."); - materialState = MaterialState.GAS; - }/* + else { + iconSet = aCustomTextures; + } + if (iconSet == null || iconSet.mSetName.toLowerCase().contains("fluid")) { + iconSet = TextureSet.SET_METALLIC; + } + Logger.MATERIALS("[Debug] Calculated Texture Set to be "+iconSet.mSetName+"."); + + + final int durability = material.mDurability; + boolean mGenerateCell = false; + boolean mGenerateFluid = true; + MaterialState materialState; + String chemicalFormula = StringUtils.subscript(Utils.sanitizeString(material.mChemicalFormula)); + final Element element = material.mElement; + + + //Weird Blacklist of Bad Chemical Strings + if (material.mElement == Element.Pb || material.mElement == Element.Na || material.mElement == Element.Ar){ + chemicalFormula = StringUtils.subscript(Utils.sanitizeString(material.mElement.name())); + } + + //Determine default state + Logger.MATERIALS("[Debug] Setting State of GT generated material. "+material.mDefaultLocalName); + if (material.getMolten(1) != null || material.getSolid(1) != null){ + materialState = MaterialState.SOLID; + Logger.MATERIALS("[Debug] Molten or Solid was not null."); + if (material.getMolten(1) == null && material.getSolid(1) != null){ + Logger.MATERIALS("[Debug] Molten is Null, Solid is not. Enabling cell generation."); + mGenerateCell = true; + } + else if (material.getMolten(1) != null && material.getSolid(1) == null){ + Logger.MATERIALS("[Debug] Molten is not Null, Solid is null. Not enabling cell generation."); + //mGenerateCell = true; + } + Logger.MATERIALS("[Debug] State set as solid."); + } + else if (material.getFluid(1) != null){ + Logger.MATERIALS("[Debug] State set as liquid."); + materialState = MaterialState.LIQUID; + } + else if (material.getGas(1) != null){ + Logger.MATERIALS("[Debug] State set as gas."); + materialState = MaterialState.GAS; + }/* else if (material.getPlasma(1) != null){ Logger.MATERIALS("[Debug] State set as plasma."); materialState = MaterialState.PLASMA; }*/ - else { - Logger.MATERIALS("[Debug] State set as solid. This material has no alternative states, so for safety we wont generate anything."); - materialState = MaterialState.SOLID; - mGenerateFluid = false; - } + else { + Logger.MATERIALS("[Debug] State set as solid. This material has no alternative states, so for safety we wont generate anything."); + materialState = MaterialState.SOLID; + mGenerateFluid = false; + } - if (name.toLowerCase().contains("infused")){ - final String tempname = name.substring(7, name.length()); - name = "Infused " + tempname; + if (name.toLowerCase().contains("infused")){ + final String tempname = name.substring(7, name.length()); + name = "Infused " + tempname; + } + if (hasValidRGBA(rgba) || (element == Element.H) || ((material == Materials.InfusedAir) || (material == Materials.InfusedFire) || (material == Materials.InfusedEarth) || (material == Materials.InfusedWater))){ + //ModItems.itemBaseDecidust = UtilsItems.generateDecidust(material); + //ModItems.itemBaseCentidust = UtilsItems.generateCentidust(material); + Material M = new Material(name, materialState,iconSet, durability, rgba, melting, boiling, protons, neutrons, blastFurnace, chemicalFormula, radioactivity.intValue(), mGenerateCell, mGenerateFluid); + mGeneratedMaterialMap.put(aMaterialKey, M); + return M; + } + else { + Logger.DEBUG_MATERIALS("Failed to generate GT++ material instance for "+material.name() +" | Valid RGB? "+(hasValidRGBA(rgba))); + } } - if (hasValidRGBA(rgba) || (element == Element.H) || ((material == Materials.InfusedAir) || (material == Materials.InfusedFire) || (material == Materials.InfusedEarth) || (material == Materials.InfusedWater))){ - //ModItems.itemBaseDecidust = UtilsItems.generateDecidust(material); - //ModItems.itemBaseCentidust = UtilsItems.generateCentidust(material); - return new Material(name, materialState,iconSet, durability, rgba, melting, boiling, protons, neutrons, blastFurnace, chemicalFormula, radioactivity, mGenerateCell, mGenerateFluid); - } - else { - Logger.DEBUG_MATERIALS("Failed to generate GT++ material instance for "+material.name() +" | Valid RGB? "+(hasValidRGBA(rgba))); + catch (Throwable t) { + Logger.DEBUG_MATERIALS("Failed to generate GT++ material instance for "+material.name()); + t.printStackTrace(); } return null; } public static Material generateQuickMaterial(final String materialName, final MaterialState defaultState, final short[] colour, final int sRadioactivity) { + String aMaterialKey = materialName.toLowerCase(); + if (mGeneratedMaterialMap.containsKey(aMaterialKey)) { + return mGeneratedMaterialMap.get(aMaterialKey); + } + final Material temp = new Material( materialName, defaultState, @@ -138,6 +203,7 @@ public class MaterialUtils { false, "", sRadioactivity); + mGeneratedMaterialMap.put(aMaterialKey, temp); return temp; } @@ -237,7 +303,7 @@ public class MaterialUtils { @SuppressWarnings("deprecation") public static String getMaterialName(Materials mat){ - + String mName = null; try { @@ -281,5 +347,81 @@ public class MaterialUtils { return m; } + public static AutoMap getCompoundMaterialsRecursively(Material aMat){ + return getCompoundMaterialsRecursively_Speiger(aMat); + /* + AutoMap aDataSet = new AutoMap(); + final int HARD_LIMIT = 1000; + int mLoopCounter = 0; + if (aMat.getComposites().size() > 0) { + try { + List xList = Lists.newLinkedList(); + for (MaterialStack kj : aMat.getComposites()) { + xList.add(kj.getStackMaterial()); + } + if (xList.isEmpty()) { + aDataSet.put(aMat); + return aDataSet; + } + ListIterator listIterator = xList.listIterator(); + while(listIterator.hasNext()){ + Material e = listIterator.next(); + listIterator.remove(); + if (mLoopCounter > HARD_LIMIT) { + break; + } + + if (e.getComposites().isEmpty()) { + aDataSet.put(e); + } + else { + for (MaterialStack x : e.getComposites()) { + listIterator.add(x.getStackMaterial()); + } + } + mLoopCounter++; + + + }} + catch (Throwable t) { + aDataSet.put(aMat); + t.printStackTrace(); + } + } + if (aDataSet.isEmpty()) { + aDataSet.put(aMat); + return aDataSet; + } + return aDataSet; + */} + + public static AutoMap getCompoundMaterialsRecursively_Speiger(Material toSearch) { + AutoMap resultList = new AutoMap(); + if (toSearch.getComposites().isEmpty()) { + resultList.put(toSearch); + return resultList; + } + final int HARD_LIMIT = 1000; + + // Could be a Deque but i dont use the interface + // enough to use it as default. + LinkedList toCheck = new LinkedList(); + + toCheck.add(toSearch); + int processed = 0; + while (toCheck.size() > 0 && processed < HARD_LIMIT) { + Material current = toCheck.remove(); + if (current.getComposites().isEmpty()) { + resultList.put(current); + } else { + for (MaterialStack entry : current.getComposites()) { + toCheck.add(entry.getStackMaterial()); + } + } + processed++; + } + return resultList; + } + } \ No newline at end of file -- cgit