diff options
Diffstat (limited to 'src/Java')
8 files changed, 176 insertions, 82 deletions
diff --git a/src/Java/gtPlusPlus/core/item/ModItems.java b/src/Java/gtPlusPlus/core/item/ModItems.java index 072a3f428b..f1055a2723 100644 --- a/src/Java/gtPlusPlus/core/item/ModItems.java +++ b/src/Java/gtPlusPlus/core/item/ModItems.java @@ -11,7 +11,7 @@ import gtPlusPlus.core.item.base.dusts.decimal.BaseItemCentidust; import gtPlusPlus.core.item.base.dusts.decimal.BaseItemDecidust; import gtPlusPlus.core.item.base.foods.BaseItemFood; import gtPlusPlus.core.item.base.foods.BaseItemHotFood; -import gtPlusPlus.core.item.base.ingots.BaseItemIngot; +import gtPlusPlus.core.item.base.ingots.BaseItemIngotOLD; import gtPlusPlus.core.item.base.plates.BaseItemPlate; import gtPlusPlus.core.item.effects.RarityUncommon; import gtPlusPlus.core.item.general.*; @@ -183,6 +183,8 @@ public final class ModItems { private static Item dustCalciumSulfate; + private static BaseItemPlate itemPlateClay; + //@SuppressWarnings("unused") @@ -190,7 +192,7 @@ public final class ModItems { public static final void init(){ //Default item used when recipes fail, handy for debugging. - AAA_Broken = new BaseItemIngot("AAA_Broken", "Errors - Tell Alkalus", Utils.rgbtoHexValue(128, 128, 128), 0); + AAA_Broken = new BaseItemIngotOLD("AAA_Broken", "Errors - Tell Alkalus", Utils.rgbtoHexValue(128, 128, 128), 0); //Debug Loading if (CORE.DEBUG){ @@ -455,6 +457,8 @@ public final class ModItems { itemBaseCentidust = UtilsItems.generateCentidust(m);*/ } } + + itemPlateClay = new BaseItemPlate(MaterialUtils.generateMaterialFromGtENUM(Materials.Clay)); //EnderIO Resources if (LoadedMods.EnderIO || LOAD_ALL_CONTENT){ diff --git a/src/Java/gtPlusPlus/core/item/base/BaseItemComponent.java b/src/Java/gtPlusPlus/core/item/base/BaseItemComponent.java index 068ac0acf5..5d3244ff58 100644 --- a/src/Java/gtPlusPlus/core/item/base/BaseItemComponent.java +++ b/src/Java/gtPlusPlus/core/item/base/BaseItemComponent.java @@ -69,7 +69,7 @@ public class BaseItemComponent extends Item{ @SuppressWarnings({ "unchecked", "rawtypes" }) @Override - public void addInformation(ItemStack stack, EntityPlayer aPlayer, List list, boolean bool) { + public final void addInformation(ItemStack stack, EntityPlayer aPlayer, List list, boolean bool) { if (materialName != null && materialName != "" && !materialName.equals("") && componentMaterial != null){ @@ -111,7 +111,9 @@ public class BaseItemComponent extends Item{ //list.add(EnumChatFormatting.GRAY+"A " + materialName + " Ring."); } if (componentMaterial != null){ + if (!componentMaterial.vChemicalFormula.equals("??")) list.add(componentMaterial.vChemicalFormula); + if (componentMaterial.isRadioactive){ list.add(CORE.GT_Tooltip_Radioactive); } @@ -145,6 +147,7 @@ public class BaseItemComponent extends Item{ public static enum ComponentTypes { DUST("Dust", " Dust", "dust"), INGOT("Ingot", " Ingot", "ingot"), + HOTINGOT("HotIngot", " Hot Ingot", "ingotHot"), PLATE("Plate", " Plate", "plate"), PLATEDOUBLE("PlateDouble", " Double Plate", "plateDouble"), ROD("Rod", " Rod", "stick"), diff --git a/src/Java/gtPlusPlus/core/item/base/dusts/BaseItemDustUnique.java b/src/Java/gtPlusPlus/core/item/base/dusts/BaseItemDustUnique.java index 88e11f7307..fee8861d64 100644 --- a/src/Java/gtPlusPlus/core/item/base/dusts/BaseItemDustUnique.java +++ b/src/Java/gtPlusPlus/core/item/base/dusts/BaseItemDustUnique.java @@ -24,6 +24,7 @@ public class BaseItemDustUnique extends Item{ protected String materialName; protected String pileType; String name = ""; + String chemicalNotation = ""; public BaseItemDustUnique(String unlocalizedName, String materialName, int colour, String pileSize) { setUnlocalizedName(unlocalizedName); @@ -36,6 +37,7 @@ public class BaseItemDustUnique extends Item{ this.setCreativeTab(tabMisc); this.colour = colour; this.materialName = materialName; + this.chemicalNotation = MaterialUtils.subscript(materialName); this.sRadiation = ItemUtils.getRadioactivityLevel(materialName); GameRegistry.registerItem(this, unlocalizedName); @@ -69,13 +71,13 @@ public class BaseItemDustUnique extends Item{ public String getItemStackDisplayName(ItemStack iStack) { if (getUnlocalizedName().contains("DustTiny")){ - name = "Tiny Pile of "+MaterialUtils.subscript(materialName) + " Dust"; + name = "Tiny Pile of "+materialName+ " Dust"; } else if (getUnlocalizedName().contains("DustSmall")){ - name = "Small Pile of "+MaterialUtils.subscript(materialName) + " Dust"; + name = "Small Pile of "+materialName+ " Dust"; } else { - name = MaterialUtils.subscript(materialName) + " Dust"; + name = materialName+ " Dust"; } return name; } @@ -91,8 +93,43 @@ public class BaseItemDustUnique extends Item{ if (sRadiation > 0){ list.add(CORE.GT_Tooltip_Radioactive); } + if (containsSubScript(chemicalNotation)){ + list.add(chemicalNotation); + } super.addInformation(stack, aPlayer, list, bool); } + + static boolean containsSubScript(String s){ + if (s.contains(MaterialUtils.superscript("1"))) return true; + if (s.contains(MaterialUtils.superscript("2"))) return true; + if (s.contains(MaterialUtils.superscript("3"))) return true; + if (s.contains(MaterialUtils.superscript("4"))) return true; + if (s.contains(MaterialUtils.superscript("5"))) return true; + if (s.contains(MaterialUtils.superscript("6"))) return true; + if (s.contains(MaterialUtils.superscript("7"))) return true; + if (s.contains(MaterialUtils.superscript("8"))) return true; + if (s.contains(MaterialUtils.superscript("9"))) return true; + if (s.contains(MaterialUtils.subscript("1"))) return true; + if (s.contains(MaterialUtils.subscript("2"))) return true; + if (s.contains(MaterialUtils.subscript("3"))) return true; + if (s.contains(MaterialUtils.subscript("4"))) return true; + if (s.contains(MaterialUtils.subscript("5"))) return true; + if (s.contains(MaterialUtils.subscript("6"))) return true; + if (s.contains(MaterialUtils.subscript("7"))) return true; + if (s.contains(MaterialUtils.subscript("8"))) return true; + if (s.contains(MaterialUtils.subscript("9"))) return true; + String r = MaterialUtils.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 MaterialUtils.subscript(materialName); diff --git a/src/Java/gtPlusPlus/core/item/base/ingots/BaseItemIngot.java b/src/Java/gtPlusPlus/core/item/base/ingots/BaseItemIngot.java index 64beb4de4a..a2b5bff7f4 100644 --- a/src/Java/gtPlusPlus/core/item/base/ingots/BaseItemIngot.java +++ b/src/Java/gtPlusPlus/core/item/base/ingots/BaseItemIngot.java @@ -1,67 +1,26 @@ package gtPlusPlus.core.item.base.ingots; 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.item.base.BaseItemComponent; +import gtPlusPlus.core.material.Material; import gtPlusPlus.core.util.Utils; -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.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.world.World; -import cpw.mods.fml.common.registry.GameRegistry; -public class BaseItemIngot extends Item{ +public class BaseItemIngot extends BaseItemComponent{ - protected int colour; - protected String materialName; - protected String unlocalName; + protected final String materialName; + protected final String unlocalName; - public BaseItemIngot(String unlocalizedName, String materialName, int colour, int sRadioactivity) { - setUnlocalizedName(unlocalizedName); - this.setCreativeTab(AddToCreativeTab.tabMisc); - this.setUnlocalizedName(unlocalizedName); - this.unlocalName = unlocalizedName; - this.setMaxStackSize(64); - this.setTextureName(CORE.MODID + ":" + "itemIngot"); - this.setMaxStackSize(64); - this.colour = colour; - this.materialName = materialName; - this.sRadiation = sRadioactivity; - GameRegistry.registerItem(this, unlocalizedName); - String temp = ""; - if (unlocalName.contains("itemIngot")){ - temp = unlocalName.replace("itemI", "i"); - } - else if (unlocalName.contains("itemHotIngot")){ - temp = unlocalName.replace("itemHotIngot", "ingotHot"); - } - if (temp != null && temp != ""){ - GT_OreDictUnificator.registerOre(temp, ItemUtils.getSimpleStack(this)); - } - generateCompressorRecipe(); + public BaseItemIngot(Material material) { + this(material, ComponentTypes.INGOT); } - - @Override - public String getItemStackDisplayName(ItemStack p_77653_1_) { - - return (materialName+ " Ingot"); - } - - public final String getMaterialName() { - return materialName; - } - - @Override - public int getColorFromItemStack(ItemStack stack, int HEX_OxFFFFFF) { - if (colour == 0){ - return MathUtils.generateSingularRandomHexValue(); - } - return colour; - + + public BaseItemIngot(Material material, ComponentTypes type) { + super(material, type); + this.materialName = material.getLocalizedName(); + this.unlocalName = material.getUnlocalizedName(); + generateCompressorRecipe(); } private void generateCompressorRecipe(){ @@ -91,10 +50,4 @@ public class BaseItemIngot extends Item{ } - - protected final int sRadiation; - @Override - public void onUpdate(ItemStack iStack, World world, Entity entityHolding, int p_77663_4_, boolean p_77663_5_) { - EntityUtils.applyRadiationDamageToEntity(sRadiation, world, entityHolding); - } } diff --git a/src/Java/gtPlusPlus/core/item/base/ingots/BaseItemIngotHot.java b/src/Java/gtPlusPlus/core/item/base/ingots/BaseItemIngotHot.java index 096fae94df..a122589c9d 100644 --- a/src/Java/gtPlusPlus/core/item/base/ingots/BaseItemIngotHot.java +++ b/src/Java/gtPlusPlus/core/item/base/ingots/BaseItemIngotHot.java @@ -2,6 +2,7 @@ package gtPlusPlus.core.item.base.ingots; import gregtech.api.enums.GT_Values; import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.material.Material; import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.item.ItemUtils; import net.minecraft.entity.Entity; @@ -16,17 +17,16 @@ public class BaseItemIngotHot extends BaseItemIngot{ private int tickCounterMax = 200; private int mTier; - public BaseItemIngotHot(String unlocalizedName, String materialName, ItemStack coldIngot, int tier) { - super(unlocalizedName, materialName, Utils.rgbtoHexValue(225, 225, 225), 0); + public BaseItemIngotHot(Material material) { + super(material, ComponentTypes.HOTINGOT); this.setTextureName(CORE.MODID + ":" + "itemIngotHot"); - this.outputIngot = coldIngot; - this.mTier = tier; + this.outputIngot = material.getIngot(1); + this.mTier = material.vTier; generateRecipe(); } @Override public String getItemStackDisplayName(ItemStack p_77653_1_) { - return ("Hot "+materialName+ " Ingot"); } @@ -37,9 +37,7 @@ public class BaseItemIngotHot extends BaseItemIngot{ private void generateRecipe(){ Utils.LOG_WARNING("Adding Vacuum Freezer recipe for a Hot Ingot of "+materialName+"."); - GT_Values.RA.addVacuumFreezerRecipe(ItemUtils.getSimpleStack(this), outputIngot.copy(), 60*mTier); - - + GT_Values.RA.addVacuumFreezerRecipe(ItemUtils.getSimpleStack(this), outputIngot.copy(), 60*mTier); } @Override @@ -52,8 +50,8 @@ public class BaseItemIngotHot extends BaseItemIngot{ entityHolding.attackEntityFrom(DamageSource.onFire, 1); tickCounter = 0; } - super.onUpdate(iStack, world, entityHolding, p_77663_4_, p_77663_5_); } + super.onUpdate(iStack, world, entityHolding, p_77663_4_, p_77663_5_); } diff --git a/src/Java/gtPlusPlus/core/item/base/ingots/BaseItemIngotOLD.java b/src/Java/gtPlusPlus/core/item/base/ingots/BaseItemIngotOLD.java new file mode 100644 index 0000000000..20e72f2a64 --- /dev/null +++ b/src/Java/gtPlusPlus/core/item/base/ingots/BaseItemIngotOLD.java @@ -0,0 +1,100 @@ +package gtPlusPlus.core.item.base.ingots; + +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.entity.EntityUtils; +import gtPlusPlus.core.util.item.ItemUtils; +import gtPlusPlus.core.util.math.MathUtils; +import net.minecraft.entity.Entity; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.world.World; +import cpw.mods.fml.common.registry.GameRegistry; + +public class BaseItemIngotOLD extends Item{ + + protected int colour; + protected String materialName; + protected String unlocalName; + + public BaseItemIngotOLD(String unlocalizedName, String materialName, int colour, int sRadioactivity) { + setUnlocalizedName(unlocalizedName); + this.setCreativeTab(AddToCreativeTab.tabMisc); + this.setUnlocalizedName(unlocalizedName); + this.unlocalName = unlocalizedName; + this.setMaxStackSize(64); + this.setTextureName(CORE.MODID + ":" + "itemIngot"); + this.setMaxStackSize(64); + this.colour = colour; + this.materialName = materialName; + this.sRadiation = sRadioactivity; + GameRegistry.registerItem(this, unlocalizedName); + String temp = ""; + if (unlocalName.contains("itemIngot")){ + temp = unlocalName.replace("itemI", "i"); + } + else if (unlocalName.contains("itemHotIngot")){ + temp = unlocalName.replace("itemHotIngot", "ingotHot"); + } + if (temp != null && temp != ""){ + GT_OreDictUnificator.registerOre(temp, ItemUtils.getSimpleStack(this)); + } + generateCompressorRecipe(); + } + + @Override + public String getItemStackDisplayName(ItemStack p_77653_1_) { + + return (materialName+ " Ingot"); + } + + public final String getMaterialName() { + return materialName; + } + + @Override + public int getColorFromItemStack(ItemStack stack, int HEX_OxFFFFFF) { + if (colour == 0){ + return MathUtils.generateSingularRandomHexValue(); + } + return colour; + + } + + private void generateCompressorRecipe(){ + if (unlocalName.contains("itemIngot")){ + ItemStack tempStack = ItemUtils.getSimpleStack(this, 9); + ItemStack tempOutput = null; + String temp = getUnlocalizedName().replace("item.itemIngot", "block"); + Utils.LOG_WARNING("Unlocalized name for OreDict nameGen: "+getUnlocalizedName()); + if (getUnlocalizedName().contains("item.")){ + temp = getUnlocalizedName().replace("item.", ""); + Utils.LOG_WARNING("Generating OreDict Name: "+temp); + } + temp = temp.replace("itemIngot", "block"); + Utils.LOG_WARNING("Generating OreDict Name: "+temp); + if (temp != null && temp != ""){ + tempOutput = ItemUtils.getItemStackOfAmountFromOreDict(temp, 1); + if (tempOutput != null){ + GT_ModHandler.addCompressionRecipe(tempStack, tempOutput); + } + + } + } + else if (unlocalName.contains("itemHotIngot")){ + return; + } + + + } + + + protected final int sRadiation; + @Override + public void onUpdate(ItemStack iStack, World world, Entity entityHolding, int p_77663_4_, boolean p_77663_5_) { + EntityUtils.applyRadiationDamageToEntity(sRadiation, world, entityHolding); + } +} diff --git a/src/Java/gtPlusPlus/core/material/MaterialGenerator.java b/src/Java/gtPlusPlus/core/material/MaterialGenerator.java index eb70191d78..97ad8e7ad3 100644 --- a/src/Java/gtPlusPlus/core/material/MaterialGenerator.java +++ b/src/Java/gtPlusPlus/core/material/MaterialGenerator.java @@ -49,7 +49,7 @@ public class MaterialGenerator { Item temp; Block tempBlock; tempBlock = new BlockBaseModular(unlocalizedName, materialName,BlockTypes.STANDARD, Colour); - temp = new BaseItemIngot("itemIngot"+unlocalizedName, materialName, Colour, sRadiation); + temp = new BaseItemIngot(matInfo); temp = new BaseItemDust("itemDust"+unlocalizedName, materialName, matInfo, Colour, "Dust", materialTier, sRadiation); temp = new BaseItemDust("itemDustTiny"+unlocalizedName, materialName, matInfo, Colour, "Tiny", materialTier, sRadiation); @@ -65,10 +65,9 @@ public class MaterialGenerator { Block tempBlock; tempBlock = new BlockBaseModular(unlocalizedName, materialName,BlockTypes.STANDARD, Colour); tempBlock = new BlockBaseModular(unlocalizedName, materialName,BlockTypes.FRAME, Colour); - temp = new BaseItemIngot("itemIngot"+unlocalizedName, materialName, Colour, sRadiation); + temp = new BaseItemIngot(matInfo); if (hotIngot){ - Item tempIngot = temp; - temp = new BaseItemIngotHot("itemHotIngot"+unlocalizedName, materialName, ItemUtils.getSimpleStack(tempIngot, 1), materialTier); + temp = new BaseItemIngotHot(matInfo); } temp = new BaseItemDust("itemDust"+unlocalizedName, materialName, matInfo, Colour, "Dust", materialTier, sRadiation); temp = new BaseItemDust("itemDustTiny"+unlocalizedName, materialName, matInfo, Colour, "Tiny", materialTier, sRadiation); @@ -88,7 +87,7 @@ public class MaterialGenerator { Item temp; Block tempBlock; tempBlock = new BlockBaseModular(unlocalizedName, materialName,BlockTypes.STANDARD, Colour); - temp = new BaseItemIngot("itemIngot"+unlocalizedName, materialName, Colour, sRadiation); + temp = new BaseItemIngot(matInfo); temp = new BaseItemDust("itemDust"+unlocalizedName, materialName, matInfo, Colour, "Dust", materialTier, sRadiation); temp = new BaseItemDust("itemDustTiny"+unlocalizedName, materialName, matInfo, Colour, "Tiny", materialTier, sRadiation); temp = new BaseItemDust("itemDustSmall"+unlocalizedName, materialName, matInfo, Colour, "Small", materialTier, sRadiation); @@ -122,7 +121,7 @@ public class MaterialGenerator { Block tempBlock; tempBlock = new BlockBaseModular(unlocalizedName, materialName,BlockTypes.STANDARD, Colour); - temp = new BaseItemIngot("itemIngot"+unlocalizedName, materialName, Colour, sRadiation); + temp = new BaseItemIngot(matInfo); temp = new BaseItemDust("itemDust"+unlocalizedName, materialName, matInfo, Colour, "Dust", 3, sRadiation); temp = new BaseItemDust("itemDustTiny"+unlocalizedName, materialName, matInfo, Colour, "Tiny", 2, sRadiation); temp = new BaseItemDust("itemDustSmall"+unlocalizedName, materialName, matInfo, Colour, "Small", 1, sRadiation); diff --git a/src/Java/gtPlusPlus/core/util/materials/MaterialUtils.java b/src/Java/gtPlusPlus/core/util/materials/MaterialUtils.java index 58ce45f43c..5d219f72b0 100644 --- a/src/Java/gtPlusPlus/core/util/materials/MaterialUtils.java +++ b/src/Java/gtPlusPlus/core/util/materials/MaterialUtils.java @@ -50,7 +50,7 @@ public class MaterialUtils { long protons = material.getProtons(); long neutrons = material.getNeutrons(); boolean blastFurnace = material.mBlastFurnaceRequired; - String chemicalFormula = material.mChemicalFormula; + String chemicalFormula = MaterialUtils.subscript(material.mChemicalFormula); Element element = material.mElement; int radioactivity = 0; if (material.isRadioactive()){ |