diff options
Diffstat (limited to 'src/Java/gtPlusPlus/core/item')
3 files changed, 72 insertions, 135 deletions
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); + } } |