diff options
Diffstat (limited to 'src/Java')
-rw-r--r-- | src/Java/gtPlusPlus/core/item/ModItems.java | 14 | ||||
-rw-r--r-- | src/Java/gtPlusPlus/xmod/eio/handler/HandlerTooltip_EIO.java | 141 | ||||
-rw-r--r-- | src/Java/gtPlusPlus/xmod/eio/material/MaterialEIO.java | 56 |
3 files changed, 112 insertions, 99 deletions
diff --git a/src/Java/gtPlusPlus/core/item/ModItems.java b/src/Java/gtPlusPlus/core/item/ModItems.java index 7e53116920..3a816b457d 100644 --- a/src/Java/gtPlusPlus/core/item/ModItems.java +++ b/src/Java/gtPlusPlus/core/item/ModItems.java @@ -715,9 +715,9 @@ public final class ModItems { if (LoadedMods.Big_Reactors|| LOAD_ALL_CONTENT){ Utils.LOG_INFO("BigReactors Found - Loading Resources."); //Item Init - itemPlateBlutonium = ItemUtils.generateSpecialUsePlate("itemPlate"+"Blutonium", "Blutonium", new short[]{0, 0, 255}, 0); - itemPlateBlutonium = ItemUtils.generateSpecialUsePlate("itemPlate"+"Cyanite", "Cyanite", new short[]{0, 191, 255}, 0); - itemPlateLudicrite = ItemUtils.generateSpecialUsePlate("itemPlate"+"Ludicrite", "Ludicrite", new short[]{167, 5, 179}, 0); + itemPlateBlutonium = ItemUtils.generateSpecialUsePlate("Blutonium", "Blutonium", new short[]{0, 0, 255}, 0); + itemPlateBlutonium = ItemUtils.generateSpecialUsePlate("Cyanite", "Cyanite", new short[]{0, 191, 255}, 0); + itemPlateLudicrite = ItemUtils.generateSpecialUsePlate("Ludicrite", "Ludicrite", new short[]{167, 5, 179}, 0); } else { Utils.LOG_WARNING("BigReactors not Found - Skipping Resources."); @@ -729,7 +729,7 @@ public final class ModItems { //Item Init try { ItemUtils.getItemForOreDict("Thaumcraft:ItemResource", "ingotVoidMetal", "Void Metal Ingot", 16); - itemPlateVoidMetal = ItemUtils.generateSpecialUsePlate("itemPlate"+"Void", "Void", new short[]{82, 17, 82}, 0); + itemPlateVoidMetal = ItemUtils.generateSpecialUsePlate("Void", "Void", new short[]{82, 17, 82}, 0); GT_OreDictUnificator.registerOre("plateVoidMetal", new ItemStack(ModItems.itemPlateVoidMetal)); } catch (final NullPointerException e){ e.getClass(); @@ -744,7 +744,7 @@ public final class ModItems { if (LoadedMods.PneumaticCraft|| LOAD_ALL_CONTENT){ Utils.LOG_INFO("PneumaticCraft Found - Loading Resources."); //Item Init - itemPlateCompressedIron = ItemUtils.generateSpecialUsePlate("itemPlate"+"CompressedIron", "Compressed Iron", new short[]{128, 128, 128}, 0); + itemPlateCompressedIron = ItemUtils.generateSpecialUsePlate("CompressedIron", "Compressed Iron", new short[]{128, 128, 128}, 0); } else { Utils.LOG_WARNING("PneumaticCraft not Found - Skipping Resources."); @@ -766,7 +766,7 @@ public final class ModItems { if (LoadedMods.RFTools|| LOAD_ALL_CONTENT){ Utils.LOG_INFO("rfTools Found - Loading Resources."); //Item Init - itemPlateDimensionShard = ItemUtils.generateSpecialUsePlate("itemPlate"+"DimensionShard", "Dimensional Shard", new short[]{170, 230, 230}, 0); + itemPlateDimensionShard = ItemUtils.generateSpecialUsePlate("DimensionShard", "Dimensional Shard", new short[]{170, 230, 230}, 0); } else { Utils.LOG_WARNING("rfTools not Found - Skipping Resources."); @@ -798,7 +798,7 @@ public final class ModItems { //Special Item Handling Case if (configSwitches.enableAlternativeBatteryAlloy) { //ModItems.itemIngotBatteryAlloy = new BaseItemIngot("itemIngotBatteryAlloy", "Battery Alloy", new short[]{35, 228, 141}, 0); TODO - ModItems.itemPlateBatteryAlloy = ItemUtils.generateSpecialUsePlate("itemPlateBatteryAlloy", "Battery Alloy", new short[]{35, 228, 141}, 0); + ModItems.itemPlateBatteryAlloy = ItemUtils.generateSpecialUsePlate("BatteryAlloy", "Battery Alloy", new short[]{35, 228, 141}, 0); } diff --git a/src/Java/gtPlusPlus/xmod/eio/handler/HandlerTooltip_EIO.java b/src/Java/gtPlusPlus/xmod/eio/handler/HandlerTooltip_EIO.java index ae0ca232b7..820592a300 100644 --- a/src/Java/gtPlusPlus/xmod/eio/handler/HandlerTooltip_EIO.java +++ b/src/Java/gtPlusPlus/xmod/eio/handler/HandlerTooltip_EIO.java @@ -1,8 +1,11 @@ package gtPlusPlus.xmod.eio.handler; +import java.lang.reflect.Field; + import cpw.mods.fml.common.eventhandler.SubscribeEvent; import gregtech.api.enums.Materials; import gtPlusPlus.core.lib.LoadedMods; +import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.item.ItemUtils; import gtPlusPlus.core.util.reflect.ReflectionUtils; import gtPlusPlus.xmod.eio.material.MaterialEIO; @@ -29,88 +32,98 @@ public class HandlerTooltip_EIO { //Is the EIO Ingot Item null? //If it is, reflect in. - if (mIngot == null){ - Class<?> oMainClass; + if (mIngot == null){ try { - oMainClass = Class.forName("crazypants.enderio.EnderIO"); + Class<?> 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 (oMainClass != null && oIngotClass != null){ + + Field oAlloyField = oMainClass.getDeclaredField("itemAlloy"); + oAlloyField.setAccessible(true); + Object oAlloy = oAlloyField.get(oMainClass); + + if (oAlloy != null){ + if (oIngotClass.isInstance(oAlloy) || Item.class.isInstance(oAlloy)){ + mIngot = (Item) oAlloy; + } + + } + } } - if (mSoularium == null){ - mSoularium = ItemUtils.simpleMetaStack(mIngot, 7, 1); + catch (Throwable e) { } + } - try { - + try { + if (mIngot != null){ //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); + if (Class.forName("crazypants.enderio.material.ItemAlloy").isInstance(event.itemStack.getItem()) || event.itemStack.getUnlocalizedName().toLowerCase().contains("item.itemAlloy")){ + + //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 (mElectricalSteel == null){ + mElectricalSteel = ItemUtils.simpleMetaStack(mIngot, 0, 1); } - else if (event.itemStack == mEnergeticAlloy){ - event.toolTip.add(MaterialEIO.ENERGETIC_ALLOY.vChemicalFormula); + if (mEnergeticAlloy == null){ + mEnergeticAlloy = ItemUtils.simpleMetaStack(mIngot, 1, 1); } - else if (event.itemStack == mVibrantAlloy){ - event.toolTip.add(MaterialEIO.VIBRANT_ALLOY.vChemicalFormula); + if (mVibrantAlloy == null){ + mVibrantAlloy = ItemUtils.simpleMetaStack(mIngot, 2, 1); } - else if (event.itemStack == mRedstoneAlloy){ - event.toolTip.add(MaterialEIO.REDSTONE_ALLOY.vChemicalFormula); + if (mRedstoneAlloy == null){ + mRedstoneAlloy = ItemUtils.simpleMetaStack(mIngot, 3, 1); } - else if (event.itemStack == mConductiveIron){ - event.toolTip.add(MaterialEIO.CONDUCTIVE_IRON.vChemicalFormula); + if (mConductiveIron == null){ + mConductiveIron = ItemUtils.simpleMetaStack(mIngot, 4, 1); } - else if (event.itemStack == mPulsatingIron){ - event.toolTip.add(MaterialEIO.PULSATING_IRON.vChemicalFormula); + if (mPulsatingIron == null){ + mPulsatingIron = ItemUtils.simpleMetaStack(mIngot, 5, 1); } - else if (event.itemStack == mDarkIron){ - event.toolTip.add(Materials.DarkSteel.mChemicalFormula); + if (mDarkIron == null){ + mDarkIron = ItemUtils.simpleMetaStack(mIngot, 6, 1); } - else if (event.itemStack == mSoularium){ - event.toolTip.add(MaterialEIO.SOULARIUM.vChemicalFormula); + if (mSoularium == null){ + mSoularium = ItemUtils.simpleMetaStack(mIngot, 7, 1); } + + + //If stacks match, add a tooltip. + if (this.mIngot != null){ + if (event.itemStack.getItem() == this.mIngot){ + if (event.itemStack.getItemDamage() == 0){ + event.toolTip.add(MaterialEIO.ELECTRICAL_STEEL.vChemicalFormula); + } + else if (event.itemStack.getItemDamage() == 1){ + event.toolTip.add(MaterialEIO.ENERGETIC_ALLOY.vChemicalFormula); + } + else if (event.itemStack.getItemDamage() == 2){ + event.toolTip.add(MaterialEIO.VIBRANT_ALLOY.vChemicalFormula); + } + else if (event.itemStack.getItemDamage() == 3){ + event.toolTip.add(MaterialEIO.REDSTONE_ALLOY.vChemicalFormula); + } + else if (event.itemStack.getItemDamage() == 4){ + event.toolTip.add(MaterialEIO.CONDUCTIVE_IRON.vChemicalFormula); + } + else if (event.itemStack.getItemDamage() == 5){ + event.toolTip.add(MaterialEIO.PULSATING_IRON.vChemicalFormula); + } + else if (event.itemStack.getItemDamage() == 6){ + event.toolTip.add(Materials.DarkSteel.mChemicalFormula); + } + else if (event.itemStack.getItemDamage() == 7){ + event.toolTip.add(MaterialEIO.SOULARIUM.vChemicalFormula); + } + } + } } } - - catch (ClassNotFoundException e) { - } - - + } + catch (ClassNotFoundException e) { } } - } } diff --git a/src/Java/gtPlusPlus/xmod/eio/material/MaterialEIO.java b/src/Java/gtPlusPlus/xmod/eio/material/MaterialEIO.java index 1bcc0a3c1f..cdb04c9b45 100644 --- a/src/Java/gtPlusPlus/xmod/eio/material/MaterialEIO.java +++ b/src/Java/gtPlusPlus/xmod/eio/material/MaterialEIO.java @@ -13,10 +13,10 @@ public class MaterialEIO { "Soularium", //Material Name MaterialState.SOLID, //State new short[]{95,90,54, 0}, //Material Colour - -1, //Melting Point in C - -1, - -1, - -1, + 10, //Melting Point in C + 10, + 10, + 10, false, //Uses Blast furnace? //Material Stacks with Percentage of required elements. new MaterialStack[]{ @@ -28,10 +28,10 @@ public class MaterialEIO { "Conductive Iron", //Material Name MaterialState.SOLID, //State new short[]{164,109,100, 0}, //Material Colour - -1, //Melting Point in C - -1, - -1, - -1, + 10, //Melting Point in C + 10, + 10, + 10, false, //Uses Blast furnace? //Material Stacks with Percentage of required elements. new MaterialStack[]{ @@ -43,10 +43,10 @@ public class MaterialEIO { "Pulsating Iron", //Material Name MaterialState.SOLID, //State new short[]{50,91,21, 0}, //Material Colour - -1, //Melting Point in C - -1, - -1, - -1, + 10, //Melting Point in C + 10, + 10, + 10, false, //Uses Blast furnace? //Material Stacks with Percentage of required elements. new MaterialStack[]{ @@ -58,10 +58,10 @@ public class MaterialEIO { "Electrical Steel", //Material Name MaterialState.SOLID, //State new short[]{194,194,194, 0}, //Material Colour - -1, //Melting Point in C - -1, - -1, - -1, + 10, //Melting Point in C + 10, + 10, + 10, false, //Uses Blast furnace? //Material Stacks with Percentage of required elements. new MaterialStack[]{ @@ -73,10 +73,10 @@ public class MaterialEIO { "Energetic Alloy", //Material Name MaterialState.SOLID, //State new short[]{252,151,45, 0}, //Material Colour - -1, //Melting Point in C - -1, - -1, - -1, + 10, //Melting Point in C + 10, + 10, + 10, false, //Uses Blast furnace? //Material Stacks with Percentage of required elements. new MaterialStack[]{ @@ -89,10 +89,10 @@ public class MaterialEIO { "Vibrant Alloy", //Material Name MaterialState.SOLID, //State new short[]{204,242,142, 0}, //Material Colour - -1, //Melting Point in C - -1, - -1, - -1, + 10, //Melting Point in C + 10, + 10, + 10, false, //Uses Blast furnace? //Material Stacks with Percentage of required elements. new MaterialStack[]{ @@ -104,10 +104,10 @@ public class MaterialEIO { "Redstone Alloy", //Material Name MaterialState.SOLID, //State new short[]{178,34,34, 0}, //Material Colour - -1, //Melting Point in C - -1, - -1, - -1, + 10, //Melting Point in C + 10, + 10, + 10, false, //Uses Blast furnace? //Material Stacks with Percentage of required elements. new MaterialStack[]{ |