Some work towards simplifying localizations

This commit is contained in:
pahimar 2013-08-25 18:12:29 -04:00
parent 99ad639678
commit dc5ea61288
18 changed files with 105 additions and 22 deletions

View file

@ -19,7 +19,6 @@ import com.pahimar.ee3.core.handlers.EntityLivingHandler;
import com.pahimar.ee3.core.handlers.FuelHandler;
import com.pahimar.ee3.core.handlers.InterModCommsHandler;
import com.pahimar.ee3.core.handlers.ItemEventHandler;
import com.pahimar.ee3.core.handlers.LocalizationHandler;
import com.pahimar.ee3.core.handlers.PlayerDestroyItemHandler;
import com.pahimar.ee3.core.handlers.VersionCheckTickHandler;
import com.pahimar.ee3.core.handlers.WorldTransmutationHandler;
@ -72,15 +71,19 @@ public class EquivalentExchange3 {
@SidedProxy(clientSide = Reference.CLIENT_PROXY_CLASS, serverSide = Reference.SERVER_PROXY_CLASS)
public static CommonProxy proxy;
public static CreativeTabs tabsEE3 = new CreativeTabEE3(
CreativeTabs.getNextID(), Reference.MOD_ID);
public static CreativeTabs tabsEE3 = new CreativeTabEE3(CreativeTabs.getNextID(), Reference.MOD_ID);
@EventHandler
public void invalidFingerprint(FMLFingerprintViolationEvent event) {
// Report (log) to the user that the version of Equivalent Exchange 3
// they are using has been changed/tampered with
LogHelper.severe(Strings.INVALID_FINGERPRINT_MESSAGE);
if (Reference.FINGERPRINT.equals("@FINGERPRINT@")) {
LogHelper.warning(Strings.NO_FINGERPRINT_MESSAGE);
}
else {
LogHelper.severe(Strings.INVALID_FINGERPRINT_MESSAGE);
}
}
@EventHandler
@ -97,7 +100,7 @@ public class EquivalentExchange3 {
LogHelper.init();
// Load the localization files into the LanguageRegistry
LocalizationHandler.loadLanguages();
//LocalizationHandler.loadLanguages();
// Initialize the configuration
ConfigurationHandler.init(new File(event.getModConfigurationDirectory()

View file

@ -42,6 +42,18 @@ public class BlockAlchemicalChest extends BlockEE {
this.setBlockBounds(0.0625F, 0.0F, 0.0625F, 0.9375F, 0.875F, 0.9375F);
this.setCreativeTab(EquivalentExchange3.tabsEE3);
}
@Override
public String getUnlocalizedName() {
StringBuilder unlocalizedName = new StringBuilder();
unlocalizedName.append("tile.");
unlocalizedName.append(Strings.RESOURCE_PREFIX);
unlocalizedName.append(Strings.ALCHEMICAL_CHEST_NAME);
return unlocalizedName.toString();
}
@Override
public TileEntity createNewTileEntity(World world) {

View file

@ -46,6 +46,18 @@ public class BlockAludelBase extends BlockEE {
this.setBlockBounds(0.0625F, 0.0F, 0.0625F, 0.9375F, 1.0F, 0.9375F);
this.setHardness(5F);
}
@Override
public String getUnlocalizedName() {
StringBuilder unlocalizedName = new StringBuilder();
unlocalizedName.append("tile.");
unlocalizedName.append(Strings.RESOURCE_PREFIX);
unlocalizedName.append(Strings.ALUDEL_NAME);
return unlocalizedName.toString();
}
@Override
public TileEntity createNewTileEntity(World world) {

View file

@ -42,6 +42,18 @@ public class BlockCalcinator extends BlockEE {
this.setHardness(5F);
this.setBlockBounds(0.1F, 0.0F, 0.1F, 0.9F, 1.0F, 0.9F);
}
@Override
public String getUnlocalizedName() {
StringBuilder unlocalizedName = new StringBuilder();
unlocalizedName.append("tile.");
unlocalizedName.append(Strings.RESOURCE_PREFIX);
unlocalizedName.append(Strings.CALCINATOR_NAME);
return unlocalizedName.toString();
}
@Override
public TileEntity createNewTileEntity(World world) {

View file

@ -40,7 +40,7 @@ public abstract class BlockEE extends BlockContainer {
protected String getUnwrappedUnlocalizedName(String unlocalizedName) {
return unlocalizedName.substring(unlocalizedName.indexOf(".") + 1);
return unlocalizedName.substring(unlocalizedName.indexOf(":") + 1);
}
/**

View file

@ -40,6 +40,18 @@ public class BlockGlassBell extends BlockEE {
this.setCreativeTab(EquivalentExchange3.tabsEE3);
this.setHardness(1.0F);
}
@Override
public String getUnlocalizedName() {
StringBuilder unlocalizedName = new StringBuilder();
unlocalizedName.append("tile.");
unlocalizedName.append(Strings.RESOURCE_PREFIX);
unlocalizedName.append(Strings.GLASS_BELL_NAME);
return unlocalizedName.toString();
}
@Override
public TileEntity createNewTileEntity(World world) {

View file

@ -25,4 +25,16 @@ public class BlockRedWaterFlowing extends BlockFlowing {
this.setCreativeTab(EquivalentExchange3.tabsEE3);
this.setUnlocalizedName(Strings.RED_WATER_FLOWING_NAME);
}
@Override
public String getUnlocalizedName() {
StringBuilder unlocalizedName = new StringBuilder();
unlocalizedName.append("tile.");
unlocalizedName.append(Strings.RESOURCE_PREFIX);
unlocalizedName.append(Strings.RED_WATER_FLOWING_NAME);
return unlocalizedName.toString();
}
}

View file

@ -26,4 +26,16 @@ public class BlockRedWaterStill extends BlockStationary {
this.setCreativeTab(EquivalentExchange3.tabsEE3);
this.disableStats();
}
@Override
public String getUnlocalizedName() {
StringBuilder unlocalizedName = new StringBuilder();
unlocalizedName.append("tile.");
unlocalizedName.append(Strings.RESOURCE_PREFIX);
unlocalizedName.append(Strings.RED_WATER_STILL_NAME);
return unlocalizedName.toString();
}
}

View file

@ -18,9 +18,9 @@ import cpw.mods.fml.relauncher.SideOnly;
*/
public class CreativeTabEE3 extends CreativeTabs {
public CreativeTabEE3(int par1, String par2Str) {
public CreativeTabEE3(int tabID, String tabLabel) {
super(par1, par2Str);
super(tabID, tabLabel);
}
@Override

View file

@ -11,7 +11,6 @@ import com.pahimar.ee3.EquivalentExchange3;
import com.pahimar.ee3.core.util.ItemUtil;
import com.pahimar.ee3.lib.Colours;
import com.pahimar.ee3.lib.GuiIds;
import com.pahimar.ee3.lib.Reference;
import com.pahimar.ee3.lib.Strings;
import com.pahimar.ee3.nbt.NBTHelper;
@ -37,7 +36,7 @@ public class ItemAlchemicalBag extends ItemEE {
public ItemAlchemicalBag(int id) {
super(id);
this.setUnlocalizedName(Strings.ALCHEMICAL_BAG_NAME);
this.setUnlocalizedName(Strings.RESOURCE_PREFIX + Strings.ALCHEMICAL_BAG_NAME);
this.setCreativeTab(EquivalentExchange3.tabsEE3);
}
@ -48,7 +47,7 @@ public class ItemAlchemicalBag extends ItemEE {
icons = new Icon[ALCHEMICAL_BAG_SUBTYPES.length];
for (int i = 0; i < ALCHEMICAL_BAG_SUBTYPES.length; ++i) {
icons[i] = iconRegister.registerIcon(Reference.MOD_ID.toLowerCase() + ":" + Strings.ALCHEMICAL_BAG_NAME + ALCHEMICAL_BAG_SUBTYPES[i]);
icons[i] = iconRegister.registerIcon(Strings.RESOURCE_PREFIX + Strings.ALCHEMICAL_BAG_NAME + ALCHEMICAL_BAG_SUBTYPES[i]);
}
}
@ -127,7 +126,7 @@ public class ItemAlchemicalBag extends ItemEE {
if (itemStack != null) {
if (!(itemStack.getItem() instanceof ItemAlchemicalBag))
// TODO Localize
throw new UnsupportedOperationException("Can\'t dye non-bags!");
throw new UnsupportedOperationException("Cannot dye non-bags!");
else {
ItemUtil.setColor(itemStack, color);
}

View file

@ -10,7 +10,6 @@ import net.minecraft.util.Icon;
import net.minecraft.util.MathHelper;
import com.pahimar.ee3.EquivalentExchange3;
import com.pahimar.ee3.lib.Reference;
import com.pahimar.ee3.lib.Strings;
import cpw.mods.fml.relauncher.Side;
@ -36,7 +35,6 @@ public class ItemAlchemicalDust extends ItemEE {
super(id);
this.setHasSubtypes(true);
this.setUnlocalizedName(Strings.ALCHEMICAL_DUST_NAME);
this.setCreativeTab(EquivalentExchange3.tabsEE3);
maxStackSize = 64;
}
@ -44,8 +42,15 @@ public class ItemAlchemicalDust extends ItemEE {
@Override
public String getUnlocalizedName(ItemStack itemStack) {
StringBuilder unlocalizedName = new StringBuilder();
int meta = MathHelper.clamp_int(itemStack.getItemDamage(), 0, 5);
return super.getUnlocalizedName() + ALCHEMICAL_DUST_NAMES[meta];
unlocalizedName.append("item.");
unlocalizedName.append(Strings.RESOURCE_PREFIX);
unlocalizedName.append(Strings.ALCHEMICAL_DUST_NAME);
unlocalizedName.append(ALCHEMICAL_DUST_NAMES[meta]);
return unlocalizedName.toString();
}
@Override
@ -66,7 +71,7 @@ public class ItemAlchemicalDust extends ItemEE {
icons = new Icon[ALCHEMICAL_DUST_NAMES.length];
for (int i = 0; i < ALCHEMICAL_DUST_NAMES.length; ++i) {
icons[i] = iconRegister.registerIcon(Reference.MOD_ID.toLowerCase() + ":" + Strings.ALCHEMICAL_DUST_NAME + ALCHEMICAL_DUST_NAMES[i]);
icons[i] = iconRegister.registerIcon(Strings.RESOURCE_PREFIX + Strings.ALCHEMICAL_DUST_NAME + ALCHEMICAL_DUST_NAMES[i]);
}
}

View file

@ -30,6 +30,6 @@ public class ItemEE extends Item {
@SideOnly(Side.CLIENT)
public void registerIcons(IconRegister iconRegister) {
itemIcon = iconRegister.registerIcon(Reference.MOD_ID.toLowerCase() + ":" + this.getUnlocalizedName().substring(this.getUnlocalizedName().indexOf(".") + 1));
itemIcon = iconRegister.registerIcon(this.getUnlocalizedName().substring(this.getUnlocalizedName().indexOf(".") + 1));
}
}

View file

@ -17,7 +17,7 @@ public class ItemInertStone extends ItemEE {
public ItemInertStone(int id) {
super(id);
this.setUnlocalizedName(Strings.INERT_STONE_NAME);
this.setUnlocalizedName(Strings.RESOURCE_PREFIX + Strings.INERT_STONE_NAME);
this.setCreativeTab(EquivalentExchange3.tabsEE3);
}
}

View file

@ -17,7 +17,7 @@ public class ItemMiniumShard extends ItemEE {
public ItemMiniumShard(int id) {
super(id);
this.setUnlocalizedName(Strings.MINIUM_SHARD_NAME);
this.setUnlocalizedName(Strings.RESOURCE_PREFIX + Strings.MINIUM_SHARD_NAME);
this.setCreativeTab(EquivalentExchange3.tabsEE3);
maxStackSize = 64;
}

View file

@ -30,7 +30,7 @@ public class ItemMiniumStone extends ItemEE
public ItemMiniumStone(int id) {
super(id);
this.setUnlocalizedName(Strings.MINIUM_STONE_NAME);
this.setUnlocalizedName(Strings.RESOURCE_PREFIX + Strings.MINIUM_STONE_NAME);
this.setCreativeTab(EquivalentExchange3.tabsEE3);
this.setMaxDamage(ConfigurationSettings.MINIUM_STONE_MAX_DURABILITY - 1);
}

View file

@ -36,7 +36,7 @@ public class ItemPhilosophersStone extends ItemEE
public ItemPhilosophersStone(int id) {
super(id);
this.setUnlocalizedName(Strings.PHILOSOPHERS_STONE_NAME);
this.setUnlocalizedName(Strings.RESOURCE_PREFIX + Strings.PHILOSOPHERS_STONE_NAME);
this.setCreativeTab(EquivalentExchange3.tabsEE3);
this.setMaxDamage(ConfigurationSettings.PHILOSOPHERS_STONE_MAX_DURABILITY - 1);
maxChargeLevel = 3;

View file

@ -15,8 +15,12 @@ public class Strings {
public static final String TRUE = "true";
public static final String FALSE = "false";
public static final String TOKEN_DELIMITER = ".";
/* Localization Prefixes */
public static final String RESOURCE_PREFIX = Reference.MOD_ID.toLowerCase() + ":";
/* Fingerprint check related constants */
public static final String NO_FINGERPRINT_MESSAGE = "The copy of Equivalent Exchange 3 that you are running is a development version of the mod, and as such may be unstable and/or incomplete.";
public static final String INVALID_FINGERPRINT_MESSAGE = "The copy of Equivalent Exchange 3 that you are running has been modified from the original, and unpredictable things may happen. Please consider re-downloading the original version of the mod.";
/* Version check related constants */

View file

@ -11,7 +11,7 @@
"x3n0ph0b3"
],
"credits": "By pahimar, based on Equivalent Exchange 1 & 2 by x3n0ph0b3",
"logoFile": "/mods/ee3/textures/logo/logo.png",
"logoFile": "/assets/ee3/textures/logo/logo.png",
"screenshots": [
],
"parent":"",