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[]