From 6205a2088bbbc31a09d0a2a3d460add1a7622801 Mon Sep 17 00:00:00 2001 From: Alkalus <3060479+draknyte1@users.noreply.github.com> Date: Mon, 29 Oct 2018 05:09:01 +0000 Subject: + Added recipe for heating Titanium Ingots, required for Krypton processing. + Added custom GT TextureSets. $ Lots of small fixes to Material, Material Generation & Recipe Generation. $ Lots of small fixes to Fluids, Fluid Generation and Fluid Cell Generation. $ Fixed Creative Tabs. $ Possibly fixed issue where tickable items would instantly tick to 0. $ Fixed display names of Throwable Potions. $ Fixed NPE in removeCrudeTurbineRotors(). % Adjusted lots of textures. % Adjusted handling of Thermal Foundation Fluids. % Moved Furnace/EBF and Maceration recipes out of BaseItemDust.java. % Made Tooltips of GT++ Material Blocks, Frames and ores more informational. % Made Bromine a Fluid Material, this will remove all Bromine solid material items from the world. (Ingots, Blocks, etc.) % Increased cost of GT++ Ores in processing. - Broke lots of recipes. > EBF/ABS & All Table Crafting. TBA~ --- .../gtPlusPlus/api/objects/data/TypeCounter.java | 178 +++++++++++ .../core/block/base/BlockBaseModular.java | 39 ++- .../gtPlusPlus/core/block/base/BlockBaseOre.java | 2 +- .../gtPlusPlus/core/client/CustomTextureSet.java | 27 ++ src/Java/gtPlusPlus/core/common/CommonProxy.java | 10 +- .../gtPlusPlus/core/creative/AddToCreativeTab.java | 15 +- .../creative/tabs/MiscUtilCreativeTabBlock.java | 12 +- .../creative/tabs/MiscUtilCreativeTabMachines.java | 3 +- .../creative/tabs/MiscUtilCreativeTabMisc.java | 3 +- .../creative/tabs/MiscUtilCreativeTabOther.java | 3 +- .../creative/tabs/MiscUtilCreativeTabTools.java | 3 +- src/Java/gtPlusPlus/core/item/ModItems.java | 45 ++- .../core/item/base/BaseItemComponent.java | 89 ++++-- .../core/item/base/BaseItemTickable.java | 15 +- .../core/item/base/dusts/BaseItemDust.java | 258 ++++++++-------- .../core/item/base/itemblock/ItemBlockGtBlock.java | 70 ++++- .../core/item/base/itemblock/ItemBlockOre.java | 57 +++- .../core/item/general/ItemCreativeTab.java | 59 ++++ .../core/item/materials/DustDecayable.java | 13 +- src/Java/gtPlusPlus/core/material/ELEMENT.java | 77 +++-- src/Java/gtPlusPlus/core/material/Material.java | 341 +++++++++++++++++---- .../core/material/MaterialGenerator.java | 60 ++-- src/Java/gtPlusPlus/core/material/NONMATERIAL.java | 22 +- src/Java/gtPlusPlus/core/material/ORES.java | 28 +- .../gtPlusPlus/core/util/minecraft/FluidUtils.java | 293 ++++++++++-------- .../gtPlusPlus/core/util/minecraft/ItemUtils.java | 10 - .../core/util/minecraft/MaterialUtils.java | 41 ++- src/Java/gtPlusPlus/xmod/gregtech/HANDLER_GT.java | 12 +- .../common/blocks/fluid/GregtechFluidHandler.java | 30 +- .../gregtech/loaders/RecipeGen_DustGeneration.java | 88 +++++- .../xmod/gregtech/loaders/RecipeGen_Ore.java | 26 +- 31 files changed, 1386 insertions(+), 543 deletions(-) create mode 100644 src/Java/gtPlusPlus/api/objects/data/TypeCounter.java create mode 100644 src/Java/gtPlusPlus/core/client/CustomTextureSet.java create mode 100644 src/Java/gtPlusPlus/core/item/general/ItemCreativeTab.java (limited to 'src/Java') diff --git a/src/Java/gtPlusPlus/api/objects/data/TypeCounter.java b/src/Java/gtPlusPlus/api/objects/data/TypeCounter.java new file mode 100644 index 0000000000..3d562bf76e --- /dev/null +++ b/src/Java/gtPlusPlus/api/objects/data/TypeCounter.java @@ -0,0 +1,178 @@ +package gtPlusPlus.api.objects.data; + +import java.util.Collection; +import java.util.Iterator; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.Set; + +import gtPlusPlus.api.objects.Logger; + + +public class TypeCounter implements Set { + + private Map> mInternalMap = new LinkedHashMap>(); + private String mHighestValueKey; + private int mHighestValue = 0; + private final Class mClass; + + public TypeCounter(Class o) { + Logger.INFO("Created new TypeCounter for "+o.getName()); + mClass = o; + } + + public static class InternalTypeCounterObject { + private final Z mObject; + private int mCounter = 0; + + public InternalTypeCounterObject(Z o) { + mObject = o; + } + + public String hash() { + return String.valueOf(mObject.hashCode()); + } + + public Z get() { + return mObject; + } + + public void add() { + mCounter++; + } + + public int count() { + return mCounter; + } + + } + + public boolean add(V arg0) { + return add(arg0, null); + } + + public boolean add(V arg0, String aKeyName) { + String aKey = aKeyName != null ? aKeyName : arg0.toString(); + InternalTypeCounterObject aValue = mInternalMap.get(aKey); + if (aValue == null) { + aValue = new InternalTypeCounterObject((V) arg0); + Logger.INFO("Adding new key to map: "+aKey); + } + aValue.add(); + int a = aValue.count(); + if (a > mHighestValue) { + mHighestValue = a; + mHighestValueKey = aKey; + Logger.INFO("New Highest Count - "+aKey+":"+a); + } + mInternalMap.put(aKey, aValue); + Logger.INFO(aKey+":"+a); + return true; + } + + @Override + public boolean addAll(Collection arg0) { + boolean aReturn = true; + for (Object o : arg0) { + if (mClass.isInstance(o)) { + V j = (V) o; + boolean b = add(j); + if (!b) { + aReturn = false; + } + } + } + return aReturn; + } + + @Override + public void clear() { + mInternalMap.clear(); + } + + @Override + public boolean contains(Object arg0) { + return mInternalMap.containsKey(arg0.toString()); + } + + @Override + public boolean containsAll(Collection arg0) { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean isEmpty() { + return mInternalMap.isEmpty(); + } + + @Override + public Iterator iterator() { + // TODO Auto-generated method stub + return null; + } + + @Override + public boolean remove(Object arg0) { + InternalTypeCounterObject aValue = mInternalMap.remove(arg0.toString()); + if (aValue != null) { + return true; + } + else { + return false; + } + } + + @Override + public boolean removeAll(Collection arg0) { + boolean aReturn = true; + for (Object o : arg0) { + boolean a = remove(o); + if (!a) { + aReturn = false; + } + } + return aReturn; + } + + @Override + public boolean retainAll(Collection arg0) { + // TODO Auto-generated method stub + return false; + } + + @Override + public int size() { + return this.mInternalMap.size(); + } + + @Override + public Object[] toArray() { + Object[] aArray = new Object[this.mInternalMap.size()]; + int aPos = 0; + for (String k : this.mInternalMap.keySet()) { + if (k != null) { + InternalTypeCounterObject aVal = this.mInternalMap.get(k); + aArray[aPos++] = new Pair>(k, aVal); + } + } + return aArray; + } + + @Override + public V[] toArray(Object[] a) { + Object[] aArray = new Object[a.length]; + int aPos = 0; + for (Object k : a) { + if (k != null) { + aArray[aPos++] = k; + } + } + return (V[]) aArray; + } + + public V getResults() { + InternalTypeCounterObject x = mInternalMap.get(mHighestValueKey); + return x.get(); + } +} diff --git a/src/Java/gtPlusPlus/core/block/base/BlockBaseModular.java b/src/Java/gtPlusPlus/core/block/base/BlockBaseModular.java index 101e568188..634dc4c022 100644 --- a/src/Java/gtPlusPlus/core/block/base/BlockBaseModular.java +++ b/src/Java/gtPlusPlus/core/block/base/BlockBaseModular.java @@ -6,7 +6,7 @@ import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.world.IBlockAccess; - +import gregtech.api.enums.TextureSet; import gregtech.api.util.GT_OreDictUnificator; import gtPlusPlus.core.item.base.itemblock.ItemBlockGtBlock; @@ -26,17 +26,17 @@ public class BlockBaseModular extends BasicBlock { protected String thisBlockMaterial; protected final String thisBlockType; + public BlockBaseModular(final Material material, final BlockTypes blockType) { + this(material, blockType, material.getRgbAsHex()); + } + public BlockBaseModular(final Material material, final BlockTypes blockType, final int colour) { this(material.getUnlocalizedName(), material.getLocalizedName(), net.minecraft.block.material.Material.iron, - blockType, colour, 2); - } - - public BlockBaseModular(final String unlocalizedName, final String blockMaterial, final BlockTypes blockType, - final int colour) { - this(unlocalizedName, blockMaterial, net.minecraft.block.material.Material.iron, blockType, colour, 2); + blockType, colour, Math.min(Math.max(material.vTier, 1), 5)); + blockMaterial = material; } - public BlockBaseModular(final String unlocalizedName, final String blockMaterial, + 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); @@ -57,7 +57,7 @@ public class BlockBaseModular extends BasicBlock { ItemUtils.getSimpleStack(this)); } else if (this.thisBlockType.equals(BlockTypes.FRAME.name().toUpperCase())) { - GameRegistry.registerBlock(this, ItemBlockGtFrameBox.class, + GameRegistry.registerBlock(this, ItemBlockGtBlock.class, Utils.sanitizeString(blockType.getTexture() + unlocalizedName)); GT_OreDictUnificator.registerOre( "frameGt" + getUnlocalizedName().replace("tile.", "").replace("tile.BlockGtFrame", "") @@ -111,12 +111,27 @@ public class BlockBaseModular extends BasicBlock { return false; } + public Material getMaterialEx(){ + return this.blockMaterial; + } + @Override @SideOnly(Side.CLIENT) public void registerBlockIcons(final IIconRegister iIcon) { - if (this.thisBlock != BlockTypes.ORE) { - this.blockIcon = iIcon.registerIcon(CORE.MODID + ":" + this.thisBlock.getTexture()); - } + if (!CORE.ConfigSwitches.useGregtechTextures || this.blockMaterial == null || this.thisBlock == BlockTypes.ORE){ + this.blockIcon = iIcon.registerIcon(CORE.MODID + ":" + this.thisBlock.getTexture()); + } + String metType = "9j4852jyo3rjmh3owlhw9oe"; + if (this.blockMaterial != null) { + TextureSet u = this.blockMaterial.getTextureSet(); + if (u != null) { + metType = u.mSetName; + } + } + 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); } @Override diff --git a/src/Java/gtPlusPlus/core/block/base/BlockBaseOre.java b/src/Java/gtPlusPlus/core/block/base/BlockBaseOre.java index ab1fd5e08a..526f2b245c 100644 --- a/src/Java/gtPlusPlus/core/block/base/BlockBaseOre.java +++ b/src/Java/gtPlusPlus/core/block/base/BlockBaseOre.java @@ -35,7 +35,7 @@ public class BlockBaseOre extends BasicBlock implements ITexturedBlock { this.setHardness(2.0f); this.setResistance(6.0F); this.setLightLevel(0.0F); - this.setHarvestLevel("pickaxe", 3); + this.setHarvestLevel("pickaxe", Math.min(Math.max(material.vTier, 1), 5)); 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 new file mode 100644 index 0000000000..d7bbecd6c7 --- /dev/null +++ b/src/Java/gtPlusPlus/core/client/CustomTextureSet.java @@ -0,0 +1,27 @@ +package gtPlusPlus.core.client; + +import gregtech.api.enums.TextureSet; + +public class CustomTextureSet extends TextureSet { + + public static enum TextureSets { + + REFINED(), + GEM_A(), + ENRICHED(); + + private final CustomTextureSet A; + + private TextureSets (){ + A = new CustomTextureSet(this.name().toUpperCase()); + } + public CustomTextureSet get() { + return A; + } + } + + public CustomTextureSet(String aSetName) { + super(aSetName); + } + +} diff --git a/src/Java/gtPlusPlus/core/common/CommonProxy.java b/src/Java/gtPlusPlus/core/common/CommonProxy.java index c9ea0f3e5b..9e75cd4a16 100644 --- a/src/Java/gtPlusPlus/core/common/CommonProxy.java +++ b/src/Java/gtPlusPlus/core/common/CommonProxy.java @@ -45,12 +45,13 @@ public class CommonProxy { //Should Register Gregtech Materials I've Made Utils.registerEvent(this); if (LoadedMods.Gregtech){ - if (CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK){ - Logger.INFO("We're using Gregtech 5.09 Experimental."); + if (!CORE.GTNH) { + Logger.INFO("We're using Gregtech "+Utils.getGregtechVersionAsString()); } else { - Logger.INFO("We're using Gregtech 5.08 or an earlier fork."); + Logger.INFO("We're using GTNH's Gregtech "+Utils.getGregtechVersionAsString()); } + Logger.INFO("Setting up our own GT_Proxy."); GtProxy = new Meta_GT_Proxy(); } @@ -74,6 +75,8 @@ public class CommonProxy { else { Logger.WARNING("Development mode not set."); } + + AddToCreativeTab.initialiseTabs(); //Moved from Init after Debug Loading. //29/01/18 - Alkalus @@ -83,7 +86,6 @@ public class CommonProxy { ModBlocks.init(); CI.preInit(); - AddToCreativeTab.initialiseTabs(); COMPAT_IntermodStaging.preInit(); diff --git a/src/Java/gtPlusPlus/core/creative/AddToCreativeTab.java b/src/Java/gtPlusPlus/core/creative/AddToCreativeTab.java index 8e6d38f301..218bef46bd 100644 --- a/src/Java/gtPlusPlus/core/creative/AddToCreativeTab.java +++ b/src/Java/gtPlusPlus/core/creative/AddToCreativeTab.java @@ -1,7 +1,7 @@ package gtPlusPlus.core.creative; import net.minecraft.creativetab.CreativeTabs; - +import gregtech.api.util.GT_CreativeTab; import gtPlusPlus.core.creative.tabs.*; import gtPlusPlus.xmod.bop.creative.MiscUtilsBOPTab; @@ -16,11 +16,20 @@ public class AddToCreativeTab { public static CreativeTabs tabBOP; public static void initialiseTabs() { - tabBlock = new MiscUtilCreativeTabBlock("MiscUtilBlockTab"); + //GT_CreativeTab + /*tabBlock = new MiscUtilCreativeTabBlock("MiscUtilBlockTab"); tabMisc = new MiscUtilCreativeTabMisc("MiscUtilMiscTab"); tabTools = new MiscUtilCreativeTabTools("MiscUtilToolsTab"); tabMachines = new MiscUtilCreativeTabMachines("MiscUtilMachineTab"); tabOther = new MiscUtilCreativeTabOther("MiscUtilOtherTab"); - tabBOP = new MiscUtilsBOPTab("MiscUtilBOP"); + tabBOP = new MiscUtilsBOPTab("MiscUtilBOP");*/ + + tabBlock = new GT_CreativeTab("GTPP_BLOCKS", "GT++ Blocks"); + tabMisc = new GT_CreativeTab("GTPP_MISC", "GT++ Misc"); + tabTools = new GT_CreativeTab("GTPP_TOOLS", "GT++ Tools"); + tabMachines = new GT_CreativeTab("GTPP_MACHINES", "GT++ Machines"); + tabOther = new GT_CreativeTab("GTPP_OTHER", "GT++ Other"); + tabBOP = new GT_CreativeTab("GTPP_OTHER_2", "GT++ Other II"); + } } diff --git a/src/Java/gtPlusPlus/core/creative/tabs/MiscUtilCreativeTabBlock.java b/src/Java/gtPlusPlus/core/creative/tabs/MiscUtilCreativeTabBlock.java index 3af79c7305..2851a514d0 100644 --- a/src/Java/gtPlusPlus/core/creative/tabs/MiscUtilCreativeTabBlock.java +++ b/src/Java/gtPlusPlus/core/creative/tabs/MiscUtilCreativeTabBlock.java @@ -1,8 +1,10 @@ package gtPlusPlus.core.creative.tabs; import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.init.Blocks; import net.minecraft.item.Item; - +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import gtPlusPlus.core.block.ModBlocks; public class MiscUtilCreativeTabBlock extends CreativeTabs { @@ -13,7 +15,13 @@ public class MiscUtilCreativeTabBlock extends CreativeTabs { @Override public Item getTabIconItem() { - return Item.getItemFromBlock(ModBlocks.blockCompressedObsidian); + return Item.getItemFromBlock(Blocks.bedrock); } + + @SideOnly(Side.CLIENT) + @Override + public int func_151243_f(){ + return 0; + } } diff --git a/src/Java/gtPlusPlus/core/creative/tabs/MiscUtilCreativeTabMachines.java b/src/Java/gtPlusPlus/core/creative/tabs/MiscUtilCreativeTabMachines.java index 9f145cf581..96c809c4da 100644 --- a/src/Java/gtPlusPlus/core/creative/tabs/MiscUtilCreativeTabMachines.java +++ b/src/Java/gtPlusPlus/core/creative/tabs/MiscUtilCreativeTabMachines.java @@ -1,6 +1,7 @@ package gtPlusPlus.core.creative.tabs; import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.init.Items; import net.minecraft.item.Item; import gtPlusPlus.core.item.ModItems; @@ -14,7 +15,7 @@ public class MiscUtilCreativeTabMachines extends CreativeTabs { @Override public Item getTabIconItem() { - return ModItems.itemAlkalusDisk; + return Items.netherbrick; } } diff --git a/src/Java/gtPlusPlus/core/creative/tabs/MiscUtilCreativeTabMisc.java b/src/Java/gtPlusPlus/core/creative/tabs/MiscUtilCreativeTabMisc.java index 17c56f68af..a67668bbf0 100644 --- a/src/Java/gtPlusPlus/core/creative/tabs/MiscUtilCreativeTabMisc.java +++ b/src/Java/gtPlusPlus/core/creative/tabs/MiscUtilCreativeTabMisc.java @@ -1,6 +1,7 @@ package gtPlusPlus.core.creative.tabs; import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.init.Items; import net.minecraft.item.Item; import gtPlusPlus.core.item.ModItems; @@ -13,7 +14,7 @@ public class MiscUtilCreativeTabMisc extends CreativeTabs { @Override public Item getTabIconItem() { - return ModItems.AAA_Broken; + return Items.painting; } } diff --git a/src/Java/gtPlusPlus/core/creative/tabs/MiscUtilCreativeTabOther.java b/src/Java/gtPlusPlus/core/creative/tabs/MiscUtilCreativeTabOther.java index 156086081e..afd89346c0 100644 --- a/src/Java/gtPlusPlus/core/creative/tabs/MiscUtilCreativeTabOther.java +++ b/src/Java/gtPlusPlus/core/creative/tabs/MiscUtilCreativeTabOther.java @@ -1,6 +1,7 @@ package gtPlusPlus.core.creative.tabs; import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.init.Items; import net.minecraft.item.Item; import gtPlusPlus.core.item.ModItems; @@ -13,7 +14,7 @@ public class MiscUtilCreativeTabOther extends CreativeTabs { @Override public Item getTabIconItem() { - return ModItems.backpack_Green; + return Items.repeater; } } diff --git a/src/Java/gtPlusPlus/core/creative/tabs/MiscUtilCreativeTabTools.java b/src/Java/gtPlusPlus/core/creative/tabs/MiscUtilCreativeTabTools.java index b68eccd0e4..ab1ab069de 100644 --- a/src/Java/gtPlusPlus/core/creative/tabs/MiscUtilCreativeTabTools.java +++ b/src/Java/gtPlusPlus/core/creative/tabs/MiscUtilCreativeTabTools.java @@ -1,6 +1,7 @@ package gtPlusPlus.core.creative.tabs; import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.init.Items; import net.minecraft.item.Item; import gtPlusPlus.core.item.ModItems; @@ -13,7 +14,7 @@ public class MiscUtilCreativeTabTools extends CreativeTabs { @Override public Item getTabIconItem() { - return ModItems.itemStaballoyPickaxe; + return Items.diamond_pickaxe; } } diff --git a/src/Java/gtPlusPlus/core/item/ModItems.java b/src/Java/gtPlusPlus/core/item/ModItems.java index 5b8e8ab2a1..0e21e9b154 100644 --- a/src/Java/gtPlusPlus/core/item/ModItems.java +++ b/src/Java/gtPlusPlus/core/item/ModItems.java @@ -22,10 +22,12 @@ import gtPlusPlus.core.common.compat.COMPAT_Baubles; import gtPlusPlus.core.creative.AddToCreativeTab; import gtPlusPlus.core.handler.OldCircuitHandler; import gtPlusPlus.core.item.base.*; +import gtPlusPlus.core.item.base.BaseItemComponent.ComponentTypes; import gtPlusPlus.core.item.base.foil.BaseItemFoil; import gtPlusPlus.core.item.base.foods.BaseItemFood; import gtPlusPlus.core.item.base.foods.BaseItemHotFood; import gtPlusPlus.core.item.base.gears.BaseItemSmallGear; +import gtPlusPlus.core.item.base.ingots.BaseItemIngot; import gtPlusPlus.core.item.base.ingots.BaseItemIngot_OLD; import gtPlusPlus.core.item.base.misc.BaseItemMisc; import gtPlusPlus.core.item.base.misc.BaseItemMisc.MiscTypes; @@ -56,6 +58,7 @@ import gtPlusPlus.core.lib.LoadedMods; import gtPlusPlus.core.material.*; 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.data.StringUtils; import gtPlusPlus.core.util.debug.DEBUG_INIT; @@ -275,6 +278,8 @@ public final class ModItems { public static Item itemControlCore; + public static ItemStack itemHotTitaniumIngot; + 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. @@ -347,7 +352,7 @@ public final class ModItems { itemGemShards = new ItemGemShards("itemGemShards", "Gem Shards", AddToCreativeTab.tabMisc, 32, 0, "They glitter in the light", EnumRarity.rare, EnumChatFormatting.GRAY, false, Utils.rgbtoHexValue(182, 114, 18)).setTextureName(CORE.MODID + ":itemHeliumBlob"); itemHalfCompleteCasings = new ItemHalfCompleteCasings("itemHalfCompleteCasings", AddToCreativeTab.tabMisc, 32, 0, "This isn't quite finished yet.", EnumRarity.common, EnumChatFormatting.GRAY, false, Utils.rgbtoHexValue(255, 255, 255)).setTextureName("gregtech" + ":" + "gt.metaitem.01/" + "761"); itemSulfuricPotion = new ItemSulfuricAcidPotion("itemSulfuricPotion", "Throwable Vial of Sulfuric Acid", "Burn your foes alive!").setTextureName(CORE.MODID + ":itemSulfuricAcidPotion"); - itemHydrofluoricPotion = new ItemHydrofluoricAcidPotion("itemHydrofluoricPotion", "Thowable Vial of Hydrofluoric Acid", "They won't see this coming, nor anything after!").setTextureName(CORE.MODID + ":itemPotion"); + itemHydrofluoricPotion = new ItemHydrofluoricAcidPotion("itemHydrofluoricPotion", "Throwable Vial of Hydrofluoric Acid", "They won't see this coming, nor anything after!").setTextureName(CORE.MODID + ":itemPotion"); //Start meta Item Generation ItemsFoods.load(); @@ -599,7 +604,8 @@ public final class ModItems { //FLiBe Fuel Compounds dustLi2BeF4 = ItemUtils.generateSpecialUseDusts("Li2BeF4", "Li2BeF4 Fuel Compound", "Li2BeF4", Utils.rgbtoHexValue(255, 255, 255))[0]; //https://en.wikipedia.org/wiki/FLiBe - fluidFLiBeSalt = FluidUtils.generateFluid("Li2BeF4", "Li2BeF4", 7430, new short[]{255, 255, 255, 100}); + //fluidFLiBeSalt = ("Li2BeF4", "Li2BeF4", 7430, new short[]{255, 255, 255, 100}, 0); + fluidFLiBeSalt = FluidUtils.addGTFluidNoPrefix("Li2BeF4", "Li2BeF4", new short[]{255, 255, 255, 100}, 0, 743, null, CI.emptyCells(1), 1000, true); //LFTR Control Circuit itemCircuitLFTR = new CoreItem("itemCircuitLFTR", ""+EnumChatFormatting.GREEN+"Control Circuit", AddToCreativeTab.tabMisc, 1, 0, new String[] {"Keeps Multiblocks Stable"}, EnumRarity.epic, EnumChatFormatting.DARK_GREEN, false, null); @@ -637,10 +643,10 @@ public final class ModItems { temp2 = ItemUtils.getCorrectStacktype("Forestry:fertilizerCompound", 1); } if (temp1 != null){ - FluidUtils.generateFluidNonMolten("Fertiliser", "Fertiliser", 32, new short[]{45, 170, 45, 100}, temp1, temp2); + FluidUtils.generateFluidNonMolten("Fertiliser", "Fertiliser", 32, new short[]{45, 170, 45, 100}, temp1, temp2, true); } - FluidUtils.generateFluidNonMolten("UN32Fertiliser", "UN-32 Fertiliser", 24, new short[]{55, 190, 55, 100}, null, null); - FluidUtils.generateFluidNonMolten("UN18Fertiliser", "UN-18 Fertiliser", 22, new short[]{60, 155, 60, 100}, null, null); + FluidUtils.generateFluidNonMolten("UN32Fertiliser", "UN-32 Fertiliser", 24, new short[]{55, 190, 55, 100}, null, null, true); + FluidUtils.generateFluidNonMolten("UN18Fertiliser", "UN-18 Fertiliser", 22, new short[]{60, 155, 60, 100}, null, null, true); /*GT_Values.RA.addMixerRecipe( arg0, //Item In @@ -657,7 +663,7 @@ public final class ModItems { } //Juice - FluidUtils.generateFluidNonMolten("RaisinJuice", "Raisin Juice", 2, new short[]{51, 0, 51, 100}, ItemUtils.getItemStackOfAmountFromOreDictNoBroken("foodRaisins", 1), ItemUtils.getItemStackOfAmountFromOreDictNoBroken("fruitRaisins", 1), 50); + FluidUtils.generateFluidNonMolten("RaisinJuice", "Raisin Juice", 2, new short[]{51, 0, 51, 100}, ItemUtils.getItemStackOfAmountFromOreDictNoBroken("foodRaisins", 1), ItemUtils.getItemStackOfAmountFromOreDictNoBroken("fruitRaisins", 1), 50, true); //Test items @@ -688,10 +694,10 @@ public final class ModItems { //Just an unusual plate needed for some black magic. if (ItemUtils.getItemStackOfAmountFromOreDictNoBroken("plateClay", 1) == null){ - itemPlateClay = new BaseItemPlate(MaterialUtils.generateMaterialFromGtENUM(Materials.Clay)); + itemPlateClay = new BaseItemPlate(NONMATERIAL.CLAY); } if (ItemUtils.getItemStackOfAmountFromOreDictNoBroken("plateDoubleClay", 1) == null){ - itemDoublePlateClay = new BaseItemPlateDouble(MaterialUtils.generateMaterialFromGtENUM(Materials.Clay)); + itemDoublePlateClay = new BaseItemPlateDouble(NONMATERIAL.CLAY); } //Need this for Mutagenic Frames @@ -701,18 +707,25 @@ public final class ModItems { //A small gear needed for wizardry. if (ItemUtils.getItemStackOfAmountFromOreDictNoBroken("gearGtSmallWroughtIron", 1) == null){ - itemSmallWroughtIronGear = new BaseItemSmallGear(MaterialUtils.generateMaterialFromGtENUM(Materials.WroughtIron)); + itemSmallWroughtIronGear = new BaseItemSmallGear(NONMATERIAL.WROUGHT_IRON); + } + //Krypton Processing + if (ItemUtils.getItemStackOfAmountFromOreDictNoBroken("ingotHotTitanium", 1) == null){ + itemHotTitaniumIngot = ItemUtils.getSimpleStack(new BaseItemIngot(ELEMENT.getInstance().TITANIUM, ComponentTypes.HOTINGOT)); + } + else { + itemHotTitaniumIngot = ItemUtils.getItemStackOfAmountFromOreDictNoBroken("ingotHotTitanium", 1); } + GT_Values.RA.addBlastRecipe(ELEMENT.getInstance().TITANIUM.getIngot(1), null, itemHotTitaniumIngot, null, 10 * 20, 512, Materials.Titanium.mBlastFurnaceTemp); //Special Sillyness if (true) { if (ItemUtils.getItemStackOfAmountFromOreDictNoBroken("plateSodium", 1) == null){ - new BaseItemPlate(MaterialUtils.generateMaterialFromGtENUM(Materials.Sodium)); + new BaseItemPlate(ELEMENT.getInstance().SODIUM); } - Material meatRaw = MaterialUtils.generateMaterialFromGtENUM(Materials.MeatRaw); - meatRaw.setTextureSet(TextureSet.SET_ROUGH); + Material meatRaw = NONMATERIAL.MEAT; // A plate of Meat. if (ItemUtils.getItemStackOfAmountFromOreDictNoBroken("plateMeatRaw", 1) == null){ itemPlateRawMeat = new BaseItemPlate(meatRaw); @@ -721,7 +734,7 @@ public final class ModItems { } // A Block of Meat. if (ItemUtils.getItemStackOfAmountFromOreDictNoBroken("blockMeatRaw", 1) == null){ - blockRawMeat = new BlockBaseModular(meatRaw.getUnlocalizedName(), meatRaw.getLocalizedName(), BlockTypes.STANDARD, meatRaw.getRgbAsHex()); + blockRawMeat = new BlockBaseModular(meatRaw, BlockTypes.STANDARD); ItemUtils.registerFuel(ItemUtils.getSimpleStack(blockRawMeat), 900); } } @@ -734,15 +747,15 @@ public final class ModItems { //A plate of Lithium. if (ItemUtils.getItemStackOfAmountFromOreDictNoBroken("plateLithium", 1) == null){ - itemPlateLithium = new BaseItemPlate(MaterialUtils.generateMaterialFromGtENUM(Materials.Lithium)); + itemPlateLithium = new BaseItemPlate(ELEMENT.getInstance().LITHIUM); } //A plate of Europium. if ((ItemUtils.getItemStackOfAmountFromOreDictNoBroken("plateEuropium", 1) == null) && CORE.ConfigSwitches.enableCustom_Pipes){ - itemPlateEuropium = new BaseItemPlate(MaterialUtils.generateMaterialFromGtENUM(Materials.Europium)); + itemPlateEuropium = new BaseItemPlate(ELEMENT.getInstance().EUROPIUM); } if ((ItemUtils.getItemStackOfAmountFromOreDictNoBroken("plateDoubleEuropium", 1) == null) && CORE.ConfigSwitches.enableCustom_Pipes){ - itemDoublePlateEuropium = new BaseItemPlateDouble(MaterialUtils.generateMaterialFromGtENUM(Materials.Europium)); + itemDoublePlateEuropium = new BaseItemPlateDouble(ELEMENT.getInstance().EUROPIUM); } dustNeptunium238 = new DustDecayable("dustNeptunium238", Utils.rgbtoHexValue(175, 240, 75), 50640, new String[] {""+StringUtils.superscript("238Np"), "Result: Plutonium 238 ("+StringUtils.superscript("238Pu")+")"}, ELEMENT.getInstance().PLUTONIUM238.getDust(1).getItem(), 5); diff --git a/src/Java/gtPlusPlus/core/item/base/BaseItemComponent.java b/src/Java/gtPlusPlus/core/item/base/BaseItemComponent.java index 558a0605fe..ea0a2bb5eb 100644 --- a/src/Java/gtPlusPlus/core/item/base/BaseItemComponent.java +++ b/src/Java/gtPlusPlus/core/item/base/BaseItemComponent.java @@ -1,6 +1,8 @@ package gtPlusPlus.core.item.base; +import java.util.HashMap; import java.util.List; +import java.util.Map; import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.relauncher.Side; @@ -14,10 +16,10 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.IIcon; import net.minecraft.world.World; - +import gregtech.api.enums.OrePrefixes; import gregtech.api.enums.TextureSet; import gregtech.api.util.GT_OreDictUnificator; - +import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.creative.AddToCreativeTab; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.lib.LoadedMods; @@ -33,6 +35,12 @@ import gtPlusPlus.xmod.thaumcraft.util.ThaumcraftUtils; public class BaseItemComponent extends Item{ + private final static Class mTextureSetPreload; + + static { + mTextureSetPreload = TextureSet.class; + } + public final Material componentMaterial; public final String materialName; public final String unlocalName; @@ -54,7 +62,9 @@ public class BaseItemComponent extends Item{ //this.setTextureName(this.getCorrectTextures()); this.componentColour = material.getRgbAsHex(); GameRegistry.registerItem(this, this.unlocalName); - if (componentType != ComponentTypes.DUST) + + //if (componentType != ComponentTypes.DUST) + GT_OreDictUnificator.registerOre(componentType.getOreDictName()+material.getUnlocalizedName(), ItemUtils.getSimpleStack(this)); if (LoadedMods.Thaumcraft) { ThaumcraftUtils.addAspectToItem(ItemUtils.getSimpleStack(this), GTPP_Aspects.METALLUM, 1); @@ -62,6 +72,7 @@ public class BaseItemComponent extends Item{ ThaumcraftUtils.addAspectToItem(ItemUtils.getSimpleStack(this), GTPP_Aspects.RADIO, 2); } } + registerComponent(); } //For Cell Generation @@ -78,6 +89,30 @@ public class BaseItemComponent extends Item{ this.setTextureName(CORE.MODID + ":" + "item"+ComponentTypes.CELL.COMPONENT_NAME); GameRegistry.registerItem(this, unlocalName); GT_OreDictUnificator.registerOre(ComponentTypes.CELL.getOreDictName()+unlocalName, ItemUtils.getSimpleStack(this)); + registerComponent(); + } + + public boolean registerComponent() { + if (this.componentMaterial == null) { + return false; + } + //Register Component + Map aMap = Material.mComponentMap.get(componentMaterial.getUnlocalizedName()); + if (aMap == null) { + aMap = new HashMap(); + } + String aKey = componentType.getGtOrePrefix().name(); + BaseItemComponent x = aMap.get(aKey); + if (x == null) { + aMap.put(aKey, this); + Material.mComponentMap.put(componentMaterial.getUnlocalizedName(), aMap); + return true; + } + else { + //Bad + Logger.MATERIALS("Tried to double register a material component. "); + return false; + } } public String getCorrectTextures(){ @@ -224,34 +259,36 @@ public class BaseItemComponent extends Item{ public static enum ComponentTypes { - DUST("Dust", " Dust", "dust"), - DUSTSMALL("DustSmall", " Dust", "dustSmall"), - DUSTTINY("DustTiny", " Dust", "dustTiny"), - INGOT("Ingot", " Ingot", "ingot"), - HOTINGOT("HotIngot", " Hot Ingot", "ingotHot"), - PLATE("Plate", " Plate", "plate"), - PLATEDOUBLE("PlateDouble", " Double Plate", "plateDouble"), - ROD("Rod", " Rod", "stick"), - RODLONG("RodLong", " Long Rod", "stickLong"), - GEAR("Gear", " Gear", "gearGt"), - SMALLGEAR("SmallGear", " Gear", "gearGtSmall"), //TODO - SCREW("Screw", " Screw", "screw"), - BOLT("Bolt", " Bolt", "bolt"), - ROTOR("Rotor", " Rotor", "rotor"), - RING("Ring", " Ring", "ring"), - FOIL("Foil", " Foil", "foil"), - PLASMACELL("CellPlasma", " Plasma Cell", "cellPlasma"), - CELL("Cell", " Cell", "cell"), - NUGGET("Nugget", " Nugget", "nugget"), - PLATEHEAVY("HeavyPlate", " Heavy Plate", "plateHeavy"); + DUST("Dust", " Dust", "dust", OrePrefixes.dust), + DUSTSMALL("DustSmall", " Dust", "dustSmall", OrePrefixes.dustSmall), + DUSTTINY("DustTiny", " Dust", "dustTiny", OrePrefixes.dustTiny), + INGOT("Ingot", " Ingot", "ingot", OrePrefixes.ingot), + HOTINGOT("HotIngot", " Hot Ingot", "ingotHot", OrePrefixes.ingotHot), + PLATE("Plate", " Plate", "plate", OrePrefixes.plate), + PLATEDOUBLE("PlateDouble", " Double Plate", "plateDouble", OrePrefixes.plateDouble), + ROD("Rod", " Rod", "stick", OrePrefixes.stick), + RODLONG("RodLong", " Long Rod", "stickLong", OrePrefixes.stickLong), + GEAR("Gear", " Gear", "gearGt", OrePrefixes.gearGt), + SMALLGEAR("SmallGear", " Gear", "gearGtSmall", OrePrefixes.gearGtSmall), //TODO + SCREW("Screw", " Screw", "screw", OrePrefixes.screw), + BOLT("Bolt", " Bolt", "bolt", OrePrefixes.bolt), + ROTOR("Rotor", " Rotor", "rotor", OrePrefixes.rotor), + RING("Ring", " Ring", "ring", OrePrefixes.ring), + FOIL("Foil", " Foil", "foil", OrePrefixes.foil), + PLASMACELL("CellPlasma", " Plasma Cell", "cellPlasma", OrePrefixes.cellPlasma), + CELL("Cell", " Cell", "cell", OrePrefixes.cell), + NUGGET("Nugget", " Nugget", "nugget", OrePrefixes.nugget), + PLATEHEAVY("HeavyPlate", " Heavy Plate", "plateHeavy", OrePrefixes.plateDense); private String COMPONENT_NAME; private String DISPLAY_NAME; private String OREDICT_NAME; - private ComponentTypes (final String LocalName, final String DisplayName, final String OreDictName){ + private OrePrefixes a_GT_EQUAL; + private ComponentTypes (final String LocalName, final String DisplayName, final String OreDictName, final OrePrefixes aPrefix){ this.COMPONENT_NAME = LocalName; this.DISPLAY_NAME = DisplayName; this.OREDICT_NAME = OreDictName; + this.a_GT_EQUAL = aPrefix; } public String getComponent(){ @@ -266,6 +303,10 @@ public class BaseItemComponent extends Item{ return this.OREDICT_NAME; } + public OrePrefixes getGtOrePrefix() { + return this.a_GT_EQUAL; + } + } } diff --git a/src/Java/gtPlusPlus/core/item/base/BaseItemTickable.java b/src/Java/gtPlusPlus/core/item/base/BaseItemTickable.java index d5b44db9f5..78c2724ea8 100644 --- a/src/Java/gtPlusPlus/core/item/base/BaseItemTickable.java +++ b/src/Java/gtPlusPlus/core/item/base/BaseItemTickable.java @@ -52,7 +52,13 @@ public class BaseItemTickable extends CoreItem { if (world == null || iStack == null) { return; } - tickItemTag(world, iStack); + + + boolean active = getIsActive(world, iStack); + if (active) { + tickItemTag(world, iStack); + } + } /*private final boolean setGregtechItemList() { @@ -160,7 +166,7 @@ public class BaseItemTickable extends CoreItem { } } else { - createNBT(world, aStack); + return createNBT(world, aStack); } return true; } @@ -266,10 +272,7 @@ public class BaseItemTickable extends CoreItem { } } } - else { - createNBT(world, aStack); - } - return false; + return createNBT(world, aStack); } @Override diff --git a/src/Java/gtPlusPlus/core/item/base/dusts/BaseItemDust.java b/src/Java/gtPlusPlus/core/item/base/dusts/BaseItemDust.java index 909d87fe57..afc4b17354 100644 --- a/src/Java/gtPlusPlus/core/item/base/dusts/BaseItemDust.java +++ b/src/Java/gtPlusPlus/core/item/base/dusts/BaseItemDust.java @@ -1,44 +1,46 @@ package gtPlusPlus.core.item.base.dusts; -import static gtPlusPlus.core.creative.AddToCreativeTab.tabMisc; +import gtPlusPlus.core.item.base.BaseItemComponent; +import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.material.Material; -import java.util.List; +public class BaseItemDust extends BaseItemComponent { -import cpw.mods.fml.common.registry.GameRegistry; -import net.minecraft.entity.Entity; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.world.World; -import gregtech.api.enums.GT_Values; -import gregtech.api.util.GT_ModHandler; -import gregtech.api.util.GT_OreDictUnificator; + private Material dustInfo; + private BaseItemComponent[] mSizedDusts = new BaseItemComponent[2]; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.item.ModItems; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.material.Material; -import gtPlusPlus.core.util.math.MathUtils; -import gtPlusPlus.core.util.minecraft.EntityUtils; -import gtPlusPlus.core.util.minecraft.ItemUtils; + public BaseItemDust(Material aMat) { + this(aMat, true); + } -public class BaseItemDust extends Item{ + public BaseItemDust(Material aMat, boolean generateSmallDusts) { + super(aMat, ComponentTypes.DUST); + if (generateSmallDusts) { + mSizedDusts[0] = new BaseItemComponent(aMat, ComponentTypes.DUSTSMALL); + mSizedDusts[1] = new BaseItemComponent(aMat, ComponentTypes.DUSTTINY); + } + } - protected int colour; - protected String materialName; - protected String pileType; - String name = ""; - private int mTier; - private Material dustInfo; + public BaseItemDust(DustState aState, Material aMat) { + super(aMat, ComponentTypes.DUST); + if (aState.generatesSmallDust()) { + mSizedDusts[0] = new BaseItemComponent(aMat, ComponentTypes.DUSTSMALL); + } + if (aState.generatesTinyDust()) { + mSizedDusts[1] = new BaseItemComponent(aMat, ComponentTypes.DUSTTINY); + } + } - public BaseItemDust(final String unlocalizedName, final String materialName, final Material matInfo, final int colour, final String pileSize, final int tier){ + private BaseItemDust(final String unlocalizedName, final String materialName, final Material matInfo, final int colour, final String pileSize, final int tier){ this(unlocalizedName, materialName, matInfo, colour, pileSize, tier, true); } - public BaseItemDust(String unlocalizedName, String materialName, Material matInfo, int colour, String pileSize, int tier, boolean addRecipes) { - try { + private BaseItemDust(String unlocalizedName, String materialName, Material matInfo, int colour, String pileSize, int tier, boolean addRecipes) { + super(matInfo, ComponentTypes.DUST); + + try {/* this.setUnlocalizedName(unlocalizedName); this.setMaxStackSize(64); @@ -78,14 +80,15 @@ public class BaseItemDust extends Item{ this.addFurnaceRecipe(); this.addMacerationRecipe(); } - } + */} catch (Throwable t) { t.printStackTrace(); } } private String getCorrectTexture(final String pileSize){ - if (!CORE.ConfigSwitches.useGregtechTextures){ + + if (!CORE.ConfigSwitches.useGregtechTextures || this.dustInfo.getTextureSet() == null){ if ((pileSize == "dust") || (pileSize == "Dust")){ this.setTextureName(CORE.MODID + ":" + "dust");} else{ @@ -103,7 +106,7 @@ public class BaseItemDust extends Item{ return "gregtech" + ":" + "materialicons/"+this.dustInfo.getTextureSet().mSetName+"/dust"; } - @Override + /* @Override public String getItemStackDisplayName(final ItemStack iStack) { String unlocal = super.getItemStackDisplayName(iStack); @@ -114,11 +117,10 @@ public class BaseItemDust extends Item{ return unlocal; } - } + }*/ - @Override + /* @Override public void onUpdate(final ItemStack iStack, final World world, final Entity entityHolding, final int p_77663_4_, final boolean p_77663_5_) { - try { if (this.dustInfo != null){ if (entityHolding instanceof EntityPlayer){ @@ -131,10 +133,9 @@ public class BaseItemDust extends Item{ catch (Throwable t) { t.printStackTrace(); } + }*/ - } - - @SuppressWarnings({ "unchecked", "rawtypes" }) + /*@SuppressWarnings({ "unchecked", "rawtypes" }) @Override public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) { @@ -151,101 +152,116 @@ public class BaseItemDust extends Item{ //} super.addInformation(stack, aPlayer, list, bool); - } - - public final String getMaterialName() { - return this.materialName; - } - - @Override - public int getColorFromItemStack(final ItemStack stack, final int HEX_OxFFFFFF) { - if (this.colour == 0){ - return MathUtils.generateSingularRandomHexValue(); + }*/ + + public static class DustState { + static final int NORMAL = (1); + static final int SMALL = (10); + static final int TINY = (100); + final int MIXTURE; + final boolean[] doesThings = new boolean[3]; + + public DustState (boolean genDust, boolean genSmallDust, boolean genDustTiny){ + int aTotal = 0; + if (genDust) { + aTotal += NORMAL; + doesThings[0] = true; + } + else { + doesThings[0] = false; + } + if (genSmallDust) { + aTotal += SMALL; + doesThings[1] = true; + } + else { + doesThings[1] = false; + } + if (genDustTiny) { + aTotal += TINY; + doesThings[2] = true; + } + else { + doesThings[2] = false; + } + MIXTURE = aTotal; } - return this.colour; - - } - private void addMacerationRecipe(){ - - try { - Logger.MATERIALS("Adding Maceration recipe for "+this.materialName+" Ingot -> Dusts"); - final int chance = (this.mTier*10)/MathUtils.randInt(10, 20); - GT_ModHandler.addPulverisationRecipe(dustInfo.getIngot(1), dustInfo.getDust(1), null, chance); + public boolean generatesDust() { + return doesThings[0]; } - catch (Throwable t) { - t.printStackTrace(); + public boolean generatesSmallDust() { + return doesThings[1]; + } + public boolean generatesTinyDust() { + return doesThings[2]; } - } - - private void addFurnaceRecipe(){ - - ItemStack aDust = dustInfo.getDust(1); - ItemStack aOutput; - try { - if (this.dustInfo.requiresBlastFurnace()) { - aOutput = dustInfo.getHotIngot(1); - if (aOutput != null) { - if (addBlastFurnaceRecipe(aDust, null, aOutput, null, dustInfo.getMeltingPointK())){ - Logger.MATERIALS("Successfully added a blast furnace recipe for "+this.materialName); - } - else { - Logger.MATERIALS("Failed to add a blast furnace recipe for "+this.materialName); - } - } - else { - Logger.MATERIALS("Failed to add a blast furnace recipe for "+this.materialName); - } + private DustState(int amount) { + + if (amount == 1) { + doesThings[0] = true; + doesThings[1] = false; + doesThings[2] = false; + + } + else if (amount == 10) { + doesThings[0] = false; + doesThings[1] = true; + doesThings[2] = false; + + } + else if (amount == 100) { + doesThings[0] = false; + doesThings[1] = false; + doesThings[2] = true; + + } + else if (amount == 11) { + doesThings[0] = true; + doesThings[1] = true; + doesThings[2] = false; + + } + else if (amount == 101) { + doesThings[0] = true; + doesThings[1] = false; + doesThings[2] = true; + + } + else if (amount == 110) { + doesThings[0] = false; + doesThings[1] = true; + doesThings[2] = true; + + } + else if (amount == 111) { + doesThings[0] = true; + doesThings[1] = true; + doesThings[2] = true; } else { - aOutput = dustInfo.getIngot(1); - if (aOutput != null) { - if (CORE.GT_Recipe.addSmeltingAndAlloySmeltingRecipe(aDust, aOutput)){ - Logger.MATERIALS("Successfully added a furnace recipe for "+this.materialName); - } - else { - Logger.MATERIALS("Failed to add a furnace recipe for "+this.materialName); - } - } - } - } - catch (Throwable t) { - t.printStackTrace(); + doesThings[0] = false; + doesThings[1] = false; + doesThings[2] = false; + } + MIXTURE = amount; } - } - - private boolean addBlastFurnaceRecipe(final ItemStack input1, final ItemStack input2, final ItemStack output1, final ItemStack output2, final int tempRequired){ - - try { - int timeTaken = 125*this.mTier*10; - - if (this.mTier <= 4){ - timeTaken = 25*this.mTier*10; + public DustState get(int a) { + if (a == 1) { + return new DustState(NORMAL); } - int aSlot = mTier - 2; - if (aSlot < 2) { - aSlot = 2; + else if (a == 10) { + return new DustState(SMALL); + } + else if (a == 100) { + return new DustState(TINY); + } + else { + return new DustState(MIXTURE); } - long aVoltage = GT_Values.V[aSlot >= 2 ? aSlot : 2]; - - return GT_Values.RA.addBlastRecipe( - input1, - input2, - GT_Values.NF, GT_Values.NF, - output1, - output2, - timeTaken, - (int) aVoltage, - tempRequired); - } - catch (Throwable t) { - t.printStackTrace(); - return false; } - - - } + } diff --git a/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockGtBlock.java b/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockGtBlock.java index f9594822ab..56d2aabdba 100644 --- a/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockGtBlock.java +++ b/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockGtBlock.java @@ -7,20 +7,27 @@ import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumChatFormatting; import net.minecraft.world.World; import gtPlusPlus.core.block.base.BlockBaseModular; import gtPlusPlus.core.block.base.BlockBaseOre; import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.material.Material; +import gtPlusPlus.core.material.MaterialStack; import gtPlusPlus.core.util.minecraft.EntityUtils; +import gtPlusPlus.core.util.sys.KeyboardUtils; public class ItemBlockGtBlock extends ItemBlock{ protected final int blockColour; protected final int sRadiation; + private final Material mMaterial; + private final Block thisBlock; private boolean isOre = false; + private boolean isModular = false; public ItemBlockGtBlock(final Block block) { super(block); @@ -28,14 +35,42 @@ public class ItemBlockGtBlock extends ItemBlock{ if (block instanceof BlockBaseOre){ this.isOre = true; } + 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; - this.blockColour = baseBlock.getRenderColor(0); - if (block.getLocalizedName().toLowerCase().contains("uranium") || block.getLocalizedName().toLowerCase().contains("plutonium") || block.getLocalizedName().toLowerCase().contains("thorium")){ - this.sRadiation = 2; + if (isModular) { + this.blockColour = baseBlock.getRenderColor(0); + } + else if (isOre) { + this.blockColour = block.getBlockColor(); + } + 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)); } @@ -45,17 +80,38 @@ 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.isOre){ - if (this.thisBlock != null){ - if (this.thisBlock.getLocalizedName().equalsIgnoreCase("fluorite ore")){ - list.add("Mined from Sandstone and Limestone."); + + 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)); + + if (this.mMaterial != null) { + list.add("Ore contains: "); + if (mMaterial.getComposites().isEmpty()) { + list.add("- "+mMaterial.getLocalizedName()); + } + else { + for (MaterialStack m : mMaterial.getComposites()) { + list.add("- "+m.getStackMaterial().getLocalizedName()+" x"+m.getPartsPerOneHundred()); + } + } } } } else { + list.add(EnumChatFormatting.DARK_GRAY+"Hold Ctrl to show additional info."); } super.addInformation(stack, aPlayer, list, bool); } diff --git a/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockOre.java b/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockOre.java index 91dcf97f5b..03f3e50338 100644 --- a/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockOre.java +++ b/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockOre.java @@ -7,14 +7,17 @@ import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumChatFormatting; import net.minecraft.world.World; import gtPlusPlus.core.block.base.BlockBaseOre; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.material.Material; +import gtPlusPlus.core.material.MaterialStack; import gtPlusPlus.core.material.nuclear.FLUORIDES; import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.minecraft.EntityUtils; +import gtPlusPlus.core.util.sys.KeyboardUtils; public class ItemBlockOre extends ItemBlock{ @@ -60,23 +63,55 @@ public class ItemBlockOre extends ItemBlock{ if (this.mThisMaterial == FLUORIDES.FLUORITE){ list.add("Mined from Sandstone with a 1/"+(CORE.ConfigSwitches.chanceToDropFluoriteOre*20)+" chance, or Limestone with a 1/"+(CORE.ConfigSwitches.chanceToDropFluoriteOre)+" chance."); } - else if (this.mThisMaterial != FLUORIDES.FLUORITE){ +/* else if (this.mThisMaterial != FLUORIDES.FLUORITE){ list.add("Mined from the Toxic Everglades."); - } - 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_) { - if (this.mThisMaterial != null){ - if (this.mThisRadiation > 0){ - if (entityHolding instanceof EntityPlayer){ - if (!((EntityPlayer) entityHolding).capabilities.isCreativeMode){ - EntityUtils.applyRadiationDamageToEntity(iStack.stackSize, this.mThisMaterial.vRadiationLevel, world, entityHolding); + if (KeyboardUtils.isCtrlKeyDown()) { + + if (this.mThisMaterial != null) { + Block b = Block.getBlockFromItem(stack.getItem()); + if (b != null) { + String aTool = b.getHarvestTool(stack.getItemDamage()); + int aMiningLevel1 = b.getHarvestLevel(stack.getItemDamage()); + if (aMiningLevel1 != 0) { + list.add("Mining Level: "+Math.min(Math.max(aMiningLevel1, 0), 5)); + } + list.add("Ore contains: "); + if (mThisMaterial.getComposites().isEmpty()) { + list.add("- "+mThisMaterial.getLocalizedName()); + } + else { + for (MaterialStack m : mThisMaterial.getComposites()) { + list.add("- "+m.getStackMaterial().getLocalizedName()+" x"+m.getPartsPerOneHundred()); } } } + } + } + 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_) { + if (this.mThisMaterial != null){ + if (this.mThisRadiation > 0){ + if (entityHolding instanceof EntityPlayer){ + if (!((EntityPlayer) entityHolding).capabilities.isCreativeMode){ + EntityUtils.applyRadiationDamageToEntity(iStack.stackSize, this.mThisMaterial.vRadiationLevel, world, entityHolding); + } + } } } +} } diff --git a/src/Java/gtPlusPlus/core/item/general/ItemCreativeTab.java b/src/Java/gtPlusPlus/core/item/general/ItemCreativeTab.java new file mode 100644 index 0000000000..c1a2655a03 --- /dev/null +++ b/src/Java/gtPlusPlus/core/item/general/ItemCreativeTab.java @@ -0,0 +1,59 @@ +package gtPlusPlus.core.item.general; + +import java.util.List; + +import cpw.mods.fml.common.registry.GameRegistry; +import gregtech.api.GregTech_API; +import gtPlusPlus.core.lib.CORE; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.IIcon; + +public class ItemCreativeTab extends Item { + + public IIcon[] icons = new IIcon[10]; + + public ItemCreativeTab() { + super(); + this.setHasSubtypes(true); + String unlocalizedName = "itemCreativeTabs"; + this.setUnlocalizedName(unlocalizedName); + this.setCreativeTab(GregTech_API.TAB_GREGTECH); + GameRegistry.registerItem(this, unlocalizedName); + } + + @Override + public void registerIcons(IIconRegister reg) { + this.icons[0] = reg.registerIcon(CORE.MODID + ":" + "controlcore/Core_0"); + this.icons[1] = reg.registerIcon(CORE.MODID + ":" + "controlcore/Core_1"); + this.icons[2] = reg.registerIcon(CORE.MODID + ":" + "controlcore/Core_2"); + this.icons[3] = reg.registerIcon(CORE.MODID + ":" + "controlcore/Core_3"); + this.icons[4] = reg.registerIcon(CORE.MODID + ":" + "controlcore/Core_4"); + this.icons[5] = reg.registerIcon(CORE.MODID + ":" + "controlcore/Core_5"); + this.icons[6] = reg.registerIcon(CORE.MODID + ":" + "controlcore/Core_6"); + this.icons[7] = reg.registerIcon(CORE.MODID + ":" + "controlcore/Core_7"); + this.icons[8] = reg.registerIcon(CORE.MODID + ":" + "controlcore/Core_8"); + this.icons[9] = reg.registerIcon(CORE.MODID + ":" + "controlcore/Core_9"); + } + + @Override + public IIcon getIconFromDamage(int meta) { + return this.icons[meta]; + } + + @SuppressWarnings({ "unchecked", "rawtypes" }) + @Override + public void getSubItems(Item item, CreativeTabs tab, List list) { + for (int i = 0; i < 10; i ++) { + list.add(new ItemStack(item, 1, i)); + } + } + + @Override + public String getUnlocalizedName(ItemStack stack) { + return this.getUnlocalizedName() + "_" + stack.getItemDamage(); + } + +} diff --git a/src/Java/gtPlusPlus/core/item/materials/DustDecayable.java b/src/Java/gtPlusPlus/core/item/materials/DustDecayable.java index 8e19896b92..aa3b044802 100644 --- a/src/Java/gtPlusPlus/core/item/materials/DustDecayable.java +++ b/src/Java/gtPlusPlus/core/item/materials/DustDecayable.java @@ -30,9 +30,9 @@ public class DustDecayable extends BaseItemTickable { @Override public void registerIcons(IIconRegister reg) { - String gt = "gregtech" + ":" + "materialicons/"+"METALLIC"+"/" + "dust"; + String gt = "gregtech" + ":" + "materialicons/"+"SHINY"+"/" + "dust"; this.mIcon[0] = reg.registerIcon(gt); - String gt2 = "gregtech" + ":" + "materialicons/"+"METALLIC"+"/" + "dust" + "_OVERLAY"; + String gt2 = "gregtech" + ":" + "materialicons/"+"SHINY"+"/" + "dust" + "_OVERLAY"; this.mIcon[1] = reg.registerIcon(gt2); } @@ -57,15 +57,16 @@ public class DustDecayable extends BaseItemTickable { } } - if (!tickItemTag(world, iStack)) { + if (!tickItemTag(world, iStack) && !this.getIsActive(world, iStack)) { if (entityHolding instanceof EntityPlayer){ ItemStack replacement = ItemUtils.getSimpleStack(turnsIntoItem); //Logger.INFO("Replacing "+iStack.getDisplayName()+" with "+replacement.getDisplayName()+"."); final ItemStack tempTransform = replacement; - if (iStack.stackSize == 64){ - tempTransform.stackSize=64; + if (iStack.stackSize > 1){ + int u = iStack.stackSize; + tempTransform.stackSize = u; ((EntityPlayer) entityHolding).inventory.addItemStackToInventory((tempTransform)); - for (int l=0;l<64;l++){ + for (int l=0;l mMaterialMap = new HashSet(); + + public static final Map> mComponentMap = new HashMap>(); private String unlocalizedName; private String localizedName; @@ -111,21 +117,31 @@ 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); + } + + 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, boolean addCells,final MaterialStack... inputs) { + this (materialName, defaultState, textureSet, 0, rgba, meltingPoint, boilingPoint, protons, neutrons, blastFurnace, chemicalSymbol, radiationLevel, addCells, true, inputs); + } - public Material(final String materialName, final MaterialState defaultState, 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, final MaterialStack... inputs){ + private Material(final String materialName, final MaterialState defaultState, 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, final MaterialStack... inputs){ this (materialName, defaultState, null, 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, final MaterialStack... inputs){ - this (materialName, defaultState, null, durability, rgba, meltingPoint, boilingPoint, protons, neutrons, blastFurnace, chemicalSymbol, radiationLevel, true, true, inputs); - } + 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){ if (mMaterialMap.add(this)) { - //Placeholder + } + mComponentMap.put(unlocalizedName, new HashMap()); + try { this.unlocalizedName = Utils.sanitizeString(materialName); this.localizedName = materialName; @@ -150,7 +166,6 @@ public class Material { } } } - this.textureSet = setTextureSet(set); //Set Melting/Boiling point, if value is -1 calculate it from compound inputs. @@ -283,8 +298,37 @@ public class Material { } } + if (vMaterialInput.size() > 0) { + AutoMap aDataSet = new AutoMap(); + + int bonus = 0; + bonus += this.vMaterialInput.size(); + bonus += MathUtils.roundToClosestInt(meltingPointC/1000); + + + + aDataSet.put(bonus); + + for (MaterialStack m : this.vMaterialInput) { + aDataSet.put(m.getStackMaterial().vTier); + } + int aAverage = MathUtils.getIntAverage(aDataSet); + if (aAverage > Integer.MAX_VALUE || aAverage < Integer.MIN_VALUE) { + aAverage = 0; + } + if (aAverage > 0) { + this.vTier = Math.min(aAverage, 10); + } + else { + this.vTier = MaterialUtils.getTierOfMaterial((int) MathUtils.celsiusToKelvin(meltingPoint)); + } + } + else { + this.vTier = MaterialUtils.getTierOfMaterial((int) MathUtils.celsiusToKelvin(meltingPoint)); + } + + //Sets the materials 'tier'. Will probably replace this logic. - this.vTier = MaterialUtils.getTierOfMaterial((int) MathUtils.celsiusToKelvin(meltingPoint)); this.usesBlastFurnace = blastFurnace; this.vVoltageMultiplier = MaterialUtils.getVoltageForTier(vTier); @@ -315,6 +359,7 @@ public class Material { } else{ Logger.MATERIALS("MaterialInput == null && chemicalSymbol probably equals nothing"); + this.vChemicalSymbol = "??"; this.vChemicalFormula = "??"; } @@ -355,7 +400,9 @@ public class Material { ratio = ratio + ":" +this.vSmallestRatio[hu]; } } - } + } + + this.textureSet = setTextureSet(set, vTier); Logger.MATERIALS("Creating a Material instance for "+materialName); Logger.MATERIALS("Formula: "+this.vChemicalFormula + " Smallest Stack: "+this.smallestStackSizeWhenProcessing+" Smallest Ratio:"+ratio); @@ -370,19 +417,149 @@ public class Material { } } + public Material(String string, MaterialState solid, TextureSet setShiny, int i, short[] s, int j, int k, int l, + int m, boolean b, String string2, int n) { + // TODO Auto-generated constructor stub + } + public final TextureSet getTextureSet() { synchronized(this) { return textureSet; } } + 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."); return set; } + + int aGem = 0; + int aShiny = 0; + TextureSet aSet = null; + + //Check Mixture Contents + for (MaterialStack m : this.getComposites()) { + + //Gems + if (m.getStackMaterial() == ELEMENT.getInstance().AER) { + aGem++; + } + else if (m.getStackMaterial() == ELEMENT.getInstance().AQUA) { + aGem++; + } + else if (m.getStackMaterial() == ELEMENT.getInstance().IGNIS) { + aGem++; + } + else if (m.getStackMaterial() == ELEMENT.getInstance().TERRA) { + aGem++; + } + 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++; + } + else if (m.getStackMaterial() == ELEMENT.getInstance().SILVER) { + aShiny++; + } + else if (m.getStackMaterial() == ELEMENT.getInstance().PLATINUM) { + aShiny++; + } + else if (m.getStackMaterial() == ELEMENT.getInstance().AMERICIUM) { + aShiny++; + } + else if (m.getStackMaterial() == ELEMENT.getInstance().TITANIUM) { + aShiny++; + } + else if (m.getStackMaterial() == ELEMENT.getInstance().GERMANIUM) { + aShiny++; + } + else if (m.getStackMaterial() == ELEMENT.getInstance().GALLIUM) { + aShiny++; + } + else if (m.getStackMaterial() == ELEMENT.getInstance().MERCURY) { + aShiny++; + } + else if (m.getStackMaterial() == ELEMENT.getInstance().MAGIC) { + aShiny++; + } + else if (m.getStackMaterial() == ELEMENT.getInstance().SAMARIUM) { + aShiny++; + } + else if (m.getStackMaterial() == ELEMENT.getInstance().TANTALUM) { + aShiny++; + } + } + + if (aSet == null) { + if (aGem >= this.getComposites().size()/2) { + if (MathUtils.isNumberEven(aGem)) { + Logger.MATERIALS("Set textureset for "+this.localizedName+" to be "+TextureSet.SET_GEM_HORIZONTAL.mSetName+"."); + return TextureSet.SET_GEM_HORIZONTAL; + } + else { + Logger.MATERIALS("Set textureset for "+this.localizedName+" to be "+TextureSet.SET_GEM_VERTICAL.mSetName+"."); + return TextureSet.SET_GEM_VERTICAL; + } + } + } + + if (aSet == null) { + if (aShiny >= this.getComposites().size()/3) { + Logger.MATERIALS("Set textureset for "+this.localizedName+" to be "+TextureSet.SET_SHINY.mSetName+"."); + 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 { - // build hash table with count - AutoMap sets = new AutoMap(); + aSet = TextureSet.SET_FINE; + } + if (aSet == null) { + aSet = TextureSet.SET_METALLIC; + }*/ + + + + + // build hash table with count + AutoMap sets = new AutoMap(); if (this.vMaterialInput != null) { for (MaterialStack r : this.vMaterialInput) { if (r.getStackMaterial().getTextureSet().mSetName.toLowerCase().contains("fluid")) { @@ -392,15 +569,17 @@ public class Material { sets.put(r.getStackMaterial()); } } - TextureSet mostUsedTypeTextureSet = (TextureSet) MaterialUtils.getMostCommonTextureSet(new ArrayList(sets.values())); + TextureSet mostUsedTypeTextureSet = MaterialUtils.getMostCommonTextureSet(new ArrayList(sets.values())); if (mostUsedTypeTextureSet != null && mostUsedTypeTextureSet instanceof TextureSet) { Logger.MATERIALS("Set textureset for "+this.localizedName+" to be "+mostUsedTypeTextureSet.mSetName+"."); return mostUsedTypeTextureSet; } - } - } + } Logger.MATERIALS("Set textureset for "+this.localizedName+" to be "+Materials.Iron.mIconSet.mSetName+". [Fallback]"); - return Materials.Iron.mIconSet; + return Materials.Gold.mIconSet; + + + } public final String getLocalizedName(){ @@ -480,6 +659,28 @@ public class Material { public final boolean requiresBlastFurnace(){ return this.usesBlastFurnace; } + + public final ItemStack getComponentByPrefix(OrePrefixes aPrefix, int stacksize) { + Map g = mComponentMap.get(this.unlocalizedName); + if (g == null) { + Map aMap = new HashMap(); + mComponentMap.put(unlocalizedName, aMap); + g = aMap; + } + Item i = g.get(aPrefix.name()); + if (i != null) { + return ItemUtils.getSimpleStack(i, stacksize); + } + else { + ItemStack u = ItemUtils.getItemStackOfAmountFromOreDictNoBroken(aPrefix.name()+this.unlocalizedName, stacksize); + if (u != null) { + return u; + } + else { + return ItemUtils.getSimpleStack(ModItems.AAA_Broken); + } + } + } final public Block getBlock(){ return Block.getBlockFromItem(ItemUtils.getItemStackOfAmountFromOreDictNoBroken("block"+this.unlocalizedName, 1).getItem()); @@ -490,79 +691,76 @@ public class Material { } public final ItemStack getDust(final int stacksize){ - return ItemUtils.getGregtechDust("dust"+this.unlocalizedName, stacksize); + ItemStack i = getComponentByPrefix(OrePrefixes.dust, stacksize); + return i != null ? i : ItemUtils.getGregtechDust("dust"+this.unlocalizedName, stacksize); } public final ItemStack getSmallDust(final int stacksize){ - return ItemUtils.getItemStackOfAmountFromOreDictNoBroken("dustSmall"+this.unlocalizedName, stacksize); + return getComponentByPrefix(OrePrefixes.dustSmall, stacksize); } public final ItemStack getTinyDust(final int stacksize){ - return ItemUtils.getItemStackOfAmountFromOreDictNoBroken("dustTiny"+this.unlocalizedName, stacksize); - } - - public final ItemStack[] getValidInputStacks(){ - return ItemUtils.validItemsForOreDict(this.unlocalizedName); + return getComponentByPrefix(OrePrefixes.dustTiny, stacksize); } public final ItemStack getIngot(final int stacksize){ - return ItemUtils.getItemStackOfAmountFromOreDictNoBroken("ingot"+this.unlocalizedName, stacksize); + return getComponentByPrefix(OrePrefixes.ingot, stacksize); } public final ItemStack getHotIngot(final int stacksize){ - return ItemUtils.getItemStackOfAmountFromOreDictNoBroken("ingotHot"+this.unlocalizedName, stacksize); + return getComponentByPrefix(OrePrefixes.ingotHot, stacksize); } public final ItemStack getPlate(final int stacksize){ - return ItemUtils.getItemStackOfAmountFromOreDictNoBroken("plate"+this.unlocalizedName, stacksize); + return getComponentByPrefix(OrePrefixes.plate, stacksize); } public final ItemStack getPlateDouble(final int stacksize){ - return ItemUtils.getItemStackOfAmountFromOreDictNoBroken("plateDouble"+this.unlocalizedName, stacksize); + return getComponentByPrefix(OrePrefixes.plateDouble, stacksize); } public final ItemStack getGear(final int stacksize){ - return ItemUtils.getItemStackOfAmountFromOreDictNoBroken("gearGt"+this.unlocalizedName, stacksize); + return getComponentByPrefix(OrePrefixes.gearGt, stacksize); } public final ItemStack getRod(final int stacksize){ - return ItemUtils.getItemStackOfAmountFromOreDictNoBroken("stick"+this.unlocalizedName, stacksize); + return getComponentByPrefix(OrePrefixes.stick, stacksize); } public final ItemStack getLongRod(final int stacksize){ - return ItemUtils.getItemStackOfAmountFromOreDictNoBroken("stickLong"+this.unlocalizedName, stacksize); + return getComponentByPrefix(OrePrefixes.stickLong, stacksize); } public final ItemStack getBolt(final int stacksize){ - return ItemUtils.getItemStackOfAmountFromOreDictNoBroken("bolt"+this.unlocalizedName, stacksize); + return getComponentByPrefix(OrePrefixes.bolt, stacksize); } public final ItemStack getScrew(final int stacksize){ - return ItemUtils.getItemStackOfAmountFromOreDictNoBroken("screw"+this.unlocalizedName, stacksize); + return getComponentByPrefix(OrePrefixes.screw, stacksize); } public final ItemStack getRing(final int stacksize){ - return ItemUtils.getItemStackOfAmountFromOreDictNoBroken("ring"+this.unlocalizedName, stacksize); + return getComponentByPrefix(OrePrefixes.ring, stacksize); } public final ItemStack getRotor(final int stacksize){ - return ItemUtils.getItemStackOfAmountFromOreDictNoBroken("rotor"+this.unlocalizedName, stacksize); + return getComponentByPrefix(OrePrefixes.rotor, stacksize); } public final ItemStack getFrameBox(final int stacksize){ - return ItemUtils.getItemStackOfAmountFromOreDictNoBroken("frameGt"+this.unlocalizedName, stacksize); + return getComponentByPrefix(OrePrefixes.frameGt, stacksize); } public final ItemStack getCell(final int stacksize){ - return ItemUtils.getItemStackOfAmountFromOreDictNoBroken("cell"+this.unlocalizedName, stacksize); + return getComponentByPrefix(OrePrefixes.cell, stacksize); } public final ItemStack getPlasmaCell(final int stacksize){ - return ItemUtils.getItemStackOfAmountFromOreDictNoBroken("cellPlasma"+this.unlocalizedName, stacksize); + return getComponentByPrefix(OrePrefixes.cellPlasma, stacksize); } public final ItemStack getNugget(final int stacksize){ - return ItemUtils.getItemStackOfAmountFromOreDictNoBroken("nugget"+this.unlocalizedName, stacksize); + return getComponentByPrefix(OrePrefixes.nugget, stacksize); } /** @@ -737,31 +935,46 @@ public class Material { if (dummyFormulaArray != null){ if (dummyFormulaArray.length >= 1){ for (int e=0;e 1){ - if (tempInput.get(e).getStackMaterial().vChemicalFormula.length() > 3){ - dummyFormula = dummyFormula + "(" + tempInput.get(e).getStackMaterial().vChemicalFormula + ")" + dummyFormulaArray[e]; + if (aChemFormula.length() > 3){ + dummyFormula = dummyFormula + "(" + aChemFormula + ")" + dummyFormulaArray[e]; } else { - dummyFormula = dummyFormula + tempInput.get(e).getStackMaterial().vChemicalFormula + dummyFormulaArray[e]; + dummyFormula = dummyFormula + aChemFormula + dummyFormulaArray[e]; } } else if (dummyFormulaArray[e] == 1){ - if (tempInput.get(e).getStackMaterial().vChemicalFormula.length() > 3){ - dummyFormula = dummyFormula + "(" +tempInput.get(e).getStackMaterial().vChemicalFormula + ")"; + if (aChemFormula.length() > 3){ + dummyFormula = dummyFormula + "(" +aChemFormula + ")"; } else { - dummyFormula = dummyFormula +tempInput.get(e).getStackMaterial().vChemicalFormula; + dummyFormula = dummyFormula +aChemFormula; } } + else { + dummyFormula = dummyFormula + "??"; + } } else { dummyFormula = dummyFormula + "??"; } } else { - dummyFormula = dummyFormula + "▓▓"; + dummyFormula = dummyFormula + "??"; } } } @@ -884,12 +1097,13 @@ public class Material { return aTest3.getFluid(); } - + ItemStack aFullCell = ItemUtils.getItemStackOfAmountFromOreDictNoBroken("cell"+this.getUnlocalizedName(), 1); Logger.MATERIALS("Generating our own fluid."); //Generate a Cell if we need to - if (ItemUtils.getItemStackOfAmountFromOreDictNoBroken("cell"+this.getUnlocalizedName(), 1) == null){ + if (aFullCell == null){ if (this.vGenerateCells){ - new BaseItemCell(this); + Item g = new BaseItemCell(this); + aFullCell = ItemUtils.getSimpleStack(g); Logger.MATERIALS("Generated a cell for "+this.getUnlocalizedName()); } else { @@ -902,33 +1116,36 @@ public class Material { this.getUnlocalizedName(), "Molten "+this.getLocalizedName(), this.RGBA, - this.materialState.ID(), + 4, this.getMeltingPointK(), - ItemUtils.getItemStackOfAmountFromOreDictNoBroken("cell"+this.getUnlocalizedName(), 1), + aFullCell, ItemUtils.getEmptyCell(), - 1000); + 1000, + this.vGenerateCells); } - else if (this.materialState == MaterialState.LIQUID){ + else if (this.materialState == MaterialState.LIQUID || this.materialState == MaterialState.PURE_LIQUID){ return FluidUtils.addGTFluid( this.getUnlocalizedName(), this.getLocalizedName(), this.RGBA, - this.materialState.ID(), + 0, this.getMeltingPointK(), - ItemUtils.getItemStackOfAmountFromOreDictNoBroken("cell"+this.getUnlocalizedName(), 1), + aFullCell, ItemUtils.getEmptyCell(), - 1000); + 1000, + this.vGenerateCells); } else if (this.materialState == MaterialState.GAS){ return FluidUtils.addGTFluid( this.getUnlocalizedName(), this.getLocalizedName()+" Gas", this.RGBA, - this.materialState.ID(), + 2, this.getMeltingPointK(), - ItemUtils.getItemStackOfAmountFromOreDictNoBroken("cell"+this.getUnlocalizedName(), 1), + aFullCell, ItemUtils.getEmptyCell(), - 1000); + 1000, + this.vGenerateCells); } else { //Plasma return this.generatePlasma(); @@ -971,7 +1188,7 @@ public class Material { final public int calculateMeltingPoint(){ try { - + AutoMap aDataSet = new AutoMap(); for (MaterialStack m : this.vMaterialInput) { aDataSet.put(m.getStackMaterial().getMeltingPointC()); @@ -986,7 +1203,7 @@ public class Material { final public int calculateBoilingPoint(){ try { - + AutoMap aDataSet = new AutoMap(); for (MaterialStack m : this.vMaterialInput) { aDataSet.put(m.getStackMaterial().getBoilingPointC()); @@ -1001,7 +1218,7 @@ public class Material { final public long calculateProtons(){ try { - + AutoMap aDataSet = new AutoMap(); for (MaterialStack m : this.vMaterialInput) { aDataSet.put(m.getStackMaterial().getProtons()); @@ -1016,7 +1233,7 @@ public class Material { final public long calculateNeutrons(){ try { - + AutoMap aDataSet = new AutoMap(); for (MaterialStack m : this.vMaterialInput) { aDataSet.put(m.getStackMaterial().getNeutrons()); diff --git a/src/Java/gtPlusPlus/core/material/MaterialGenerator.java b/src/Java/gtPlusPlus/core/material/MaterialGenerator.java index 01353a71d9..4ed8f4ceb3 100644 --- a/src/Java/gtPlusPlus/core/material/MaterialGenerator.java +++ b/src/Java/gtPlusPlus/core/material/MaterialGenerator.java @@ -15,8 +15,11 @@ import gtPlusPlus.api.objects.data.AutoMap; import gtPlusPlus.core.block.base.BasicBlock.BlockTypes; import gtPlusPlus.core.block.base.BlockBaseModular; import gtPlusPlus.core.block.base.BlockBaseOre; +import gtPlusPlus.core.item.base.BaseItemComponent; +import gtPlusPlus.core.item.base.BaseItemComponent.ComponentTypes; import gtPlusPlus.core.item.base.bolts.BaseItemBolt; import gtPlusPlus.core.item.base.dusts.BaseItemDust; +import gtPlusPlus.core.item.base.dusts.BaseItemDust.DustState; import gtPlusPlus.core.item.base.gears.BaseItemGear; import gtPlusPlus.core.item.base.ingots.BaseItemIngot; import gtPlusPlus.core.item.base.ingots.BaseItemIngotHot; @@ -105,12 +108,10 @@ public class MaterialGenerator { if (matInfo.getState() == MaterialState.SOLID){ if (generateEverything == true){ if (sRadiation >= 1){ - tempBlock = new BlockBaseModular(unlocalizedName, materialName,BlockTypes.STANDARD, Colour); + tempBlock = new BlockBaseModular(matInfo,BlockTypes.STANDARD); temp = new BaseItemIngot(matInfo); - temp = new BaseItemDust("itemDust"+unlocalizedName, materialName, matInfo, Colour, "Dust", materialTier); - temp = new BaseItemDust("itemDustTiny"+unlocalizedName, materialName, matInfo, Colour, "Tiny", materialTier); - temp = new BaseItemDust("itemDustSmall"+unlocalizedName, materialName, matInfo, Colour, "Small", materialTier); + temp = new BaseItemDust(matInfo); temp = new BaseItemNugget(matInfo); temp = new BaseItemPlate(matInfo); temp = new BaseItemRod(matInfo); @@ -118,15 +119,13 @@ public class MaterialGenerator { } else { - tempBlock = new BlockBaseModular(unlocalizedName, materialName,BlockTypes.STANDARD, Colour); - tempBlock = new BlockBaseModular(unlocalizedName, materialName,BlockTypes.FRAME, Colour); + tempBlock = new BlockBaseModular(matInfo,BlockTypes.STANDARD); + tempBlock = new BlockBaseModular(matInfo,BlockTypes.FRAME); temp = new BaseItemIngot(matInfo); if (hotIngot){ temp = new BaseItemIngotHot(matInfo); } - temp = new BaseItemDust("itemDust"+unlocalizedName, materialName, matInfo, Colour, "Dust", materialTier); - temp = new BaseItemDust("itemDustTiny"+unlocalizedName, materialName, matInfo, Colour, "Tiny", materialTier); - temp = new BaseItemDust("itemDustSmall"+unlocalizedName, materialName, matInfo, Colour, "Small", materialTier); + temp = new BaseItemDust(matInfo); temp = new BaseItemNugget(matInfo); temp = new BaseItemPlate(matInfo); temp = new BaseItemPlateDouble(matInfo); @@ -139,12 +138,10 @@ public class MaterialGenerator { temp = new BaseItemGear(matInfo); } } else { - tempBlock = new BlockBaseModular(unlocalizedName, materialName,BlockTypes.STANDARD, Colour); + tempBlock = new BlockBaseModular(matInfo,BlockTypes.STANDARD); temp = new BaseItemIngot(matInfo); - temp = new BaseItemDust("itemDust"+unlocalizedName, materialName, matInfo, Colour, "Dust", materialTier); - temp = new BaseItemDust("itemDustTiny"+unlocalizedName, materialName, matInfo, Colour, "Tiny", materialTier); - temp = new BaseItemDust("itemDustSmall"+unlocalizedName, materialName, matInfo, Colour, "Small", materialTier); + temp = new BaseItemDust(matInfo); temp = new BaseItemNugget(matInfo); temp = new BaseItemPlate(matInfo); temp = new BaseItemPlateDouble(matInfo); @@ -152,16 +149,18 @@ public class MaterialGenerator { } else if (matInfo.getState() == MaterialState.LIQUID){ if (generateEverything == true){ - tempBlock = new BlockBaseModular(unlocalizedName, materialName,BlockTypes.STANDARD, Colour); + tempBlock = new BlockBaseModular(matInfo,BlockTypes.STANDARD); } temp = new BaseItemIngot(matInfo); - temp = new BaseItemDust("itemDust"+unlocalizedName, materialName, matInfo, Colour, "Dust", materialTier); - temp = new BaseItemDust("itemDustTiny"+unlocalizedName, materialName, matInfo, Colour, "Tiny", materialTier); - temp = new BaseItemDust("itemDustSmall"+unlocalizedName, materialName, matInfo, Colour, "Small", materialTier); + temp = new BaseItemDust(matInfo); temp = new BaseItemNugget(matInfo); temp = new BaseItemPlate(matInfo); temp = new BaseItemPlateDouble(matInfo); } + else if (matInfo.getState() == MaterialState.GAS){ + temp = new BaseItemDust(matInfo); + FluidUtils.generateGas(unlocalizedName, materialName, matInfo.getMeltingPointK(), C, true); + } else if (matInfo.getState() == MaterialState.PURE_LIQUID){ FluidUtils.generateFluidNoPrefix(unlocalizedName, materialName, matInfo.getMeltingPointK(), C); return true; @@ -211,9 +210,7 @@ public class MaterialGenerator { } if (matInfo.getState() == MaterialState.SOLID){ - temp = new BaseItemDust("itemDust"+unlocalizedName, materialName, matInfo, Colour, "Dust", materialTier, false); - temp = new BaseItemDust("itemDustTiny"+unlocalizedName, materialName, matInfo, Colour, "Tiny", materialTier, false); - temp = new BaseItemDust("itemDustSmall"+unlocalizedName, materialName, matInfo, Colour, "Small", materialTier, false); + temp = new BaseItemDust(matInfo); } //Add A jillion Recipes - old code @@ -246,11 +243,8 @@ public class MaterialGenerator { sRadiation = matInfo.vRadiationLevel; } - tempBlock = new BlockBaseModular(unlocalizedName, materialName,BlockTypes.STANDARD, Colour); - temp = new BaseItemDust("itemDust"+unlocalizedName, materialName, matInfo, Colour, "Dust", 3); - temp = new BaseItemDust("itemDustTiny"+unlocalizedName, materialName, matInfo, Colour, "Tiny", 2); - temp = new BaseItemDust("itemDustSmall"+unlocalizedName, materialName, matInfo, Colour, "Small", 1); - + tempBlock = new BlockBaseModular(matInfo,BlockTypes.STANDARD); + temp = new BaseItemDust(matInfo); temp = new BaseItemIngot(matInfo); temp = new BaseItemNugget(matInfo); @@ -307,12 +301,18 @@ public class MaterialGenerator { tempBlock = new BlockBaseOre(matInfo, BlockTypes.ORE, Colour.intValue()); } - if (generateDust) { - temp = new BaseItemDust("itemDust"+unlocalizedName, materialName, matInfo, Colour, "Dust", matInfo.vTier, false); + DustState aState = new DustState(generateDust, generateSmallTinyDusts, generateSmallTinyDusts); + + if (!aState.generatesDust()) { + if (aState.generatesSmallDust()) { + temp = new BaseItemComponent(matInfo, ComponentTypes.DUSTSMALL); + } + if (aState.generatesTinyDust()) { + temp = new BaseItemComponent(matInfo, ComponentTypes.DUSTTINY); + } } - if (generateSmallTinyDusts) { - temp = new BaseItemDust("itemDustTiny"+unlocalizedName, materialName, matInfo, Colour, "Tiny", matInfo.vTier, false); - temp = new BaseItemDust("itemDustSmall"+unlocalizedName, materialName, matInfo, Colour, "Small", matInfo.vTier, false); + else { + temp = new BaseItemDust(aState, matInfo); } temp = new BaseItemCrushedOre(matInfo); diff --git a/src/Java/gtPlusPlus/core/material/NONMATERIAL.java b/src/Java/gtPlusPlus/core/material/NONMATERIAL.java index f0a7716199..4da34ae16c 100644 --- a/src/Java/gtPlusPlus/core/material/NONMATERIAL.java +++ b/src/Java/gtPlusPlus/core/material/NONMATERIAL.java @@ -1,7 +1,7 @@ package gtPlusPlus.core.material; import gregtech.api.enums.Materials; - +import gregtech.api.enums.TextureSet; import gtPlusPlus.core.util.minecraft.MaterialUtils; public class NONMATERIAL { @@ -14,9 +14,27 @@ public class NONMATERIAL { //Glowstone Dust public static final Material GLOWSTONE = MaterialUtils.generateMaterialFromGtENUM(Materials.Glowstone); - + //Enderpearl public static final Material ENDERPEARL = MaterialUtils.generateMaterialFromGtENUM(Materials.EnderPearl); + + //Raw Flesh + public static final Material MEAT = MaterialUtils.generateMaterialFromGtENUM(Materials.MeatRaw); + + //Clay + public static final Material CLAY = MaterialUtils.generateMaterialFromGtENUM(Materials.Clay); + + //Wrought Iron + public static final Material WROUGHT_IRON = MaterialUtils.generateMaterialFromGtENUM(Materials.WroughtIron); + + + + + static { + MEAT.setTextureSet(TextureSet.SET_ROUGH); + CLAY.setTextureSet(TextureSet.SET_ROUGH); + } + } diff --git a/src/Java/gtPlusPlus/core/material/ORES.java b/src/Java/gtPlusPlus/core/material/ORES.java index 75d6da07fe..a99cdc476d 100644 --- a/src/Java/gtPlusPlus/core/material/ORES.java +++ b/src/Java/gtPlusPlus/core/material/ORES.java @@ -1,7 +1,7 @@ package gtPlusPlus.core.material; import gregtech.api.enums.TextureSet; - +import gtPlusPlus.core.client.CustomTextureSet.TextureSets; import gtPlusPlus.core.material.state.MaterialState; public final class ORES { @@ -9,7 +9,7 @@ public final class ORES { public static final Material GEIKIELITE = new Material( "Geikielite", //Material Name MaterialState.ORE, //State - TextureSet.SET_GEM_HORIZONTAL, //Texture Set + TextureSets.GEM_A.get(), //Texture Set new short[]{187, 193, 204, 0}, //Material Colour 500, 1500, @@ -133,7 +133,7 @@ public final class ORES { public static final Material SAMARSKITE_Y = new Material( "Samarskite (Y)", //Material Name MaterialState.ORE, //State - TextureSet.SET_FINE, //Texture Set + TextureSets.ENRICHED.get(), //Texture Set new short[]{65, 163, 164, 0}, //Material Colour 500, 1500, @@ -153,7 +153,7 @@ public final class ORES { public static final Material SAMARSKITE_YB = new Material( "Samarskite (Yb)", //Material Name MaterialState.ORE, //State - TextureSet.SET_FINE, //Texture Set + TextureSets.ENRICHED.get(), //Texture Set new short[]{95, 193, 194, 0}, //Material Colour 500, 1500, @@ -172,7 +172,7 @@ public final class ORES { public static final Material ZIRCON = new Material( "Zircon", //Material Name MaterialState.ORE, //State - TextureSet.SET_GEM_VERTICAL, //Texture Set + TextureSets.GEM_A.get(), //Texture Set new short[]{195, 19, 19, 0}, //Material Colour 500, 1500, @@ -189,7 +189,7 @@ public final class ORES { public static final Material GADOLINITE_CE = new Material( "Gadolinite (Ce)", //Material Name MaterialState.ORE, //State - TextureSet.SET_FINE, //Texture Set + TextureSets.REFINED.get(), //Texture Set new short[]{15, 159, 59, 0}, //Material Colour 500, 1500, @@ -211,7 +211,7 @@ public final class ORES { public static final Material GADOLINITE_Y = new Material( "Gadolinite (Y)", //Material Name MaterialState.ORE, //State - TextureSet.SET_FINE, //Texture Set + TextureSets.REFINED.get(), //Texture Set new short[]{35, 189, 99, 0}, //Material Colour 500, 1500, @@ -323,7 +323,7 @@ public final class ORES { public static final Material ZIRCOPHYLLITE = new Material( "Zircophyllite", //Material Name MaterialState.ORE, //State - TextureSet.SET_FIERY, //Texture Set + TextureSets.REFINED.get(), //Texture Set new short[]{30, 0, 6, 0}, //Material Colour 500, 1500, @@ -346,7 +346,7 @@ public final class ORES { public static final Material ZIRKELITE = new Material( "Zirkelite", //Material Name MaterialState.ORE, //State - TextureSet.SET_GEM_HORIZONTAL, //Texture Set + TextureSets.GEM_A.get(), //Texture Set new short[]{229, 208, 48, 0}, //Material Colour 500, 1500, @@ -366,7 +366,7 @@ public final class ORES { public static final Material LANTHANITE_LA = new Material( "Lanthanite (La)", //Material Name MaterialState.ORE, //State - TextureSet.SET_METALLIC, //Texture Set + TextureSets.REFINED.get(), //Texture Set new short[]{219, 160, 214, 0}, //Material Colour 500, 1500, @@ -439,7 +439,7 @@ public final class ORES { public static final Material CERITE = new Material( "Cerite", //Material Name MaterialState.ORE, //State - TextureSet.SET_METALLIC, //Texture Set + TextureSets.REFINED.get(), //Texture Set new short[]{68, 13, 0, 0}, //Material Colour 500, 1500, @@ -608,7 +608,7 @@ public final class ORES { public static final Material LAFOSSAITE = new Material( "Lafossaite", //Material Name MaterialState.ORE, //State - TextureSet.SET_METALLIC, //Texture Set + TextureSets.REFINED.get(), //Texture Set new short[]{165, 105, 205, 0}, //Material Colour 500, 1500, @@ -644,7 +644,7 @@ public final class ORES { public static final Material COMANCHEITE = new Material( "Comancheite", //Material Name MaterialState.ORE, //State - TextureSet.SET_FINE, //Texture Set + TextureSets.REFINED.get(), //Texture Set new short[]{65, 205, 105, 0}, //Material Colour 500, 1500, @@ -759,7 +759,7 @@ public final class ORES { public static final Material IRARSITE = new Material( "Irarsite", //Material Name MaterialState.ORE, //State - TextureSet.SET_FIERY, //Texture Set + TextureSets.ENRICHED.get(), //Texture Set new short[]{125, 105, 105, 0}, //Material Colour 500, 1500, diff --git a/src/Java/gtPlusPlus/core/util/minecraft/FluidUtils.java b/src/Java/gtPlusPlus/core/util/minecraft/FluidUtils.java index 5bdd42b02d..8e25b4e485 100644 --- a/src/Java/gtPlusPlus/core/util/minecraft/FluidUtils.java +++ b/src/Java/gtPlusPlus/core/util/minecraft/FluidUtils.java @@ -5,7 +5,6 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import gregtech.api.enums.Dyes; -import gregtech.api.enums.GT_Values; import gregtech.api.enums.ItemList; import gregtech.api.util.GT_LanguageManager; @@ -166,92 +165,53 @@ public class FluidUtils { } - public static Fluid addAutogeneratedMoltenFluid(final String materialNameFormatted, final short[] rgba, final int MeltingPoint) { - return addFluid("molten." + materialNameFormatted.toLowerCase(), "molten.autogenerated", "Molten " + materialNameFormatted, null, rgba, 1, (MeltingPoint <= 0L) ? 1000L : MeltingPoint, null, null, 0); - } - public static Fluid addAutogeneratedMoltenFluid(final GT_Materials aMaterial) { - return addFluid("molten." + aMaterial.name().toLowerCase(), "molten.autogenerated", "Molten " + aMaterial.name(), aMaterial, aMaterial.mMoltenRGBa, 1, (aMaterial.mMeltingPoint <= 0L) ? 1000L : aMaterial.mMeltingPoint, null, null, 0); - } - public static Fluid addFluid(final String aName, final String aLocalized, final GT_Materials aMaterial, final int aState, final long aTemperatureK) { - return addFluid(aName, aLocalized, aMaterial, aState, aTemperatureK, null, null, 0); - } - public static Fluid addFluid(final String aName, final String aLocalized, final GT_Materials aMaterial, final int aState, final long aTemperatureK, final ItemStack aFullContainer, final ItemStack aEmptyContainer, final int aFluidAmount) { - return addFluid(aName, aName.toLowerCase(), aLocalized, aMaterial, null, aState, aTemperatureK, aFullContainer, aEmptyContainer, aFluidAmount); + + public static Fluid addGtFluid(final String aName, final String aLocalized, final GT_Materials aMaterial, final int aState, final long aTemperatureK, final ItemStack aFullContainer, final ItemStack aEmptyContainer, final int aFluidAmount) { + return addGtFluid(aName, aLocalized, aMaterial, aState, aTemperatureK, aFullContainer, aEmptyContainer, aFluidAmount, true); } - public static Fluid addFluid(String aName, final String aTexture, final String aLocalized, final GT_Materials aMaterial, final short[] aRGBa, final int aState, final long aTemperatureK, final ItemStack aFullContainer, final ItemStack aEmptyContainer, final int aFluidAmount) { - aName = Utils.sanitizeString(aName.toLowerCase()); - Fluid rFluid = new FluidGT6(aName, aTexture, (aRGBa != null) ? aRGBa : Dyes._NULL.getRGBA()); - GT_LanguageManager.addStringLocalization(rFluid.getUnlocalizedName(), (aLocalized == null) ? aName : aLocalized); - if (FluidRegistry.registerFluid(rFluid)) { - switch (aState) { - case 0: { - rFluid.setGaseous(false); - rFluid.setViscosity(10000); - break; - } - case 1: - case 4: { - rFluid.setGaseous(false); - rFluid.setViscosity(1000); - break; - } - case 2: { - rFluid.setGaseous(true); - rFluid.setDensity(-100); - rFluid.setViscosity(200); - break; - } - case 3: { - rFluid.setGaseous(true); - rFluid.setDensity(-10000); - rFluid.setViscosity(10); - rFluid.setLuminosity(15); - break; - } - } - } - else { - rFluid = FluidRegistry.getFluid(aName); - } - if ((rFluid.getTemperature() == new Fluid("test").getTemperature()) || (rFluid.getTemperature() <= 0)) { - rFluid.setTemperature((int) (aTemperatureK)); - } - if (aMaterial != null) { - switch (aState) { - case 1: { - aMaterial.mFluid = (rFluid); - break; - } - case 2: { - aMaterial.mGas = (rFluid); - break; - } - case 3: { - aMaterial.mPlasma = (rFluid); - break; + + public static Fluid addGtFluid(final String aName, final String aLocalized, final GT_Materials aMaterial, final int aState, final long aTemperatureK, final ItemStack aFullContainer, final ItemStack aEmptyContainer, final int aFluidAmount, final boolean aGenerateCell) { + Fluid g = addGTFluid(aName, "fluid.autogenerated", aLocalized, aMaterial.mRGBa, aState, aTemperatureK, aFullContainer, aEmptyContainer, aFluidAmount, aGenerateCell); + if (g != null) { + if (aMaterial != null) { + switch (aState) { + case 1: { + aMaterial.mFluid = (g); + break; + } + case 2: { + aMaterial.mGas = (g); + break; + } + case 3: { + aMaterial.mPlasma = (g); + break; + } } } + return g; } - if ((aFullContainer != null) && (aEmptyContainer != null) && !FluidContainerRegistry.registerFluidContainer(new FluidStack(rFluid, aFluidAmount), aFullContainer, aEmptyContainer)) { - MaterialGenerator.addFluidCannerRecipe(aFullContainer, container(aFullContainer, false), null, new FluidStack(rFluid, aFluidAmount)); - } - return rFluid; + return null; } - public static Fluid addGTFluid(final String aName, final String aLocalized, final short[] aRGBa, final int aState, final long aTemperatureK, final ItemStack aFullContainer, final ItemStack aEmptyContainer, final int aFluidAmount) { - return addGTFluid("molten."+aName, "molten.autogenerated", aLocalized, aRGBa, aState, aTemperatureK, aFullContainer, aEmptyContainer, aFluidAmount); + public static Fluid addGTFluid(final String aName, final String aLocalized, final short[] aRGBa, final int aState, final long aTemperatureK, final ItemStack aFullContainer, final ItemStack aEmptyContainer, final int aFluidAmount, final boolean aGenerateCell) { + return addGTFluid("molten."+aName, "molten.autogenerated", aLocalized, aRGBa, aState, aTemperatureK, aFullContainer, aEmptyContainer, aFluidAmount, aGenerateCell); } - public static Fluid addGTFluidNonMolten(final String aName, final String aLocalized, final short[] aRGBa, final int aState, final long aTemperatureK, final ItemStack aFullContainer, final ItemStack aEmptyContainer, final int aFluidAmount) { - return addGTFluid("fluid."+aName, "fluid.autogenerated", aLocalized, aRGBa, aState, aTemperatureK, aFullContainer, aEmptyContainer, aFluidAmount); + public static Fluid addGTFluidNonMolten(final String aName, final String aLocalized, final short[] aRGBa, final int aState, final long aTemperatureK, final ItemStack aFullContainer, final ItemStack aEmptyContainer, final int aFluidAmount, final boolean aGenerateCell) { + return addGTFluid("fluid."+aName, "fluid.autogenerated", aLocalized, aRGBa, aState, aTemperatureK, aFullContainer, aEmptyContainer, aFluidAmount, aGenerateCell); } - public static Fluid addGTFluidNoPrefix(final String aName, final String aLocalized, final short[] aRGBa, final int aState, final long aTemperatureK, final ItemStack aFullContainer, final ItemStack aEmptyContainer, final int aFluidAmount) { - return addGTFluid(aName, "fluid.autogenerated", aLocalized, aRGBa, aState, aTemperatureK, aFullContainer, aEmptyContainer, aFluidAmount); + public static Fluid addGTFluidNoPrefix(final String aName, final String aLocalized, final short[] aRGBa, final int aState, final long aTemperatureK, final ItemStack aFullContainer, final ItemStack aEmptyContainer, final int aFluidAmount, final boolean aGenerateCell) { + return addGTFluid(aName, "fluid.autogenerated", aLocalized, aRGBa, aState, aTemperatureK, aFullContainer, aEmptyContainer, aFluidAmount, aGenerateCell); + } + //Gass + public static Fluid addGtGas(final String aName, final String aLocalized, final short[] aRGBa, final int aState, final long aTemperatureK, final ItemStack aFullContainer, final ItemStack aEmptyContainer, final int aFluidAmount, final boolean aGenerateCell) { + return addGTFluid(aName, "fluid.autogenerated", aLocalized, aRGBa, aState, aTemperatureK, aFullContainer, aEmptyContainer, aFluidAmount, aGenerateCell); } public static Fluid addGTPlasma(final Material aMaterial) { @@ -287,46 +247,91 @@ public class FluidUtils { 10000, temp, ItemUtils.getEmptyCell(), - 1000); + 1000, + false); } return null; } - public static Fluid addGTFluid(String aName, final String aTexture, final String aLocalized, final short[] aRGBa, final int aState, final long aTemperatureK, final ItemStack aFullContainer, final ItemStack aEmptyContainer, final int aFluidAmount) { + public static Fluid addGTFluid(String aName, final String aTexture, final String aLocalized, final short[] aRGBa, final int aState, final long aTemperatureK, ItemStack aFullContainer, final ItemStack aEmptyContainer, final int aFluidAmount, final boolean aGenerateFilledCell) { + + String aNameOriginal = aName; + aName = Utils.sanitizeString(aName.toLowerCase()); - Fluid rFluid = new FluidGT6(aName, aTexture, (aRGBa != null) ? aRGBa : Dyes._NULL.getRGBA()); - GT_LanguageManager.addStringLocalization(rFluid.getUnlocalizedName(), (aLocalized == null) ? aName : aLocalized); - if (FluidRegistry.registerFluid(rFluid)) { - switch (aState) { - case 0: { - rFluid.setGaseous(false); - rFluid.setViscosity(10000); - break; - } - case 1: - case 4: { - rFluid.setGaseous(false); - rFluid.setViscosity(1000); - break; - } - case 2: { - rFluid.setGaseous(true); - rFluid.setDensity(-100); - rFluid.setViscosity(200); - break; - } - case 3: { - rFluid.setGaseous(true); - rFluid.setDensity(-10000); - rFluid.setViscosity(10); - rFluid.setLuminosity(15); - break; - } - } + + String aLocalName = (aLocalized == null) ? aName : aLocalized; + + Fluid rFluid; + Fluid gFluid = FluidRegistry.getFluid(aName); + FluidStack aCheck = FluidUtils.getWildcardFluidStack(aName.toLowerCase(), 1000); + boolean register = false; + if (aCheck != null) { + rFluid = aCheck.getFluid(); + } + else if (gFluid != null) { + rFluid = gFluid; } else { - rFluid = FluidRegistry.getFluid(aName); + rFluid = new FluidGT6(aName, aTexture, (aRGBa != null) ? aRGBa : Dyes._NULL.getRGBA()); + register = true; + + } + + if (register) { + GT_LanguageManager.addStringLocalization(rFluid.getUnlocalizedName(), aLocalName); + if (FluidRegistry.registerFluid(rFluid)) { + switch (aState) { + case 0: { + rFluid.setGaseous(false); + rFluid.setViscosity(10000); + break; + } + case 1: + case 4: { + rFluid.setGaseous(false); + rFluid.setViscosity(1000); + break; + } + case 2: { + rFluid.setGaseous(true); + rFluid.setDensity(-100); + rFluid.setViscosity(200); + break; + } + case 3: { + rFluid.setGaseous(true); + rFluid.setDensity(-10000); + rFluid.setViscosity(10); + rFluid.setLuminosity(15); + break; + } + } + } } + + + + if (aFullContainer == null) { + ItemStack oreStack = ItemUtils.getItemStackOfAmountFromOreDictNoBroken("cell"+aName, 1); + aFullContainer = oreStack; + } + + Item tempCell = null; + //Generate a Cell if we need to + if (aGenerateFilledCell && aFullContainer == null) { + String aMatName = aNameOriginal; + if (aMatName.contains("molten.")) { + aMatName = aMatName.replace("molten.", ""); + aMatName = aMatName.substring(0, 1).toUpperCase() + aMatName.substring(1); + } + if (aMatName.contains("fluid.")) { + aMatName = aMatName.replace("fluid.", ""); + aMatName = aMatName.substring(0, 1).toUpperCase() + aMatName.substring(1); + } + tempCell = new BaseItemComponent(aMatName, aLocalized, aRGBa); + aFullContainer = ItemUtils.getSimpleStack(tempCell); + } + if ((rFluid.getTemperature() == new Fluid("test").getTemperature()) || (rFluid.getTemperature() <= 0)) { rFluid.setTemperature((int) (aTemperatureK)); } @@ -422,24 +427,25 @@ public class FluidUtils { return amount(aStacksize, container(aStack, aCheckIFluidContainerItems)); } - public final static Fluid generateFluid(final String unlocalizedName, final String localizedName, final int MeltingPoint, final short[] RGBA){ + public final static Fluid generateFluid(final String unlocalizedName, final String localizedName, final int MeltingPoint, final short[] RGBA, boolean aGenerateCell){ FluidStack aFStack = (FluidUtils.getFluidStack("molten"+"."+unlocalizedName.toLowerCase(), 1)); if (aFStack == null){ Logger.WARNING("Generating our own fluid."); - ItemStack cell = ItemUtils.getItemStackOfAmountFromOreDictNoBroken("cell"+unlocalizedName, 1); +/* ItemStack cell = ItemUtils.getItemStackOfAmountFromOreDictNoBroken("cell"+unlocalizedName, 1); if (cell == null){ final Item temp = new BaseItemComponent(unlocalizedName, localizedName, RGBA); cell = ItemUtils.getSimpleStack(temp); - } + }*/ final Fluid gtFluid = FluidUtils.addGTFluid( unlocalizedName, "Molten "+localizedName, RGBA, 4, MeltingPoint, - cell, + null, ItemUtils.getEmptyCell(), - 1000); + 1000, + aGenerateCell); return gtFluid; } @@ -449,15 +455,20 @@ public class FluidUtils { } } - public final static Fluid generateFluidNonMolten(final String unlocalizedName, final String localizedName, final int MeltingPoint, final short[] RGBA){ - return generateFluidNonMolten(unlocalizedName, localizedName, MeltingPoint, RGBA, null, null, 0); + public final static Fluid generateFluidNonMolten(final String unlocalizedName, final String localizedName, final int MeltingPoint, final short[] RGBA, final boolean aGenerateCell){ + return generateFluidNonMolten(unlocalizedName, localizedName, MeltingPoint, RGBA, null, null, 0, aGenerateCell); } + public final static Fluid generateFluidNonMolten(final String unlocalizedName, final String localizedName, final int MeltingPoint, final short[] RGBA, final ItemStack dustStack, final ItemStack dustStack2){ - return generateFluidNonMolten(unlocalizedName, localizedName, MeltingPoint, RGBA, dustStack, dustStack2, 144); + return generateFluidNonMolten(unlocalizedName, localizedName, MeltingPoint, RGBA, dustStack, dustStack2, 144, true); + } + + public final static Fluid generateFluidNonMolten(final String unlocalizedName, final String localizedName, final int MeltingPoint, final short[] RGBA, final ItemStack dustStack, final ItemStack dustStack2, final boolean aGenerateCell){ + return generateFluidNonMolten(unlocalizedName, localizedName, MeltingPoint, RGBA, dustStack, dustStack2, 144, aGenerateCell); } - public final static Fluid generateFluidNonMolten(final String unlocalizedName, final String localizedName, final int MeltingPoint, final short[] RGBA, ItemStack dustStack, final ItemStack dustStack2, final int amountPerItem){ + public final static Fluid generateFluidNonMolten(final String unlocalizedName, final String localizedName, final int MeltingPoint, final short[] RGBA, ItemStack dustStack, final ItemStack dustStack2, final int amountPerItem, final boolean aGenerateCell){ if (dustStack == null){ dustStack = ItemUtils.getItemStackOfAmountFromOreDictNoBroken("dust"+Utils.sanitizeString(localizedName), 1); } @@ -465,22 +476,16 @@ public class FluidUtils { if (aFStack == null){ Logger.WARNING("Generating our own fluid."); - //Generate a Cell if we need to - if (ItemUtils.getItemStackOfAmountFromOreDictNoBroken("cell"+unlocalizedName, 1) == null){ - @SuppressWarnings("unused") - final - Item temp = new BaseItemComponent(unlocalizedName, localizedName, RGBA); - } - final Fluid gtFluid = FluidUtils.addGTFluidNonMolten( unlocalizedName, localizedName, RGBA, 4, MeltingPoint, - ItemUtils.getItemStackOfAmountFromOreDictNoBroken("cell"+unlocalizedName, 1), + null, ItemUtils.getEmptyCell(), - 1000); + 1000, + aGenerateCell); if (dustStack != null){ MaterialGenerator.addFluidExtractionRecipe( @@ -510,8 +515,12 @@ public class FluidUtils { return aFStack.getFluid(); } } - + public final static Fluid generateFluidNoPrefix(final String unlocalizedName, final String localizedName, final int MeltingPoint, final short[] RGBA){ + return generateFluidNoPrefix(unlocalizedName, localizedName, MeltingPoint, RGBA, true); + } + + public final static Fluid generateFluidNoPrefix(final String unlocalizedName, final String localizedName, final int MeltingPoint, final short[] RGBA, final boolean aGenerateCell){ Fluid gtFluid; if (FluidUtils.getFluidStack(unlocalizedName.toLowerCase(), 1) == null){ Logger.WARNING("Generating our own fluid."); @@ -521,19 +530,47 @@ public class FluidUtils { RGBA, 4, MeltingPoint, - ItemUtils.getItemStackOfAmountFromOreDictNoBroken("cell"+unlocalizedName, 1), + null, ItemUtils.getEmptyCell(), - 1000); + 1000, + aGenerateCell); } else { gtFluid = FluidUtils.getFluidStack(unlocalizedName.toLowerCase(), 1).getFluid(); } //Generate a Cell if we need to - if (ItemUtils.getItemStackOfAmountFromOreDictNoBroken("cell"+unlocalizedName, 1) == null){ - new BaseItemCell(unlocalizedName, localizedName, RGBA, gtFluid); +// if (ItemUtils.getItemStackOfAmountFromOreDictNoBroken("cell"+unlocalizedName, 1) == null){ +// new BaseItemCell(unlocalizedName, localizedName, RGBA, gtFluid); +// } + return gtFluid; + } + + public final static Fluid generateGas(final String unlocalizedName, final String localizedName, final int MeltingPoint, final short[] RGBA, final boolean aGenerateCell){ + Fluid gtFluid; + if (FluidUtils.getFluidStack(unlocalizedName.toLowerCase(), 1) == null){ + Logger.WARNING("Generating our own gas."); + gtFluid = FluidUtils.addGtGas( + unlocalizedName, + localizedName, + RGBA, + 3, + MeltingPoint, + null, + ItemUtils.getEmptyCell(), + 1000, + aGenerateCell); + } + else { + gtFluid = FluidUtils.getFluidStack(unlocalizedName.toLowerCase(), 1).getFluid(); } + //Generate a Cell if we need to +/* if (ItemUtils.getItemStackOfAmountFromOreDictNoBroken("cell"+unlocalizedName, 1) == null){ + new BaseItemCell(unlocalizedName, localizedName, RGBA, gtFluid); + }*/ return gtFluid; } + + public static FluidStack getMobEssence(final int amount){ diff --git a/src/Java/gtPlusPlus/core/util/minecraft/ItemUtils.java b/src/Java/gtPlusPlus/core/util/minecraft/ItemUtils.java index 27ba5c2733..165a7931cb 100644 --- a/src/Java/gtPlusPlus/core/util/minecraft/ItemUtils.java +++ b/src/Java/gtPlusPlus/core/util/minecraft/ItemUtils.java @@ -22,7 +22,6 @@ import gtPlusPlus.api.objects.data.Pair; import gtPlusPlus.api.objects.minecraft.BlockPos; import gtPlusPlus.core.item.ModItems; import gtPlusPlus.core.item.base.BasicSpawnEgg; -import gtPlusPlus.core.item.base.dusts.BaseItemDust; import gtPlusPlus.core.item.base.dusts.BaseItemDustUnique; import gtPlusPlus.core.item.base.dusts.decimal.BaseItemCentidust; import gtPlusPlus.core.item.base.dusts.decimal.BaseItemDecidust; @@ -330,15 +329,6 @@ public class ItemUtils { return null; } - public static Item[] generateDusts(final String unlocalizedName, final String materialName, final int materialTier, final Material matInfo, final int Colour){ - final int radioactive = getRadioactivityLevel(materialName); - final Item[] output = { - new BaseItemDust("itemDust"+unlocalizedName, materialName, matInfo, Colour, "Dust", materialTier), - new BaseItemDust("itemDustSmall"+unlocalizedName, materialName, matInfo, Colour, "Small", materialTier), - new BaseItemDust("itemDustTiny"+unlocalizedName, materialName, matInfo, Colour, "Tiny", materialTier)}; - return output; - } - //NullFormula public static Item[] generateSpecialUseDusts(final String unlocalizedName, final String materialName, final int Colour){ return generateSpecialUseDusts(unlocalizedName, materialName, "NullFormula", Colour); diff --git a/src/Java/gtPlusPlus/core/util/minecraft/MaterialUtils.java b/src/Java/gtPlusPlus/core/util/minecraft/MaterialUtils.java index 9d1dbff23a..0eb888209a 100644 --- a/src/Java/gtPlusPlus/core/util/minecraft/MaterialUtils.java +++ b/src/Java/gtPlusPlus/core/util/minecraft/MaterialUtils.java @@ -13,6 +13,7 @@ import net.minecraft.item.ItemStack; import gregtech.api.enums.*; import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.api.objects.data.TypeCounter; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.material.Material; import gtPlusPlus.core.material.state.MaterialState; @@ -129,7 +130,6 @@ public class MaterialUtils { final Material temp = new Material( materialName, defaultState, - 0, //Durability colour, 1000, //melting 3000, //boiling @@ -148,35 +148,35 @@ public class MaterialUtils { return true; } - public static int getTierOfMaterial(final int M){ - if ((M >= 0) && (M <= 1000)){ + public static int getTierOfMaterial(final int aMeltingPoint){ + if ((aMeltingPoint >= 0) && (aMeltingPoint <= 1000)){ return 1; } - else if((M >= 1001) && (M <= 2000)){ + else if((aMeltingPoint >= 1001) && (aMeltingPoint <= 2000)){ return 2; } - else if((M >= 2001) && (M <= 3000)){ + else if((aMeltingPoint >= 2001) && (aMeltingPoint <= 3000)){ return 3; } - else if((M >= 3001) && (M <= 4000)){ + else if((aMeltingPoint >= 3001) && (aMeltingPoint <= 4000)){ return 4; } - else if((M >= 4001) && (M <= 5000)){ + else if((aMeltingPoint >= 4001) && (aMeltingPoint <= 5000)){ return 5; } - else if((M >= 5001) && (M <= 6000)){ + else if((aMeltingPoint >= 5001) && (aMeltingPoint <= 6000)){ return 6; } - else if((M >= 6001) && (M <= 7000)){ + else if((aMeltingPoint >= 6001) && (aMeltingPoint <= 7000)){ return 7; } - else if((M >= 7001) && (M <= 8000)){ + else if((aMeltingPoint >= 7001) && (aMeltingPoint <= 8000)){ return 8; } - else if((M >= 8001) && (M <= 9000)){ + else if((aMeltingPoint >= 8001) && (aMeltingPoint <= 9000)){ return 9; } - else if((M >= 9001) && (M <= 9999)){ + else if((aMeltingPoint >= 9001) && (aMeltingPoint <= 9999)){ return 10; } else { @@ -256,10 +256,21 @@ public class MaterialUtils { return mName; } - public static TextureSet getMostCommonTextureSet(List list) { - Optional r = list.stream().map(Material::getTextureSet).collect(Collectors.groupingBy(Function.identity(), Collectors.counting())).entrySet().stream().max(Map.Entry.comparingByValue()).map(Map.Entry::getKey); + public static TextureSet getMostCommonTextureSet(List list) { + TypeCounter aCounter = new TypeCounter(TextureSet.class); + for (Material m : list) { + TextureSet t = m.getTextureSet(); + if (t == null) { + t = Materials.Gold.mIconSet; + } + if (t != null) { + aCounter.add(t, t.mSetName); + } + } + return aCounter.getResults(); + /*Optional r = list.stream().map(Material::getTextureSet).collect(Collectors.groupingBy(Function.identity(), Collectors.counting())).entrySet().stream().max(Map.Entry.comparingByValue()).map(Map.Entry::getKey); TextureSet o = (r != null && r.isPresent() && r.get() != null) ? r.get() : null; - return o; + return o;*/ } public static Materials getMaterial(String aMaterialName) { diff --git a/src/Java/gtPlusPlus/xmod/gregtech/HANDLER_GT.java b/src/Java/gtPlusPlus/xmod/gregtech/HANDLER_GT.java index 182d30e5c5..abf8fd9714 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/HANDLER_GT.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/HANDLER_GT.java @@ -29,6 +29,7 @@ import gtPlusPlus.xmod.gregtech.common.items.MetaGeneratedGregtechTools; import gtPlusPlus.xmod.gregtech.loaders.*; import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechConduits; import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechNitroDieselFix; +import net.minecraft.item.Item; import net.minecraft.item.ItemStack; public class HANDLER_GT { @@ -102,14 +103,21 @@ public class HANDLER_GT { private static int removeCrudeTurbineRotors() { int aRemoved = 0; - + Item aU; Collection aAssRecipes = GT_Recipe.GT_Recipe_Map.sAssemblerRecipes.mRecipeList; //170, 172, 174, 176 if (aAssRecipes.size() > 0 && (CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK || CORE.GTNH)) { recipe: for (GT_Recipe aG : aAssRecipes) { if (aG.mOutputs != null && aG.mOutputs.length > 0) { outputs: for (ItemStack aI : aG.mOutputs) { - if (aI.getItem() instanceof GT_MetaGenerated_Tool_01) { + if (aI == null) { + continue; + } + aU = aI.getItem(); + if (aU == null) { + continue; + } + if (aU instanceof GT_MetaGenerated_Tool_01) { int aMeta = aI.getItemDamage(); //Logger.INFO("Found assembler recipe outputting a GT Tool with a meta value of "+aMeta); if (aMeta >= 170 && aMeta <= 176) { diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/fluid/GregtechFluidHandler.java b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/fluid/GregtechFluidHandler.java index b4aa2080f9..3e4b9a3fee 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/fluid/GregtechFluidHandler.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/fluid/GregtechFluidHandler.java @@ -1,8 +1,7 @@ package gtPlusPlus.xmod.gregtech.common.blocks.fluid; import net.minecraft.item.ItemStack; - -import gregtech.api.enums.ItemList; +import net.minecraftforge.fluids.FluidRegistry; import gregtech.api.enums.OrePrefixes; import gregtech.api.util.GT_OreDictUnificator; @@ -40,24 +39,31 @@ public class GregtechFluidHandler { if (!LoadedMods.ThermalFoundation){ - Logger.INFO("Adding in our own GT versions of Thermal Foundation Fluids"); - FluidUtils.addFluid("cryotheum", "Gelid Cryotheum", GT_Materials.Cryotheum, 4, -1200, GT_OreDictUnificator.get(OrePrefixes.cell, GT_Materials.Cryotheum, 1L), ItemUtils.getEmptyCell(), 1000); - FluidUtils.addFluid("pyrotheum", "Blazing Pyrotheum", GT_Materials.Pyrotheum, 4, 4000, GT_OreDictUnificator.get(OrePrefixes.cell, GT_Materials.Pyrotheum, 1L), ItemUtils.getEmptyCell(), 1000); - FluidUtils.addFluid("ender", "Resonant Ender", GT_Materials.Ender, 4, 4000, GT_OreDictUnificator.get(OrePrefixes.cell, GT_Materials.Ender, 1L), ItemUtils.getEmptyCell(), 1000); + Logger.INFO("Adding in our own GT versions of Thermal Foundation Fluids if they do not already exist."); + if (!FluidRegistry.isFluidRegistered("cryotheum")) { + FluidUtils.addGtFluid("cryotheum", "Gelid Cryotheum", GT_Materials.Cryotheum, 4, -1200, GT_OreDictUnificator.get(OrePrefixes.cell, GT_Materials.Cryotheum, 1L), ItemUtils.getEmptyCell(), 1000); + } + if (!FluidRegistry.isFluidRegistered("pyrotheum")) { + FluidUtils.addGtFluid("pyrotheum", "Blazing Pyrotheum", GT_Materials.Pyrotheum, 4, 4000, GT_OreDictUnificator.get(OrePrefixes.cell, GT_Materials.Pyrotheum, 1L), ItemUtils.getEmptyCell(), 1000); + } + if (!FluidRegistry.isFluidRegistered("ender")) { + FluidUtils.addGtFluid("ender", "Resonant Ender", GT_Materials.Ender, 4, 4000, GT_OreDictUnificator.get(OrePrefixes.cell, GT_Materials.Ender, 1L), ItemUtils.getEmptyCell(), 1000); + } + } if (LoadedMods.IndustrialCraft2){ Logger.INFO("Adding in GT Fluids for various nuclear related content."); - FluidUtils.addFluid("hydrofluoricAcid", "Industrial Strength Hydrofluoric Acid", GT_Materials.HydrofluoricAcid, 1, 120, GT_OreDictUnificator.get(OrePrefixes.cell, GT_Materials.HydrofluoricAcid, 1L), ItemUtils.getEmptyCell(), 1000); + FluidUtils.addGtFluid("hydrofluoricAcid", "Industrial Strength Hydrofluoric Acid", GT_Materials.HydrofluoricAcid, 1, 120, GT_OreDictUnificator.get(OrePrefixes.cell, GT_Materials.HydrofluoricAcid, 1L), ItemUtils.getEmptyCell(), 1000, false); generateIC2FluidCell("HydrofluoricAcid"); FluidUtils.generateFluidNoPrefix("SulfurDioxide", "High Quality Sulfur Dioxide", 263, GT_Materials.SulfurDioxide.mRGBa); - FluidUtils.addFluid("sulfurousAcid", "Sulfurous Acid", GT_Materials.SulfurousAcid, 4, 75, GT_OreDictUnificator.get(OrePrefixes.cell, GT_Materials.SulfurousAcid, 1L), ItemUtils.getEmptyCell(), 1000); + FluidUtils.addGtFluid("sulfurousAcid", "Sulfurous Acid", GT_Materials.SulfurousAcid, 4, 75, GT_OreDictUnificator.get(OrePrefixes.cell, GT_Materials.SulfurousAcid, 1L), ItemUtils.getEmptyCell(), 1000, false); generateIC2FluidCell("SulfurousAcid"); - FluidUtils.addFluid("sulfuricApatite", "Sulfuric Apatite Mix", GT_Materials.SulfuricApatite, 4, 500, GT_OreDictUnificator.get(OrePrefixes.cell, GT_Materials.SulfuricApatite, 1L), ItemUtils.getEmptyCell(), 1000); + FluidUtils.addGtFluid("sulfuricApatite", "Sulfuric Apatite Mix", GT_Materials.SulfuricApatite, 4, 500, GT_OreDictUnificator.get(OrePrefixes.cell, GT_Materials.SulfuricApatite, 1L), ItemUtils.getEmptyCell(), 1000, false); generateIC2FluidCell("SulfuricApatite"); @@ -70,16 +76,16 @@ public class GregtechFluidHandler { else { Logger.INFO("No Suitable versions of Hydrogen Chloride available, adding our own."); } - FluidUtils.addFluid("hydrogenChloride", "Industrial Strength Hydrogen Chloride", GT_Materials.HydrogenChloride, 4, 75, GT_OreDictUnificator.get(OrePrefixes.cell, GT_Materials.HydrogenChloride, 1L), ItemUtils.getEmptyCell(), 1000); + FluidUtils.addGtFluid("hydrogenChloride", "Industrial Strength Hydrogen Chloride", GT_Materials.HydrogenChloride, 4, 75, GT_OreDictUnificator.get(OrePrefixes.cell, GT_Materials.HydrogenChloride, 1L), ItemUtils.getEmptyCell(), 1000, false); generateIC2FluidCell("HydrogenChloride"); } } - FluidUtils.addFluid("sulfuricLithium", "Sulfuric Lithium Mix", GT_Materials.SulfuricLithium, 4, 280, GT_OreDictUnificator.get(OrePrefixes.cell, GT_Materials.SulfuricLithium, 1L), ItemUtils.getEmptyCell(), 1000); + FluidUtils.addGtFluid("sulfuricLithium", "Sulfuric Lithium Mix", GT_Materials.SulfuricLithium, 4, 280, GT_OreDictUnificator.get(OrePrefixes.cell, GT_Materials.SulfuricLithium, 1L), ItemUtils.getEmptyCell(), 1000, false); generateIC2FluidCell("SulfuricLithium"); - FluidUtils.addFluid("lithiumHydroxide", "Lithium Hydroxide", GT_Materials.LithiumHydroxide, 4, 500, GT_OreDictUnificator.get(OrePrefixes.cell, GT_Materials.LithiumHydroxide, 1L), ItemUtils.getEmptyCell(), 1000); + FluidUtils.addGtFluid("lithiumHydroxide", "Lithium Hydroxide", GT_Materials.LithiumHydroxide, 4, 500, GT_OreDictUnificator.get(OrePrefixes.cell, GT_Materials.LithiumHydroxide, 1L), ItemUtils.getEmptyCell(), 1000, false); generateIC2FluidCell("LithiumHydroxide"); diff --git a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_DustGeneration.java b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_DustGeneration.java index 1bef648bd2..b588613224 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_DustGeneration.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_DustGeneration.java @@ -14,11 +14,13 @@ import gregtech.api.util.GT_Utility; import gtPlusPlus.api.interfaces.RunnableWithInfo; import gtPlusPlus.api.objects.Logger; import gtPlusPlus.api.objects.data.AutoMap; +import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.material.Material; import gtPlusPlus.core.material.MaterialGenerator; import gtPlusPlus.core.material.MaterialStack; import gtPlusPlus.core.material.state.MaterialState; import gtPlusPlus.core.recipe.common.CI; +import gtPlusPlus.core.util.math.MathUtils; import gtPlusPlus.core.util.minecraft.ItemUtils; import gtPlusPlus.core.util.minecraft.RecipeUtils; import net.minecraftforge.fluids.FluidStack; @@ -118,7 +120,13 @@ public class RecipeGen_DustGeneration extends RecipeGen_Base { if (smallDust != null && tinyDust != null) { generatePackagerRecipes(material); } - + + ItemStack ingot = material.getIngot(1); + if (normalDust != null && ingot != null) { + addFurnaceRecipe(material); + addMacerationRecipe(material); + } + //Is this a composite? if ((inputStacks != null) && !disableOptional){ //Is this a composite? @@ -352,5 +360,83 @@ public class RecipeGen_DustGeneration extends RecipeGen_Base { return true; } + private void addMacerationRecipe(Material aMatInfo){ + try { + Logger.MATERIALS("Adding Maceration recipe for "+aMatInfo.getLocalizedName()+" Ingot -> Dusts"); + final int chance = (aMatInfo.vTier*10)/MathUtils.randInt(10, 20); + GT_ModHandler.addPulverisationRecipe(aMatInfo.getIngot(1), aMatInfo.getDust(1), null, chance); + } + catch (Throwable t) { + t.printStackTrace(); + } + } + + private void addFurnaceRecipe(Material aMatInfo){ + + ItemStack aDust = aMatInfo.getDust(1); + ItemStack aOutput; + try { + if (aMatInfo.requiresBlastFurnace()) { + aOutput = aMatInfo.getHotIngot(1); + if (aOutput != null) { + if (addBlastFurnaceRecipe(aMatInfo, aDust, null, aOutput, null, aMatInfo.getMeltingPointK())){ + Logger.MATERIALS("Successfully added a blast furnace recipe for "+aMatInfo.getLocalizedName()); + } + else { + Logger.MATERIALS("Failed to add a blast furnace recipe for "+aMatInfo.getLocalizedName()); + } + } + else { + Logger.MATERIALS("Failed to add a blast furnace recipe for "+aMatInfo.getLocalizedName()); + } + } + else { + aOutput = aMatInfo.getIngot(1); + if (aOutput != null) { + if (CORE.GT_Recipe.addSmeltingAndAlloySmeltingRecipe(aDust, aOutput)){ + Logger.MATERIALS("Successfully added a furnace recipe for "+aMatInfo.getLocalizedName()); + } + else { + Logger.MATERIALS("Failed to add a furnace recipe for "+aMatInfo.getLocalizedName()); + } + } + } + } + catch (Throwable t) { + t.printStackTrace(); + } + + } + + private boolean addBlastFurnaceRecipe(Material aMatInfo, final ItemStack input1, final ItemStack input2, final ItemStack output1, final ItemStack output2, final int tempRequired){ + + try { + int timeTaken = 125*aMatInfo.vTier*10; + + if (aMatInfo.vTier <= 4){ + timeTaken = 25*aMatInfo.vTier*10; + } + int aSlot = aMatInfo.vTier - 1; + if (aSlot < 2) { + aSlot = 2; + } + long aVoltage = GT_Values.V[aSlot >= 2 ? aSlot : 2]; + + return GT_Values.RA.addBlastRecipe( + input1, + input2, + GT_Values.NF, GT_Values.NF, + output1, + output2, + timeTaken, + (int) aVoltage, + tempRequired); + } + catch (Throwable t) { + t.printStackTrace(); + return false; + } + } + } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Ore.java b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Ore.java index 771a48c809..99984d98bf 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Ore.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Ore.java @@ -44,7 +44,11 @@ public class RecipeGen_Ore implements Runnable{ //if (material.getMaterialComposites().length > 1){ Logger.MATERIALS("[Recipe Generator Debug] ["+material.getLocalizedName()+"]"); - final int tVoltageMultiplier = material.getMeltingPointK() >= 2800 ? 120 : 30; + 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 @@ -101,19 +105,19 @@ public class RecipeGen_Ore implements Runnable{ * Macerate */ //Macerate ore to Crushed - if (GT_Values.RA.addPulveriserRecipe(material.getOre(1), new ItemStack[]{material.getCrushed(2)}, new int[]{10000}, 20*20, 2)){ + 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), bonusA.getDust(1)}, new int[]{10000, 1000}, 20*20, 2)){ + 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'"); } //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, 2)){ + 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, 2)){ + 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'"); } @@ -168,13 +172,13 @@ public class RecipeGen_Ore implements Runnable{ /** * Forge Hammer */ - if (GT_Values.RA.addForgeHammerRecipe(material.getCrushedCentrifuged(1), material.getDust(1), 10, 16)){ + 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, 16)){ + 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, 16)){ + if (GT_Values.RA.addForgeHammerRecipe(material.getOre(1), material.getCrushed(1), 10, tVoltageMultiplier/4)){ Logger.MATERIALS("[ForgeHammer] Added Recipe: 'Ore to Crushed'"); } @@ -190,7 +194,7 @@ public class RecipeGen_Ore implements Runnable{ null, null,null, new int[]{10000, 10000}, //Chances 5*20, //Eu - 5)){ //Time + tVoltageMultiplier/2)){ //Time Logger.MATERIALS("[Centrifuge] Added Recipe: Purified Dust to Clean Dust"); } @@ -203,7 +207,7 @@ public class RecipeGen_Ore implements Runnable{ null, null,null, new int[]{10000, 10000}, //Chances 5*20, //Eu - 5)){ //Time + tVoltageMultiplier/2)){ //Time Logger.MATERIALS("[Centrifuge] Added Recipe: Inpure Dust to Clean Dust"); } @@ -287,7 +291,7 @@ public class RecipeGen_Ore implements Runnable{ mInternalOutputs[4], mInternalOutputs[5], mChances, - 20*90, + 20*1*(tVoltageMultiplier/10), tVoltageMultiplier)){ Logger.MATERIALS("[Electrolyzer] Generated Electrolyzer recipe for "+material.getDust(1).getDisplayName()); } -- cgit