diff options
author | Alkalus <draknyte1@hotmail.com> | 2016-09-19 20:08:42 +1000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-09-19 20:08:42 +1000 |
commit | 9f386c3c2914ba786ece2afddb8eaa6df80a1adc (patch) | |
tree | a46fe4cc2ccd26ff83f3de8eeba7d3abb7aea58c /src/Java/gtPlusPlus/core/item | |
parent | 6c74b062034508a0ef00a68c5b4c164b3f155fc4 (diff) | |
parent | 2c4e3716a4b72f67be3bde170096394a39c80480 (diff) | |
download | GT5-Unofficial-9f386c3c2914ba786ece2afddb8eaa6df80a1adc.tar.gz GT5-Unofficial-9f386c3c2914ba786ece2afddb8eaa6df80a1adc.tar.bz2 GT5-Unofficial-9f386c3c2914ba786ece2afddb8eaa6df80a1adc.zip |
Merge pull request #13 from draknyte1/NewMatSystem
New Back-end systems for dynamic Material (Alloys) and Tool generation.
Also fixes a few issues with other things, which were noticed during development of the new systems.
Diffstat (limited to 'src/Java/gtPlusPlus/core/item')
3 files changed, 215 insertions, 138 deletions
diff --git a/src/Java/gtPlusPlus/core/item/ModItems.java b/src/Java/gtPlusPlus/core/item/ModItems.java index aafe02d470..1737b6ea4a 100644 --- a/src/Java/gtPlusPlus/core/item/ModItems.java +++ b/src/Java/gtPlusPlus/core/item/ModItems.java @@ -2,6 +2,7 @@ package gtPlusPlus.core.item; import static gtPlusPlus.core.creative.AddToCreativeTab.tabMachines; import static gtPlusPlus.core.creative.AddToCreativeTab.tabMisc; import static gtPlusPlus.core.lib.CORE.LOAD_ALL_CONTENT; +import static gtPlusPlus.core.util.item.UtilsItems.generateItemsFromMaterial; import gregtech.api.enums.Materials; import gregtech.api.util.GT_OreDictUnificator; import gtPlusPlus.core.creative.AddToCreativeTab; @@ -25,13 +26,15 @@ import gtPlusPlus.core.item.tool.staballoy.StaballoyPickaxe; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.lib.CORE.configSwitches; import gtPlusPlus.core.lib.LoadedMods; -import gtPlusPlus.core.lib.MaterialInfo; +import gtPlusPlus.core.material.ALLOY; +import gtPlusPlus.core.material.ELEMENT; import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.debug.DEBUG_INIT; import gtPlusPlus.core.util.item.UtilsItems; import net.minecraft.item.Item; import net.minecraft.item.Item.ToolMaterial; import net.minecraft.item.ItemFood; +import net.minecraft.item.ItemStack; import net.minecraftforge.common.util.EnumHelper; import cpw.mods.fml.common.registry.GameRegistry; public final class ModItems { @@ -105,7 +108,9 @@ public final class ModItems { public static Item itemPersonalCloakingDeviceCharged; public static Item itemPersonalHealingDevice; - public static MultiPickaxeBase MP_GTMATERIAL; + public static MultiPickaxeBase MP_GTMATERIAL; + + public static ItemStack FluidCell; public static BaseItemBackpack backpack_Red; public static BaseItemBackpack backpack_Green; @@ -162,53 +167,65 @@ public final class ModItems { //Start meta Item Generation ItemsFoods.load(); - UtilsItems.generateItemsFromMaterial("EnergyCrystal", "Energy Crystal", 8, MaterialInfo.ENERGYCRYSTAL, Utils.rgbtoHexValue(228, 225, 0), true); - UtilsItems.generateItemsFromMaterial("BloodSteel", "Blood Steel", 3, MaterialInfo.BLOODSTEEL, Utils.rgbtoHexValue(142, 28, 0), false); - UtilsItems.generateItemsFromMaterial("Staballoy", "Staballoy", 6, MaterialInfo.STABALLOY, Utils.rgbtoHexValue(68, 75, 66), true); - UtilsItems.generateItemsFromMaterial("Tantalloy60", "Tantalloy-60", 5, MaterialInfo.TANTALLOY60, Utils.rgbtoHexValue(68, 75, 166), true); - UtilsItems.generateItemsFromMaterial("Tantalloy61", "Tantalloy-61", 6, MaterialInfo.TANTALLOY61, Utils.rgbtoHexValue(122, 135, 196), true); - UtilsItems.generateItemsFromMaterial("Bedrockium", "Bedrockium", 9, MaterialInfo.BEDROCKIUM, Utils.rgbtoHexValue(32, 32, 32), false); - UtilsItems.generateItemsFromMaterial("Quantum", "Quantum", 10, MaterialInfo.QUANTUM, Utils.rgbtoHexValue(128, 128, 128), true); + try{ + generateItemsFromMaterial(ALLOY.ENERGYCRYSTAL); + generateItemsFromMaterial(ALLOY.BLOODSTEEL); + generateItemsFromMaterial(ALLOY.STABALLOY); + generateItemsFromMaterial(ALLOY.TANTALLOY_60); + generateItemsFromMaterial(ALLOY.TANTALLOY_61); + generateItemsFromMaterial(ALLOY.BEDROCKIUM); + generateItemsFromMaterial(ALLOY.QUANTUM); - UtilsItems.generateItemsFromMaterial("Inconel625", "Inconel-625", 4, MaterialInfo.INCONEL625, Utils.rgbtoHexValue(128, 200, 128), true); //Inconel 625: Acid resistant, good weldability. The LCF version is typically used in bellows. - UtilsItems.generateItemsFromMaterial("Inconel690", "Inconel-690", 6, MaterialInfo.INCONEL690, Utils.rgbtoHexValue(118, 220, 138), true); //Inconel 690: Low cobalt content for nuclear applications, and low resistivity. - UtilsItems.generateItemsFromMaterial("Inconel792", "Inconel-792", 5, MaterialInfo.INCONEL792, Utils.rgbtoHexValue(108, 240, 118), true); //Inconel 792: Increased aluminium content for improved high temperature corrosion properties, used especially in gas turbines. - + generateItemsFromMaterial(ALLOY.INCONEL_625); + generateItemsFromMaterial(ALLOY.INCONEL_690); + generateItemsFromMaterial(ALLOY.INCONEL_792); if (!CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK){ - UtilsItems.generateItemsFromMaterial("TungstenCarbide", "Tungsten Carbide", 5, MaterialInfo.TUNGSTENCARBIDE, Utils.rgbtoHexValue(44, 44, 44), true); + generateItemsFromMaterial(ALLOY.TUNGSTEN_CARBIDE); } - UtilsItems.generateItemsFromMaterial("SiliconCarbide", "Silicon Carbide", 4, MaterialInfo.SILICONCARBIDE, Utils.rgbtoHexValue(32, 32, 32), false); - UtilsItems.generateItemsFromMaterial("Zeron100", "Zeron-100", 8, MaterialInfo.ZERON100, Utils.rgbtoHexValue(180, 180, 20), true); - UtilsItems.generateItemsFromMaterial("MaragingSteel250", "Maraging Steel 250", 4, MaterialInfo.MARAGING250, Utils.rgbtoHexValue(140, 140, 140), true); - UtilsItems.generateItemsFromMaterial("MaragingSteel300", "Maraging Steel 300", 5, MaterialInfo.MARAGING300, Utils.rgbtoHexValue(150, 150, 150), true); - UtilsItems.generateItemsFromMaterial("MaragingSteel350", "Maraging Steel 350", 6, MaterialInfo.MARAGING350, Utils.rgbtoHexValue(160, 160, 160), true); - UtilsItems.generateItemsFromMaterial("Stellite", "Stellite", 7, MaterialInfo.STELLITE, Utils.rgbtoHexValue(129, 75, 120), true); - UtilsItems.generateItemsFromMaterial("Talonite", "Talonite", 8, MaterialInfo.TALONITE, Utils.rgbtoHexValue(228, 75, 120), false); + generateItemsFromMaterial(ALLOY.SILICON_CARBIDE); + generateItemsFromMaterial(ALLOY.ZERON_100); + generateItemsFromMaterial(ALLOY.MARAGING250); + generateItemsFromMaterial(ALLOY.MARAGING300); + generateItemsFromMaterial(ALLOY.MARAGING350); + generateItemsFromMaterial(ALLOY.STELLITE); + generateItemsFromMaterial(ALLOY.TALONITE); - UtilsItems.generateItemsFromMaterial("Tumbaga", "Tumbaga", 2, MaterialInfo.TUMBAGA, Utils.rgbtoHexValue(255,178,15), false); //Tumbaga was the name given by Spaniards to a non-specific alloy of gold and copper - UtilsItems.generateItemsFromMaterial("Potin", "Potin", 4, MaterialInfo.POTIN, Utils.rgbtoHexValue(201,151,129), false); //Potin is traditionally an alloy of bronze, tin and lead, with varying quantities of each possible + //Tumbaga was the name given by Spaniards to a non-specific alloy of gold and copper + generateItemsFromMaterial(ALLOY.TUMBAGA); + //Potin is traditionally an alloy of bronze, tin and lead, with varying quantities of each possible + generateItemsFromMaterial(ALLOY.POTIN); - UtilsItems.generateItemsFromMaterial("HastelloyW", "Hastelloy-W", 6, MaterialInfo.HASTELLOY_W, Utils.rgbtoHexValue(218, 165, 32), false); - UtilsItems.generateItemsFromMaterial("HastelloyX", "Hastelloy-X", 6, MaterialInfo.HASTELLOY_X, Utils.rgbtoHexValue(255, 193, 37), false); - UtilsItems.generateItemsFromMaterial("HastelloyC276", "Hastelloy-C276", 7, MaterialInfo.HASTELLOY_C276, Utils.rgbtoHexValue(238, 180, 34), true); - UtilsItems.generateItemsFromMaterial("HastelloyN", "Hastelloy-N", 8, MaterialInfo.HASTELLOY_N, Utils.rgbtoHexValue(155, 223, 237), true); + generateItemsFromMaterial(ALLOY.HASTELLOY_W); + generateItemsFromMaterial(ALLOY.HASTELLOY_X); + generateItemsFromMaterial(ALLOY.HASTELLOY_C276); + generateItemsFromMaterial(ALLOY.HASTELLOY_N); + + generateItemsFromMaterial(ALLOY.INCOLOY_020); + generateItemsFromMaterial(ALLOY.INCOLOY_DS); + generateItemsFromMaterial(ALLOY.INCOLOY_MA956); - UtilsItems.generateItemsFromMaterial("Incoloy020", "Incoloy-020", 7, MaterialInfo.INCOLOY020, Utils.rgbtoHexValue(81, 81, 81), false); - UtilsItems.generateItemsFromMaterial("IncoloyDS", "Incoloy-DS", 7, MaterialInfo.INCOLOYDS, Utils.rgbtoHexValue(91, 91, 91), false); - UtilsItems.generateItemsFromMaterial("IncoloyMA956", "Incoloy-MA956", 8, MaterialInfo.INCOLOYMA956, Utils.rgbtoHexValue(101, 101, 101), true); + generateItemsFromMaterial(ELEMENT.ZIRCONIUM); + generateItemsFromMaterial(ALLOY.ZIRCONIUM_CARBIDE); + generateItemsFromMaterial(ALLOY.TANTALUM_CARBIDE); + generateItemsFromMaterial(ALLOY.NIOBIUM_CARBIDE); - UtilsItems.generateItemsFromMaterial("Zirconium", "Zirconium", 6, MaterialInfo.ZIRCONIUM, Utils.rgbtoHexValue(255, 250, 205), false); - UtilsItems.generateItemsFromMaterial("ZirconiumCarbide", "Zirconium Carbide", 7, MaterialInfo.ZIRCONIUMCARBIDE, Utils.rgbtoHexValue(222, 202, 180), true); - UtilsItems.generateItemsFromMaterial("TantalumCarbide", "Tantalum Carbide", 7, MaterialInfo.TANTALUMCARBIDE, Utils.rgbtoHexValue(139, 136, 120), true); - UtilsItems.generateItemsFromMaterial("NiobiumCarbide", "Niobium Carbide", 6, MaterialInfo.NIOMBIUMCARBIDE, Utils.rgbtoHexValue(205, 197, 191), true); + //Uranium-233 is a fissile isotope of uranium that is bred from thorium-232 as part of the thorium fuel cycle. + UtilsItems.generateItemsFromMaterial(ELEMENT.URANIUM233); + + } catch (Throwable r){ + Utils.LOG_INFO("Failed to Generated a Material. "+r.getMessage()); + //Utils.LOG_INFO("Failed to Generated a Material. "+r.getCause().getMessage()); + Utils.LOG_INFO("Failed to Generated a Material. "+r.getStackTrace()[0].getMethodName()); + Utils.LOG_INFO("Failed to Generated a Material. "+r.getStackTrace()[1].getMethodName()); + r.printStackTrace(); + System.exit(1); + } - //Uranium-233if - UtilsItems.generateItemsFromMaterial("Uranium233", "Uranium 233", 4, MaterialInfo.URANIUM233, Utils.rgbtoHexValue(73, 220, 83), false); //Uranium-233 is a fissile isotope of uranium that is bred from thorium-232 as part of the thorium fuel cycle. dustLithiumCarbonate = UtilsItems.generateSpecialUseDusts("LithiumCarbonate", "Lithium Carbonate", Utils.rgbtoHexValue(137, 139, 142))[0]; @@ -382,6 +399,10 @@ public final class ModItems { //GameRegistry.registerItem(FuelRod_Thorium, "itemFuelRod_Thorium"); //GameRegistry.registerItem(FuelRod_Uranium, "itemFuelRod_Uranium"); //GameRegistry.registerItem(FuelRod_Plutonium, "itemFuelRod_Plutonium"); + + //FluidCell = new ItemStack(new IC2_ItemFluidCell("itemGT++FluidCell")); + + } else { Utils.LOG_WARNING("IndustrialCraft2 not Found - Skipping Resources."); diff --git a/src/Java/gtPlusPlus/core/item/base/dusts/BaseItemDust.java b/src/Java/gtPlusPlus/core/item/base/dusts/BaseItemDust.java index 6d12624487..0342f7f104 100644 --- a/src/Java/gtPlusPlus/core/item/base/dusts/BaseItemDust.java +++ b/src/Java/gtPlusPlus/core/item/base/dusts/BaseItemDust.java @@ -5,7 +5,7 @@ import gregtech.api.enums.GT_Values; import gregtech.api.util.GT_ModHandler; import gregtech.api.util.GT_OreDictUnificator; import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.lib.MaterialInfo; +import gtPlusPlus.core.material.Material; import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.item.UtilsItems; import gtPlusPlus.core.util.math.MathUtils; @@ -29,9 +29,10 @@ public class BaseItemDust extends Item{ protected boolean useBlastFurnace; String name = ""; private int mTier; - private MaterialInfo dustInfo; + private Material dustInfo; + private String oredictName; - public BaseItemDust(String unlocalizedName, String materialName, MaterialInfo matInfo, int colour, String pileSize, boolean blastFurnaceRequired, int tier, int sRadioactivity) { + public BaseItemDust(String unlocalizedName, String materialName, Material matInfo, int colour, String pileSize, boolean blastFurnaceRequired, int tier, int sRadioactivity) { setUnlocalizedName(unlocalizedName); this.setUnlocalizedName(unlocalizedName); this.setMaxStackSize(64); @@ -70,6 +71,7 @@ public class BaseItemDust extends Item{ Utils.LOG_WARNING("Generating OreDict Name: "+temp); } if (temp != null && temp != ""){ + oredictName = temp; GT_OreDictUnificator.registerOre(temp, UtilsItems.getSimpleStack(this)); } addMixerRecipe(); @@ -133,109 +135,75 @@ public class BaseItemDust extends Item{ private void addMixerRecipe(){ - ItemStack tempStack = UtilsItems.getSimpleStack(this); - ItemStack tempOutput = null; - ItemStack[] inputStacks = dustInfo.getInputs(); - ItemStack[] outputStacks = dustInfo.getOutputs(); - String temp = ""; - Utils.LOG_WARNING("Unlocalized name for OreDict nameGen: "+getUnlocalizedName()); - if (getUnlocalizedName().contains("item.")){ - temp = getUnlocalizedName().replace("item.", ""); - Utils.LOG_WARNING("Generating OreDict Name: "+temp); + + ItemStack thisItem; + ItemStack normalDust = dustInfo.getDust(1); + ItemStack smallDust = dustInfo.getSmallDust(1); + ItemStack tinyDust = dustInfo.getTinyDust(1); + + ItemStack[] inputStacks = dustInfo.getMaterialComposites(); + ItemStack outputStacks = dustInfo.getDust(10); + + if (oredictName.contains("dustTiny")){ + thisItem = tinyDust; + ItemStack normalStack = dustInfo.getDust(1); + ItemStack tinyStack = dustInfo.getTinyDust(9); + Utils.LOG_INFO("Generating a 9 Tiny dust to 1 Dust recipe for "+materialName); + UtilsRecipe.recipeBuilder( + thisItem, thisItem, thisItem, + thisItem, thisItem, thisItem, + thisItem, thisItem, thisItem, + normalStack); + + Utils.LOG_INFO("Generating a 9 Tiny dust from 1 Dust recipe for "+materialName); + UtilsRecipe.recipeBuilder( + normalStack, null, null, + null, null, null, + null, null, null, + tinyStack); + } - else { - temp = getUnlocalizedName(); - } - if (temp.contains("DustTiny")){ - temp = temp.replace("itemDustTiny", "dust"); - Utils.LOG_WARNING("Generating OreDict Name: "+temp); - } - else if (temp.contains("DustSmall")){ - temp = temp.replace("itemDustSmall", "dust"); - Utils.LOG_WARNING("Generating OreDict Name: "+temp); + else if (oredictName.contains("dustSmall")){ + thisItem = smallDust; + ItemStack normalStack = dustInfo.getDust(1); + ItemStack smallStack = dustInfo.getSmallDust(4); + + Utils.LOG_INFO("Generating a 4 Small dust to 1 Dust recipe for "+materialName); + UtilsRecipe.recipeBuilder( + thisItem, thisItem, null, + thisItem, thisItem, null, + null, null, null, + normalStack); + + Utils.LOG_INFO("Generating a 4 Small dust from 1 Dust recipe for "+materialName); + UtilsRecipe.recipeBuilder( + null, normalStack, null, + null, null, null, + null, null, null, + smallStack); + } else { - temp = temp.replace("itemD", "d"); - Utils.LOG_WARNING("Generating OreDict Name: "+temp); - } - if (temp != null && temp != ""){ - - if (getUnlocalizedName().contains("DustTiny") || getUnlocalizedName().contains("DustSmall")){ - tempOutput = UtilsItems.getItemStackOfAmountFromOreDict(temp, 1); - } - else { - if (outputStacks[0] != null){ - Utils.LOG_WARNING("Getting output dusts for mixer recipe. Checking ENUM, got: "+outputStacks[0].toString()); - tempOutput = outputStacks[0]; + thisItem = normalDust; + } + + if (thisItem == normalDust){ + Utils.LOG_WARNING("Generating a Dust recipe for "+materialName+" in the mixer."); + + if (inputStacks.length != 0){ + GT_Values.RA.addMixerRecipe( + inputStacks[0], inputStacks[1], + inputStacks[2], inputStacks[3], + null, null, + outputStacks, + 8*mTier*20, 8*mTier*2); } else { - Utils.LOG_WARNING("Getting output dusts for mixer recipe. Enum check failed, failback item is: "+temp); - tempOutput = UtilsItems.getItemStackOfAmountFromOreDict(temp, 1); + return; } } - } - if (tempOutput != null){ - if (getUnlocalizedName().contains("DustTiny")){ - Utils.LOG_WARNING("Generating a 9 Tiny dust to 1 Dust recipe for "+materialName); - UtilsRecipe.addShapelessGregtechRecipe(tempOutput, - tempStack, tempStack, tempStack, - tempStack, tempStack, tempStack, - tempStack, tempStack, tempStack); - } - else if (getUnlocalizedName().contains("DustSmall")){ - Utils.LOG_WARNING("Generating a 4 Small dust to 1 Dust recipe for "+materialName); - UtilsRecipe.addShapelessGregtechRecipe(tempOutput, - tempStack, tempStack, null, - tempStack, tempStack, null, - null, null, null); - } - else { - Utils.LOG_WARNING("Generating a Dust recipe for "+materialName+" in the mixer."); - - - int i = 0; - if (inputStacks.length >= 2){ - for (ItemStack is : inputStacks){ - if (is != null){ - Utils.LOG_WARNING("Found "+is.getDisplayName()+" as an input for mixer recipe."); - if (is.getDisplayName().toLowerCase().contains("tell alkalus")){ - ItemStack tempStackForAName = inputStacks[i]; - String[] inputList = dustInfo.getInputItemsAsList(); - int[] inputSizes = dustInfo.getInputStackSizesAsList(); - inputStacks[i] = UtilsItems.getItemStackOfAmountFromOreDict(inputList[i], inputSizes[i]); - Utils.LOG_WARNING("Swapping input slot "+i+" which contains "+tempStackForAName.getDisplayName()+" with "+inputStacks[i].getDisplayName()+"."); - } - - } - - else { - Utils.LOG_WARNING("Input "+i+" was null."); - } - - i++; - } - } - - GT_Values.RA.addMixerRecipe( - inputStacks[0], inputStacks[1], - inputStacks[2], inputStacks[3], - null, null, - tempOutput, - 8*mTier*20, 8*mTier*2); - - /*GT_Values.RA.addMixerRecipe( - GT_Utility.copyAmount(inputStacks[0].stackSize, new Object[]{inputStacks[0]}), GT_Utility.copyAmount(inputStacks[1].stackSize, new Object[]{inputStacks[1]}), - GT_Utility.copyAmount(inputStacks[2].stackSize, new Object[]{inputStacks[2]}), GT_Utility.copyAmount(inputStacks[3].stackSize, new Object[]{inputStacks[3]}), - null, null, - tempOutput, - 8*mTier*20, 8*mTier*2);*/ - - } - } - - } private void addMacerationRecipe(){ Utils.LOG_WARNING("Adding recipe for "+materialName+" Dusts"); @@ -260,15 +228,25 @@ public class BaseItemDust extends Item{ tempIngot = tempIngot.replace("itemDust", "ingot"); Utils.LOG_WARNING("Generating OreDict Name: "+tempIngot); - ItemStack[] outputStacks = dustInfo.getOutputs(); + ItemStack[] outputStacks = {dustInfo.getDust(1)}; if (tempIngot != null && tempIngot != ""){ tempInputStack = UtilsItems.getItemStackOfAmountFromOreDict(tempIngot, 1); tempOutputStack = UtilsItems.getItemStackOfAmountFromOreDict(tempDust, 1); - ItemStack tempStackOutput2; + ItemStack tempStackOutput2 = null; int chance = mTier*10/MathUtils.randInt(10, 20); - if (outputStacks[1] != null && !outputStacks[1].getUnlocalizedName().toLowerCase().contains("aaa_broken")){ - tempStackOutput2 = outputStacks[1]; - tempOutputStack = outputStacks[0]; + if (outputStacks.length != 0){ + if (outputStacks.length == 1){ + tempStackOutput2 = null; + } + else { + if (!outputStacks[1].getUnlocalizedName().toLowerCase().contains("aaa_broken")){ + tempStackOutput2 = outputStacks[1]; + tempOutputStack = outputStacks[0]; + } + else { + tempStackOutput2 = null; + } + } } else { tempStackOutput2 = null; diff --git a/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockFluid.java b/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockFluid.java new file mode 100644 index 0000000000..77af69f809 --- /dev/null +++ b/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockFluid.java @@ -0,0 +1,78 @@ +package gtPlusPlus.core.item.base.itemblock; + +import gtPlusPlus.core.fluids.BlockFluidBase; +import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.material.Material; +import gtPlusPlus.core.util.item.UtilsItems; +import gtPlusPlus.core.util.math.MathUtils; + +import java.util.List; + +import net.minecraft.block.Block; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemBlock; +import net.minecraft.item.ItemStack; + +public class ItemBlockFluid extends ItemBlock{ + + protected final int blockColour; + protected final int sRadiation; + protected Material thisFluid; + final BlockFluidBase baseBlock; + String name; + + public ItemBlockFluid(Block block) { + super(block); + this.baseBlock = (BlockFluidBase) block; + this.blockColour = baseBlock.getRenderColor(1); + this.thisFluid = baseBlock.getFluidMaterial(); + this.sRadiation=UtilsItems.getRadioactivityLevel(baseBlock.getUnlocalizedName()); + this.name = baseBlock.getLocalizedName().replace("tile", "").replace("fluid", "").replace("name", "").replace("block", "").replace(".", ""); + //GT_OreDictUnificator.registerOre("frameGt"+block.getUnlocalizedName().replace("tile.", "").replace("tile.BlockGtFrame", "").replace("-", "").replace("_", "").replace(" ", "").replace("FrameBox", ""), UtilsItems.getSimpleStack(this)); + } + + public final Material setFluidMaterial(Material M){ + return thisFluid=M; + } + + public int getRenderColor(int aMeta) { + return blockColour; + } + + @Override + public String getItemStackDisplayName(ItemStack iStack) { + if (thisFluid != null){ + this.name = "Molten "+thisFluid.getLocalizedName(); + return name; + } + this.name = "Molten "+baseBlock.getLocalizedName().replace("tile", "").replace("fluid", "").replace("name", "").replace("block", "").replace(".", ""); + return name; + } + + @Override + public int getColorFromItemStack(ItemStack stack, int HEX_OxFFFFFF) { + if (blockColour == 0){ + return MathUtils.generateSingularRandomHexValue(); + } + return blockColour; + + } + + @Override + public void addInformation(ItemStack stack, EntityPlayer aPlayer, List list, boolean bool) { + list.add("Temperature: "+MathUtils.celsiusToKelvin(thisFluid.getMeltingPoint_C())+"K"); + if (sRadiation > 0){ + list.add(CORE.GT_Tooltip_Radioactive); + } + super.addInformation(stack, aPlayer, list, bool); + } + + public String GetProperName() { + String tempIngot; + + tempIngot = "Molten "+baseBlock.getLocalizedName(); + + return tempIngot; + } + +} |