diff options
| author | iouter <62897714+iouter@users.noreply.github.com> | 2023-01-31 02:48:02 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-01-30 19:48:02 +0100 |
| commit | dc1421b0e6c18b83193b228edc4cea2c4312415f (patch) | |
| tree | c206c0fe1a9acbe5f1205014589561f8a3412ac1 /src/main/java/gtPlusPlus/core/item | |
| parent | a32aee4dce706f11682eedd69671bd462b2ab676 (diff) | |
| download | GT5-Unofficial-dc1421b0e6c18b83193b228edc4cea2c4312415f.tar.gz GT5-Unofficial-dc1421b0e6c18b83193b228edc4cea2c4312415f.tar.bz2 GT5-Unofficial-dc1421b0e6c18b83193b228edc4cea2c4312415f.zip | |
make almost all hardcoded items localizable (#521)
* make almost all hardcoded items localizable
* sa
Diffstat (limited to 'src/main/java/gtPlusPlus/core/item')
33 files changed, 285 insertions, 475 deletions
diff --git a/src/main/java/gtPlusPlus/core/item/ModItems.java b/src/main/java/gtPlusPlus/core/item/ModItems.java index 9c843943a4..e9bb6e1bf6 100644 --- a/src/main/java/gtPlusPlus/core/item/ModItems.java +++ b/src/main/java/gtPlusPlus/core/item/ModItems.java @@ -722,8 +722,8 @@ public final class ModItems { shardDull = new BaseItemTCShard( "Drained", Utils.rgbtoHexValue(75, 75, 75), - "Can be infused to create a magical shard.", - "Obtained from Mining Stone/SandStone, Chopping Logs or Shovelling Dirt."); + new String[] { "Can be infused to create a magical shard.", + "Obtained from Mining Stone/SandStone, Chopping Logs or Shovelling Dirt." }); // Generates four elemental shards when TC is not installed. if (!LoadedMods.Thaumcraft) { diff --git a/src/main/java/gtPlusPlus/core/item/base/BaseEuItem.java b/src/main/java/gtPlusPlus/core/item/base/BaseEuItem.java index 154c1652ce..2b057ae416 100644 --- a/src/main/java/gtPlusPlus/core/item/base/BaseEuItem.java +++ b/src/main/java/gtPlusPlus/core/item/base/BaseEuItem.java @@ -15,6 +15,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.IIcon; +import net.minecraft.util.StatCollector; import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.relauncher.Side; @@ -101,12 +102,9 @@ public class BaseEuItem extends Item implements ISpecialElectricItem, IElectricI public void registerItem(final int id, final String localizedName, final long euStorage, final short tier, final String description, final EnumRarity regRarity, final EnumChatFormatting colour, final boolean Effect) { - this.addItem(id, localizedName, EnumChatFormatting.YELLOW + "Electric", new Object[] {}); + this.addItem(id, localizedName, colour + description, new Object[] {}); this.setElectricStats(this.mOffset + id, euStorage, GT_Values.V[tier], tier, -3L, true); this.rarity.add(new Pair<>(id, regRarity)); - this.itemName.add(new Pair<>(id, localizedName)); - this.itemDescription.add(new Pair<>(id, description)); - this.descColour.add(new Pair<>(id, colour)); this.hasEffect.add(new Pair<>(id, Effect)); } @@ -131,40 +129,34 @@ public class BaseEuItem extends Item implements ISpecialElectricItem, IElectricI @Override public void addInformation(final ItemStack aStack, final EntityPlayer aPlayer, List aList, final boolean aF3_H) { // aList.add("Meta: "+(aStack.getItemDamage()-mOffset)); - if ((this.descColour.get(aStack.getItemDamage() - this.mOffset) != null) - && (this.itemDescription.get(aStack.getItemDamage() - this.mOffset) != null)) { - aList.add( - this.descColour.get(aStack.getItemDamage() - this.mOffset).getValue() - + this.itemDescription.get(aStack.getItemDamage() - this.mOffset).getValue()); - } - final String tKey = this.getUnlocalizedName(aStack) + ".tooltip", + int keyValue = aStack.getItemDamage() - this.mOffset; + final String tKey = "gtplusplus." + this.getUnlocalizedName(aStack) + "." + keyValue + ".tooltip", tString = GT_LanguageManager.getTranslation(tKey); if (GT_Utility.isStringValid(tString) && !tKey.equals(tString)) { aList.add(tString); } + aList.add(StatCollector.translateToLocal("item.itemBaseEuItem.tooltip.0")); final Long[] tStats = this.getElectricStats(aStack); if (tStats != null) { if (tStats[3] > 0) { aList.add( - EnumChatFormatting.AQUA + "Contains " - + GT_Utility.formatNumbers(tStats[3]) - + " EU Tier: " - + (tStats[2] >= 0 ? tStats[2] : 0) - + EnumChatFormatting.GRAY); + EnumChatFormatting.AQUA + StatCollector.translateToLocalFormatted( + "item.itemBaseEuItem.tooltip.1", + GT_Utility.formatNumbers(tStats[3]), + (tStats[2] >= 0 ? tStats[2] : 0)) + EnumChatFormatting.GRAY); } else { final long tCharge = this.getRealCharge(aStack); if ((tStats[3] == -2) && (tCharge <= 0)) { aList.add( - EnumChatFormatting.AQUA + "Empty. You should recycle it properly." + EnumChatFormatting.AQUA + StatCollector.translateToLocal("item.itemBaseEuItem.tooltip.2") + EnumChatFormatting.GRAY); } else { aList.add( - EnumChatFormatting.AQUA + "" - + GT_Utility.formatNumbers(tCharge) - + " / " - + GT_Utility.formatNumbers(Math.abs(tStats[0])) - + " EU - Voltage: " - + V[(int) (tStats[2] >= 0 ? tStats[2] < V.length ? tStats[2] : V.length - 1 : 1)] + EnumChatFormatting.AQUA + StatCollector.translateToLocalFormatted( + "item.itemBaseEuItem.tooltip.3", + GT_Utility.formatNumbers(tCharge), + GT_Utility.formatNumbers(Math.abs(tStats[0])), + V[(int) (tStats[2] >= 0 ? tStats[2] < V.length ? tStats[2] : V.length - 1 : 1)]) + EnumChatFormatting.GRAY); } } @@ -561,8 +553,12 @@ public class BaseEuItem extends Item implements ISpecialElectricItem, IElectricI final ItemStack rStack = new ItemStack(this, 1, this.mOffset + aID); this.mEnabledItems.set(aID); this.mVisibleItems.set(aID); - GT_LanguageManager.addStringLocalization(this.getUnlocalizedName(rStack) + ".name", aEnglish); - GT_LanguageManager.addStringLocalization(this.getUnlocalizedName(rStack) + ".tooltip", aToolTip); + GT_LanguageManager.addStringLocalization( + "gtplusplus." + this.getUnlocalizedName(rStack) + "." + aID + ".name", + aEnglish); + GT_LanguageManager.addStringLocalization( + "gtplusplus." + this.getUnlocalizedName(rStack) + "." + aID + ".tooltip", + aToolTip); final List<TC_AspectStack> tAspects = new ArrayList<>(); // Important Stuff to do first for (final Object tRandomData : aRandomData) { @@ -621,9 +617,10 @@ public class BaseEuItem extends Item implements ISpecialElectricItem, IElectricI @Override public String getItemStackDisplayName(final ItemStack par1ItemStack) { int keyValue = (par1ItemStack.getItemDamage() - this.mOffset); - if (keyValue < 0 || keyValue > 3) { + if (keyValue < 0 || keyValue > 5) { keyValue = 0; } - return this.itemName.get(keyValue).getValue(); + return GT_LanguageManager + .getTranslation("gtplusplus." + this.getUnlocalizedName(par1ItemStack) + "." + keyValue + ".name"); } } diff --git a/src/main/java/gtPlusPlus/core/item/base/BaseItemBackpack.java b/src/main/java/gtPlusPlus/core/item/base/BaseItemBackpack.java index 27f7d51bbd..ef27a4fa02 100644 --- a/src/main/java/gtPlusPlus/core/item/base/BaseItemBackpack.java +++ b/src/main/java/gtPlusPlus/core/item/base/BaseItemBackpack.java @@ -67,18 +67,6 @@ public class BaseItemBackpack extends Item { } @Override - public String getItemStackDisplayName(final ItemStack p_77653_1_) { - // Name Formatting. - String temp = this.unlocalName.replace("backpack", ""); - // Lets find the colour. - if (temp.toLowerCase().contains("dark")) { - temp = this.unlocalName.substring(12, this.unlocalName.length()); - temp = "Dark " + temp; - } - return (temp + " Backpack"); - } - - @Override @SideOnly(Side.CLIENT) public void registerIcons(final IIconRegister iconRegister) { this.itemIcon = iconRegister.registerIcon(CORE.MODID + ":" + "itemBackpack"); diff --git a/src/main/java/gtPlusPlus/core/item/base/BaseItemColourable.java b/src/main/java/gtPlusPlus/core/item/base/BaseItemColourable.java index 9e5a995a80..5b935d8234 100644 --- a/src/main/java/gtPlusPlus/core/item/base/BaseItemColourable.java +++ b/src/main/java/gtPlusPlus/core/item/base/BaseItemColourable.java @@ -12,14 +12,13 @@ import net.minecraft.util.EnumChatFormatting; import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import gregtech.api.util.GT_LanguageManager; import gtPlusPlus.core.lib.CORE; public class BaseItemColourable extends Item { private final EnumRarity rarity; private final EnumChatFormatting descColour; - private final String itemDescription; - protected String itemName; private final boolean hasEffect; public final int componentColour; @@ -42,7 +41,7 @@ public class BaseItemColourable extends Item { this.setMaxDamage(maxDmg); this.setHasSubtypes(true); this.rarity = regRarity; - this.itemDescription = description; + GT_LanguageManager.addStringLocalization("gtplusplus." + this.getUnlocalizedName() + ".tooltip", description); this.descColour = colour; this.hasEffect = Effect; this.componentColour = rgb; @@ -57,13 +56,13 @@ public class BaseItemColourable extends Item { final int stackSize, final int maxDmg, final String description, final EnumRarity regRarity, final EnumChatFormatting colour, final boolean Effect, int rgb) { this.setUnlocalizedName(unlocalizedName); - this.itemName = displayName; + GT_LanguageManager.addStringLocalization("gtplusplus." + this.getUnlocalizedName() + ".name", displayName); this.setTextureName(CORE.MODID + ":" + unlocalizedName); this.setCreativeTab(creativeTab); this.setMaxStackSize(stackSize); this.setMaxDamage(maxDmg); this.rarity = regRarity; - this.itemDescription = description; + GT_LanguageManager.addStringLocalization("gtplusplus." + this.getUnlocalizedName() + ".tooltip", description); this.descColour = colour; this.hasEffect = Effect; this.componentColour = rgb; @@ -73,7 +72,9 @@ public class BaseItemColourable extends Item { @SuppressWarnings({ "unchecked", "rawtypes" }) @Override public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) { - list.add(this.descColour + this.itemDescription); + list.add( + this.descColour + + GT_LanguageManager.getTranslation("gtplusplus." + this.getUnlocalizedName() + ".tooltip")); // super.addInformation(stack, aPlayer, list, bool); } @@ -90,9 +91,9 @@ public class BaseItemColourable extends Item { @Override public String getItemStackDisplayName(final ItemStack tItem) { - if ((this.itemName == null) || this.itemName.equals("")) { - return super.getItemStackDisplayName(tItem); - } - return this.itemName; + if (!("gtplusplus." + this.getUnlocalizedName() + ".name") + .equals(GT_LanguageManager.getTranslation("gtplusplus." + this.getUnlocalizedName() + ".name"))) { + return GT_LanguageManager.getTranslation("gtplusplus." + this.getUnlocalizedName() + ".name"); + } else return super.getItemStackDisplayName(tItem); } } diff --git a/src/main/java/gtPlusPlus/core/item/base/BaseItemComponent.java b/src/main/java/gtPlusPlus/core/item/base/BaseItemComponent.java index 414a280f3d..ec1fc44e76 100644 --- a/src/main/java/gtPlusPlus/core/item/base/BaseItemComponent.java +++ b/src/main/java/gtPlusPlus/core/item/base/BaseItemComponent.java @@ -126,16 +126,7 @@ public class BaseItemComponent extends Item { ItemUtils.getSimpleStack(this)); registerComponent(); - String aFormattedLangName = componentType.getName(); - if (!aFormattedLangName.startsWith(" ")) { - if (aFormattedLangName.contains("@")) { - String[] aSplit = aFormattedLangName.split("@"); - aFormattedLangName = aSplit[0] + " %material " + aSplit[1]; - } - } - if (aFormattedLangName.equals(componentType.getName())) { - aFormattedLangName = "%material" + aFormattedLangName; - } + String aFormattedLangName = componentType.getName().replace("@", "%material"); GT_LanguageManager.addStringLocalization("gtplusplus.item." + this.unlocalName + ".name", aFormattedLangName); } @@ -413,30 +404,30 @@ public class BaseItemComponent extends Item { public static enum ComponentTypes { - DUST("Dust", " Dust", "dust", OrePrefixes.dust), - DUSTSMALL("DustSmall", "Small Pile of@Dust", "dustSmall", OrePrefixes.dustSmall), - DUSTTINY("DustTiny", "Tiny Pile of@Dust", "dustTiny", OrePrefixes.dustTiny), - INGOT("Ingot", " Ingot", "ingot", OrePrefixes.ingot), - HOTINGOT("HotIngot", "Hot@Ingot", "ingotHot", OrePrefixes.ingotHot), - PLATE("Plate", " Plate", "plate", OrePrefixes.plate), - PLATEDOUBLE("PlateDouble", "Double@Plate", "plateDouble", OrePrefixes.plateDouble), - ROD("Rod", " Rod", "stick", OrePrefixes.stick), - RODLONG("RodLong", "Long@Rod", "stickLong", OrePrefixes.stickLong), - GEAR("Gear", " Gear", "gearGt", OrePrefixes.gearGt), - SMALLGEAR("SmallGear", "Small@Gear", "gearGtSmall", OrePrefixes.gearGtSmall), // TODO - SCREW("Screw", " Screw", "screw", OrePrefixes.screw), - BOLT("Bolt", " Bolt", "bolt", OrePrefixes.bolt), - ROTOR("Rotor", " Rotor", "rotor", OrePrefixes.rotor), - RING("Ring", " Ring", "ring", OrePrefixes.ring), - FOIL("Foil", " Foil", "foil", OrePrefixes.foil), - PLASMACELL("CellPlasma", " Plasma Cell", "cellPlasma", OrePrefixes.cellPlasma), - CELL("Cell", " Cell", "cell", OrePrefixes.cell), - NUGGET("Nugget", " Nugget", "nugget", OrePrefixes.nugget), - PLATEHEAVY("HeavyPlate", "Heavy@Plate", "plateHeavy", OrePrefixes.plateQuadruple), - SPRING("Spring", " Spring", "spring", OrePrefixes.spring), - SMALLSPRING("SmallSpring", "Small@Spring", "springSmall", OrePrefixes.springSmall), - FINEWIRE("FineWire", "Fine@Wire", "wireFine", OrePrefixes.wireFine), - PLATEDENSE("PlateDense", "Dense@Plate", "plateDense", OrePrefixes.plateDense),; + DUST("Dust", "@ Dust", "dust", OrePrefixes.dust), + DUSTSMALL("DustSmall", "Small Pile of @ Dust", "dustSmall", OrePrefixes.dustSmall), + DUSTTINY("DustTiny", "Tiny Pile of @ Dust", "dustTiny", OrePrefixes.dustTiny), + INGOT("Ingot", "@ Ingot", "ingot", OrePrefixes.ingot), + HOTINGOT("HotIngot", "Hot @ Ingot", "ingotHot", OrePrefixes.ingotHot), + PLATE("Plate", "@ Plate", "plate", OrePrefixes.plate), + PLATEDOUBLE("PlateDouble", "Double @ Plate", "plateDouble", OrePrefixes.plateDouble), + ROD("Rod", "@ Rod", "stick", OrePrefixes.stick), + RODLONG("RodLong", "Long @ Rod", "stickLong", OrePrefixes.stickLong), + GEAR("Gear", "@ Gear", "gearGt", OrePrefixes.gearGt), + SMALLGEAR("SmallGear", "Small @ Gear", "gearGtSmall", OrePrefixes.gearGtSmall), // TODO + SCREW("Screw", "@ Screw", "screw", OrePrefixes.screw), + BOLT("Bolt", "@ Bolt", "bolt", OrePrefixes.bolt), + ROTOR("Rotor", "@ Rotor", "rotor", OrePrefixes.rotor), + RING("Ring", "@ Ring", "ring", OrePrefixes.ring), + FOIL("Foil", "@ Foil", "foil", OrePrefixes.foil), + PLASMACELL("CellPlasma", "@ Plasma Cell", "cellPlasma", OrePrefixes.cellPlasma), + CELL("Cell", "@ Cell", "cell", OrePrefixes.cell), + NUGGET("Nugget", "@ Nugget", "nugget", OrePrefixes.nugget), + PLATEHEAVY("HeavyPlate", "Heavy @ Plate", "plateHeavy", OrePrefixes.plateQuadruple), + SPRING("Spring", "@ Spring", "spring", OrePrefixes.spring), + SMALLSPRING("SmallSpring", "Small @ Spring", "springSmall", OrePrefixes.springSmall), + FINEWIRE("FineWire", "Fine @ Wire", "wireFine", OrePrefixes.wireFine), + PLATEDENSE("PlateDense", "Dense @ Plate", "plateDense", OrePrefixes.plateDense),; private String COMPONENT_NAME; private String DISPLAY_NAME; diff --git a/src/main/java/gtPlusPlus/core/item/base/BaseItemTCShard.java b/src/main/java/gtPlusPlus/core/item/base/BaseItemTCShard.java index 1e4a104b65..1714278cd1 100644 --- a/src/main/java/gtPlusPlus/core/item/base/BaseItemTCShard.java +++ b/src/main/java/gtPlusPlus/core/item/base/BaseItemTCShard.java @@ -6,10 +6,10 @@ import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumChatFormatting; import net.minecraft.world.World; import cpw.mods.fml.common.registry.GameRegistry; +import gregtech.api.util.GT_LanguageManager; import gregtech.api.util.GT_OreDictUnificator; import gtPlusPlus.core.creative.AddToCreativeTab; import gtPlusPlus.core.lib.CORE; @@ -20,27 +20,24 @@ public class BaseItemTCShard extends Item { public final String unlocalName; public final String displayName; - public final String descriptionString; - public final String descriptionString2; public final int itemColour; public BaseItemTCShard(final String DisplayName, final int colour) { - this(DisplayName, colour, ""); + this(DisplayName, colour, null); } - public BaseItemTCShard(final String DisplayName, final int colour, final String Description) { - this(DisplayName, colour, "", Description); - } - - public BaseItemTCShard(final String DisplayName, final int colour, final String Description, - final String Description2) { + public BaseItemTCShard(final String DisplayName, final int colour, final String[] Description) { this.unlocalName = "item" + Utils.sanitizeString(DisplayName); this.displayName = DisplayName; this.itemColour = colour; - this.descriptionString = Description; - this.descriptionString2 = Description2; this.setCreativeTab(AddToCreativeTab.tabMisc); this.setUnlocalizedName(this.unlocalName); + if (Description != null) { + for (int i = 0; i < Description.length; i++) { + GT_LanguageManager + .addStringLocalization("gtplusplus." + getUnlocalizedName() + ".tooltip." + i, Description[i]); + } + } this.setMaxStackSize(64); this.setTextureName(CORE.MODID + ":" + "itemShard"); GameRegistry.registerItem(this, this.unlocalName); @@ -48,19 +45,15 @@ public class BaseItemTCShard extends Item { GT_OreDictUnificator.registerOre("gemInfused" + DisplayName, ItemUtils.getSimpleStack(this)); } - @Override - public String getItemStackDisplayName(final ItemStack p_77653_1_) { - return (this.displayName + " Shard"); - } - @SuppressWarnings({ "unchecked", "rawtypes" }) @Override public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) { - if ((this.descriptionString != "") || !this.descriptionString.equals("")) { - list.add(EnumChatFormatting.GRAY + this.descriptionString); - } - if ((this.descriptionString2 != "") || !this.descriptionString2.equals("")) { - list.add(EnumChatFormatting.GRAY + this.descriptionString2); + for (int i = 0;; i++) { + String tooltip = GT_LanguageManager + .getTranslation("gtplusplus." + this.getUnlocalizedName() + ".tooltip" + "." + i); + if (!("gtplusplus." + this.getUnlocalizedName() + ".tooltip" + "." + i).equals(tooltip)) { + list.add(tooltip); + } else break; } } diff --git a/src/main/java/gtPlusPlus/core/item/base/CoreItem.java b/src/main/java/gtPlusPlus/core/item/base/CoreItem.java index 2cf0e4510d..516fdea294 100644 --- a/src/main/java/gtPlusPlus/core/item/base/CoreItem.java +++ b/src/main/java/gtPlusPlus/core/item/base/CoreItem.java @@ -14,6 +14,7 @@ import net.minecraft.world.World; import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import gregtech.api.util.GT_LanguageManager; import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.util.minecraft.ItemUtils; @@ -22,7 +23,6 @@ public class CoreItem extends Item { private final EnumRarity rarity; private final EnumChatFormatting descColour; - private final String[] itemDescription; protected String itemName; private final boolean hasEffect; @@ -182,7 +182,7 @@ public class CoreItem extends Item { this.setMaxStackSize(stackSize); this.setMaxDamage(maxDmg); this.rarity = regRarity; - this.itemDescription = description; + this.setItemDescription(description); this.descColour = colour != null ? colour : EnumChatFormatting.RESET; this.hasEffect = Effect; this.turnsInto = OverrideItem; @@ -203,7 +203,7 @@ public class CoreItem extends Item { this.setMaxStackSize(stackSize); this.setMaxDamage(maxDmg); this.rarity = regRarity; - this.itemDescription = description; + this.setItemDescription(description); this.descColour = colour != null ? colour : EnumChatFormatting.RESET; this.hasEffect = Effect; this.turnsInto = OverrideItem; @@ -213,10 +213,12 @@ public class CoreItem extends Item { @SuppressWarnings({ "unchecked", "rawtypes" }) @Override public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) { - if (this.itemDescription.length > 0) { - for (int u = 0; u < this.itemDescription.length; u++) { - list.add(this.descColour + this.itemDescription[u]); - } + for (int i = 0;; i++) { + String tooltip = GT_LanguageManager + .getTranslation("gtplusplus." + this.getUnlocalizedName() + ".tooltip" + "." + i); + if (!("gtplusplus." + this.getUnlocalizedName() + ".tooltip" + "." + i).equals(tooltip)) { + list.add(tooltip); + } else break; } // list.add(this.descColour+this.itemDescription); // super.addInformation(stack, aPlayer, list, bool); @@ -271,6 +273,13 @@ public class CoreItem extends Item { return ItemUtils.getSimpleStack(this); } + public void setItemDescription(String[] description) { + for (int i = 0; i < description.length; i++) { + GT_LanguageManager.addStringLocalization( + "gtplusplus." + this.getUnlocalizedName() + ".tooltip" + "." + i, + description[i]); + } + } /* * @Override public String getItemStackDisplayName(final ItemStack tItem) { if ((this.itemName == null) || * this.itemName.equals("")) { return super.getItemStackDisplayName(tItem); } return this.itemName; } diff --git a/src/main/java/gtPlusPlus/core/item/base/cell/BaseItemPlasmaCell.java b/src/main/java/gtPlusPlus/core/item/base/cell/BaseItemPlasmaCell.java index 655d8c431f..8e9c00143a 100644 --- a/src/main/java/gtPlusPlus/core/item/base/cell/BaseItemPlasmaCell.java +++ b/src/main/java/gtPlusPlus/core/item/base/cell/BaseItemPlasmaCell.java @@ -58,11 +58,6 @@ public class BaseItemPlasmaCell extends BaseItemComponent { } @Override - public String getItemStackDisplayName(final ItemStack cell) { - return this.materialName + " Plasma Cell"; - } - - @Override public void onUpdate(final ItemStack iStack, final World world, final Entity entityHolding, final int p_77663_4_, final boolean p_77663_5_) { if (this.componentMaterial != null) { diff --git a/src/main/java/gtPlusPlus/core/item/base/dusts/BaseItemDustUnique.java b/src/main/java/gtPlusPlus/core/item/base/dusts/BaseItemDustUnique.java index 8d90228bca..4fc3c6936d 100644 --- a/src/main/java/gtPlusPlus/core/item/base/dusts/BaseItemDustUnique.java +++ b/src/main/java/gtPlusPlus/core/item/base/dusts/BaseItemDustUnique.java @@ -12,6 +12,7 @@ import net.minecraft.item.ItemStack; import cpw.mods.fml.common.registry.GameRegistry; import gregtech.api.enums.OrePrefixes; +import gregtech.api.util.GT_LanguageManager; import gregtech.api.util.GT_OreDictUnificator; import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.lib.CORE; @@ -25,7 +26,6 @@ public class BaseItemDustUnique extends Item { 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, @@ -49,13 +49,15 @@ public class BaseItemDustUnique extends Item { this.sRadiation = ItemUtils.getRadioactivityLevel(materialName); GameRegistry.registerItem(this, unlocalizedName); + String type; if (this.getUnlocalizedName().contains("DustTiny")) { - this.name = "Tiny Pile of " + this.materialName + " Dust"; + type = "Tiny Pile of %material Dust"; } else if (this.getUnlocalizedName().contains("DustSmall")) { - this.name = "Small Pile of " + this.materialName + " Dust"; + type = "Small Pile of %material Dust"; } else { - this.name = this.materialName + " Dust"; + type = "%material Dust"; } + GT_LanguageManager.addStringLocalization("gtplusplus." + this.getUnlocalizedName() + ".name", type); String temp = ""; Logger.WARNING("Unlocalized name for OreDict nameGen: " + this.getUnlocalizedName()); @@ -107,7 +109,8 @@ public class BaseItemDustUnique extends Item { @Override public String getItemStackDisplayName(final ItemStack iStack) { - return this.name; + return GT_LanguageManager.getTranslation("gtplusplus." + getUnlocalizedName() + ".name") + .replace("%material", GT_LanguageManager.getTranslation("gtplusplus.material." + materialName)); } private String getCorrectTexture(final String pileSize) { diff --git a/src/main/java/gtPlusPlus/core/item/base/foods/BaseItemFood.java b/src/main/java/gtPlusPlus/core/item/base/foods/BaseItemFood.java index b9d5011f94..95f2a1d41d 100644 --- a/src/main/java/gtPlusPlus/core/item/base/foods/BaseItemFood.java +++ b/src/main/java/gtPlusPlus/core/item/base/foods/BaseItemFoo |
