diff options
author | Alkalus <draknyte1@hotmail.com> | 2017-11-28 16:19:47 +1000 |
---|---|---|
committer | Alkalus <draknyte1@hotmail.com> | 2017-11-28 16:19:47 +1000 |
commit | 4da55268da03a810028dac0da43604f05feed2c4 (patch) | |
tree | 2c85d56281735044f7233b73a6f53ddc56fb0fb9 /src/Java/gtPlusPlus | |
parent | 6bf6499f68796e77ee76d523e5dc706e08d51288 (diff) | |
download | GT5-Unofficial-4da55268da03a810028dac0da43604f05feed2c4.tar.gz GT5-Unofficial-4da55268da03a810028dac0da43604f05feed2c4.tar.bz2 GT5-Unofficial-4da55268da03a810028dac0da43604f05feed2c4.zip |
+ Added formulas to EIO ingots.
+ Added a new material list for non-elements/alloys.
$ Completely redid EIO compat items to reflect their chemical formula.
Diffstat (limited to 'src/Java/gtPlusPlus')
8 files changed, 355 insertions, 142 deletions
diff --git a/src/Java/gtPlusPlus/core/common/CommonProxy.java b/src/Java/gtPlusPlus/core/common/CommonProxy.java index 55bde81bb7..78e42d0ac7 100644 --- a/src/Java/gtPlusPlus/core/common/CommonProxy.java +++ b/src/Java/gtPlusPlus/core/common/CommonProxy.java @@ -2,7 +2,6 @@ package gtPlusPlus.core.common; import static gtPlusPlus.core.lib.CORE.DEBUG; -import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.common.event.*; import cpw.mods.fml.common.registry.GameRegistry; import gtPlusPlus.core.block.ModBlocks; @@ -20,9 +19,9 @@ import gtPlusPlus.core.tileentities.ModTileEntities; import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.debug.DEBUG_INIT; import gtPlusPlus.core.util.player.PlayerCache; +import gtPlusPlus.xmod.eio.handler.HandlerTooltip_EIO; import gtPlusPlus.xmod.gregtech.common.Meta_GT_Proxy; import net.minecraft.entity.Entity; -import net.minecraftforge.common.MinecraftForge; public class CommonProxy { @@ -30,8 +29,7 @@ public class CommonProxy { public CommonProxy(){ //Should Register Gregtech Materials I've Made - MinecraftForge.EVENT_BUS.register(this); - FMLCommonHandler.instance().bus().register(this); + Utils.registerEvent(this); if (LoadedMods.Gregtech){ if (CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK){ Utils.LOG_INFO("We're using Gregtech 5.09 Experimental."); @@ -82,10 +80,21 @@ public class CommonProxy { ModItems.init(); ModBlocks.init(); CI.Init(); + + /** + * Register the Event Handlers. + */ + //Prevents my Safes being destroyed. - MinecraftForge.EVENT_BUS.register(new PickaxeBlockBreakEventHandler()); + Utils.registerEvent(new PickaxeBlockBreakEventHandler()); //Block Handler for all events. - MinecraftForge.EVENT_BUS.register(new BlockEventHandler()); + Utils.registerEvent(new BlockEventHandler()); + //Handles Custom tooltips for EIO. + Utils.registerEvent(new HandlerTooltip_EIO()); + + /** + * End of Subscribe Event registration. + */ Utils.LOG_INFO("[Proxy] Calling Render registrator."); registerRenderThings(); diff --git a/src/Java/gtPlusPlus/core/item/ModItems.java b/src/Java/gtPlusPlus/core/item/ModItems.java index 11a9d85765..7e53116920 100644 --- a/src/Java/gtPlusPlus/core/item/ModItems.java +++ b/src/Java/gtPlusPlus/core/item/ModItems.java @@ -66,6 +66,7 @@ import gtPlusPlus.core.util.debug.DEBUG_INIT; import gtPlusPlus.core.util.fluid.FluidUtils; import gtPlusPlus.core.util.item.ItemUtils; import gtPlusPlus.core.util.materials.MaterialUtils; +import gtPlusPlus.xmod.eio.material.MaterialEIO; import net.minecraft.item.EnumRarity; import net.minecraft.item.Item; import net.minecraft.item.Item.ToolMaterial; @@ -683,22 +684,22 @@ public final class ModItems { if ((LoadedMods.EnderIO || LOAD_ALL_CONTENT) && !CORE.GTNH){ Utils.LOG_INFO("EnderIO Found - Loading Resources."); //Enderio Dusts - itemDustSoularium = ItemUtils.generateSpecialUseDusts("Soularium", "Soularium", ""+Materials.Soulsand.mChemicalFormula+Materials.Gold.mChemicalFormula, Utils.rgbtoHexValue(95,90,54))[0]; - itemDustRedstoneAlloy = ItemUtils.generateSpecialUseDusts("RedstoneAlloy", "Redstone Alloy", ""+Materials.Redstone.mChemicalFormula+Materials.Silicon.mChemicalFormula, Utils.rgbtoHexValue(178,34,34))[0]; - itemDustElectricalSteel = ItemUtils.generateSpecialUseDusts("ElectricalSteel", "Electrical Steel", "(Fe50C)3Si", Utils.rgbtoHexValue(194,194,194))[0]; - itemDustPulsatingIron = ItemUtils.generateSpecialUseDusts("PulsatingIron", "Pulsating Iron", ""+Materials.Iron.mChemicalFormula+Materials.Enderpearl.mChemicalFormula, Utils.rgbtoHexValue(50,91,21))[0]; - itemDustEnergeticAlloy = ItemUtils.generateSpecialUseDusts("EnergeticAlloy", "Energetic Alloy", ""+Materials.Gold.mChemicalFormula+Materials.Redstone.mChemicalFormula+Materials.Glowstone.mChemicalFormula, Utils.rgbtoHexValue(252,151,45))[0]; - itemDustVibrantAlloy = ItemUtils.generateSpecialUseDusts("VibrantAlloy", "Vibrant Alloy", "("+Materials.Gold.mChemicalFormula+Materials.Redstone.mChemicalFormula+Materials.Glowstone.mChemicalFormula+")"+Materials.Enderpearl, Utils.rgbtoHexValue(204,242,142))[0]; - itemDustConductiveIron = ItemUtils.generateSpecialUseDusts("ConductiveIron", "Conductive Iron", ""+Materials.Iron.mChemicalFormula+Materials.Redstone.mChemicalFormula, Utils.rgbtoHexValue(164,109,100))[0]; + itemDustSoularium = ItemUtils.generateSpecialUseDusts("Soularium", "Soularium", MaterialEIO.SOULARIUM.vChemicalFormula, MaterialEIO.SOULARIUM.getRgbAsHex())[0]; + itemDustRedstoneAlloy = ItemUtils.generateSpecialUseDusts("RedstoneAlloy", "Redstone Alloy", MaterialEIO.REDSTONE_ALLOY.vChemicalFormula, MaterialEIO.REDSTONE_ALLOY.getRgbAsHex())[0]; + itemDustElectricalSteel = ItemUtils.generateSpecialUseDusts("ElectricalSteel", "Electrical Steel", MaterialEIO.ELECTRICAL_STEEL.vChemicalFormula, MaterialEIO.ELECTRICAL_STEEL.getRgbAsHex())[0]; + itemDustPulsatingIron = ItemUtils.generateSpecialUseDusts("PulsatingIron", "Pulsating Iron", MaterialEIO.PULSATING_IRON.vChemicalFormula, MaterialEIO.PULSATING_IRON.getRgbAsHex())[0]; + itemDustEnergeticAlloy = ItemUtils.generateSpecialUseDusts("EnergeticAlloy", "Energetic Alloy", MaterialEIO.ENERGETIC_ALLOY.vChemicalFormula, MaterialEIO.ENERGETIC_ALLOY.getRgbAsHex())[0]; + itemDustVibrantAlloy = ItemUtils.generateSpecialUseDusts("VibrantAlloy", "Vibrant Alloy", MaterialEIO.VIBRANT_ALLOY.vChemicalFormula, MaterialEIO.VIBRANT_ALLOY.getRgbAsHex())[0]; + itemDustConductiveIron = ItemUtils.generateSpecialUseDusts("ConductiveIron", "Conductive Iron", MaterialEIO.CONDUCTIVE_IRON.vChemicalFormula, MaterialEIO.CONDUCTIVE_IRON.getRgbAsHex())[0]; //EnderIO Plates - itemPlateSoularium = ItemUtils.generateSpecialUsePlate("itemPlate"+"Soularium", "Soularium", new short[]{95, 90, 54}, 0); - itemPlateRedstoneAlloy = ItemUtils.generateSpecialUsePlate("itemPlate"+"RedstoneAlloy", "Redstone Alloy", new short[]{178,34,34}, 0); - itemPlateElectricalSteel = ItemUtils.generateSpecialUsePlate("itemPlate"+"ElectricalSteel", "Electrical Steel", new short[]{194, 194, 194}, 0); - itemPlatePulsatingIron = ItemUtils.generateSpecialUsePlate("itemPlate"+"PhasedIron", "Phased Iron", new short[]{50, 91, 21}, 0); - itemPlateEnergeticAlloy = ItemUtils.generateSpecialUsePlate("itemPlate"+"EnergeticAlloy", "Energetic Alloy", new short[]{252, 152, 45}, 0); - itemPlateVibrantAlloy = ItemUtils.generateSpecialUsePlate("itemPlate"+"VibrantAlloy", "Vibrant Alloy", new short[]{204, 242, 142}, 0); - itemPlateConductiveIron = ItemUtils.generateSpecialUsePlate("itemPlate"+"ConductiveIron", "Conductive Iron", new short[]{164, 109, 100}, 0); + itemPlateSoularium = ItemUtils.generateSpecialUsePlate("Soularium", "Soularium", MaterialEIO.SOULARIUM.vChemicalFormula, MaterialEIO.SOULARIUM.getRgbAsHex(), 0); + itemPlateRedstoneAlloy = ItemUtils.generateSpecialUsePlate("RedstoneAlloy", "Redstone Alloy", MaterialEIO.REDSTONE_ALLOY.vChemicalFormula, MaterialEIO.REDSTONE_ALLOY.getRgbAsHex(), 0); + itemPlateElectricalSteel = ItemUtils.generateSpecialUsePlate("ElectricalSteel", "Electrical Steel", MaterialEIO.ELECTRICAL_STEEL.vChemicalFormula, MaterialEIO.ELECTRICAL_STEEL.getRgbAsHex(), 0); + itemPlatePulsatingIron = ItemUtils.generateSpecialUsePlate("PhasedIron", "Phased Iron", MaterialEIO.PULSATING_IRON.vChemicalFormula, MaterialEIO.PULSATING_IRON.getRgbAsHex(), 0); + itemPlateEnergeticAlloy = ItemUtils.generateSpecialUsePlate("EnergeticAlloy", "Energetic Alloy", MaterialEIO.ENERGETIC_ALLOY.vChemicalFormula, MaterialEIO.ENERGETIC_ALLOY.getRgbAsHex(), 0); + itemPlateVibrantAlloy = ItemUtils.generateSpecialUsePlate("VibrantAlloy", "Vibrant Alloy", MaterialEIO.VIBRANT_ALLOY.vChemicalFormula, MaterialEIO.VIBRANT_ALLOY.getRgbAsHex(), 0); + itemPlateConductiveIron = ItemUtils.generateSpecialUsePlate("ConductiveIron", "Conductive Iron", MaterialEIO.CONDUCTIVE_IRON.vChemicalFormula, MaterialEIO.CONDUCTIVE_IRON.getRgbAsHex(), 0); //Register dumb naming conventions - Who chose fucking phased Iron/Gold? GT_OreDictUnificator.registerOre("dustPhasedGold", ItemUtils.getSimpleStack(itemDustVibrantAlloy)); diff --git a/src/Java/gtPlusPlus/core/item/base/dusts/BaseItemDustUnique.java b/src/Java/gtPlusPlus/core/item/base/dusts/BaseItemDustUnique.java index 5e07993ee4..93fc833c79 100644 --- a/src/Java/gtPlusPlus/core/item/base/dusts/BaseItemDustUnique.java +++ b/src/Java/gtPlusPlus/core/item/base/dusts/BaseItemDustUnique.java @@ -17,19 +17,18 @@ import net.minecraft.item.ItemStack; public class BaseItemDustUnique extends Item{ - protected int colour; - protected String materialName; - protected String pileType; - String name = ""; - String chemicalNotation = ""; + protected final int colour; + protected final int sRadiation; + protected final String materialName; + protected final String name; + protected final String chemicalNotation; public BaseItemDustUnique(final String unlocalizedName, final String materialName, final int colour, final String pileSize) { - this(unlocalizedName, materialName, "", colour, pileSize); + this(unlocalizedName, materialName, "NullFormula", colour, pileSize); } public BaseItemDustUnique(final String unlocalizedName, final String materialName, final String mChemicalFormula, final int colour, final String pileSize) { this.setUnlocalizedName(unlocalizedName); - this.setUnlocalizedName(unlocalizedName); this.setMaxStackSize(64); this.setTextureName(this.getCorrectTexture(pileSize)); this.setCreativeTab(tabMisc); @@ -44,6 +43,16 @@ public class BaseItemDustUnique extends Item{ this.sRadiation = ItemUtils.getRadioactivityLevel(materialName); GameRegistry.registerItem(this, unlocalizedName); + if (this.getUnlocalizedName().contains("DustTiny")){ + this.name = "Tiny Pile of "+this.materialName+ " Dust"; + } + else if (this.getUnlocalizedName().contains("DustSmall")){ + this.name = "Small Pile of "+this.materialName+ " Dust"; + } + else { + this.name = this.materialName+ " Dust"; + } + String temp = ""; Utils.LOG_WARNING("Unlocalized name for OreDict nameGen: "+this.getUnlocalizedName()); if (this.getUnlocalizedName().contains("item.")){ @@ -72,16 +81,6 @@ public class BaseItemDustUnique extends Item{ @Override public String getItemStackDisplayName(final ItemStack iStack) { - - if (this.getUnlocalizedName().contains("DustTiny")){ - this.name = "Tiny Pile of "+this.materialName+ " Dust"; - } - else if (this.getUnlocalizedName().contains("DustSmall")){ - this.name = "Small Pile of "+this.materialName+ " Dust"; - } - else { - this.name = this.materialName+ " Dust"; - } return this.name; } @@ -102,7 +101,6 @@ public class BaseItemDustUnique extends Item{ return "gregtech" + ":" + "materialicons/SHINY/dust"; } - protected final int sRadiation; @SuppressWarnings({ "rawtypes", "unchecked" }) @Override @@ -110,97 +108,11 @@ public class BaseItemDustUnique extends Item{ if (this.sRadiation > 0){ list.add(CORE.GT_Tooltip_Radioactive); } - if (containsSubScript(this.chemicalNotation)){ + if (StringUtils.containsSuperOrSubScript(this.chemicalNotation)){ list.add(this.chemicalNotation); } super.addInformation(stack, aPlayer, list, bool); - } - - static boolean containsSubScript(final String s){ - if (s.contains(StringUtils.superscript("1"))) { - return true; - } - if (s.contains(StringUtils.superscript("2"))) { - return true; - } - if (s.contains(StringUtils.superscript("3"))) { - return true; - } - if (s.contains(StringUtils.superscript("4"))) { - return true; - } - if (s.contains(StringUtils.superscript("5"))) { - return true; - } - if (s.contains(StringUtils.superscript("6"))) { - return true; - } - if (s.contains(StringUtils.superscript("7"))) { - return true; - } - if (s.contains(StringUtils.superscript("8"))) { - return true; - } - if (s.contains(StringUtils.superscript("9"))) { - return true; - } - if (s.contains(StringUtils.subscript("1"))) { - return true; - } - if (s.contains(StringUtils.subscript("2"))) { - return true; - } - if (s.contains(StringUtils.subscript("3"))) { - return true; - } - if (s.contains(StringUtils.subscript("4"))) { - return true; - } - if (s.contains(StringUtils.subscript("5"))) { - return true; - } - if (s.contains(StringUtils.subscript("6"))) { - return true; - } - if (s.contains(StringUtils.subscript("7"))) { - return true; - } - if (s.contains(StringUtils.subscript("8"))) { - return true; - } - if (s.contains(StringUtils.subscript("9"))) { - return true; - } - final String r = StringUtils.subscript(s); - if (r.contains(("1"))) { - return false; - } - if (r.contains(("2"))) { - return false; - } - if (r.contains(("3"))) { - return false; - } - if (r.contains(("4"))) { - return false; - } - if (r.contains(("5"))) { - return false; - } - if (r.contains(("6"))) { - return false; - } - if (r.contains(("7"))) { - return false; - } - if (r.contains(("8"))) { - return false; - } - if (r.contains(("9"))) { - return false; - } - return false; - } + } public final String getMaterialName() { return StringUtils.subscript(this.materialName); diff --git a/src/Java/gtPlusPlus/core/item/base/plates/BaseItemPlate_OLD.java b/src/Java/gtPlusPlus/core/item/base/plates/BaseItemPlate_OLD.java index 326ecc7385..86f61c7251 100644 --- a/src/Java/gtPlusPlus/core/item/base/plates/BaseItemPlate_OLD.java +++ b/src/Java/gtPlusPlus/core/item/base/plates/BaseItemPlate_OLD.java @@ -1,43 +1,56 @@ package gtPlusPlus.core.item.base.plates; +import java.util.List; + import cpw.mods.fml.common.registry.GameRegistry; -import gregtech.api.util.GT_ModHandler; import gregtech.api.util.GT_OreDictUnificator; import gtPlusPlus.core.creative.AddToCreativeTab; import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.Utils; +import gtPlusPlus.core.util.StringUtils; import gtPlusPlus.core.util.entity.EntityUtils; import gtPlusPlus.core.util.item.ItemUtils; import gtPlusPlus.core.util.math.MathUtils; 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; public class BaseItemPlate_OLD extends Item{ - protected int colour; - protected String materialName; - protected String unlocalName; + protected final int colour; + protected final int sRadiation; + protected final String materialName; + protected final String unlocalName; + protected final String chemicalNotation; public BaseItemPlate_OLD(final String unlocalizedName, final String materialName, final int colour, final int sRadioactivity) { - this.setUnlocalizedName(unlocalizedName); + this(unlocalizedName, materialName, "NullFormula", colour, sRadioactivity); + } + + public BaseItemPlate_OLD(final String unlocalizedName, final String materialName, final String mChemicalFormula, final int colour, final int sRadioactivity) { + this.setUnlocalizedName("itemPlate"+unlocalizedName); this.setCreativeTab(AddToCreativeTab.tabMisc); - this.setUnlocalizedName(unlocalizedName); - this.unlocalName = unlocalizedName; + this.unlocalName = "itemPlate"+unlocalizedName; this.setMaxStackSize(64); this.setTextureName(CORE.MODID + ":" + "itemPlate"); this.setMaxStackSize(64); this.colour = colour; this.materialName = materialName; + if (mChemicalFormula.equals("") || mChemicalFormula.equals("NullFormula")){ + this.chemicalNotation = StringUtils.subscript(materialName); + } + else { + this.chemicalNotation = StringUtils.subscript(mChemicalFormula); + } this.sRadiation = sRadioactivity; - GameRegistry.registerItem(this, unlocalizedName); - String temp = ""; + GameRegistry.registerItem(this, "itemPlate"+unlocalizedName); + String temp; if (this.unlocalName.toLowerCase().contains("itemplate")){ temp = this.unlocalName.replace("itemP", "p"); - } - if ((temp != null) && !temp.equals("")){ - GT_OreDictUnificator.registerOre(temp, ItemUtils.getSimpleStack(this)); + if ((temp != null) && !temp.equals("")){ + GT_OreDictUnificator.registerOre(temp, ItemUtils.getSimpleStack(this)); + } } } @@ -59,10 +72,21 @@ public class BaseItemPlate_OLD extends Item{ return this.colour; } - - protected final int sRadiation; + @Override public void onUpdate(final ItemStack iStack, final World world, final Entity entityHolding, final int p_77663_4_, final boolean p_77663_5_) { EntityUtils.applyRadiationDamageToEntity(iStack.stackSize, this.sRadiation, world, entityHolding); } + + @SuppressWarnings({ "rawtypes", "unchecked" }) + @Override + public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) { + if (this.sRadiation > 0){ + list.add(CORE.GT_Tooltip_Radioactive); + } + if (StringUtils.containsSuperOrSubScript(this.chemicalNotation)){ + list.add(this.chemicalNotation); + } + super.addInformation(stack, aPlayer, list, bool); + } } diff --git a/src/Java/gtPlusPlus/core/material/NONMATERIAL.java b/src/Java/gtPlusPlus/core/material/NONMATERIAL.java new file mode 100644 index 0000000000..d43791a90f --- /dev/null +++ b/src/Java/gtPlusPlus/core/material/NONMATERIAL.java @@ -0,0 +1,21 @@ +package gtPlusPlus.core.material; + +import gregtech.api.enums.Materials; +import gtPlusPlus.core.util.materials.MaterialUtils; + +public class NONMATERIAL { + + //Soul Sand + public static final Material SOULSAND = MaterialUtils.generateMaterialFromGtENUM(Materials.SoulSand); + + //Redstone + public static final Material REDSTONE = MaterialUtils.generateMaterialFromGtENUM(Materials.Redstone); + + //Glowstone Dust + public static final Material GLOWSTONE = MaterialUtils.generateMaterialFromGtENUM(Materials.Glowstone); + + //Enderpearl + public static final Material ENDERPEARL = MaterialUtils.generateMaterialFromGtENUM(Materials.EnderPearl); + + +} diff --git a/src/Java/gtPlusPlus/core/util/item/ItemUtils.java b/src/Java/gtPlusPlus/core/util/item/ItemUtils.java index e27c140d93..988c598153 100644 --- a/src/Java/gtPlusPlus/core/util/item/ItemUtils.java +++ b/src/Java/gtPlusPlus/core/util/item/ItemUtils.java @@ -338,7 +338,19 @@ public class ItemUtils { } public static Item generateSpecialUsePlate(final String internalName, final String displayName, final short[] rgb, final int radioactivity){ - return new BaseItemPlate_OLD(internalName, displayName, Utils.rgbtoHexValue(rgb[0], rgb[1], rgb[2]), radioactivity); + return generateSpecialUsePlate(internalName, displayName, Utils.rgbtoHexValue(rgb[0], rgb[1], rgb[2]), radioactivity); + } + + public static Item generateSpecialUsePlate(final String internalName, final String displayName, final String mFormula, final short[] rgb, final int radioactivity){ + return generateSpecialUsePlate(internalName, displayName, mFormula, Utils.rgbtoHexValue(rgb[0], rgb[1], rgb[2]), radioactivity); + } + + public static Item generateSpecialUsePlate(final String internalName, final String displayName, final int rgb, final int radioactivity){ + return new BaseItemPlate_OLD(internalName, displayName, rgb, radioactivity); + } + + public static Item generateSpecialUsePlate(final String internalName, final String displayName, final String mFormula, final int rgb, final int radioactivity){ + return new BaseItemPlate_OLD(internalName, displayName, mFormula, rgb, radioactivity); } public static Item[] generateSpecialUseDusts(final Material material, final boolean onlyLargeDust){ diff --git a/src/Java/gtPlusPlus/xmod/eio/handler/HandlerTooltip_EIO.java b/src/Java/gtPlusPlus/xmod/eio/handler/HandlerTooltip_EIO.java new file mode 100644 index 0000000000..ae0ca232b7 --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/eio/handler/HandlerTooltip_EIO.java @@ -0,0 +1,116 @@ +package gtPlusPlus.xmod.eio.handler; + +import cpw.mods.fml.common.eventhandler.SubscribeEvent; +import gregtech.api.enums.Materials; +import gtPlusPlus.core.lib.LoadedMods; +import gtPlusPlus.core.util.item.ItemUtils; +import gtPlusPlus.core.util.reflect.ReflectionUtils; +import gtPlusPlus.xmod.eio.material.MaterialEIO; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraftforge.event.entity.player.ItemTooltipEvent; + +public class HandlerTooltip_EIO { + + Item mIngot; + ItemStack mPulsatingIron; + ItemStack mConductiveIron; + ItemStack mRedstoneAlloy; + ItemStack mElectricalSteel; + ItemStack mEnergeticAlloy; + ItemStack mVibrantAlloy; + ItemStack mSoularium; + ItemStack mDarkIron; + + @SubscribeEvent + public void onItemTooltip(ItemTooltipEvent event){ + //Is EIO loaded? + if (LoadedMods.EnderIO){ + + //Is the EIO Ingot Item null? + //If it is, reflect in. + if (mIngot == null){ + Class<?> oMainClass; + try { + oMainClass = Class.forName("crazypants.enderio.EnderIO"); + Class<?> oIngotClass = Class.forName("crazypants.enderio.material.ItemAlloy"); + Object oAlloy = ReflectionUtils.getField(oMainClass, "itemAlloy"); + if (oAlloy != null && oIngotClass.isInstance(oAlloy)){ + mIngot = (Item) oAlloy; + } + } + catch (ClassNotFoundException | NoSuchFieldException e) {} + } + + //If EIO Item Is not Null, see if the ItemStacks for the ingots are null + //if they stacks are null, set the stack using the item set via reflection. + //The meta data is based on the oridinals of the materials in the EIO enum. + if (mIngot != null){ + if (mElectricalSteel == null){ + mElectricalSteel = ItemUtils.simpleMetaStack(mIngot, 0, 1); + } + if (mEnergeticAlloy == null){ + mEnergeticAlloy = ItemUtils.simpleMetaStack(mIngot, 1, 1); + } + if (mVibrantAlloy == null){ + mVibrantAlloy = ItemUtils.simpleMetaStack(mIngot, 2, 1); + } + if (mRedstoneAlloy == null){ + mRedstoneAlloy = ItemUtils.simpleMetaStack(mIngot, 3, 1); + } + if (mConductiveIron == null){ + mConductiveIron = ItemUtils.simpleMetaStack(mIngot, 4, 1); + } + if (mPulsatingIron == null){ + mPulsatingIron = ItemUtils.simpleMetaStack(mIngot, 5, 1); + } + if (mDarkIron == null){ + mDarkIron = ItemUtils.simpleMetaStack(mIngot, 6, 1); + } + if (mSoularium == null){ + mSoularium = ItemUtils.simpleMetaStack(mIngot, 7, 1); + } + + try { + + //If the Item is an instance of ItemAlloy.class then proceed + if (Class.forName("crazypants.enderio.material.ItemAlloy").isInstance(event.itemStack.getItem())){ + + //If stacks match, add a tooltip. + if (event.itemStack == mElectricalSteel){ + event.toolTip.add(MaterialEIO.ELECTRICAL_STEEL.vChemicalFormula); + } + else if (event.itemStack == mEnergeticAlloy){ + event.toolTip.add(MaterialEIO.ENERGETIC_ALLOY.vChemicalFormula); + } + else if (event.itemStack == mVibrantAlloy){ + event.toolTip.add(MaterialEIO.VIBRANT_ALLOY.vChemicalFormula); + } + else if (event.itemStack == mRedstoneAlloy){ + event.toolTip.add(MaterialEIO.REDSTONE_ALLOY.vChemicalFormula); + } + else if (event.itemStack == mConductiveIron){ + event.toolTip.add(MaterialEIO.CONDUCTIVE_IRON.vChemicalFormula); + } + else if (event.itemStack == mPulsatingIron){ + event.toolTip.add(MaterialEIO.PULSATING_IRON.vChemicalFormula); + } + else if (event.itemStack == mDarkIron){ + event.toolTip.add(Materials.DarkSteel.mChemicalFormula); + } + else if (event.itemStack == mSoularium){ + event.toolTip.add(MaterialEIO.SOULARIUM.vChemicalFormula); + } + } + } + + catch (ClassNotFoundException e) { + } + + + } + } + + } + +} diff --git a/src/Java/gtPlusPlus/xmod/eio/material/MaterialEIO.java b/src/Java/gtPlusPlus/xmod/eio/material/MaterialEIO.java new file mode 100644 index 0000000000..1bcc0a3c1f --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/eio/material/MaterialEIO.java @@ -0,0 +1,118 @@ +package gtPlusPlus.xmod.eio.material; + +import gtPlusPlus.core.material.ALLOY; +import gtPlusPlus.core.material.ELEMENT; +import gtPlusPlus.core.material.Material; +import gtPlusPlus.core.material.MaterialStack; +import gtPlusPlus.core.material.NONMATERIAL; +import gtPlusPlus.core.material.state.MaterialState; + +public class MaterialEIO { + + public static final Material SOULARIUM = new Material( + "Soularium", //Material Name + MaterialState.SOLID, //State + new short[]{95,90,54, 0}, //Material Colour + -1, //Melting Point in C + -1, + -1, + -1, + false, //Uses Blast furnace? + //Material Stacks with Percentage of required elements. + new MaterialStack[]{ + new MaterialStack(ELEMENT.getInstance().GOLD, 1), + new MaterialStack(NONMATERIAL.SOULSAND, 1) + }); + + public static final Material CONDUCTIVE_IRON = new Material( + "Conductive Iron", //Material Name + MaterialState.SOLID, //State + new short[]{164,109,100, 0}, //Material Colour + -1, //Melting Point in C + -1, + -1, + -1, + false, //Uses Blast furnace? + //Material Stacks with Percentage of required elements. + new MaterialStack[]{ + new MaterialStack(ELEMENT.getInstance().IRON, 1), + new MaterialStack(NONMATERIAL.REDSTONE, 1) + }); + + public static final Material PULSATING_IRON = new Material( + "Pulsating Iron", //Material Name + MaterialState.SOLID, //State + new short[]{50,91,21, 0}, //Material Colour + -1, //Melting Point in C + -1, + -1, + -1, + false, //Uses Blast furnace? + //Material Stacks with Percentage of required elements. + new MaterialStack[]{ + new MaterialStack(ELEMENT.getInstance().IRON, 1), + new MaterialStack(NONMATERIAL.ENDERPEARL, 1) + }); + + public static final Material ELECTRICAL_STEEL = new Material( + "Electrical Steel", //Material Name + MaterialState.SOLID, //State + new short[]{194,194,194, 0}, //Material Colour + -1, //Melting Point in C + -1, + -1, + -1, + false, //Uses Blast furnace? + //Material Stacks with Percentage of required elements. + new MaterialStack[]{ + new MaterialStack(ALLOY.STEEL, 3), + new MaterialStack(ELEMENT.getInstance().SILICON, 1) + }); + + public static final Material ENERGETIC_ALLOY = new Material( + "Energetic Alloy", //Material Name + MaterialState.SOLID, //State + new short[]{252,151,45, 0}, //Material Colour + -1, //Melting Point in C + -1, + -1, + -1, + false, //Uses Blast furnace? + //Material Stacks with Percentage of required elements. + new MaterialStack[]{ + new MaterialStack(ELEMENT.getInstance().GOLD, 1), + new MaterialStack(NONMATERIAL.REDSTONE, 1), + new MaterialStack(NONMATERIAL.GLOWSTONE, 1) + }); + + public static final Material VIBRANT_ALLOY = new Material( + "Vibrant Alloy", //Material Name + MaterialState.SOLID, //State + new short[]{204,242,142, 0}, //Material Colour + -1, //Melting Point in C + -1, + -1, + -1, + false, //Uses Blast furnace? + //Material Stacks with Percentage of required elements. + new MaterialStack[]{ + new MaterialStack(ENERGETIC_ALLOY, 1), + new MaterialStack(NONMATERIAL.ENDERPEARL, 1) + }); + + public static final Material REDSTONE_ALLOY = new Material( + "Redstone Alloy", //Material Name + MaterialState.SOLID, //State + new short[]{178,34,34, 0}, //Material Colour + -1, //Melting Point in C + -1, + -1, + -1, + false, //Uses Blast furnace? + //Material Stacks with Percentage of required elements. + new MaterialStack[]{ + new MaterialStack(ELEMENT.getInstance().SILICON, 1), + new MaterialStack(NONMATERIAL.REDSTONE, 1) + }); + +} |