diff options
Diffstat (limited to 'src/Java/gtPlusPlus')
39 files changed, 1892 insertions, 1195 deletions
diff --git a/src/Java/gtPlusPlus/GTplusplus.java b/src/Java/gtPlusPlus/GTplusplus.java index a664555cf2..92c7a9a049 100644 --- a/src/Java/gtPlusPlus/GTplusplus.java +++ b/src/Java/gtPlusPlus/GTplusplus.java @@ -57,6 +57,29 @@ import net.minecraftforge.oredict.OreDictionary; @Mod(modid = CORE.MODID, name = CORE.name, version = CORE.VERSION, dependencies = "required-after:Forge; after:TConstruct; after:PlayerAPI; after:dreamcraft; after:IC2; after:ihl; after:psychedelicraft; after:gregtech; after:Forestry; after:MagicBees; after:CoFHCore; after:Growthcraft; after:Railcraft; after:CompactWindmills; after:ForbiddenMagic; after:MorePlanet; after:PneumaticCraft; after:ExtraUtilities; after:Thaumcraft; after:rftools; after:simplyjetpacks; after:BigReactors; after:EnderIO; after:tectech; after:GTRedtech; after:beyondrealitycore; after:OpenBlocks; after:IC2NuclearControl; after:TGregworks; after:StevesCarts;") public class GTplusplus implements ActionListener { + public static enum INIT_PHASE { + SUPER(null), + PRE_INIT(SUPER), + INIT(PRE_INIT), + POST_INIT(INIT); + protected boolean mIsPhaseActive = false; + private final INIT_PHASE mPrev; + + private INIT_PHASE(INIT_PHASE aPreviousPhase) { + mPrev = aPreviousPhase; + } + + public synchronized final boolean isPhaseActive() { + return mIsPhaseActive; + } + public synchronized final void setPhaseActive(boolean aIsPhaseActive) { + if (mPrev != null && mPrev.isPhaseActive()) { + mPrev.setPhaseActive(false); + } + mIsPhaseActive = aIsPhaseActive; + } + } + //Mod Instance @Mod.Instance(CORE.MODID) public static GTplusplus instance; @@ -87,12 +110,14 @@ public class GTplusplus implements ActionListener { public GTplusplus() { super(); + INIT_PHASE.SUPER.setPhaseActive(true); mChunkLoading = new ChunkLoading(); } // Pre-Init @Mod.EventHandler public void preInit(final FMLPreInitializationEvent event) { + INIT_PHASE.PRE_INIT.setPhaseActive(true); Logger.INFO("Loading " + CORE.name + " "+CORE.VERSION+" on Gregtech "+Utils.getGregtechVersionAsString()); //Load all class objects within the plugin package. Core_Manager.veryEarlyInit(); @@ -133,6 +158,7 @@ public class GTplusplus implements ActionListener { // Init @Mod.EventHandler public void init(final FMLInitializationEvent event) { + INIT_PHASE.INIT.setPhaseActive(true); mChunkLoading.init(event); proxy.init(event); proxy.registerNetworkStuff(); @@ -154,6 +180,7 @@ public class GTplusplus implements ActionListener { // Post-Init @Mod.EventHandler public void postInit(final FMLPostInitializationEvent event) { + INIT_PHASE.POST_INIT.setPhaseActive(true); mChunkLoading.postInit(event); proxy.postInit(event); BookHandler.runLater(); 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<String, BaseItemComponent> aMap = Material.mComponentMap.get(componentMaterial.getUnlocalizedName()); + Map<String, ItemStack> aMap = Material.mComponentMap.get(componentMaterial.getUnlocalizedName()); if (aMap == null) { - aMap = new HashMap<String, BaseItemComponent>(); + aMap = new HashMap<String, ItemStack>(); } 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<String>(); } - 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<String> 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<Material> mMaterialMap = new HashSet<Material>(); - - public static final Map<String, Map<String, BaseItemComponent>> mComponentMap = new HashMap<String, Map<String, BaseItemComponent>>(); + + public static final Map<String, Map<String, ItemStack>> mComponentMap = new HashMap<String, Map<String, ItemStack>>(); 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<String, BaseItemComponent>()); + mComponentMap.put(unlocalizedName, new HashMap<String, ItemStack>()); 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<Material> mMaterialSet = MaterialUtils.getCompoundMaterialsRecursively(this); + for (int mnh = 0; mnh < 3; mnh++) { + AutoMap<Short> aDataSet = new AutoMap<Short>(); + Set<Material> set4 = new HashSet<Material>(); + 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<Integer> aDataSet = new AutoMap<Integer>(); - + 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<Material> sets = new AutoMap<Material>(); - 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<Material>(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<Material>(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<String, BaseItemComponent> g = mComponentMap.get(this.unlocalizedName); + Map<String, ItemStack> g = mComponentMap.get(this.unlocalizedName); if (g == null) { - Map<String, BaseItemComponent> aMap = new HashMap<String, BaseItemComponent>(); + Map<String, ItemStack> aMap = new HashMap<String, ItemStack>(); 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<Integer> aDataSet = new AutoMap<Integer>(); 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<Byte> aDataSet) { byte[] aNewSet = new byte[aDataSet.size()]; for (int u=0;u<aDataSet.size();u++) { - aNewSet[u] = (byte) aDataSet.get(u); + byte b = getSafeByte(aDataSet.get(u)); + aNewSet[u] = b; } return getByteAverage(aNewSet); } - - public static short getShortAverage(AutoMap aDataSet) { + + public static short getShortAverage(AutoMap<Short> aDataSet) { short[] aNewSet = new short[aDataSet.size()]; for (int u=0;u<aDataSet.size();u++) { - aNewSet[u] = (short) aDataSet.get(u); + short b = getSafeShort(aDataSet.get(u)); + aNewSet[u] = b; } return getShortAverage(aNewSet); } - - public static int getIntAverage(AutoMap aDataSet) { + + public static int getIntAverage(AutoMap<Integer> aDataSet) { int[] aNewSet = new int[aDataSet.size()]; for (int u=0;u<aDataSet.size();u++) { - aNewSet[u] = (int) aDataSet.get(u); + int b = getSafeInt(aDataSet.get(u)); + aNewSet[u] = b; } return getIntAverage(aNewSet); } - - public static float getFloatAverage(AutoMap aDataSet) { + + public static float getFloatAverage(AutoMap<Float> aDataSet) { float[] aNewSet = new float[aDataSet.size()]; for (int u=0;u<aDataSet.size();u++) { - aNewSet[u] = (float) aDataSet.get(u); + float b = getSafeFloat(aDataSet.get(u)); + aNewSet[u] = b; } return getFloatAverage(aNewSet); } - - public static long getLongAverage(AutoMap aDataSet) { + + public static long getLongAverage(AutoMap<Long> aDataSet) { long[] aNewSet = new long[aDataSet.size()]; for (int u=0;u<aDataSet.size();u++) { - aNewSet[u] = (long) aDataSet.get(u); + long b = getSafeLong(aDataSet.get(u)); + aNewSet[u] = b; } return getLongAverage(aNewSet); } - - public static double getDoubleAverage(AutoMap aDataSet) { + + public static double getDoubleAverage(AutoMap<Double> aDataSet) { double[] aNewSet = new double[aDataSet.size()]; for (int u=0;u<aDataSet.size();u++) { - aNewSet[u] = (double) aDataSet.get(u); + double b = getSafeDouble(aDataSet.get(u)); + aNewSet[u] = b; } return getDoubleAverage(aNewSet); } - - - + + + public static byte getByteAverage(byte[] aDataSet) { + if (aDataSet.length <= 0) { + return 0; + } int divisor = aDataSet.length; byte total = 0; for (byte i : aDataSet) { @@ -448,17 +457,26 @@ public class MathUtils { byte result = safeByte(total/divisor); return result; } - + public static short getShortAverage(short[] aDataSet) { + if (aDataSet.length <= 0) { + return 0; + } int divisor = aDataSet.length; + Logger.INFO("Calculating Average Short. Divisor: "+divisor); short total = 0; for (short i : aDataSet) { + Logger.INFO("Adding "+i); total += i; } - short result = safeShort(total/divisor); + short result = safeShort((total/divisor)); + Logger.INFO("Average: "+result); return result; } public static int getIntAverage(int[] aDataSet) { + if (aDataSet.length <= 0) { + return 0; + } int divisor = aDataSet.length; int total = 0; for (int i : aDataSet) { @@ -468,6 +486,9 @@ public class MathUtils { return result; } public static float getFloatAverage(float[] aDataSet) { + if (aDataSet.length <= 0) { + return 0; + } int divisor = aDataSet.length; float total = 0; for (float i : aDataSet) { @@ -477,6 +498,9 @@ public class MathUtils { return result; } public static long getLongAverage(long[] aDataSet) { + if (aDataSet.length <= 0) { + return 0; + } int divisor = aDataSet.length; long total = 0; for (long i : aDataSet) { @@ -486,6 +510,9 @@ public class MathUtils { return result; } public static double getDoubleAverage(double[] aDataSet) { + if (aDataSet.length <= 0) { + return 0; + } int divisor = aDataSet.length; double total = 0; for (double i : aDataSet) { @@ -495,4 +522,163 @@ public class MathUtils { return result; } + public static int howManyPlaces(int aValueForGen) { + if (aValueForGen < 0) { + aValueForGen = makeNegative(aValueForGen); + } + String a = String.valueOf(aValueForGen); + return a.length(); + } + + /** + * Inverts the value, making Positives into Negatives and vice versa. + * @param aPositive - An int value, either positive or negative. + * @return - Inverted int Value. + */ + public static int makeNegative(int aPositive) { + if (aPositive > 0) { + return -aPositive; + } + else if (aPositive < 0) { + return +aPositive; + } + else { + return 0; + } + } + + public static <V> 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<ItemStack> 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<String, Material> 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<Material> getCompoundMaterialsRecursively(Material aMat){ + return getCompoundMaterialsRecursively_Speiger(aMat); + /* + AutoMap<Material> aDataSet = new AutoMap<Material>(); + final int HARD_LIMIT = 1000; + int mLoopCounter = 0; + if (aMat.getComposites().size() > 0) { + try { + List<Material> xList = Lists.newLinkedList(); + for (MaterialStack kj : aMat.getComposites()) { + xList.add(kj.getStackMaterial()); + } + if (xList.isEmpty()) { + aDataSet.put(aMat); + return aDataSet; + } + ListIterator<Material> 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<Material> getCompoundMaterialsRecursively_Speiger(Material toSearch) { + AutoMap<Material> resultList = new AutoMap<Material>(); + 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<Material> toCheck = new LinkedList<Material>(); + + 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 diff --git a/src/Java/gtPlusPlus/everglades/GTplusplus_Everglades.java b/src/Java/gtPlusPlus/everglades/GTplusplus_Everglades.java index 031533f026..db94bae390 100644 --- a/src/Java/gtPlusPlus/everglades/GTplusplus_Everglades.java +++ b/src/Java/gtPlusPlus/everglades/GTplusplus_Everglades.java @@ -116,6 +116,7 @@ public class GTplusplus_Everglades implements ActionListener { MaterialGenerator.generateOreMaterial(ORES.KASHINITE); MaterialGenerator.generateOreMaterial(ORES.IRARSITE); MaterialGenerator.generateOreMaterial(ORES.RADIOBARITE); + MaterialGenerator.generateOreMaterial(ORES.DEEP_EARTH_REACTOR_FUEL_DEPOSIT); //Custom Ores if (LoadedMods.Big_Reactors) { diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java index 7c099f49ef..38e5681bdc 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java @@ -755,8 +755,17 @@ GT_MetaTileEntity_MultiBlockBase { } //mControlCoreBus - public boolean addControlCoreToMachineList(final IGregTechTileEntity aTileEntity, final int aBaseCasingIndex) { - return addToMachineList(aTileEntity, aBaseCasingIndex); + public boolean addControlCoreToMachineList(final IGregTechTileEntity aTileEntity, final int aBaseCasingIndex) { + log("Found GT_MetaTileEntity_Hatch_ControlCore"); + final IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); + if (aMetaTileEntity == null) { + return false; + } + if (!mControlCoreBus.isEmpty()) { + return false; + } + + return addToMachineListInternal(mControlCoreBus, aMetaTileEntity, aBaseCasingIndex); } @Override @@ -775,7 +784,7 @@ GT_MetaTileEntity_MultiBlockBase { //Handle Custom Hustoms if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_ControlCore) { log("Found GT_MetaTileEntity_Hatch_ControlCore"); - aDidAdd = addToMachineListInternal(mControlCoreBus, aMetaTileEntity, aBaseCasingIndex); + aDidAdd = addControlCoreToMachineList(aTileEntity, aBaseCasingIndex); } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputBattery) { log("Found GT_MetaTileEntity_Hatch_InputBattery"); @@ -917,9 +926,13 @@ GT_MetaTileEntity_MultiBlockBase { } @Override - public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { - resetRecipeMapForAllInputHatches(); + public final void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { super.onScrewdriverRightClick(aSide, aPlayer, aX, aY, aZ); + onModeChangeByScrewdriver(aSide, aPlayer, aX, aY, aZ); + } + + public void onModeChangeByScrewdriver(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { + resetRecipeMapForAllInputHatches(); } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/misc/GregtechMTE_TeslaTower.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/misc/GregtechMTE_TeslaTower.java index 0bc9014f01..43f317d25c 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/misc/GregtechMTE_TeslaTower.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/misc/GregtechMTE_TeslaTower.java @@ -447,7 +447,7 @@ public class GregtechMTE_TeslaTower extends GregtechMeta_MultiBlockBase { } @Override - public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { + public void onModeChangeByScrewdriver(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { mMode = Utils.invertBoolean(mMode); this.mInRange.clear(); if (mMode){ diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialArcFurnace.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialArcFurnace.java index 83984c1286..b2b4cdfda5 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialArcFurnace.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialArcFurnace.java @@ -339,8 +339,7 @@ extends GregtechMeta_MultiBlockBase { } @Override - public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { - super.onScrewdriverRightClick(aSide, aPlayer, aX, aY, aZ); + public void onModeChangeByScrewdriver(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { if (this.mSize > 3) { this.mPlasmaMode = Utils.invertBoolean(mPlasmaMode); if (mPlasmaMode) { @@ -349,7 +348,8 @@ extends GregtechMeta_MultiBlockBase { else { PlayerUtils.messagePlayer(aPlayer, "["+EnumChatFormatting.RED+"MODE"+EnumChatFormatting.RESET+"] "+EnumChatFormatting.YELLOW+"Electric"+EnumChatFormatting.RESET); } - } + } + super.onScrewdriverRightClick(aSide, aPlayer, aX, aY, aZ); } @Override diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialCentrifuge.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialCentrifuge.java index 3c99a74052..9a23567022 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialCentrifuge.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialCentrifuge.java @@ -195,15 +195,15 @@ extends GregtechMeta_MultiBlockBase { } @Override - public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { - super.onScrewdriverRightClick(aSide, aPlayer, aX, aY, aZ); + public void onModeChangeByScrewdriver(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { this.mIsAnimated = Utils.invertBoolean(mIsAnimated); if (this.mIsAnimated) { PlayerUtils.messagePlayer(aPlayer, "Using Animated Turbine Texture."); } else { PlayerUtils.messagePlayer(aPlayer, "Using Static Turbine Texture."); - } + } + super.onScrewdriverRightClick(aSide, aPlayer, aX, aY, aZ); } @Override diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMultiMachine.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMultiMachine.java index 7e14604266..cf780cbedf 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMultiMachine.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMultiMachine.java @@ -843,7 +843,7 @@ extends GregtechMeta_MultiBlockBase { } @Override - public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { + public void onModeChangeByScrewdriver(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { if (mInternalMode < 2) { mInternalMode++; } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialPlatePress.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialPlatePress.java index aa13c8d712..36a880633f 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialPlatePress.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialPlatePress.java @@ -186,7 +186,7 @@ public class GregtechMetaTileEntity_IndustrialPlatePress extends GregtechMeta_Mu } @Override - public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { + public void onModeChangeByScrewdriver(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { mFormingMode = Utils.invertBoolean(mFormingMode); if (mFormingMode){ PlayerUtils.messagePlayer(aPlayer, "Now running in Forming Press Mode."); diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialWashPlant.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialWashPlant.java index e7b2a9c4a5..c6ba185e77 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialWashPlant.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialWashPlant.java @@ -358,7 +358,7 @@ extends GregtechMeta_MultiBlockBase { } @Override - public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { + public void onModeChangeByScrewdriver(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { mChemicalMode = Utils.invertBoolean(mChemicalMode); if (mChemicalMode){ PlayerUtils.messagePlayer(aPlayer, "Wash Plant is now running in Chemical Bath Mode."); diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GT4Entity_AutoCrafter.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GT4Entity_AutoCrafter.java index 64b64981e7..bb6a3c9631 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GT4Entity_AutoCrafter.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GT4Entity_AutoCrafter.java @@ -224,7 +224,7 @@ public class GT4Entity_AutoCrafter extends GregtechMeta_MultiBlockBase { private boolean isModernGT = true; @Override - public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { + public void onModeChangeByScrewdriver(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { if (isModernGT && !CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK) { isModernGT = false; } @@ -232,13 +232,13 @@ public class GT4Entity_AutoCrafter extends GregtechMeta_MultiBlockBase { if (isModernGT && !CORE.GTNH) { mMachineMode = mMachineMode.nextMode(); if (mMachineMode == MODE.CRAFTING) { - PlayerUtils.messagePlayer(aPlayer, "Running the Auto-Crafter in mode: §dAuto-Crafting"); + PlayerUtils.messagePlayer(aPlayer, "Running the Auto-Crafter in mode: �dAuto-Crafting"); } else if (mMachineMode == MODE.ASSEMBLY) { - PlayerUtils.messagePlayer(aPlayer, "Running the Auto-Crafter in mode: §aAssembly"); + PlayerUtils.messagePlayer(aPlayer, "Running the Auto-Crafter in mode: �aAssembly"); } else if (mMachineMode == MODE.DISASSEMBLY) { - PlayerUtils.messagePlayer(aPlayer, "Running the Auto-Crafter in mode: §cDisassembly"); + PlayerUtils.messagePlayer(aPlayer, "Running the Auto-Crafter in mode: �cDisassembly"); } else { - PlayerUtils.messagePlayer(aPlayer, "Running the Auto-Crafter in mode: §eCircuit Assembly"); + PlayerUtils.messagePlayer(aPlayer, "Running the Auto-Crafter in mode: �eCircuit Assembly"); } } //5.08 support @@ -251,11 +251,11 @@ public class GT4Entity_AutoCrafter extends GregtechMeta_MultiBlockBase { } if (mMachineMode == MODE.CRAFTING) { - PlayerUtils.messagePlayer(aPlayer, "You are now running the Auto-Crafter in mode: §dAuto-Crafting"); + PlayerUtils.messagePlayer(aPlayer, "You are now running the Auto-Crafter in mode: �dAuto-Crafting"); } else if (mMachineMode == MODE.ASSEMBLY) { - PlayerUtils.messagePlayer(aPlayer, "You are now running the Auto-Crafter in mode: §aAssembly"); + PlayerUtils.messagePlayer(aPlayer, "You are now running the Auto-Crafter in mode: �aAssembly"); } else { - PlayerUtils.messagePlayer(aPlayer, "You are now running the Auto-Crafter in mode: §cDisassembly"); + PlayerUtils.messagePlayer(aPlayer, "You are now running the Auto-Crafter in mode: �cDisassembly"); } } super.onScrewdriverRightClick(aSide, aPlayer, aX, aY, aZ); diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_SolarTower.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_SolarTower.java index 6e233f9035..04bdbd9647 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_SolarTower.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_SolarTower.java @@ -249,7 +249,7 @@ extends GregtechMeta_MultiBlockBase { } @Override - public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { + public void onModeChangeByScrewdriver(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { super.onScrewdriverRightClick(aSide, aPlayer, aX, aY, aZ); if (this.mHeight > 3) {} diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/GT_MTE_LargeTurbine_SHSteam.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/GT_MTE_LargeTurbine_SHSteam.java index e3405f37b8..e4016e6650 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/GT_MTE_LargeTurbine_SHSteam.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/GT_MTE_LargeTurbine_SHSteam.java @@ -128,11 +128,12 @@ public class GT_MTE_LargeTurbine_SHSteam extends GregtechMetaTileEntity_LargerTu } @Override - public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { + public void onModeChangeByScrewdriver(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { if (aSide == getBaseMetaTileEntity().getFrontFacing()) { looseFit^=true; GT_Utility.sendChatToPlayer(aPlayer, looseFit ? "Fitting: Loose - More Flow" : "Fitting: Tight - More Efficiency"); } + super.onScrewdriverRightClick(aSide, aPlayer, aX, aY, aZ); } @Override diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/GT_MTE_LargeTurbine_Steam.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/GT_MTE_LargeTurbine_Steam.java index 7a0ba50b52..ce30f92466 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/GT_MTE_LargeTurbine_Steam.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/GT_MTE_LargeTurbine_Steam.java @@ -136,11 +136,12 @@ public class GT_MTE_LargeTurbine_Steam extends GregtechMetaTileEntity_LargerTurb } @Override - public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { + public void onModeChangeByScrewdriver(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { if (aSide == getBaseMetaTileEntity().getFrontFacing()) { looseFit^=true; GT_Utility.sendChatToPlayer(aPlayer, looseFit ? "Fitting: Loose - More Flow" : "Fitting: Tight - More Efficiency"); } + super.onScrewdriverRightClick(aSide, aPlayer, aX, aY, aZ); } @Override diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/GregtechMetaTileEntity_LargerTurbineBase.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/GregtechMetaTileEntity_LargerTurbineBase.java index 27181a792e..575e8d9b73 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/GregtechMetaTileEntity_LargerTurbineBase.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/GregtechMetaTileEntity_LargerTurbineBase.java @@ -481,7 +481,7 @@ public abstract class GregtechMetaTileEntity_LargerTurbineBase extends GregtechM @Override - public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { + public void onModeChangeByScrewdriver(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { if (!KeyboardUtils.isShiftKeyDown()) { super.onScrewdriverRightClick(aSide, aPlayer, aX, aY, aZ); } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/storage/GregtechMetaTileEntity_PowerSubStationController.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/storage/GregtechMetaTileEntity_PowerSubStationController.java index 2bbe6e96f5..e925dc388b 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/storage/GregtechMetaTileEntity_PowerSubStationController.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/storage/GregtechMetaTileEntity_PowerSubStationController.java @@ -568,7 +568,7 @@ public class GregtechMetaTileEntity_PowerSubStationController extends GregtechMe } @Override - public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { + public void onModeChangeByScrewdriver(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { mIsOutputtingPower = Utils.invertBoolean(mIsOutputtingPower); if (mIsOutputtingPower) { PlayerUtils.messagePlayer(aPlayer, "Sub-Station is now outputting power from the controller."); diff --git a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_AlloySmelter.java b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_AlloySmelter.java index f0a816d405..6ed5eecd38 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_AlloySmelter.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_AlloySmelter.java @@ -31,6 +31,7 @@ public class RecipeGen_AlloySmelter extends RecipeGen_Base { final int tVoltageMultiplier = material.getMeltingPointK() >= 2800 ? 60 : 15; //Nuggets + if (material.getIngot(1) != null && material.getNugget(1) != null) GT_Values.RA.addAlloySmelterRecipe( material.getIngot(1), ItemList.Shape_Mold_Nugget.get(0), @@ -39,6 +40,7 @@ public class RecipeGen_AlloySmelter extends RecipeGen_Base { 2 * tVoltageMultiplier); //Gears + if (material.getIngot(1) != null && material.getGear(1) != null) GT_Values.RA.addAlloySmelterRecipe( material.getIngot(8), ItemList.Shape_Mold_Gear.get(0), @@ -47,6 +49,7 @@ public class RecipeGen_AlloySmelter extends RecipeGen_Base { 2 * tVoltageMultiplier); //Ingot + if (material.getIngot(1) != null && material.getNugget(1) != null) GT_Values.RA.addAlloySmelterRecipe( material.getNugget(9), ItemList.Shape_Mold_Ingot.get(0), diff --git a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Extruder.java b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Extruder.java index 08008994ea..2fd7f93c2d 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Extruder.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Extruder.java @@ -35,7 +35,7 @@ public class RecipeGen_Extruder extends RecipeGen_Base { final int tVoltageMultiplier = material.getMeltingPointK() >= 2800 ? 60 : 15; final ItemStack itemIngot = material.getIngot(1); - final ItemStack plate_Single = material.getPlate(1); + final ItemStack itemPlate = material.getPlate(1); final ItemStack itemGear = material.getGear(1); final ItemStack shape_Plate = ItemList.Shape_Extruder_Plate.get(0); @@ -49,6 +49,7 @@ public class RecipeGen_Extruder extends RecipeGen_Base { Logger.WARNING("Generating Extruder recipes for "+material.getLocalizedName()); //Ingot Recipe + if (material.getIngot(1) != null && material.getBlock(1) != null) if (addExtruderRecipe( material.getBlock(1), shape_Ingot, @@ -62,6 +63,7 @@ public class RecipeGen_Extruder extends RecipeGen_Base { } //Block Recipe + if (material.getIngot(1) != null && material.getBlock(1) != null) if (addExtruderRecipe( material.getIngot(9), shape_Block, @@ -75,10 +77,11 @@ public class RecipeGen_Extruder extends RecipeGen_Base { } //Plate Recipe + if (material.getIngot(1) != null && material.getPlate(1) != null) if (addExtruderRecipe( itemIngot, shape_Plate, - plate_Single, + itemPlate, 10, 4 * tVoltageMultiplier)){ Logger.WARNING("Extruder Plate Recipe: "+material.getLocalizedName()+" - Success"); } @@ -87,6 +90,7 @@ public class RecipeGen_Extruder extends RecipeGen_Base { } //Ring Recipe + if (material.getIngot(1) != null && material.getRing(1) != null) if (!material.isRadioactive){ if (addExtruderRecipe( itemIngot, @@ -103,6 +107,7 @@ public class RecipeGen_Extruder extends RecipeGen_Base { //Gear Recipe + if (material.getIngot(1) != null && material.getGear(1) != null) if (!material.isRadioactive){ if (addExtruderRecipe( material.getIngot(4), @@ -119,6 +124,7 @@ public class RecipeGen_Extruder extends RecipeGen_Base { //Rod Recipe + if (material.getIngot(1) != null && material.getRod(1) != null) if (addExtruderRecipe( itemIngot, shape_Rod, @@ -133,6 +139,7 @@ public class RecipeGen_Extruder extends RecipeGen_Base { //Bolt Recipe + if (material.getIngot(1) != null && material.getBolt(1) != null) if (!material.isRadioactive){ if (addExtruderRecipe( itemIngot, diff --git a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Fluids.java b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Fluids.java index 1f3c91c9cb..5e2675689b 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Fluids.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Fluids.java @@ -18,11 +18,11 @@ public class RecipeGen_Fluids extends RecipeGen_Base { MaterialGenerator.mRecipeMapsToGenerate.put(mRecipeGenMap); } - public RecipeGen_Fluids(final Material M){ + public RecipeGen_Fluids(final Material M) { this(M, false); } - - public RecipeGen_Fluids(final Material M, final boolean dO){ + + public RecipeGen_Fluids(final Material M, final boolean dO) { this.toGenerate = M; this.disableOptional = dO; mRecipeGenMap.add(this); @@ -33,263 +33,269 @@ public class RecipeGen_Fluids extends RecipeGen_Base { generateRecipes(this.toGenerate, this.disableOptional); } - private void generateRecipes(final Material material, final boolean dO){ + private void generateRecipes(final Material material, final boolean dO) { if (material == null) { return; } - - //Melting Shapes to fluid - if (material.getFluid(1) != null && !material.getFluid(1).getUnlocalizedName().toLowerCase().contains("plasma")){ - + + // Melting Shapes to fluid + if (material.getFluid(1) != null + && !material.getFluid(1).getUnlocalizedName().toLowerCase().contains("plasma")) { + if (!material.requiresBlastFurnace()) { - //Ingot - if (GT_Values.RA.addFluidExtractionRecipe(material.getIngot(1), //Input - null, //Input 2 - material.getFluid(144), //Fluid Output - 0, //Chance - 1*20, //Duration - 16 //Eu Tick - )){ - Logger.WARNING("144l fluid extractor from 1 ingot Recipe: "+material.getLocalizedName()+" - Success"); - } - else { - Logger.WARNING("144l fluid extractor from 1 ingot Recipe: "+material.getLocalizedName()+" - Failed"); - } + // Ingot + if (material.getIngot(1) != null) + if (GT_Values.RA.addFluidExtractionRecipe(material.getIngot(1), // Input + null, // Input 2 + material.getFluid(144), // Fluid Output + 0, // Chance + 1 * 20, // Duration + 16 // Eu Tick + )) { + Logger.WARNING("144l fluid extractor from 1 ingot Recipe: " + material.getLocalizedName() + + " - Success"); + } else { + Logger.WARNING("144l fluid extractor from 1 ingot Recipe: " + material.getLocalizedName() + + " - Failed"); + } - //Plate - if (GT_Values.RA.addFluidExtractionRecipe(material.getPlate(1), //Input - null, //Input 2 - material.getFluid(144), //Fluid Output - 0, //Chance - 1*20, //Duration - 16 //Eu Tick - )){ - Logger.WARNING("144l fluid extractor from 1 plate Recipe: "+material.getLocalizedName()+" - Success"); - } - else { - Logger.WARNING("144l fluid extractor from 1 plate Recipe: "+material.getLocalizedName()+" - Failed"); - } + // Plate + if (material.getPlate(1) != null) + if (GT_Values.RA.addFluidExtractionRecipe(material.getPlate(1), // Input + null, // Input 2 + material.getFluid(144), // Fluid Output + 0, // Chance + 1 * 20, // Duration + 16 // Eu Tick + )) { + Logger.WARNING("144l fluid extractor from 1 plate Recipe: " + material.getLocalizedName() + + " - Success"); + } else { + Logger.WARNING("144l fluid extractor from 1 plate Recipe: " + material.getLocalizedName() + + " - Failed"); + } - //Double Plate - if (GT_Values.RA.addFluidExtractionRecipe(material.getPlateDouble(1), //Input - null, //Input 2 - material.getFluid(288), //Fluid Output - 0, //Chance - 1*20, //Duration - 16 //Eu Tick - )){ - Logger.WARNING("144l fluid extractor from 1 double plate Recipe: "+material.getLocalizedName()+" - Success"); - } - else { - Logger.WARNING("144l fluid extractor from 1 double plate Recipe: "+material.getLocalizedName()+" - Failed"); - } + // Double Plate + if (material.getPlateDouble(1) != null) + if (GT_Values.RA.addFluidExtractionRecipe(material.getPlateDouble(1), // Input + null, // Input 2 + material.getFluid(288), // Fluid Output + 0, // Chance + 1 * 20, // Duration + 16 // Eu Tick + )) { + Logger.WARNING("144l fluid extractor from 1 double plate Recipe: " + material.getLocalizedName() + + " - Success"); + } else { + Logger.WARNING("144l fluid extractor from 1 double plate Recipe: " + material.getLocalizedName() + + " - Failed"); + } - //Nugget - if (GT_Values.RA.addFluidExtractionRecipe(material.getNugget(1), //Input - null, //Input 2 - material.getFluid(16), //Fluid Output - 0, //Chance - 16, //Duration - 8 //Eu Tick - )){ - Logger.WARNING("16l fluid extractor from 1 nugget Recipe: "+material.getLocalizedName()+" - Success"); - } - else { - Logger.WARNING("16l fluid extractor from 1 nugget Recipe: "+material.getLocalizedName()+" - Failed"); - } + // Nugget + if (material.getNugget(1) != null) + if (GT_Values.RA.addFluidExtractionRecipe(material.getNugget(1), // Input + null, // Input 2 + material.getFluid(16), // Fluid Output + 0, // Chance + 16, // Duration + 8 // Eu Tick + )) { + Logger.WARNING("16l fluid extractor from 1 nugget Recipe: " + material.getLocalizedName() + + " - Success"); + } else { + Logger.WARNING("16l fluid extractor from 1 nugget Recipe: " + material.getLocalizedName() + + " - Failed"); + } - //Block - if (GT_Values.RA.addFluidExtractionRecipe(material.getBlock(1), //Input - null, //Input 2 - material.getFluid(144*9), //Fluid Output - 0, //Chance - 288, //Duration - 16 //Eu Tick - )){ - Logger.WARNING((144*9)+"l fluid extractor from 1 block Recipe: "+material.getLocalizedName()+" - Success"); - } - else { - Logger.WARNING((144*9)+"l fluid extractor from 1 block Recipe: "+material.getLocalizedName()+" - Failed"); - } + // Block + if (material.getBlock(1) != null) + if (GT_Values.RA.addFluidExtractionRecipe(material.getBlock(1), // Input + null, // Input 2 + material.getFluid(144 * 9), // Fluid Output + 0, // Chance + 288, // Duration + 16 // Eu Tick + )) { + Logger.WARNING((144 * 9) + "l fluid extractor from 1 block Recipe: " + + material.getLocalizedName() + " - Success"); + } else { + Logger.WARNING((144 * 9) + "l fluid extractor from 1 block Recipe: " + + material.getLocalizedName() + " - Failed"); + } } + // Making Shapes from fluid + // Ingot + if (material.getIngot(1) != null) + if (GT_Values.RA.addFluidSolidifierRecipe(ItemList.Shape_Mold_Ingot.get(0), // Item Shape + material.getFluid(144), // Fluid Input + material.getIngot(1), // output + 32, // Duration + 8 // Eu Tick + )) { + Logger.WARNING( + "144l fluid molder for 1 ingot Recipe: " + material.getLocalizedName() + " - Success"); + } else { + Logger.WARNING( + "144l fluid molder for 1 ingot Recipe: " + material.getLocalizedName() + " - Failed"); + } + // Plate + if (material.getPlate(1) != null) + if (GT_Values.RA.addFluidSolidifierRecipe(ItemList.Shape_Mold_Plate.get(0), // Item Shape + material.getFluid(144), // Fluid Input + material.getPlate(1), // output + 32, // Duration + 8 // Eu Tick + )) { + Logger.WARNING( + "144l fluid molder for 1 plate Recipe: " + material.getLocalizedName() + " - Success"); + } else { + Logger.WARNING( + "144l fluid molder for 1 plate Recipe: " + material.getLocalizedName() + " - Failed"); + } + // Nugget + if (material.getNugget(1) != null) + if (GT_Values.RA.addFluidSolidifierRecipe(ItemList.Shape_Mold_Nugget.get(0), // Item Shape + material.getFluid(16), // Fluid Input + material.getNugget(1), // output + 16, // Duration + 4 // Eu Tick + )) { + Logger.WARNING( + "16l fluid molder for 1 nugget Recipe: " + material.getLocalizedName() + " - Success"); + } else { + Logger.WARNING( + "16l fluid molder for 1 nugget Recipe: " + material.getLocalizedName() + " - Failed"); + } - //Making Shapes from fluid - - //Ingot - if (GT_Values.RA.addFluidSolidifierRecipe( - ItemList.Shape_Mold_Ingot.get(0), //Item Shape - material.getFluid(144), //Fluid Input - material.getIngot(1), //output - 32, //Duration - 8 //Eu Tick - )){ - Logger.WARNING("144l fluid molder for 1 ingot Recipe: "+material.getLocalizedName()+" - Success"); - } - else { - Logger.WARNING("144l fluid molder for 1 ingot Recipe: "+material.getLocalizedName()+" - Failed"); - } + // Gears + if (material.getGear(1) != null) + if (GT_Values.RA.addFluidSolidifierRecipe(ItemList.Shape_Mold_Gear.get(0), // Item Shape + material.getFluid(576), // Fluid Input + material.getGear(1), // output + 128, // Duration + 8 // Eu Tick + )) { + Logger.WARNING( + "576l fluid molder for 1 gear Recipe: " + material.getLocalizedName() + " - Success"); + } else { + Logger.WARNING("576l fluid molder for 1 gear Recipe: " + material.getLocalizedName() + " - Failed"); + } - //Plate - if (GT_Values.RA.addFluidSolidifierRecipe( - ItemList.Shape_Mold_Plate.get(0), //Item Shape - material.getFluid(144), //Fluid Input - material.getPlate(1), //output - 32, //Duration - 8 //Eu Tick - )){ - Logger.WARNING("144l fluid molder for 1 plate Recipe: "+material.getLocalizedName()+" - Success"); - } - else { - Logger.WARNING("144l fluid molder for 1 plate Recipe: "+material.getLocalizedName()+" - Failed"); - } + // Blocks + if (material.getBlock(1) != null) + if (GT_Values.RA.addFluidSolidifierRecipe(ItemList.Shape_Mold_Block.get(0), // Item Shape + material.getFluid(144 * 9), // Fluid Input + material.getBlock(1), // output + 288, // Duration + 16 // Eu Tick + )) { + Logger.WARNING((144 * 9) + "l fluid molder from 1 block Recipe: " + material.getLocalizedName() + + " - Success"); + } else { + Logger.WARNING((144 * 9) + "l fluid molder from 1 block Recipe: " + material.getLocalizedName() + + " - Failed"); + } - //Nugget - if (GT_Values.RA.addFluidSolidifierRecipe( - ItemList.Shape_Mold_Nugget.get(0), //Item Shape - material.getFluid(16), //Fluid Input - material.getNugget(1), //output - 16, //Duration - 4 //Eu Tick - )){ - Logger.WARNING("16l fluid molder for 1 nugget Recipe: "+material.getLocalizedName()+" - Success"); - } - else { - Logger.WARNING("16l fluid molder for 1 nugget Recipe: "+material.getLocalizedName()+" - Failed"); - } + if (CORE.GTNH) { - //Gears - if (GT_Values.RA.addFluidSolidifierRecipe( - ItemList.Shape_Mold_Gear.get(0), //Item Shape - material.getFluid(576), //Fluid Input - material.getGear(1), //output - 128, //Duration - 8 //Eu Tick - )){ - Logger.WARNING("576l fluid molder for 1 gear Recipe: "+material.getLocalizedName()+" - Success"); - } - else { - Logger.WARNING("576l fluid molder for 1 gear Recipe: "+material.getLocalizedName()+" - Failed"); - } + // GTNH - //Blocks - if (GT_Values.RA.addFluidSolidifierRecipe( - ItemList.Shape_Mold_Block.get(0), //Item Shape - material.getFluid(144*9), //Fluid Input - material.getBlock(1), //output - 288, //Duration - 16 //Eu Tick - )){ - Logger.WARNING((144*9)+"l fluid molder from 1 block Recipe: "+material.getLocalizedName()+" - Success"); - } - else { - Logger.WARNING((144*9)+"l fluid molder from 1 block Recipe: "+material.getLocalizedName()+" - Failed"); - } - - - - - if (CORE.GTNH){ - - //GTNH - - //Shape_Mold_Rod - //Shape_Mold_Rod_Long - //Shape_Mold_Bolt, - //Shape_Mold_Screw, - //Shape_Mold_Ring, + // Shape_Mold_Rod + // Shape_Mold_Rod_Long + // Shape_Mold_Bolt, + // Shape_Mold_Screw, + // Shape_Mold_Ring, ItemList mold_Rod = ItemList.valueOf("Shape_Mold_Rod"); ItemList mold_Rod_Long = ItemList.valueOf("Shape_Mold_Rod_Long"); ItemList mold_Bolt = ItemList.valueOf("Shape_Mold_Bolt"); ItemList mold_Screw = ItemList.valueOf("Shape_Mold_Screw"); ItemList mold_Ring = ItemList.valueOf("Shape_Mold_Ring"); - - //Rod - if (mold_Rod != null && GT_Values.RA.addFluidSolidifierRecipe( - mold_Rod.get(0), //Item Shape - material.getFluid(72), //Fluid Input - material.getRod(1), //output - 150, //Duration - 24 //Eu Tick - )){ - Logger.WARNING((144*9)+"l fluid molder from 1 rod Recipe: "+material.getLocalizedName()+" - Success"); - } - else { - Logger.WARNING((144*9)+"l fluid molder from 1 rod Recipe: "+material.getLocalizedName()+" - Failed"); - } - - //Rod Long - if (mold_Rod_Long != null && GT_Values.RA.addFluidSolidifierRecipe( - mold_Rod_Long.get(0), //Item Shape - material.getFluid(144), //Fluid Input - material.getLongRod(1), //output - 300, //Duration - 24 //Eu Tick - )){ - Logger.WARNING((144*9)+"l fluid molder from 1 rod long Recipe: "+material.getLocalizedName()+" - Success"); - } - else { - Logger.WARNING((144*9)+"l fluid molder from 1 rod long Recipe: "+material.getLocalizedName()+" - Failed"); - } - - //Bolt - if (mold_Bolt != null && GT_Values.RA.addFluidSolidifierRecipe( - mold_Bolt.get(0), //Item Shape - material.getFluid(18), //Fluid Input - material.getBolt(1), //output - 50, //Duration - 6 //Eu Tick - )){ - Logger.WARNING((144*9)+"l fluid molder from 1 bolt Recipe: "+material.getLocalizedName()+" - Success"); - } - else { - Logger.WARNING((144*9)+"l fluid molder from 1 bolt Recipe: "+material.getLocalizedName()+" - Failed"); - } - - //Screw - if (mold_Screw != null && GT_Values.RA.addFluidSolidifierRecipe( - mold_Screw.get(0), //Item Shape - material.getFluid(18), //Fluid Input - material.getScrew(1), //output - 50, //Duration - 6 //Eu Tick - )){ - Logger.WARNING((144*9)+"l fluid molder from 1 screw Recipe: "+material.getLocalizedName()+" - Success"); - } - else { - Logger.WARNING((144*9)+"l fluid molder from 1 screw Recipe: "+material.getLocalizedName()+" - Failed"); - } - - //Ring - if (mold_Ring != null && GT_Values.RA.addFluidSolidifierRecipe( - mold_Ring.get(0), //Item Shape - material.getFluid(36), //Fluid Input - material.getRing(1), //output - 100, //Duration - 12 //Eu Tick - )){ - Logger.WARNING((144*9)+"l fluid molder from 1 ring Recipe: "+material.getLocalizedName()+" - Success"); - } - else { - Logger.WARNING((144*9)+"l fluid molder from 1 ring Recipe: "+material.getLocalizedName()+" - Failed"); - } - - - - - - - - + + // Rod + if (material.getRod(1) != null) + if (mold_Rod != null && GT_Values.RA.addFluidSolidifierRecipe(mold_Rod.get(0), // Item Shape + material.getFluid(72), // Fluid Input + material.getRod(1), // output + 150, // Duration + 24 // Eu Tick + )) { + Logger.WARNING((144 * 9) + "l fluid molder from 1 rod Recipe: " + material.getLocalizedName() + + " - Success"); + } else { + Logger.WARNING((144 * 9) + "l fluid molder from 1 rod Recipe: " + material.getLocalizedName() + + " - Failed"); + } + + // Rod Long + if (material.getLongRod(1) != null) + if (mold_Rod_Long != null && GT_Values.RA.addFluidSolidifierRecipe(mold_Rod_Long.get(0), // Item + // Shape + material.getFluid(144), // Fluid Input + material.getLongRod(1), // output + 300, // Duration + 24 // Eu Tick + )) { + Logger.WARNING((144 * 9) + "l fluid molder from 1 rod long Recipe: " + + material.getLocalizedName() + " - Success"); + } else { + Logger.WARNING((144 * 9) + "l fluid molder from 1 rod long Recipe: " + + material.getLocalizedName() + " - Failed"); + } + + // Bolt + if (material.getBolt(1) != null) + if (mold_Bolt != null && GT_Values.RA.addFluidSolidifierRecipe(mold_Bolt.get(0), // Item Shape + material.getFluid(18), // Fluid Input + material.getBolt(1), // output + 50, // Duration + 6 // Eu Tick + )) { + Logger.WARNING((144 * 9) + "l fluid molder from 1 bolt Recipe: " + material.getLocalizedName() + + " - Success"); + } else { + Logger.WARNING((144 * 9) + "l fluid molder from 1 bolt Recipe: " + material.getLocalizedName() + + " - Failed"); + } + + // Screw + if (material.getScrew(1) != null) + if (mold_Screw != null && GT_Values.RA.addFluidSolidifierRecipe(mold_Screw.get(0), // Item Shape + material.getFluid(18), // Fluid Input + material.getScrew(1), // output + 50, // Duration + 6 // Eu Tick + )) { + Logger.WARNING((144 * 9) + "l fluid molder from 1 screw Recipe: " + material.getLocalizedName() + + " - Success"); + } else { + Logger.WARNING((144 * 9) + "l fluid molder from 1 screw Recipe: " + material.getLocalizedName() + + " - Failed"); + } + + // Ring + if (material.getRing(1) != null) + if (mold_Ring != null && GT_Values.RA.addFluidSolidifierRecipe(mold_Ring.get(0), // Item Shape + material.getFluid(36), // Fluid Input + material.getRing(1), // output + 100, // Duration + 12 // Eu Tick + )) { + Logger.WARNING((144 * 9) + "l fluid molder from 1 ring Recipe: " + material.getLocalizedName() + + " - Success"); + } else { + Logger.WARNING((144 * 9) + "l fluid molder from 1 ring Recipe: " + material.getLocalizedName() + + " - Failed"); + } + } } } } - diff --git a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Ore.java b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Ore.java index 99984d98bf..9529b9019a 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Ore.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Ore.java @@ -2,6 +2,8 @@ package gtPlusPlus.xmod.gregtech.loaders; import net.minecraft.item.ItemStack; +import java.util.ArrayList; + import gregtech.api.GregTech_API; import gregtech.api.enums.GT_Values; import gregtech.api.enums.Materials; @@ -33,7 +35,7 @@ public class RecipeGen_Ore implements Runnable{ public void run() { generateRecipes(this.toGenerate); } - + private static Material mStone; public static void generateRecipes(final Material material){ @@ -41,26 +43,51 @@ public class RecipeGen_Ore implements Runnable{ if (mStone == null) { mStone = MaterialUtils.generateMaterialFromGtENUM(Materials.Stone); } - + //if (material.getMaterialComposites().length > 1){ - Logger.MATERIALS("[Recipe Generator Debug] ["+material.getLocalizedName()+"]"); - int tVoltageMultiplier = MaterialUtils.getVoltageForTier(material.vTier); - if (tVoltageMultiplier < 120) { - tVoltageMultiplier = material.getMeltingPointK() >= 2800 ? 480 : 120; - } - - final ItemStack dustStone = ItemUtils.getItemStackOfAmountFromOreDict("dustStone", 1); - Material bonusA = null; //Ni - Material bonusB = null; //Tin + Logger.MATERIALS("[Recipe Generator Debug] ["+material.getLocalizedName()+"]"); + int tVoltageMultiplier = MaterialUtils.getVoltageForTier(material.vTier); + if (tVoltageMultiplier < 120) { + tVoltageMultiplier = material.getMeltingPointK() >= 2800 ? 480 : 120; + } - if (material.getComposites().size() >= 1 && material.getComposites().get(0) != null){ - bonusA = material.getComposites().get(0).getStackMaterial(); - } - else { - bonusA = material; + final ItemStack dustStone = ItemUtils.getItemStackOfAmountFromOreDict("dustStone", 1); + Material bonusA = null; //Ni + Material bonusB = null; //Tin + + if (material.getComposites().size() >= 1 && material.getComposites().get(0) != null){ + bonusA = material.getComposites().get(0).getStackMaterial(); + } + else { + bonusA = material; + } + + boolean allFailed = false; + + + //Setup Bonuses + ArrayList<Material> aMatComp = new ArrayList<Material>(); + for (Material j : MaterialUtils.getCompoundMaterialsRecursively(material)) { + aMatComp.add(j); + } + + if (aMatComp.size() < 3) { + while (aMatComp.size() < 3) { + aMatComp.add(material); } + } - boolean allFailed = false; + AutoMap<Material> amJ = new AutoMap<Material>(); + int aIndexCounter = 0; + for (Material g : aMatComp) { + if (g.hasSolidForm()) { + if (getDust(g) != null && getTinyDust(g) != null) { + amJ.put(g); + } + } + } + + if (amJ.size() < 2) { if (material.getComposites().size() >= 2 && material.getComposites().get(1) != null){ bonusB = material.getComposites().get(1).getStackMaterial(); //If Secondary Output has no solid output, try the third (If it exists) @@ -84,64 +111,91 @@ public class RecipeGen_Ore implements Runnable{ else { allFailed = true; } + } + else { + bonusA = amJ.get(0); + bonusB = amJ.get(1); + } - //Default out if it's made of fluids or some shit. - if (allFailed || bonusB == null) { - bonusB = tVoltageMultiplier <= 100 ? material : mStone; - } + //Default out if it's made of fluids or some shit. + if (bonusA == null) { + bonusA = tVoltageMultiplier <= 100 ? material : mStone; + } + //Default out if it's made of fluids or some shit. + if (allFailed || bonusB == null) { + bonusB = tVoltageMultiplier <= 100 ? material : mStone; + } - AutoMap<Pair<Integer, Material>> componentMap = new AutoMap<Pair<Integer, Material>>(); - for (MaterialStack r : material.getComposites()){ - if (r != null){ - componentMap.put(new Pair<Integer, Material>(r.getPartsPerOneHundred(), r.getStackMaterial())); - } + AutoMap<Pair<Integer, Material>> componentMap = new AutoMap<Pair<Integer, Material>>(); + for (MaterialStack r : material.getComposites()){ + if (r != null){ + componentMap.put(new Pair<Integer, Material>(r.getPartsPerOneHundred(), r.getStackMaterial())); } + } - //Need two valid outputs - if (bonusA == null || bonusB == null || !bonusA.hasSolidForm() || !bonusB.hasSolidForm()) { - return; - } - /** - * Macerate - */ - //Macerate ore to Crushed - if (GT_Values.RA.addPulveriserRecipe(material.getOre(1), new ItemStack[]{material.getCrushed(2)}, new int[]{10000}, 20*20, tVoltageMultiplier/2)){ - Logger.MATERIALS("[Macerator] Added Recipe: 'Macerate ore to Crushed ore'"); + //Need two valid outputs + if (bonusA == null || bonusB == null || !bonusA.hasSolidForm() || !bonusB.hasSolidForm()) { + if (bonusA == null) { + bonusA = mStone; } - //Macerate Crushed to Impure Dust - if (GT_Values.RA.addPulveriserRecipe(material.getCrushed(1), new ItemStack[]{material.getDustImpure(1), bonusA.getDust(1)}, new int[]{10000, 1000}, 20*20, tVoltageMultiplier/2)){ - Logger.MATERIALS("[Macerator] Added Recipe: 'Macerate Crushed ore to Impure Dust'"); + if (bonusB == null) { + bonusB = mStone; } - //Macerate Washed to Purified Dust - if (GT_Values.RA.addPulveriserRecipe(material.getCrushedPurified(1), new ItemStack[]{material.getDustPurified(1), bonusA.getDust(1)}, new int[]{10000, 1000}, 20*20, tVoltageMultiplier/2)){ - Logger.MATERIALS("[Macerator] Added Recipe: 'Macerate Washed ore to Purified Dust'"); - } - //Macerate Centrifuged to Pure Dust - if (GT_Values.RA.addPulveriserRecipe(material.getCrushedCentrifuged(1), new ItemStack[]{material.getDust(1), bonusA.getDust(1)}, new int[]{10000, 1000}, 20*20, tVoltageMultiplier/2)){ - Logger.MATERIALS("[Macerator] Added Recipe: 'Macerate Centrifuged ore to Pure Dust'"); + if (!bonusA.hasSolidForm()) { + bonusA = mStone; } + if (!bonusB.hasSolidForm()) { + bonusB = mStone; + } + } - /** - * Wash - */ - //Wash into Purified Crushed - /*if (GT_Values.RA.addOreWasherRecipe(material.getCrushed(1), material.getCrushedPurified(1), bonusA.getTinyDust(1), dustStone, FluidUtils.getWater(1000), 25*20, 16)){ + ItemStack tinyDustA = getTinyDust(bonusA); + ItemStack tinyDustB = getTinyDust(bonusB); + ItemStack matDust = getDust(material); + ItemStack matDustA = getDust(bonusA); + ItemStack matDustB = getDust(bonusB); + + /** + * Macerate + */ + //Macerate ore to Crushed + if (GT_Values.RA.addPulveriserRecipe(material.getOre(1), new ItemStack[]{material.getCrushed(2)}, new int[]{10000}, 20*20, tVoltageMultiplier/2)){ + Logger.MATERIALS("[Macerator] Added Recipe: 'Macerate ore to Crushed ore'"); + } + //Macerate Crushed to Impure Dust + if (GT_Values.RA.addPulveriserRecipe(material.getCrushed(1), new ItemStack[]{material.getDustImpure(1), matDustA}, new int[]{10000, 1000}, 20*20, tVoltageMultiplier/2)){ + Logger.MATERIALS("[Macerator] Added Recipe: 'Macerate Crushed ore to Impure Dust'"); + } + //Macerate Washed to Purified Dust + if (GT_Values.RA.addPulveriserRecipe(material.getCrushedPurified(1), new ItemStack[]{material.getDustPurified(1), matDustA}, new int[]{10000, 1000}, 20*20, tVoltageMultiplier/2)){ + Logger.MATERIALS("[Macerator] Added Recipe: 'Macerate Washed ore to Purified Dust'"); + } + //Macerate Centrifuged to Pure Dust + if (GT_Values.RA.addPulveriserRecipe(material.getCrushedCentrifuged(1), new ItemStack[]{matDust, matDustA}, new int[]{10000, 1000}, 20*20, tVoltageMultiplier/2)){ + Logger.MATERIALS("[Macerator] Added Recipe: 'Macerate Centrifuged ore to Pure Dust'"); + } + + /** + * Wash + */ + //Wash into Purified Crushed + /*if (GT_Values.RA.addOreWasherRecipe(material.getCrushed(1), material.getCrushedPurified(1), bonusA.getTinyDust(1), dustStone, FluidUtils.getWater(1000), 25*20, 16)){ Logger.MATERIALS("[OreWasher] Added Recipe: 'Wash Crushed ore into Purified Crushed ore'"); }*/ - //.08 compat method - if (GT_ModHandler.addOreWasherRecipe(material.getCrushed(1), 1000, material.getCrushedPurified(1), bonusA.getTinyDust(1), dustStone)){ - Logger.MATERIALS("[OreWasher] Added Recipe: 'Wash Crushed ore into Purified Crushed ore'"); - } + //.08 compat method + if (GT_ModHandler.addOreWasherRecipe(material.getCrushed(1), 1000, material.getCrushedPurified(1), tinyDustA, dustStone)){ + Logger.MATERIALS("[OreWasher] Added Recipe: 'Wash Crushed ore into Purified Crushed ore'"); + } - /** - * Thermal Centrifuge - */ - /*//Crushed ore to Centrifuged Ore - if (GT_Values.RA.addThermalCentrifugeRecipe(material.getCrushed(1), material.getCrushedCentrifuged(1), bonusB.getTinyDust(1), dustStone, 25*20, 24)){ + /** + * Thermal Centrifuge + */ + /*//Crushed ore to Centrifuged Ore + if (GT_Values.RA.addThermalCentrifugeRecipe(material.getCrushed(1), material.getCrushedCentrifuged(1), tinyDustB, dustStone, 25*20, 24)){ Logger.MATERIALS("[ThermalCentrifuge] Added Recipe: 'Crushed ore to Centrifuged Ore'"); } //Washed ore to Centrifuged Ore @@ -149,319 +203,319 @@ public class RecipeGen_Ore implements Runnable{ Logger.MATERIALS("[ThermalCentrifuge] Added Recipe: 'Washed ore to Centrifuged Ore'"); }*/ - Logger.MATERIALS("material.getCrushed(1): "+(material.getCrushed(1) != null)); - Logger.MATERIALS("material.getCrushedPurified(1): "+(material.getCrushedPurified(1) != null)); - Logger.MATERIALS("bonusA.getTinyDust(1): "+(bonusA.getTinyDust(1) != null)+" | Material: "+(bonusA != null) + " | Material name: "+(bonusA != null ? bonusA.getLocalizedName() : "invalid material")); - Logger.MATERIALS("bonusB.getTinyDust(1): "+(bonusB.getTinyDust(1) != null)+" | Material: "+(bonusB != null) + " | Material name: "+(bonusB != null ? bonusB.getLocalizedName() : "invalid material")); + Logger.MATERIALS("material.getCrushed(1): "+(material.getCrushed(1) != null)); + Logger.MATERIALS("material.getCrushedPurified(1): "+(material.getCrushedPurified(1) != null)); + Logger.MATERIALS("bonusA.getTinyDust(1): "+(tinyDustA != null)+" | Material: "+(bonusA != null) + " | Material name: "+(bonusA != null ? bonusA.getLocalizedName() : "invalid material")); + Logger.MATERIALS("bonusB.getTinyDust(1): "+(tinyDustB != null)+" | Material: "+(bonusB != null) + " | Material name: "+(bonusB != null ? bonusB.getLocalizedName() : "invalid material")); - try { + try { //.08 compat - if (GT_ModHandler.addThermalCentrifugeRecipe(material.getCrushed(1), 200, material.getCrushedCentrifuged(1), bonusB.getTinyDust(1), dustStone)){ - Logger.MATERIALS("[ThermalCentrifuge] Added Recipe: 'Crushed ore to Centrifuged Ore' | Input: "+material.getCrushed(1).getDisplayName()+" | Outputs: "+material.getCrushedCentrifuged(1).getDisplayName()+", "+bonusB.getTinyDust(1).getDisplayName()+", "+dustStone.getDisplayName()+"."); - } - } - catch (Throwable t) {} - try { - if (GT_ModHandler.addThermalCentrifugeRecipe(material.getCrushedPurified(1), 200, material.getCrushedCentrifuged(1), bonusA.getTinyDust(1), dustStone)){ - Logger.MATERIALS("[ThermalCentrifuge] Added Recipe: 'Washed ore to Centrifuged Ore' | Input: "+material.getCrushedPurified(1).getDisplayName()+" | Outputs: "+material.getCrushedCentrifuged(1).getDisplayName()+", "+bonusA.getTinyDust(1).getDisplayName()+", "+dustStone.getDisplayName()+"."); + if (GT_ModHandler.addThermalCentrifugeRecipe(material.getCrushed(1), 200, material.getCrushedCentrifuged(1), tinyDustB, dustStone)){ + Logger.MATERIALS("[ThermalCentrifuge] Added Recipe: 'Crushed ore to Centrifuged Ore' | Input: "+material.getCrushed(1).getDisplayName()+" | Outputs: "+material.getCrushedCentrifuged(1).getDisplayName()+", "+tinyDustB.getDisplayName()+", "+dustStone.getDisplayName()+"."); } + } + catch (Throwable t) {} + try { + if (GT_ModHandler.addThermalCentrifugeRecipe(material.getCrushedPurified(1), 200, material.getCrushedCentrifuged(1), tinyDustA, dustStone)){ + Logger.MATERIALS("[ThermalCentrifuge] Added Recipe: 'Washed ore to Centrifuged Ore' | Input: "+material.getCrushedPurified(1).getDisplayName()+" | Outputs: "+material.getCrushedCentrifuged(1).getDisplayName()+", "+tinyDustA.getDisplayName()+", "+dustStone.getDisplayName()+"."); } - catch (Throwable t) {} - + } + catch (Throwable t) {} - /** - * Forge Hammer - */ - if (GT_Values.RA.addForgeHammerRecipe(material.getCrushedCentrifuged(1), material.getDust(1), 10, tVoltageMultiplier/4)){ - Logger.MATERIALS("[ForgeHammer] Added Recipe: 'Crushed Centrifuged to Pure Dust'"); - } - if (GT_Values.RA.addForgeHammerRecipe(material.getCrushedPurified(1), material.getDustPurified(1), 10, tVoltageMultiplier/4)){ - Logger.MATERIALS("[ForgeHammer] Added Recipe: 'Crushed Purified to Purified Dust'"); - } - if (GT_Values.RA.addForgeHammerRecipe(material.getOre(1), material.getCrushed(1), 10, tVoltageMultiplier/4)){ - Logger.MATERIALS("[ForgeHammer] Added Recipe: 'Ore to Crushed'"); - } - /** - * Centrifuge - */ - //Purified Dust to Clean - if (GT_Values.RA.addCentrifugeRecipe( - material.getDustPurified(1), null, - null, //In Fluid - null, //Out Fluid - material.getDust(1), bonusA.getTinyDust(1),null, - null, null,null, - new int[]{10000, 10000}, //Chances - 5*20, //Eu - tVoltageMultiplier/2)){ //Time - Logger.MATERIALS("[Centrifuge] Added Recipe: Purified Dust to Clean Dust"); - } + /** + * Forge Hammer + */ + if (GT_Values.RA.addForgeHammerRecipe(material.getCrushedCentrifuged(1), matDust, 10, tVoltageMultiplier/4)){ + Logger.MATERIALS("[ForgeHammer] Added Recipe: 'Crushed Centrifuged to Pure Dust'"); + } + if (GT_Values.RA.addForgeHammerRecipe(material.getCrushedPurified(1), material.getDustPurified(1), 10, tVoltageMultiplier/4)){ + Logger.MATERIALS("[ForgeHammer] Added Recipe: 'Crushed Purified to Purified Dust'"); + } + if (GT_Values.RA.addForgeHammerRecipe(material.getOre(1), material.getCrushed(1), 10, tVoltageMultiplier/4)){ + Logger.MATERIALS("[ForgeHammer] Added Recipe: 'Ore to Crushed'"); + } - //Impure Dust to Clean - if (GT_Values.RA.addCentrifugeRecipe( - material.getDustImpure(1), null, - null, //In Fluid - null, //Out Fluid - material.getDust(1), bonusB.getTinyDust(1),null, - null, null,null, - new int[]{10000, 10000}, //Chances - 5*20, //Eu - tVoltageMultiplier/2)){ //Time - Logger.MATERIALS("[Centrifuge] Added Recipe: Inpure Dust to Clean Dust"); - } + /** + * Centrifuge + */ + //Purified Dust to Clean + if (GT_Values.RA.addCentrifugeRecipe( + material.getDustPurified(1), null, + null, //In Fluid + null, //Out Fluid + matDust, tinyDustA,null, + null, null,null, + new int[]{10000, 10000}, //Chances + 5*20, //Eu + tVoltageMultiplier/2)){ //Time + Logger.MATERIALS("[Centrifuge] Added Recipe: Purified Dust to Clean Dust"); + } + //Impure Dust to Clean + if (GT_Values.RA.addCentrifugeRecipe( + material.getDustImpure(1), null, + null, //In Fluid + null, //Out Fluid + matDust, tinyDustB,null, + null, null,null, + new int[]{10000, 10000}, //Chances + 5*20, //Eu + tVoltageMultiplier/2)){ //Time + Logger.MATERIALS("[Centrifuge] Added Recipe: Inpure Dust to Clean Dust"); + } - /** - * Electrolyzer - */ - //Process Dust - if (componentMap.size() > 0 && componentMap.size() <= 6){ + /** + * Electrolyzer + */ - ItemStack mInternalOutputs[] = new ItemStack[6]; - int mChances[] = new int[6]; - int mCellCount = 0; + //Process Dust + if (componentMap.size() > 0 && componentMap.size() <= 6){ - int mTotalCount = 0; + ItemStack mInternalOutputs[] = new ItemStack[6]; + int mChances[] = new int[6]; + int mCellCount = 0; - int mCounter = 0; - for (Pair<Integer, Material> f : componentMap){ - if (f.getValue().getState() != MaterialState.SOLID){ - Logger.MATERIALS("[Electrolyzer] Found Fluid Component, adding "+f.getKey()+" cells of "+f.getValue().getLocalizedName()+"."); - mInternalOutputs[mCounter++] = f.getValue().getCell(f.getKey()); - mCellCount += f.getKey(); - mTotalCount += f.getKey(); - Logger.MATERIALS("[Electrolyzer] In total, adding "+mCellCount+" cells for "+material.getLocalizedName()+" processing."); - } - else { - Logger.MATERIALS("[Electrolyzer] Found Solid Component, adding "+f.getKey()+" dusts of "+f.getValue().getLocalizedName()+"."); - mInternalOutputs[mCounter++] = f.getValue().getDust(f.getKey()); - mTotalCount += f.getKey(); - } - } + int mTotalCount = 0; - //Build Output Array - for (int g=0;g<mInternalOutputs.length;g++){ - Logger.MATERIALS("[Electrolyzer] Is output["+g+"] valid with a chance? "+(mInternalOutputs[g] != null ? 10000 : 0)); - mChances[g] = (mInternalOutputs[g] != null ? 10000 : 0); + int mCounter = 0; + for (Pair<Integer, Material> f : componentMap){ + if (f.getValue().getState() != MaterialState.SOLID){ + Logger.MATERIALS("[Electrolyzer] Found Fluid Component, adding "+f.getKey()+" cells of "+f.getValue().getLocalizedName()+"."); + mInternalOutputs[mCounter++] = f.getValue().getCell(f.getKey()); + mCellCount += f.getKey(); + mTotalCount += f.getKey(); + Logger.MATERIALS("[Electrolyzer] In total, adding "+mCellCount+" cells for "+material.getLocalizedName()+" processing."); } - - ItemStack emptyCell = null; - if (mCellCount > 0){ - emptyCell = ItemUtils.getItemStackOfAmountFromOreDict("cellEmpty", mCellCount); - Logger.MATERIALS("[Electrolyzer] Recipe now requires "+mCellCount+" empty cells as input."); + else { + Logger.MATERIALS("[Electrolyzer] Found Solid Component, adding "+f.getKey()+" dusts of "+f.getValue().getLocalizedName()+"."); + mInternalOutputs[mCounter++] = f.getValue().getDust(f.getKey()); + mTotalCount += f.getKey(); } + } - ItemStack mainDust = material.getDust(material.smallestStackSizeWhenProcessing); + //Build Output Array + for (int g=0;g<mInternalOutputs.length;g++){ + Logger.MATERIALS("[Electrolyzer] Is output["+g+"] valid with a chance? "+(mInternalOutputs[g] != null ? 10000 : 0)); + mChances[g] = (mInternalOutputs[g] != null ? 10000 : 0); + } + + ItemStack emptyCell = null; + if (mCellCount > 0){ + emptyCell = ItemUtils.getItemStackOfAmountFromOreDict("cellEmpty", mCellCount); + Logger.MATERIALS("[Electrolyzer] Recipe now requires "+mCellCount+" empty cells as input."); + } + + ItemStack mainDust = material.getDust(material.smallestStackSizeWhenProcessing); + if (mainDust != null){ + Logger.MATERIALS("[Electrolyzer] Recipe now requires "+material.smallestStackSizeWhenProcessing+"x "+mainDust.getDisplayName()+" as input."); + } + else { + mainDust = material.getDust(mTotalCount); + Logger.MATERIALS("[Electrolyzer] Could not find valid input dust, trying alternative."); if (mainDust != null){ - Logger.MATERIALS("[Electrolyzer] Recipe now requires "+material.smallestStackSizeWhenProcessing+"x "+mainDust.getDisplayName()+" as input."); + Logger.MATERIALS("[Electrolyzer] Recipe now requires "+mTotalCount+"x "+mainDust.getDisplayName()+" as input."); } else { - mainDust = material.getDust(mTotalCount); - Logger.MATERIALS("[Electrolyzer] Could not find valid input dust, trying alternative."); - if (mainDust != null){ - Logger.MATERIALS("[Electrolyzer] Recipe now requires "+mTotalCount+"x "+mainDust.getDisplayName()+" as input."); - } - else { - Logger.MATERIALS("[Electrolyzer] Could not find valid input dust, exiting."); - } + Logger.MATERIALS("[Electrolyzer] Could not find valid input dust, exiting."); } + } - for (int j=0;j<mInternalOutputs.length;j++){ - if (mInternalOutputs[j] == null){ - mInternalOutputs[j] = GT_Values.NI; - Logger.MATERIALS("[Electrolyzer] Set slot "+j+" to null."); - } - else { - Logger.MATERIALS("[Electrolyzer] Set slot "+j+" to "+mInternalOutputs[j].getDisplayName()+"."); - } + for (int j=0;j<mInternalOutputs.length;j++){ + if (mInternalOutputs[j] == null){ + mInternalOutputs[j] = GT_Values.NI; + Logger.MATERIALS("[Electrolyzer] Set slot "+j+" to null."); + } + else { + Logger.MATERIALS("[Electrolyzer] Set slot "+j+" to "+mInternalOutputs[j].getDisplayName()+"."); } + } - try{ - if (addElectrolyzerRecipe( - mainDust, - emptyCell, //input 2 - null, //Input fluid 1 - null, //Output fluid 1 - mInternalOutputs[0], - mInternalOutputs[1], - mInternalOutputs[2], - mInternalOutputs[3], - mInternalOutputs[4], - mInternalOutputs[5], - mChances, - 20*1*(tVoltageMultiplier/10), - tVoltageMultiplier)){ - Logger.MATERIALS("[Electrolyzer] Generated Electrolyzer recipe for "+material.getDust(1).getDisplayName()); - } - else { - Logger.MATERIALS("[Electrolyzer] Failed to generate Electrolyzer recipe for "+material.getDust(1).getDisplayName()); - } + try{ + if (addElectrolyzerRecipe( + mainDust, + emptyCell, //input 2 + null, //Input fluid 1 + null, //Output fluid 1 + mInternalOutputs[0], + mInternalOutputs[1], + mInternalOutputs[2], + mInternalOutputs[3], + mInternalOutputs[4], + mInternalOutputs[5], + mChances, + 20*1*(tVoltageMultiplier/10), + tVoltageMultiplier)){ + Logger.MATERIALS("[Electrolyzer] Generated Electrolyzer recipe for "+matDust.getDisplayName()); } - catch(Throwable t){ - t.printStackTrace(); + else { + Logger.MATERIALS("[Electrolyzer] Failed to generate Electrolyzer recipe for "+matDust.getDisplayName()); } } - else if (componentMap.size() > 6 && componentMap.size() <= 9){ - Logger.MATERIALS("[Issue][Electrolyzer] "+material.getLocalizedName()+" is composed of over 6 materials, so an electrolyzer recipe for processing cannot be generated. Trying to create one for the Dehydrator instead."); - - ItemStack mInternalOutputs[] = new ItemStack[9]; - int mChances[] = new int[9]; - int mCellCount = 0; - - int mTotalCount = 0; - - int mCounter = 0; - for (Pair<Integer, Material> f : componentMap){ - if (f.getValue().getState() != MaterialState.SOLID){ - Logger.MATERIALS("[Dehydrator] Found Fluid Component, adding "+f.getKey()+" cells of "+f.getValue().getLocalizedName()+"."); - mInternalOutputs[mCounter++] = f.getValue().getCell(f.getKey()); - mCellCount += f.getKey(); - mTotalCount += f.getKey(); - Logger.MATERIALS("[Dehydrator] In total, adding "+mCellCount+" cells for "+material.getLocalizedName()+" processing."); - } - else { - Logger.MATERIALS("[Dehydrator] Found Solid Component, adding "+f.getKey()+" dusts of "+f.getValue().getLocalizedName()+"."); - mInternalOutputs[mCounter++] = f.getValue().getDust(f.getKey()); - mTotalCount += f.getKey(); - } - } - - //Build Output Array - for (int g=0;g<mInternalOutputs.length;g++){ - Logger.MATERIALS("[Dehydrator] Is output["+g+"] valid with a chance? "+(mInternalOutputs[g] != null ? 10000 : 0)); - mChances[g] = (mInternalOutputs[g] != null ? 10000 : 0); + catch(Throwable t){ + t.printStackTrace(); + } + } + else if (componentMap.size() > 6 && componentMap.size() <= 9){ + Logger.MATERIALS("[Issue][Electrolyzer] "+material.getLocalizedName()+" is composed of over 6 materials, so an electrolyzer recipe for processing cannot be generated. Trying to create one for the Dehydrator instead."); + + ItemStack mInternalOutputs[] = new ItemStack[9]; + int mChances[] = new int[9]; + int mCellCount = 0; + + int mTotalCount = 0; + + int mCounter = 0; + for (Pair<Integer, Material> f : componentMap){ + if (f.getValue().getState() != MaterialState.SOLID){ + Logger.MATERIALS("[Dehydrator] Found Fluid Component, adding "+f.getKey()+" cells of "+f.getValue().getLocalizedName()+"."); + mInternalOutputs[mCounter++] = f.getValue().getCell(f.getKey()); + mCellCount += f.getKey(); + mTotalCount += f.getKey(); + Logger.MATERIALS("[Dehydrator] In total, adding "+mCellCount+" cells for "+material.getLocalizedName()+" processing."); } - - ItemStack emptyCell = null; - if (mCellCount > 0){ - emptyCell = ItemUtils.getItemStackOfAmountFromOreDict("cellEmpty", mCellCount); - Logger.MATERIALS("[Dehydrator] Recipe now requires "+mCellCount+" empty cells as input."); + else { + Logger.MATERIALS("[Dehydrator] Found Solid Component, adding "+f.getKey()+" dusts of "+f.getValue().getLocalizedName()+"."); + mInternalOutputs[mCounter++] = f.getValue().getDust(f.getKey()); + mTotalCount += f.getKey(); } + } + + //Build Output Array + for (int g=0;g<mInternalOutputs.length;g++){ + Logger.MATERIALS("[Dehydrator] Is output["+g+"] valid with a chance? "+(mInternalOutputs[g] != null ? 10000 : 0)); + mChances[g] = (mInternalOutputs[g] != null ? 10000 : 0); + } + + ItemStack emptyCell = null; + if (mCellCount > 0){ + emptyCell = ItemUtils.getItemStackOfAmountFromOreDict("cellEmpty", mCellCount); + Logger.MATERIALS("[Dehydrator] Recipe now requires "+mCellCount+" empty cells as input."); + } - ItemStack mainDust = material.getDust(material.smallestStackSizeWhenProcessing); + ItemStack mainDust = material.getDust(material.smallestStackSizeWhenProcessing); + if (mainDust != null){ + Logger.MATERIALS("[Dehydrator] Recipe now requires "+material.smallestStackSizeWhenProcessing+"x "+mainDust.getDisplayName()+" as input."); + } + else { + mainDust = material.getDust(mTotalCount); + Logger.MATERIALS("[Dehydrator] Could not find valid input dust, trying alternative."); if (mainDust != null){ - Logger.MATERIALS("[Dehydrator] Recipe now requires "+material.smallestStackSizeWhenProcessing+"x "+mainDust.getDisplayName()+" as input."); + Logger.MATERIALS("[Dehydrator] Recipe now requires "+mTotalCount+"x "+mainDust.getDisplayName()+" as input."); } else { - mainDust = material.getDust(mTotalCount); - Logger.MATERIALS("[Dehydrator] Could not find valid input dust, trying alternative."); - if (mainDust != null){ - Logger.MATERIALS("[Dehydrator] Recipe now requires "+mTotalCount+"x "+mainDust.getDisplayName()+" as input."); - } - else { - Logger.MATERIALS("[Dehydrator] Could not find valid input dust, exiting."); - } + Logger.MATERIALS("[Dehydrator] Could not find valid input dust, exiting."); } + } - for (int j=0;j<mInternalOutputs.length;j++){ - if (mInternalOutputs[j] == null){ - mInternalOutputs[j] = GT_Values.NI; - Logger.MATERIALS("[Dehydrator] Set slot "+j+" to null."); - } - else { - Logger.MATERIALS("[Dehydrator] Set slot "+j+" to "+mInternalOutputs[j].getDisplayName()+"."); - } + for (int j=0;j<mInternalOutputs.length;j++){ + if (mInternalOutputs[j] == null){ + mInternalOutputs[j] = GT_Values.NI; + Logger.MATERIALS("[Dehydrator] Set slot "+j+" to null."); } + else { + Logger.MATERIALS("[Dehydrator] Set slot "+j+" to "+mInternalOutputs[j].getDisplayName()+"."); + } + } - try{ + try{ - if (CORE.RA.addDehydratorRecipe( - new ItemStack[]{mainDust, emptyCell}, - null, - null, - mInternalOutputs, - mChances, - 20*1*(tVoltageMultiplier/10), - tVoltageMultiplier)){ - Logger.MATERIALS("[Dehydrator] Generated Dehydrator recipe for "+material.getDust(1).getDisplayName()); - } - else { - Logger.MATERIALS("[Dehydrator] Failed to generate Dehydrator recipe for "+material.getDust(1).getDisplayName()); - } + if (CORE.RA.addDehydratorRecipe( + new ItemStack[]{mainDust, emptyCell}, + null, + null, + mInternalOutputs, + mChances, + 20*1*(tVoltageMultiplier/10), + tVoltageMultiplier)){ + Logger.MATERIALS("[Dehydrator] Generated Dehydrator recipe for "+matDust.getDisplayName()); } - catch(Throwable t){ - t.printStackTrace(); + else { + Logger.MATERIALS("[Dehydrator] Failed to generate Dehydrator recipe for "+matDust.getDisplayName()); } + } + catch(Throwable t){ + t.printStackTrace(); + } - } + } - /** - * Shaped Crafting - */ - RecipeUtils.recipeBuilder( - CI.craftingToolHammer_Hard, null, null, - material.getCrushedPurified(1), null, null, - null, null, null, - material.getDustPurified(1)); + /** + * Shaped Crafting + */ + RecipeUtils.recipeBuilder( + CI.craftingToolHammer_Hard, null, null, + material.getCrushedPurified(1), null, null, + null, null, null, + material.getDustPurified(1)); - RecipeUtils.recipeBuilder( - CI.craftingToolHammer_Hard, null, null, - material.getCrushed(1), null, null, - null, null, null, - material.getDustImpure(1)); + RecipeUtils.recipeBuilder( + CI.craftingToolHammer_Hard, null, null, + material.getCrushed(1), null, null, + null, null, null, + material.getDustImpure(1)); - RecipeUtils.recipeBuilder( - CI.craftingToolHammer_Hard, null, null, - material.getCrushedCentrifuged(1), null, null, - null, null, null, - material.getDust(1)); + RecipeUtils.recipeBuilder( + CI.craftingToolHammer_Hard, null, null, + material.getCrushedCentrifuged(1), null, null, + null, null, null, + matDust); - final ItemStack normalDust = material.getDust(1); - final ItemStack smallDust = material.getSmallDust(1); - final ItemStack tinyDust = material.getTinyDust(1); + final ItemStack normalDust = matDust; + final ItemStack smallDust = material.getSmallDust(1); + final ItemStack tinyDust = material.getTinyDust(1); - if (RecipeUtils.recipeBuilder( - tinyDust, tinyDust, tinyDust, - tinyDust, tinyDust, tinyDust, - tinyDust, tinyDust, tinyDust, - normalDust)){ - Logger.WARNING("9 Tiny dust to 1 Dust Recipe: "+material.getLocalizedName()+" - Success"); - } - else { - Logger.WARNING("9 Tiny dust to 1 Dust Recipe: "+material.getLocalizedName()+" - Failed"); - } + if (RecipeUtils.recipeBuilder( + tinyDust, tinyDust, tinyDust, + tinyDust, tinyDust, tinyDust, + tinyDust, tinyDust, tinyDust, + normalDust)){ + Logger.WARNING("9 Tiny dust to 1 Dust Recipe: "+material.getLocalizedName()+" - Success"); + } + else { + Logger.WARNING("9 Tiny dust to 1 Dust Recipe: "+material.getLocalizedName()+" - Failed"); + } - if (RecipeUtils.recipeBuilder( - normalDust, null, null, - null, null, null, - null, null, null, - material.getTinyDust(9))){ - Logger.WARNING("9 Tiny dust from 1 Recipe: "+material.getLocalizedName()+" - Success"); - } - else { - Logger.WARNING("9 Tiny dust from 1 Recipe: "+material.getLocalizedName()+" - Failed"); - } + if (RecipeUtils.recipeBuilder( + normalDust, null, null, + null, null, null, + null, null, null, + material.getTinyDust(9))){ + Logger.WARNING("9 Tiny dust from 1 Recipe: "+material.getLocalizedName()+" - Success"); + } + else { + Logger.WARNING("9 Tiny dust from 1 Recipe: "+material.getLocalizedName()+" - Failed"); + } - if (RecipeUtils.recipeBuilder( - smallDust, smallDust, null, - smallDust, smallDust, null, - null, null, null, - normalDust)){ - Logger.WARNING("4 Small dust to 1 Dust Recipe: "+material.getLocalizedName()+" - Success"); - } - else { - Logger.WARNING("4 Small dust to 1 Dust Recipe: "+material.getLocalizedName()+" - Failed"); - } + if (RecipeUtils.recipeBuilder( + smallDust, smallDust, null, + smallDust, smallDust, null, + null, null, null, + normalDust)){ + Logger.WARNING("4 Small dust to 1 Dust Recipe: "+material.getLocalizedName()+" - Success"); + } + else { + Logger.WARNING("4 Small dust to 1 Dust Recipe: "+material.getLocalizedName()+" - Failed"); + } - if (RecipeUtils.recipeBuilder( - null, normalDust, null, - null, null, null, - null, null, null, - material.getSmallDust(4))){ - Logger.WARNING("4 Small dust from 1 Dust Recipe: "+material.getLocalizedName()+" - Success"); - } - else { - Logger.WARNING("4 Small dust from 1 Dust Recipe: "+material.getLocalizedName()+" - Failed"); - } + if (RecipeUtils.recipeBuilder( + null, normalDust, null, + null, null, null, + null, null, null, + material.getSmallDust(4))){ + Logger.WARNING("4 Small dust from 1 Dust Recipe: "+material.getLocalizedName()+" - Success"); + } + else { + Logger.WARNING("4 Small dust from 1 Dust Recipe: "+material.getLocalizedName()+" - Failed"); + } //} } @@ -485,4 +539,20 @@ public class RecipeGen_Ore implements Runnable{ return true; } + public static ItemStack getTinyDust(Material m) { + ItemStack x = m.getTinyDust(1); + if (x == null) { + x = mStone.getDust(1); + } + return x; + } + + public static ItemStack getDust(Material m) { + ItemStack x = m.getDust(1); + if (x == null) { + x = mStone.getDust(1); + } + return x; + } + } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_ShapedCrafting.java b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_ShapedCrafting.java index df50f6c7d7..1646ab1535 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_ShapedCrafting.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_ShapedCrafting.java @@ -56,7 +56,7 @@ public class RecipeGen_ShapedCrafting extends RecipeGen_Base { //Plates //Single Plate Shaped/Shapeless - if (material.getPlate(1) != null) + if (material.getPlate(1) != null && material.getIngot(1) != null) GT_ModHandler.addCraftingRecipe( material.getPlate(1), gregtech.api.util.GT_ModHandler.RecipeBits.DO_NOT_CHECK_FOR_COLLISIONS | gregtech.api.util.GT_ModHandler.RecipeBits.BUFFERED, @@ -66,7 +66,7 @@ public class RecipeGen_ShapedCrafting extends RecipeGen_Base { Character.valueOf('B'), material.getIngot(1)}); - if (material.getPlate(1) != null) + if (material.getPlate(1) != null && material.getIngot(1) != null) GT_ModHandler.addShapelessCraftingRecipe( material.getPlate(1), new Object[]{gregtech.api.enums.ToolDictNames.craftingToolForgeHammer, @@ -74,7 +74,7 @@ public class RecipeGen_ShapedCrafting extends RecipeGen_Base { material.getIngot(1)}); //Double Plate Shaped/Shapeless - if (material.getPlateDouble(1) != null) + if (material.getPlateDouble(1) != null && material.getPlate(1) != null) GT_ModHandler.addCraftingRecipe( material.getPlateDouble(1), gregtech.api.util.GT_ModHandler.RecipeBits.DO_NOT_CHECK_FOR_COLLISIONS | gregtech.api.util.GT_ModHandler.RecipeBits.BUFFERED, @@ -84,7 +84,7 @@ public class RecipeGen_ShapedCrafting extends RecipeGen_Base { Character.valueOf('B'), material.getPlate(1)}); - if (material.getPlateDouble(1) != null) + if (material.getPlateDouble(1) != null && material.getPlate(1) != null) GT_ModHandler.addShapelessCraftingRecipe( material.getPlateDouble(1), new Object[]{gregtech.api.enums.ToolDictNames.craftingToolForgeHammer, @@ -92,7 +92,7 @@ public class RecipeGen_ShapedCrafting extends RecipeGen_Base { material.getPlate(1)}); //Ring Recipe - if (!material.isRadioactive && material.getRing(1) != null){ + if (!material.isRadioactive && material.getRing(1) != null && material.getRod(1) != null){ if (CORE.GTNH){ if (RecipeUtils.recipeBuilder( "craftingToolHardHammer", null, null, @@ -121,7 +121,7 @@ public class RecipeGen_ShapedCrafting extends RecipeGen_Base { //Framebox Recipe - if (!material.isRadioactive && material.getFrameBox(1) != null){ + if (!material.isRadioactive && material.getFrameBox(1) != null && material.getRod(1) != null){ final ItemStack stackStick = material.getRod(1); if (RecipeUtils.recipeBuilder( stackStick, stackStick, stackStick, @@ -166,7 +166,7 @@ public class RecipeGen_ShapedCrafting extends RecipeGen_Base { //Shaped Recipe - Bolts - if (!material.isRadioactive && material.getBolt(1) != null){ + if (!material.isRadioactive && material.getBolt(1) != null && material.getRod(1) != null){ if (RecipeUtils.recipeBuilder( "craftingToolSaw", null, null, null, material.getRod(1), null, @@ -181,7 +181,7 @@ public class RecipeGen_ShapedCrafting extends RecipeGen_Base { //Shaped Recipe - Ingot to Rod - if (material.getRod(1) != null) + if (material.getRod(1) != null && material.getIngot(1) != null) if (RecipeUtils.recipeBuilder( "craftingToolFile", null, null, null, material.getIngot(1), null, @@ -195,7 +195,7 @@ public class RecipeGen_ShapedCrafting extends RecipeGen_Base { //Shaped Recipe - Long Rod to two smalls - if (material.getRod(1) != null) + if (material.getRod(1) != null && material.getLongRod(1) != null) if (RecipeUtils.recipeBuilder( "craftingToolSaw", null, null, material.getLongRod(1), null, null, @@ -208,7 +208,7 @@ public class RecipeGen_ShapedCrafting extends RecipeGen_Base { } //Two small to long rod - if (material.getLongRod(1) != null) + if (material.getLongRod(1) != null && material.getRod(1) != null) if (RecipeUtils.recipeBuilder( material.getRod(1), "craftingToolHardHammer", material.getRod(1), null, null, null, @@ -221,7 +221,7 @@ public class RecipeGen_ShapedCrafting extends RecipeGen_Base { } //Rotor Recipe - if (!material.isRadioactive && material.getRotor(1) != null){ + if (!material.isRadioactive && material.getRotor(1) != null && material.getRing(1) != null && material.getPlate(1) != null && material.getScrew(1) != null){ if (RecipeUtils.recipeBuilder( material.getPlate(1), "craftingToolHardHammer", material.getPlate(1), material.getScrew(1), material.getRing(1), "craftingToolFile", @@ -235,7 +235,7 @@ public class RecipeGen_ShapedCrafting extends RecipeGen_Base { } //Gear Recipe - if (!material.isRadioactive && material.getGear(1) != null){ + if (!material.isRadioactive && material.getGear(1) != null && material.getPlate(1) != null && material.getRod(1) != null){ if (RecipeUtils.recipeBuilder( material.getRod(1), material.getPlate(1), material.getRod(1), material.getPlate(1), "craftingToolWrench", material.getPlate(1), @@ -249,7 +249,7 @@ public class RecipeGen_ShapedCrafting extends RecipeGen_Base { } //Screws - if (!material.isRadioactive && material.getScrew(1) != null){ + if (!material.isRadioactive && material.getScrew(1) != null && material.getBolt(1) != null){ if (RecipeUtils.recipeBuilder( "craftingToolFile", material.getBolt(1), null, material.getBolt(1), null, null, |