Refactoring for translation

This commit is contained in:
drcrazy 2017-09-08 02:03:35 +03:00
parent 8a8205b4b1
commit ab1802ba5e
48 changed files with 240 additions and 118 deletions

View file

@ -33,7 +33,7 @@ import net.minecraft.util.*;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.text.TextComponentString;
import net.minecraft.util.text.TextFormatting;
import net.minecraft.util.text.translation.I18n;
import net.minecraft.client.resources.I18n;
import net.minecraft.world.World;
import net.minecraftforge.common.DimensionManager;
import net.minecraftforge.fml.relauncher.Side;
@ -81,13 +81,13 @@ public class ItemFrequencyTransmitter extends ItemTR {
if (!world.isRemote) {
ChatUtils.sendNoSpamMessages(MessageIDs.freqTransmitterID, new TextComponentString(
TextFormatting.GRAY + I18n.translateToLocal("techreborn.message.setTo") + " X: " +
TextFormatting.GRAY + I18n.format("techreborn.message.setTo") + " X: " +
TextFormatting.GOLD + pos.getX() +
TextFormatting.GRAY + " Y: " +
TextFormatting.GOLD + pos.getY() +
TextFormatting.GRAY + " Z: " +
TextFormatting.GOLD + pos.getZ() +
TextFormatting.GRAY + " " + I18n.translateToLocal("techreborn.message.in") + " " +
TextFormatting.GRAY + " " + I18n.format("techreborn.message.in") + " " +
TextFormatting.GOLD + DimensionManager.getProviderType(world.provider.getDimension())
.getName() + " (" + world.provider.getDimension() + ")"));
}
@ -102,8 +102,8 @@ public class ItemFrequencyTransmitter extends ItemTR {
stack.setTagCompound(null);
if (!world.isRemote) {
ChatUtils.sendNoSpamMessages(MessageIDs.freqTransmitterID, new TextComponentString(
TextFormatting.GRAY + I18n.translateToLocal("techreborn.message.coordsHaveBeen") + " "
+ TextFormatting.GOLD + I18n.translateToLocal("techreborn.message.cleared")));
TextFormatting.GRAY + I18n.format("techreborn.message.coordsHaveBeen") + " "
+ TextFormatting.GOLD + I18n.format("techreborn.message.cleared")));
}
}
@ -123,7 +123,7 @@ public class ItemFrequencyTransmitter extends ItemTR {
list.add(TextFormatting.DARK_GRAY + DimensionManager.getProviderType(dim).getName());
} else {
list.add(TextFormatting.GRAY + I18n.translateToLocal("techreborn.message.noCoordsSet"));
list.add(TextFormatting.GRAY + I18n.format("techreborn.message.noCoordsSet"));
}
}
@ -145,7 +145,7 @@ public class ItemFrequencyTransmitter extends ItemTR {
int coordDim = stack.getTagCompound().getInteger("dim");
text = grey + "X: " + gold + coordX + grey + " Y: " + gold + coordY + grey + " Z: " + gold + coordZ + grey + " Dim: " + gold + DimensionManager.getProviderType(coordDim).getName() + " (" + coordDim + ")";
} else {
text = grey + I18n.translateToLocal("techreborn.message.noCoordsSet");
text = grey + I18n.format("techreborn.message.noCoordsSet");
}
}
return text;

View file

