diff options
Diffstat (limited to 'src/Java/gtPlusPlus/core/item/base')
| -rw-r--r-- | src/Java/gtPlusPlus/core/item/base/dusts/BaseItemDustUnique.java | 124 | ||||
| -rw-r--r-- | src/Java/gtPlusPlus/core/item/base/plates/BaseItemPlate_OLD.java | 54 |
2 files changed, 57 insertions, 121 deletions
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); + } } |