@ -34,9 +34,6 @@ import techreborn.events.TRRecipeHandler;
*/
public class ItemTRArmour extends ItemArmor {
private ArmorMaterial material = ArmorMaterial.LEATHER;
private EntityEquipmentSlot slot = EntityEquipmentSlot.HEAD;
public ItemTRArmour(ArmorMaterial material, EntityEquipmentSlot slot) {
super(material, material.getDamageReductionAmount(slot), slot);
if (slot == EntityEquipmentSlot.HEAD)

View file

@ -59,7 +59,6 @@ public class ItemCloakingDevice extends ItemTR implements IEnergyItemInfo, IEner
public static int MaxCharge = ConfigTechReborn.CloakingDeviceCharge;
public static int Limit = 100;
public static boolean isActive;
private int armorType = 1;
public ItemCloakingDevice() {
setUnlocalizedName("techreborn.cloakingdevice");

View file

@ -122,7 +122,6 @@ public class ItemJackhammer extends ItemPickaxe implements IEnergyItemInfo, IEne
return transferLimit;
}
@SuppressWarnings({ "rawtypes", "unchecked" })
@SideOnly(Side.CLIENT)
@Override
public void getSubItems(CreativeTabs par2CreativeTabs, NonNullList<ItemStack> itemList) {

View file

@ -40,7 +40,7 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.*;
import net.minecraft.util.text.TextComponentString;
import net.minecraft.util.text.TextFormatting;
import net.minecraft.util.text.translation.I18n;
import net.minecraft.client.resources.I18n;
import net.minecraft.world.World;
import net.minecraftforge.common.capabilities.ICapabilityProvider;
import net.minecraftforge.fml.relauncher.Side;
@ -141,9 +141,9 @@ public class ItemNanosaber extends ItemSword implements IEnergyItemInfo, IEnergy
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4) {
if (stack.getTagCompound() == null || !stack.getTagCompound().getBoolean("isActive")) {
list.add(TextFormatting.GRAY + I18n.translateToLocal("techreborn.message.nanosaberInactive"));
list.add(TextFormatting.GRAY + I18n.format("techreborn.message.nanosaberInactive"));
} else {
list.add(TextFormatting.GRAY + I18n.translateToLocal("techreborn.message.nanosaberActive"));
list.add(TextFormatting.GRAY + I18n.format("techreborn.message.nanosaberActive"));
}
}
@ -154,9 +154,9 @@ public class ItemNanosaber extends ItemSword implements IEnergyItemInfo, IEnergy
if (player.isSneaking()) {
if (!PoweredItem.canUseEnergy(this.cost, stack)) {
ChatUtils.sendNoSpamMessages(MessageIDs.nanosaberID, new TextComponentString(
TextFormatting.GRAY + I18n.translateToLocal("techreborn.message.nanosaberEnergyErrorTo") + " "
TextFormatting.GRAY + I18n.format("techreborn.message.nanosaberEnergyErrorTo") + " "
+ TextFormatting.GOLD + I18n
.translateToLocal("techreborn.message.nanosaberActivate")));
.format("techreborn.message.nanosaberActivate")));
} else {
if (stack.getTagCompound() == null || !stack.getTagCompound().getBoolean("isActive")) {
if (stack.getTagCompound() == null) {
@ -165,17 +165,17 @@ public class ItemNanosaber extends ItemSword implements IEnergyItemInfo, IEnergy
stack.getTagCompound().setBoolean("isActive", true);
if (world.isRemote) {
ChatUtils.sendNoSpamMessages(MessageIDs.nanosaberID, new TextComponentString(
TextFormatting.GRAY + I18n.translateToLocal("techreborn.message.setTo") + " "
TextFormatting.GRAY + I18n.format("techreborn.message.setTo") + " "
+ TextFormatting.GOLD + I18n
.translateToLocal("techreborn.message.nanosaberActive")));
.format("techreborn.message.nanosaberActive")));
}
} else {
stack.getTagCompound().setBoolean("isActive", false);
if (world.isRemote) {
ChatUtils.sendNoSpamMessages(MessageIDs.nanosaberID, new TextComponentString(
TextFormatting.GRAY + I18n.translateToLocal("techreborn.message.setTo") + " "
TextFormatting.GRAY + I18n.format("techreborn.message.setTo") + " "
+ TextFormatting.GOLD + I18n
.translateToLocal("techreborn.message.nanosaberInactive")));
.format("techreborn.message.nanosaberInactive")));
}
}
}
@ -188,9 +188,9 @@ public class ItemNanosaber extends ItemSword implements IEnergyItemInfo, IEnergy
public void onUpdate(ItemStack stack, World worldIn, Entity entityIn, int itemSlot, boolean isSelected) {
if (stack.getTagCompound() != null && stack.getTagCompound().getBoolean("isActive") && !PoweredItem.canUseEnergy(cost, stack)) {
ChatUtils.sendNoSpamMessages(MessageIDs.nanosaberID, new TextComponentString(
TextFormatting.GRAY + I18n.translateToLocal("techreborn.message.nanosaberEnergyError") + " "
TextFormatting.GRAY + I18n.format("techreborn.message.nanosaberEnergyError") + " "
+ TextFormatting.GOLD + I18n
.translateToLocal("techreborn.message.nanosaberDeactivating")));
.format("techreborn.message.nanosaberDeactivating")));
stack.getTagCompound().setBoolean("isActive", false);
}
}

View file

@ -31,7 +31,7 @@ import net.minecraft.util.ActionResult;
import net.minecraft.util.EnumActionResult;
import net.minecraft.util.EnumHand;
import net.minecraft.util.text.TextFormatting;
import net.minecraft.util.text.translation.I18n;
import net.minecraft.client.resources.I18n;
import net.minecraft.world.World;
import techreborn.Core;
import techreborn.client.EGui;
@ -58,6 +58,6 @@ public class ItemTechManual extends ItemTR {
@Override
public void addInformation(final ItemStack stack, final World world, final List<String> tooltip, ITooltipFlag flag) {
tooltip.add(TextFormatting.RED + I18n.translateToLocal("tooltip.wip"));
tooltip.add(TextFormatting.RED + I18n.format("tooltip.wip"));
}
}