From 45da67b0ceff0440805d865b0c3e7a41ef3fb695 Mon Sep 17 00:00:00 2001 From: Florian Kostenzer Date: Thu, 29 Jul 2021 23:04:15 +0200 Subject: [PATCH 1/3] Move all I18n calls LocalisationUtils and allow getItemStackDisplayName on servers --- .../api/block/machines/MachineItemBlock.java | 10 +++---- .../api/gui/widgets/ClickButtonWidget.java | 4 +-- .../api/gui/widgets/CycleButtonWidget.java | 6 ++-- .../gregtech/api/gui/widgets/LabelWidget.java | 4 +-- .../api/gui/widgets/SimpleTextWidget.java | 4 +-- .../api/gui/widgets/SliderWidget.java | 4 +-- .../gregtech/api/gui/widgets/TankWidget.java | 20 ++++++------- .../api/gui/widgets/ToggleButtonWidget.java | 4 +-- .../api/gui/widgets/tab/ItemTabInfo.java | 4 +-- .../items/materialitem/MaterialMetaItem.java | 1 - .../api/items/metaitem/ElectricStats.java | 4 +-- .../gregtech/api/items/metaitem/MetaItem.java | 17 ++++++----- .../api/items/toolitem/ToolMetaItem.java | 13 ++++----- .../SimpleGeneratorMetaTileEntity.java | 6 ++-- .../WorkableTieredMetaTileEntity.java | 6 ++-- .../block/material/ItemBlockMaterialPipe.java | 1 - .../java/gregtech/api/recipes/RecipeMap.java | 4 +-- .../api/recipes/machines/FuelRecipeMap.java | 7 ++--- .../BlastTemperatureProperty.java | 6 ++-- .../recipeproperties/DefaultProperty.java | 4 +-- .../unification/material/type/Material.java | 5 ++-- .../api/unification/ore/OrePrefix.java | 7 ++--- .../gregtech/api/util/LocalisationUtils.java | 28 +++++++++++++++++++ src/main/java/gregtech/common/MetaFluids.java | 7 ++--- .../gregtech/common/blocks/BlockWireCoil.java | 12 ++++---- .../common/blocks/CompressedItemBlock.java | 1 - .../common/blocks/FrameItemBlock.java | 1 - .../gregtech/common/blocks/OreItemBlock.java | 1 - .../gregtech/common/blocks/VariantBlock.java | 10 +++---- .../common/gui/widget/ItemListSlotWidget.java | 4 +-- .../java/gregtech/common/items/MetaItem1.java | 4 +-- .../AbstractMaterialPartBehavior.java | 9 +++--- .../items/behaviors/ColorSprayBehaviour.java | 8 ++++-- .../common/items/behaviors/FacadeItem.java | 4 +-- .../common/items/behaviors/HoeBehaviour.java | 4 +-- .../items/behaviors/IntCircuitBehaviour.java | 4 +-- .../items/behaviors/LighterBehaviour.java | 6 ++-- .../items/behaviors/ModeSwitchBehavior.java | 6 ++-- .../items/behaviors/PlungerBehaviour.java | 4 +-- .../items/behaviors/ScoopBehaviour.java | 4 +-- .../items/behaviors/SoftHammerBehaviour.java | 4 +-- .../ToggleEnergyConsumerBehavior.java | 4 +-- .../items/behaviors/TurbineRotorBehavior.java | 4 +-- .../items/behaviors/WrenchBehaviour.java | 4 +-- .../electric/MetaTileEntityAirCollector.java | 12 ++++---- .../electric/MetaTileEntityBatteryBuffer.java | 12 ++++---- .../electric/MetaTileEntityBlockBreaker.java | 8 +++--- .../electric/MetaTileEntityCharger.java | 8 +++--- .../electric/MetaTileEntityFisher.java | 10 +++---- .../electric/MetaTileEntityHull.java | 8 +++--- .../electric/MetaTileEntityItemCollector.java | 12 ++++---- .../electric/MetaTileEntityPump.java | 12 ++++---- .../electric/MetaTileEntityTransformer.java | 26 ++++++++--------- .../MetaTileEntityEnergyHatch.java | 12 ++++---- .../MetaTileEntityFluidHatch.java | 4 +-- .../multiblockpart/MetaTileEntityItemBus.java | 4 +-- .../steam/boiler/SteamBoiler.java | 4 +-- .../storage/MetaTileEntityChest.java | 4 +-- .../storage/MetaTileEntityQuantumChest.java | 10 +++---- .../storage/MetaTileEntityQuantumTank.java | 8 +++--- .../storage/MetaTileEntityTank.java | 8 +++--- .../common/pipelike/cable/ItemBlockCable.java | 8 +++--- .../fluidpipe/ItemBlockFluidPipe.java | 8 +++--- .../gregtech/common/tools/ToolHardHammer.java | 4 +-- .../gregtech/integration/jei/GTJeiPlugin.java | 4 +-- .../gregtech/integration/jei/GTOreInfo.java | 10 +++---- .../multiblock/MultiblockInfoCategory.java | 4 +-- .../jei/multiblock/MultiblockInfoPage.java | 4 +-- .../MultiblockInfoRecipeWrapper.java | 4 +-- .../jei/multiblock/infos/CokeOvenInfo.java | 4 +-- .../jei/multiblock/infos/CrackerUnitInfo.java | 4 +-- .../multiblock/infos/DieselEngineInfo.java | 4 +-- .../infos/DistillationTowerInfo.java | 6 ++-- .../infos/ElectricBlastFurnaceInfo.java | 4 +-- .../infos/ImplosionCompressorInfo.java | 4 +-- .../jei/multiblock/infos/LargeBoilerInfo.java | 4 +-- .../multiblock/infos/LargeTurbineInfo.java | 4 +-- .../multiblock/infos/MultiSmelterInfo.java | 4 +-- .../infos/PrimitiveBlastFurnaceInfo.java | 4 +-- .../multiblock/infos/PyrolyzeOvenInfo.java | 4 +-- .../multiblock/infos/VacuumFreezerInfo.java | 4 +-- .../jei/recipe/GTRecipeWrapper.java | 12 ++++---- .../jei/recipe/IntCircuitCategory.java | 4 +-- .../jei/recipe/fuel/GTFuelRecipeWrapper.java | 8 +++--- .../primitive/CokeOvenRecipeWrapper.java | 4 +-- .../jei/recipe/primitive/OreByProduct.java | 8 +++--- .../PrimitiveBlastRecipeWrapper.java | 4 +-- .../primitive/PrimitiveRecipeCategory.java | 4 +-- .../utils/CustomItemReturnRecipeWrapper.java | 4 +-- .../provider/TransformerInfoProvider.java | 1 - 90 files changed, 298 insertions(+), 283 deletions(-) create mode 100644 src/main/java/gregtech/api/util/LocalisationUtils.java diff --git a/src/main/java/gregtech/api/block/machines/MachineItemBlock.java b/src/main/java/gregtech/api/block/machines/MachineItemBlock.java index e114133c69..d7eb0cbea2 100644 --- a/src/main/java/gregtech/api/block/machines/MachineItemBlock.java +++ b/src/main/java/gregtech/api/block/machines/MachineItemBlock.java @@ -4,8 +4,8 @@ import gregtech.api.GregTechAPI; import gregtech.api.metatileentity.ITieredMetaTileEntity; import gregtech.api.metatileentity.MetaTileEntity; +import gregtech.api.util.LocalisationUtils; import net.minecraft.block.state.IBlockState; -import net.minecraft.client.resources.I18n; import net.minecraft.client.util.ITooltipFlag; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemBlock; @@ -75,8 +75,8 @@ public void addInformation(ItemStack stack, @Nullable World worldIn, List 1000L && tooltipHoverString != null) { - List hoverList = Arrays.asList(I18n.format(tooltipHoverString).split("/n")); + List hoverList = Arrays.asList(LocalisationUtils.format(tooltipHoverString).split("/n")); drawHoveringText(ItemStack.EMPTY, hoverList, 300, mouseX, mouseY); } } diff --git a/src/main/java/gregtech/api/gui/widgets/LabelWidget.java b/src/main/java/gregtech/api/gui/widgets/LabelWidget.java index c22a2f2753..f43fae426a 100644 --- a/src/main/java/gregtech/api/gui/widgets/LabelWidget.java +++ b/src/main/java/gregtech/api/gui/widgets/LabelWidget.java @@ -2,12 +2,12 @@ import gregtech.api.gui.IRenderContext; import gregtech.api.gui.Widget; +import gregtech.api.util.LocalisationUtils; import gregtech.api.util.Position; import gregtech.api.util.Size; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.client.resources.I18n; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -36,7 +36,7 @@ public LabelWidget(int xPosition, int yPosition, String text, int color, Object[ } private String getResultText() { - return I18n.format(text, formatting); + return LocalisationUtils.format(text, formatting); } private void recomputeSize() { diff --git a/src/main/java/gregtech/api/gui/widgets/SimpleTextWidget.java b/src/main/java/gregtech/api/gui/widgets/SimpleTextWidget.java index 0995f47c8f..caa48f3e0b 100644 --- a/src/main/java/gregtech/api/gui/widgets/SimpleTextWidget.java +++ b/src/main/java/gregtech/api/gui/widgets/SimpleTextWidget.java @@ -2,12 +2,12 @@ import gregtech.api.gui.IRenderContext; import gregtech.api.gui.Widget; +import gregtech.api.util.LocalisationUtils; import gregtech.api.util.Position; import gregtech.api.util.Size; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.client.resources.I18n; import net.minecraft.network.PacketBuffer; import java.util.function.Supplier; @@ -46,7 +46,7 @@ private void updateSize() { @Override public void drawInBackground(int mouseX, int mouseY, IRenderContext context) { FontRenderer fontRenderer = Minecraft.getMinecraft().fontRenderer; - String text = formatLocale.isEmpty() ? (I18n.hasKey(lastText) ? I18n.format(lastText) : lastText) : I18n.format(formatLocale, lastText); + String text = formatLocale.isEmpty() ? (LocalisationUtils.hasKey(lastText) ? LocalisationUtils.format(lastText) : lastText) : LocalisationUtils.format(formatLocale, lastText); Position position = getPosition(); fontRenderer.drawString(text, position.x - fontRenderer.getStringWidth(text) / 2, diff --git a/src/main/java/gregtech/api/gui/widgets/SliderWidget.java b/src/main/java/gregtech/api/gui/widgets/SliderWidget.java index a9d27eb220..1d2d243d2b 100644 --- a/src/main/java/gregtech/api/gui/widgets/SliderWidget.java +++ b/src/main/java/gregtech/api/gui/widgets/SliderWidget.java @@ -5,13 +5,13 @@ import gregtech.api.gui.IRenderContext; import gregtech.api.gui.Widget; import gregtech.api.gui.resources.TextureArea; +import gregtech.api.util.LocalisationUtils; import gregtech.api.util.Position; import gregtech.api.util.Size; import gregtech.api.util.function.FloatConsumer; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.client.resources.I18n; import net.minecraft.network.PacketBuffer; import net.minecraft.util.math.MathHelper; @@ -21,7 +21,7 @@ public class SliderWidget extends Widget { - public static final BiFunction DEFAULT_TEXT_SUPPLIER = (name, value) -> I18n.format(name, value.intValue()); + public static final BiFunction DEFAULT_TEXT_SUPPLIER = (name, value) -> LocalisationUtils.format(name, value.intValue()); private int sliderWidth = 8; private TextureArea backgroundArea = GuiTextures.SLIDER_BACKGROUND; diff --git a/src/main/java/gregtech/api/gui/widgets/TankWidget.java b/src/main/java/gregtech/api/gui/widgets/TankWidget.java index 6b52414f44..f861b27fc2 100644 --- a/src/main/java/gregtech/api/gui/widgets/TankWidget.java +++ b/src/main/java/gregtech/api/gui/widgets/TankWidget.java @@ -7,12 +7,12 @@ import gregtech.api.gui.resources.RenderUtil; import gregtech.api.gui.resources.TextureArea; import gregtech.api.util.FluidTooltipUtil; +import gregtech.api.util.LocalisationUtils; import gregtech.api.util.Position; import gregtech.api.util.Size; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; @@ -143,22 +143,22 @@ public void drawInForeground(int mouseX, int mouseY) { if (formula != null && !formula.isEmpty()) tooltips.add(ChatFormatting.GRAY.toString() + formula); - tooltips.add(I18n.format("gregtech.fluid.amount", lastFluidInTank.amount, lastTankCapacity)); - tooltips.add(I18n.format("gregtech.fluid.temperature", fluid.getTemperature(lastFluidInTank))); - tooltips.add(I18n.format(fluid.isGaseous(lastFluidInTank) ? "gregtech.fluid.state_gas" : "gregtech.fluid.state_liquid")); + tooltips.add(LocalisationUtils.format("gregtech.fluid.amount", lastFluidInTank.amount, lastTankCapacity)); + tooltips.add(LocalisationUtils.format("gregtech.fluid.temperature", fluid.getTemperature(lastFluidInTank))); + tooltips.add(LocalisationUtils.format(fluid.isGaseous(lastFluidInTank) ? "gregtech.fluid.state_gas" : "gregtech.fluid.state_liquid")); } else { - tooltips.add(I18n.format("gregtech.fluid.empty")); - tooltips.add(I18n.format("gregtech.fluid.amount", 0, lastTankCapacity)); + tooltips.add(LocalisationUtils.format("gregtech.fluid.empty")); + tooltips.add(LocalisationUtils.format("gregtech.fluid.amount", 0, lastTankCapacity)); } if (allowClickFilling) { tooltips.add(""); //add empty line to separate things - tooltips.add(I18n.format("gregtech.fluid.click_to_fill")); - tooltips.add(I18n.format("gregtech.fluid.click_to_fill.shift")); + tooltips.add(LocalisationUtils.format("gregtech.fluid.click_to_fill")); + tooltips.add(LocalisationUtils.format("gregtech.fluid.click_to_fill.shift")); } if (allowClickEmptying) { tooltips.add(""); //add empty line to separate things - tooltips.add(I18n.format("gregtech.fluid.click_to_empty")); - tooltips.add(I18n.format("gregtech.fluid.click_to_empty.shift")); + tooltips.add(LocalisationUtils.format("gregtech.fluid.click_to_empty")); + tooltips.add(LocalisationUtils.format("gregtech.fluid.click_to_empty.shift")); } drawHoveringText(ItemStack.EMPTY, tooltips, 300, mouseX, mouseY); GlStateManager.color(1.0f, 1.0f, 1.0f); diff --git a/src/main/java/gregtech/api/gui/widgets/ToggleButtonWidget.java b/src/main/java/gregtech/api/gui/widgets/ToggleButtonWidget.java index 2df77959d4..0cf39d10ef 100644 --- a/src/main/java/gregtech/api/gui/widgets/ToggleButtonWidget.java +++ b/src/main/java/gregtech/api/gui/widgets/ToggleButtonWidget.java @@ -6,10 +6,10 @@ import gregtech.api.gui.Widget; import gregtech.api.gui.resources.SizedTextureArea; import gregtech.api.gui.resources.TextureArea; +import gregtech.api.util.LocalisationUtils; import gregtech.api.util.Position; import gregtech.api.util.Size; import gregtech.api.util.function.BooleanConsumer; -import net.minecraft.client.resources.I18n; import net.minecraft.item.ItemStack; import net.minecraft.network.PacketBuffer; import net.minecraftforge.fml.relauncher.Side; @@ -69,7 +69,7 @@ public void drawInForeground(int mouseX, int mouseY) { if(isMouseOverElement(mouseX, mouseY) && tooltipText != null) { String postfix = isPressed ? ".enabled" : ".disabled"; String tooltipHoverString = tooltipText + postfix; - List hoverList = Arrays.asList(I18n.format(tooltipHoverString).split("/n")); + List hoverList = Arrays.asList(LocalisationUtils.format(tooltipHoverString).split("/n")); drawHoveringText(ItemStack.EMPTY, hoverList, 300, mouseX, mouseY); } } diff --git a/src/main/java/gregtech/api/gui/widgets/tab/ItemTabInfo.java b/src/main/java/gregtech/api/gui/widgets/tab/ItemTabInfo.java index 7630c782ef..d5e219a537 100644 --- a/src/main/java/gregtech/api/gui/widgets/tab/ItemTabInfo.java +++ b/src/main/java/gregtech/api/gui/widgets/tab/ItemTabInfo.java @@ -2,11 +2,11 @@ import com.google.common.collect.Lists; import gregtech.api.gui.resources.TextureArea; +import gregtech.api.util.LocalisationUtils; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.ScaledResolution; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.RenderHelper; -import net.minecraft.client.resources.I18n; import net.minecraft.item.ItemStack; import net.minecraftforge.fml.client.config.GuiUtils; @@ -32,7 +32,7 @@ public void renderTab(TextureArea tabTexture, int posX, int posY, int xSize, int @Override public void renderHoverText(int posX, int posY, int xSize, int ySize, int guiWidth, int guiHeight, boolean isSelected, int mouseX, int mouseY) { - String localizedText = I18n.format(nameLocale); + String localizedText = LocalisationUtils.format(nameLocale); Minecraft mc = Minecraft.getMinecraft(); ScaledResolution resolution = new ScaledResolution(mc); GuiUtils.drawHoveringText(Lists.newArrayList(localizedText), mouseX, mouseY, diff --git a/src/main/java/gregtech/api/items/materialitem/MaterialMetaItem.java b/src/main/java/gregtech/api/items/materialitem/MaterialMetaItem.java index 43e5d2c214..dc2632ff60 100644 --- a/src/main/java/gregtech/api/items/materialitem/MaterialMetaItem.java +++ b/src/main/java/gregtech/api/items/materialitem/MaterialMetaItem.java @@ -102,7 +102,6 @@ protected boolean canGenerate(OrePrefix orePrefix, Material material) { } @Override - @SideOnly(Side.CLIENT) public String getItemStackDisplayName(ItemStack itemStack) { if (itemStack.getItemDamage() < metaItemOffset) { Material material = Material.MATERIAL_REGISTRY.getObjectById(itemStack.getItemDamage() % 1000); diff --git a/src/main/java/gregtech/api/items/metaitem/ElectricStats.java b/src/main/java/gregtech/api/items/metaitem/ElectricStats.java index 73a6b12a0e..8a679ff643 100644 --- a/src/main/java/gregtech/api/items/metaitem/ElectricStats.java +++ b/src/main/java/gregtech/api/items/metaitem/ElectricStats.java @@ -7,7 +7,7 @@ import gregtech.api.items.metaitem.stats.IItemCapabilityProvider; import gregtech.api.items.metaitem.stats.IItemMaxStackSizeProvider; import gregtech.api.items.metaitem.stats.IItemComponent; -import net.minecraft.client.resources.I18n; +import gregtech.api.util.LocalisationUtils; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; @@ -115,7 +115,7 @@ private static void setInDischargeMode(ItemStack itemStack, boolean isDischargeM public void addInformation(ItemStack itemStack, List lines) { IElectricItem electricItem = itemStack.getCapability(GregtechCapabilities.CAPABILITY_ELECTRIC_ITEM, null); if(electricItem != null && electricItem.canProvideChargeExternally()) { - lines.add(I18n.format("metaitem.electric.discharge_mode.tooltip")); + lines.add(LocalisationUtils.format("metaitem.electric.discharge_mode.tooltip")); } } diff --git a/src/main/java/gregtech/api/items/metaitem/MetaItem.java b/src/main/java/gregtech/api/items/metaitem/MetaItem.java index dac758f3d6..28100ca6da 100644 --- a/src/main/java/gregtech/api/items/metaitem/MetaItem.java +++ b/src/main/java/gregtech/api/items/metaitem/MetaItem.java @@ -21,10 +21,10 @@ import gregtech.api.unification.material.type.Material; import gregtech.api.unification.ore.OrePrefix; import gregtech.api.unification.stack.ItemMaterialInfo; +import gregtech.api.util.LocalisationUtils; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.block.model.ModelBakery; import net.minecraft.client.renderer.block.model.ModelResourceLocation; -import net.minecraft.client.resources.I18n; import net.minecraft.client.util.ITooltipFlag; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.enchantment.Enchantment; @@ -471,7 +471,6 @@ public boolean shouldCauseReequipAnimation(ItemStack oldStack, ItemStack newStac } @Override - @SideOnly(Side.CLIENT) public String getItemStackDisplayName(ItemStack stack) { if (stack.getItemDamage() >= metaItemOffset) { T item = getItem(stack); @@ -486,9 +485,9 @@ public String getItemStackDisplayName(ItemStack stack) { .getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null); if (fluidHandlerItem != null) { FluidStack fluidInside = fluidHandlerItem.drain(Integer.MAX_VALUE, false); - return I18n.format(unlocalizedName, fluidInside == null ? I18n.format("metaitem.fluid_cell.empty") : fluidInside.getLocalizedName()); + return LocalisationUtils.format(unlocalizedName, fluidInside == null ? LocalisationUtils.format("metaitem.fluid_cell.empty") : fluidInside.getLocalizedName()); } - return I18n.format(unlocalizedName); + return LocalisationUtils.format(unlocalizedName); } return super.getItemStackDisplayName(stack); } @@ -499,13 +498,13 @@ public void addInformation(ItemStack itemStack, @Nullable World worldIn, List= metaItemOffset) { T item = getItem(stack); @@ -415,7 +414,7 @@ public String getItemStackDisplayName(ItemStack stack) { } SolidMaterial primaryMaterial = getToolMaterial(stack); String materialName = primaryMaterial == null ? "" : String.valueOf(primaryMaterial.getLocalizedName()); - return I18n.format("metaitem." + item.unlocalizedName + ".name", materialName); + return LocalisationUtils.format("metaitem." + item.unlocalizedName + ".name", materialName); } return super.getItemStackDisplayName(stack); } @@ -431,11 +430,11 @@ public void addInformation(ItemStack itemStack, @Nullable World worldIn, List 0) { - lines.add(I18n.format("metaitem.tool.tooltip.durability", maxInternalDamage - getItemDamage(itemStack), maxInternalDamage)); + lines.add(LocalisationUtils.format("metaitem.tool.tooltip.durability", maxInternalDamage - getItemDamage(itemStack), maxInternalDamage)); } - lines.add(I18n.format("metaitem.tool.tooltip.primary_material", primaryMaterial.getLocalizedName(), getHarvestLevel(itemStack))); - lines.add(I18n.format("metaitem.tool.tooltip.attack_damage", toolStats.getBaseDamage(itemStack) + primaryMaterial.harvestLevel)); - lines.add(I18n.format("metaitem.tool.tooltip.mining_speed", getToolDigSpeed(itemStack))); + lines.add(LocalisationUtils.format("metaitem.tool.tooltip.primary_material", primaryMaterial.getLocalizedName(), getHarvestLevel(itemStack))); + lines.add(LocalisationUtils.format("metaitem.tool.tooltip.attack_damage", toolStats.getBaseDamage(itemStack) + primaryMaterial.harvestLevel)); + lines.add(LocalisationUtils.format("metaitem.tool.tooltip.mining_speed", getToolDigSpeed(itemStack))); super.addInformation(itemStack, worldIn, lines, tooltipFlag); toolStats.addInformation(itemStack, lines, tooltipFlag.isAdvanced()); } diff --git a/src/main/java/gregtech/api/metatileentity/SimpleGeneratorMetaTileEntity.java b/src/main/java/gregtech/api/metatileentity/SimpleGeneratorMetaTileEntity.java index 20c2815401..31867eb64e 100644 --- a/src/main/java/gregtech/api/metatileentity/SimpleGeneratorMetaTileEntity.java +++ b/src/main/java/gregtech/api/metatileentity/SimpleGeneratorMetaTileEntity.java @@ -18,8 +18,8 @@ import gregtech.api.recipes.machines.FuelRecipeMap; import gregtech.api.render.OrientedOverlayRenderer; import gregtech.api.render.Textures; +import gregtech.api.util.LocalisationUtils; import gregtech.api.util.PipelineUtil; -import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; @@ -137,7 +137,7 @@ protected ModularUI createUI(EntityPlayer entityPlayer) { @Override public void addInformation(ItemStack stack, @Nullable World player, List tooltip, boolean advanced) { - tooltip.add(I18n.format("gregtech.universal.tooltip.voltage_out", energyContainer.getOutputVoltage(), GTValues.VN[getTier()])); - tooltip.add(I18n.format("gregtech.universal.tooltip.energy_storage_capacity", energyContainer.getEnergyCapacity())); + tooltip.add(LocalisationUtils.format("gregtech.universal.tooltip.voltage_out", energyContainer.getOutputVoltage(), GTValues.VN[getTier()])); + tooltip.add(LocalisationUtils.format("gregtech.universal.tooltip.energy_storage_capacity", energyContainer.getEnergyCapacity())); } } diff --git a/src/main/java/gregtech/api/metatileentity/WorkableTieredMetaTileEntity.java b/src/main/java/gregtech/api/metatileentity/WorkableTieredMetaTileEntity.java index a64c9b1383..02c12da5aa 100644 --- a/src/main/java/gregtech/api/metatileentity/WorkableTieredMetaTileEntity.java +++ b/src/main/java/gregtech/api/metatileentity/WorkableTieredMetaTileEntity.java @@ -10,7 +10,7 @@ import gregtech.api.recipes.Recipe; import gregtech.api.recipes.RecipeMap; import gregtech.api.render.OrientedOverlayRenderer; -import net.minecraft.client.resources.I18n; +import gregtech.api.util.LocalisationUtils; import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; @@ -124,7 +124,7 @@ protected int getOutputTankCapacity(int index) { @Override public void addInformation(ItemStack stack, @Nullable World player, List tooltip, boolean advanced) { super.addInformation(stack, player, tooltip, advanced); - tooltip.add(I18n.format("gregtech.universal.tooltip.voltage_in", energyContainer.getInputVoltage(), GTValues.VN[getTier()])); - tooltip.add(I18n.format("gregtech.universal.tooltip.energy_storage_capacity", energyContainer.getEnergyCapacity())); + tooltip.add(LocalisationUtils.format("gregtech.universal.tooltip.voltage_in", energyContainer.getInputVoltage(), GTValues.VN[getTier()])); + tooltip.add(LocalisationUtils.format("gregtech.universal.tooltip.energy_storage_capacity", energyContainer.getEnergyCapacity())); } } diff --git a/src/main/java/gregtech/api/pipenet/block/material/ItemBlockMaterialPipe.java b/src/main/java/gregtech/api/pipenet/block/material/ItemBlockMaterialPipe.java index f836119bbf..00b93f6b71 100644 --- a/src/main/java/gregtech/api/pipenet/block/material/ItemBlockMaterialPipe.java +++ b/src/main/java/gregtech/api/pipenet/block/material/ItemBlockMaterialPipe.java @@ -14,7 +14,6 @@ public ItemBlockMaterialPipe(BlockMaterialPipe block) @SuppressWarnings("unchecked") @Override - @SideOnly(Side.CLIENT) public String getItemStackDisplayName(ItemStack stack) { PipeType pipeType = blockPipe.getItemPipeType(stack); Material material = ((BlockMaterialPipe) blockPipe).getItemMaterial(stack); diff --git a/src/main/java/gregtech/api/recipes/RecipeMap.java b/src/main/java/gregtech/api/recipes/RecipeMap.java index 69d36860c0..d648fe4644 100644 --- a/src/main/java/gregtech/api/recipes/RecipeMap.java +++ b/src/main/java/gregtech/api/recipes/RecipeMap.java @@ -24,6 +24,7 @@ import gregtech.api.util.EnumValidationResult; import gregtech.api.util.GTLog; import gregtech.api.util.GTUtility; +import gregtech.api.util.LocalisationUtils; import gregtech.api.util.ValidationResult; import net.minecraft.client.resources.I18n; import net.minecraft.item.ItemStack; @@ -406,10 +407,9 @@ public List ccGetRecipeList() { .collect(Collectors.toList()); } - @SideOnly(Side.CLIENT) @ZenGetter("localizedName") public String getLocalizedName() { - return I18n.format("recipemap." + unlocalizedName + ".name"); + return LocalisationUtils.format("recipemap." + unlocalizedName + ".name"); } @ZenGetter("unlocalizedName") diff --git a/src/main/java/gregtech/api/recipes/machines/FuelRecipeMap.java b/src/main/java/gregtech/api/recipes/machines/FuelRecipeMap.java index d22cab1b6e..f4cf6e6b56 100644 --- a/src/main/java/gregtech/api/recipes/machines/FuelRecipeMap.java +++ b/src/main/java/gregtech/api/recipes/machines/FuelRecipeMap.java @@ -6,11 +6,9 @@ import gregtech.api.GTValues; import gregtech.api.recipes.FluidKey; import gregtech.api.recipes.recipes.FuelRecipe; -import net.minecraft.client.resources.I18n; +import gregtech.api.util.LocalisationUtils; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fml.common.Optional.Method; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenGetter; import stanhebben.zenscript.annotations.ZenMethod; @@ -84,10 +82,9 @@ public List getRecipeList() { return Collections.unmodifiableList(recipeList); } - @SideOnly(Side.CLIENT) @ZenGetter("localizedName") public String getLocalizedName() { - return I18n.format("recipemap." + unlocalizedName + ".name"); + return LocalisationUtils.format("recipemap." + unlocalizedName + ".name"); } @ZenGetter("unlocalizedName") diff --git a/src/main/java/gregtech/api/recipes/recipeproperties/BlastTemperatureProperty.java b/src/main/java/gregtech/api/recipes/recipeproperties/BlastTemperatureProperty.java index ec3a088c77..d75f1ccbf0 100644 --- a/src/main/java/gregtech/api/recipes/recipeproperties/BlastTemperatureProperty.java +++ b/src/main/java/gregtech/api/recipes/recipeproperties/BlastTemperatureProperty.java @@ -1,8 +1,8 @@ package gregtech.api.recipes.recipeproperties; import gregtech.api.unification.material.type.Material; +import gregtech.api.util.LocalisationUtils; import net.minecraft.client.Minecraft; -import net.minecraft.client.resources.I18n; import org.apache.commons.lang3.Validate; import java.util.Map; @@ -29,7 +29,7 @@ public static BlastTemperatureProperty getInstance() { @Override public void drawInfo(Minecraft minecraft, int x, int y, int color, Object value) { - minecraft.fontRenderer.drawString(I18n.format("gregtech.recipe.blast_furnace_temperature", + minecraft.fontRenderer.drawString(LocalisationUtils.format("gregtech.recipe.blast_furnace_temperature", value, getMinTierForTemperature(castValue(value))), x, y, color); } @@ -41,7 +41,7 @@ private String getMinTierForTemperature(Integer value) { if (mapValue instanceof Material) { name = ((Material) mapValue).getLocalizedName(); } else if (mapValue instanceof String) { - name = I18n.format((String) mapValue); + name = LocalisationUtils.format((String) mapValue); } } } diff --git a/src/main/java/gregtech/api/recipes/recipeproperties/DefaultProperty.java b/src/main/java/gregtech/api/recipes/recipeproperties/DefaultProperty.java index 7c444f32bc..00ddc2d02e 100644 --- a/src/main/java/gregtech/api/recipes/recipeproperties/DefaultProperty.java +++ b/src/main/java/gregtech/api/recipes/recipeproperties/DefaultProperty.java @@ -1,7 +1,7 @@ package gregtech.api.recipes.recipeproperties; +import gregtech.api.util.LocalisationUtils; import net.minecraft.client.Minecraft; -import net.minecraft.client.resources.I18n; public class DefaultProperty extends RecipeProperty { @@ -10,7 +10,7 @@ public DefaultProperty(String key, Class type) { } public void drawInfo(Minecraft minecraft, int x, int y, int color, Object value) { - minecraft.fontRenderer.drawString(I18n.format("gregtech.recipe." + getKey(), + minecraft.fontRenderer.drawString(LocalisationUtils.format("gregtech.recipe." + getKey(), castValue(value)), x, y, color); } diff --git a/src/main/java/gregtech/api/unification/material/type/Material.java b/src/main/java/gregtech/api/unification/material/type/Material.java index ac149e5dcc..6763d50cf9 100644 --- a/src/main/java/gregtech/api/unification/material/type/Material.java +++ b/src/main/java/gregtech/api/unification/material/type/Material.java @@ -9,7 +9,7 @@ import gregtech.api.unification.stack.MaterialStack; import gregtech.api.util.GTControlledRegistry; import gregtech.api.util.GTLog; -import net.minecraft.client.resources.I18n; +import gregtech.api.util.LocalisationUtils; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import stanhebben.zenscript.annotations.*; @@ -381,10 +381,9 @@ public String getUnlocalizedName() { return "material." + toString(); } - @SideOnly(Side.CLIENT) @ZenGetter("localizedName") public String getLocalizedName() { - return I18n.format(getUnlocalizedName()); + return LocalisationUtils.format(getUnlocalizedName()); } @Override diff --git a/src/main/java/gregtech/api/unification/ore/OrePrefix.java b/src/main/java/gregtech/api/unification/ore/OrePrefix.java index b330c01c6a..768d5d4716 100644 --- a/src/main/java/gregtech/api/unification/ore/OrePrefix.java +++ b/src/main/java/gregtech/api/unification/ore/OrePrefix.java @@ -7,7 +7,7 @@ import gregtech.api.unification.material.type.*; import gregtech.api.unification.stack.MaterialStack; import gregtech.api.util.GTUtility; -import net.minecraft.client.resources.I18n; +import gregtech.api.util.LocalisationUtils; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import org.apache.commons.lang3.Validate; @@ -442,13 +442,12 @@ private void runGeneratedMaterialHandlers() { currentProcessingPrefix.set(null); } - @SideOnly(Side.CLIENT) public String getLocalNameForItem(Material material) { String specfiedUnlocalized = "item." + material.toString() + "." + this.name(); - if (I18n.hasKey(specfiedUnlocalized)) return I18n.format(specfiedUnlocalized); + if (LocalisationUtils.hasKey(specfiedUnlocalized)) return LocalisationUtils.format(specfiedUnlocalized); String unlocalized = "item.material.oreprefix." + this.name(); String matLocalized = material.getLocalizedName(); - String formatted = I18n.format(unlocalized, matLocalized); + String formatted = LocalisationUtils.format(unlocalized, matLocalized); return formatted.equals(unlocalized) ? matLocalized : formatted; } diff --git a/src/main/java/gregtech/api/util/LocalisationUtils.java b/src/main/java/gregtech/api/util/LocalisationUtils.java new file mode 100644 index 0000000000..ca2d6e19a0 --- /dev/null +++ b/src/main/java/gregtech/api/util/LocalisationUtils.java @@ -0,0 +1,28 @@ +package gregtech.api.util; + +import net.minecraftforge.fml.common.FMLCommonHandler; +import net.minecraftforge.fml.relauncher.Side; + +public class LocalisationUtils { + + public static String format(String p_format_0_, Object... p_format_1_) { + if (FMLCommonHandler.instance().getEffectiveSide() == Side.SERVER) { + return net.minecraft.util.text.translation.I18n.translateToLocalFormatted(p_format_0_, p_format_1_); + } else { + return net.minecraft.client.resources.I18n.format(p_format_0_, p_format_1_); + } + } + + public static String translateToLocal(String p_format_0_) { + return net.minecraft.util.text.translation.I18n.translateToLocal(p_format_0_); + } + + public static boolean hasKey(String p_hasKey_0_) { + if (FMLCommonHandler.instance().getEffectiveSide() == Side.SERVER) { + return net.minecraft.util.text.translation.I18n.canTranslate(p_hasKey_0_); + } else { + return net.minecraft.client.resources.I18n.hasKey(p_hasKey_0_); + } + } + +} diff --git a/src/main/java/gregtech/common/MetaFluids.java b/src/main/java/gregtech/common/MetaFluids.java index 1b72049db7..fd98232d1d 100644 --- a/src/main/java/gregtech/common/MetaFluids.java +++ b/src/main/java/gregtech/common/MetaFluids.java @@ -7,9 +7,9 @@ import gregtech.api.unification.material.type.Material; import gregtech.api.util.FluidTooltipUtil; import gregtech.api.util.GTUtility; +import gregtech.api.util.LocalisationUtils; import gregtech.common.blocks.MetaBlocks; import net.minecraft.client.renderer.texture.TextureMap; -import net.minecraft.client.resources.I18n; import net.minecraft.util.ResourceLocation; import net.minecraftforge.fluids.*; import net.minecraftforge.fml.relauncher.Side; @@ -244,11 +244,10 @@ public String getUnlocalizedName() { } @Override - @SideOnly(Side.CLIENT) public String getLocalizedName(FluidStack stack) { - String localizedName = I18n.format(getUnlocalizedName()); + String localizedName = LocalisationUtils.format(getUnlocalizedName()); if (state.prefixLocale != null) { - return I18n.format(state.prefixLocale, localizedName); + return LocalisationUtils.format(state.prefixLocale, localizedName); } return localizedName; } diff --git a/src/main/java/gregtech/common/blocks/BlockWireCoil.java b/src/main/java/gregtech/common/blocks/BlockWireCoil.java index 8f0aebfa20..4a792972e2 100644 --- a/src/main/java/gregtech/common/blocks/BlockWireCoil.java +++ b/src/main/java/gregtech/common/blocks/BlockWireCoil.java @@ -3,9 +3,9 @@ import gregtech.api.unification.material.MarkerMaterials.Tier; import gregtech.api.unification.material.Materials; import gregtech.api.unification.material.type.Material; +import gregtech.api.util.LocalisationUtils; import net.minecraft.block.SoundType; import net.minecraft.block.state.IBlockState; -import net.minecraft.client.resources.I18n; import net.minecraft.client.util.ITooltipFlag; import net.minecraft.entity.EntityLiving.SpawnPlacementType; import net.minecraft.item.ItemStack; @@ -40,12 +40,12 @@ public void addInformation(ItemStack itemStack, @Nullable World worldIn, List tooltip, ITooltipFlag advanced) { //tier less tooltip like: tile.turbine_casing.tooltip String unlocalizedVariantTooltip = getTranslationKey() + ".tooltip"; - if (I18n.hasKey(unlocalizedVariantTooltip)) - tooltip.addAll(Arrays.asList(I18n.format(unlocalizedVariantTooltip).split("/n"))); + if (LocalisationUtils.hasKey(unlocalizedVariantTooltip)) + tooltip.addAll(Arrays.asList(LocalisationUtils.format(unlocalizedVariantTooltip).split("/n"))); //item specific tooltip: tile.turbine_casing.bronze_gearbox.tooltip String unlocalizedTooltip = stack.getTranslationKey() + ".tooltip"; - if (I18n.hasKey(unlocalizedTooltip)) - tooltip.addAll(Arrays.asList(I18n.format(unlocalizedTooltip).split("/n"))); + if (LocalisationUtils.hasKey(unlocalizedTooltip)) + tooltip.addAll(Arrays.asList(LocalisationUtils.format(unlocalizedTooltip).split("/n"))); } @Override diff --git a/src/main/java/gregtech/common/gui/widget/ItemListSlotWidget.java b/src/main/java/gregtech/common/gui/widget/ItemListSlotWidget.java index 29a3b8b8a7..e570a9fe76 100644 --- a/src/main/java/gregtech/common/gui/widget/ItemListSlotWidget.java +++ b/src/main/java/gregtech/common/gui/widget/ItemListSlotWidget.java @@ -4,12 +4,12 @@ import gregtech.api.gui.IRenderContext; import gregtech.api.gui.Widget; import gregtech.api.util.ItemStackKey; +import gregtech.api.util.LocalisationUtils; import gregtech.api.util.Position; import gregtech.api.util.Size; import gregtech.common.inventory.IItemInfo; import gregtech.common.inventory.IItemList; import gregtech.common.inventory.IItemList.InsertMode; -import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; import net.minecraft.network.PacketBuffer; @@ -62,7 +62,7 @@ public void drawInForeground(int mouseX, int mouseY) { ItemStack itemStack = itemInfo.getItemStackKey().getItemStackRaw(); List tooltip = getItemToolTip(itemStack); int totalItemStored = itemInfo.getTotalItemAmount(); - String itemStoredText = I18n.format("gregtech.item_list.item_stored", totalItemStored); + String itemStoredText = LocalisationUtils.format("gregtech.item_list.item_stored", totalItemStored); tooltip.add(TextFormatting.GRAY + itemStoredText); drawHoveringText(itemStack, tooltip, -1, mouseX, mouseY); } diff --git a/src/main/java/gregtech/common/items/MetaItem1.java b/src/main/java/gregtech/common/items/MetaItem1.java index 2621aa62f7..6a9e24c62e 100644 --- a/src/main/java/gregtech/common/items/MetaItem1.java +++ b/src/main/java/gregtech/common/items/MetaItem1.java @@ -15,11 +15,11 @@ import gregtech.api.unification.ore.OrePrefix; import gregtech.api.unification.stack.ItemMaterialInfo; import gregtech.api.unification.stack.MaterialStack; +import gregtech.api.util.LocalisationUtils; import gregtech.api.util.RandomPotionEffect; import gregtech.common.items.behaviors.*; import net.minecraft.block.BlockCauldron; import net.minecraft.block.state.IBlockState; -import net.minecraft.client.resources.I18n; import net.minecraft.client.util.ITooltipFlag; import net.minecraft.entity.item.EntityItem; import net.minecraft.init.Items; @@ -548,7 +548,7 @@ public boolean onEntityItemUpdate(EntityItem itemEntity) { @Override protected void addMaterialTooltip(ItemStack itemStack, OrePrefix prefix, Material material, List lines, ITooltipFlag tooltipFlag) { if (prefix == OrePrefix.dustImpure || prefix == OrePrefix.dustPure) { - lines.add(I18n.format("metaitem.dust.tooltip.purify")); + lines.add(LocalisationUtils.format("metaitem.dust.tooltip.purify")); } } diff --git a/src/main/java/gregtech/common/items/behaviors/AbstractMaterialPartBehavior.java b/src/main/java/gregtech/common/items/behaviors/AbstractMaterialPartBehavior.java index f3c8c56ec5..57ffcccb84 100644 --- a/src/main/java/gregtech/common/items/behaviors/AbstractMaterialPartBehavior.java +++ b/src/main/java/gregtech/common/items/behaviors/AbstractMaterialPartBehavior.java @@ -7,7 +7,7 @@ import gregtech.api.unification.material.Materials; import gregtech.api.unification.material.type.IngotMaterial; import gregtech.api.unification.material.type.Material; -import net.minecraft.client.resources.I18n; +import gregtech.api.util.LocalisationUtils; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.math.MathHelper; @@ -62,10 +62,9 @@ public void setPartDamage(ItemStack itemStack, int rotorDamage) { } @Override - @SideOnly(Side.CLIENT) public String getItemStackDisplayName(ItemStack itemStack, String unlocalizedName) { IngotMaterial material = getPartMaterial(itemStack); - return I18n.format(unlocalizedName, material.getLocalizedName()); + return LocalisationUtils.format(unlocalizedName, material.getLocalizedName()); } @Override @@ -73,8 +72,8 @@ public void addInformation(ItemStack stack, List lines) { IngotMaterial material = getPartMaterial(stack); int maxRotorDurability = getPartMaxDurability(stack); int rotorDamage = getPartDamage(stack); - lines.add(I18n.format("metaitem.tool.tooltip.durability", maxRotorDurability - rotorDamage, maxRotorDurability)); - lines.add(I18n.format("metaitem.tool.tooltip.primary_material", material.getLocalizedName(), material.harvestLevel)); + lines.add(LocalisationUtils.format("metaitem.tool.tooltip.durability", maxRotorDurability - rotorDamage, maxRotorDurability)); + lines.add(LocalisationUtils.format("metaitem.tool.tooltip.primary_material", material.getLocalizedName(), material.harvestLevel)); } @Override diff --git a/src/main/java/gregtech/common/items/behaviors/ColorSprayBehaviour.java b/src/main/java/gregtech/common/items/behaviors/ColorSprayBehaviour.java index 7ef6f3f31f..09bc8d1e8c 100644 --- a/src/main/java/gregtech/common/items/behaviors/ColorSprayBehaviour.java +++ b/src/main/java/gregtech/common/items/behaviors/ColorSprayBehaviour.java @@ -1,10 +1,10 @@ package gregtech.common.items.behaviors; +import gregtech.api.util.LocalisationUtils; import net.minecraft.block.Block; import net.minecraft.block.BlockStainedGlass; import net.minecraft.block.BlockStainedGlassPane; import net.minecraft.block.state.IBlockState; -import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.item.EnumDyeColor; @@ -14,6 +14,8 @@ import net.minecraft.util.EnumHand; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; import java.util.List; @@ -66,7 +68,7 @@ private boolean tryPaintSpecialBlock(World world, BlockPos pos, Block block) { @Override public void addInformation(ItemStack itemStack, List lines) { int remainingUses = getUsesLeft(itemStack); - lines.add(I18n.format("behaviour.paintspray." + this.color.getTranslationKey() + ".tooltip")); - lines.add(I18n.format("behaviour.paintspray.uses", remainingUses)); + lines.add(LocalisationUtils.format("behaviour.paintspray." + this.color.getTranslationKey() + ".tooltip")); + lines.add(LocalisationUtils.format("behaviour.paintspray.uses", remainingUses)); } } diff --git a/src/main/java/gregtech/common/items/behaviors/FacadeItem.java b/src/main/java/gregtech/common/items/behaviors/FacadeItem.java index d215473d05..68dd06015c 100644 --- a/src/main/java/gregtech/common/items/behaviors/FacadeItem.java +++ b/src/main/java/gregtech/common/items/behaviors/FacadeItem.java @@ -3,9 +3,9 @@ import com.google.common.collect.ImmutableList; import gregtech.api.items.metaitem.stats.IItemNameProvider; import gregtech.api.items.metaitem.stats.ISubItemHandler; +import gregtech.api.util.LocalisationUtils; import gregtech.common.ConfigHolder; import gregtech.common.covers.facade.FacadeHelper; -import net.minecraft.client.resources.I18n; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.init.Blocks; import net.minecraft.init.Items; @@ -24,7 +24,7 @@ public class FacadeItem implements IItemNameProvider, ISubItemHandler { public String getItemStackDisplayName(ItemStack itemStack, String unlocalizedName) { ItemStack facadeStack = getFacadeStack(itemStack); String name = facadeStack.getItem().getItemStackDisplayName(facadeStack); - return I18n.format(unlocalizedName, name); + return LocalisationUtils.format(unlocalizedName, name); } @Override diff --git a/src/main/java/gregtech/common/items/behaviors/HoeBehaviour.java b/src/main/java/gregtech/common/items/behaviors/HoeBehaviour.java index e6044b6a16..8cf28dcba1 100644 --- a/src/main/java/gregtech/common/items/behaviors/HoeBehaviour.java +++ b/src/main/java/gregtech/common/items/behaviors/HoeBehaviour.java @@ -2,10 +2,10 @@ import gregtech.api.items.metaitem.stats.IItemBehaviour; import gregtech.api.util.GTUtility; +import gregtech.api.util.LocalisationUtils; import net.minecraft.block.Block; import net.minecraft.block.BlockDirt; import net.minecraft.block.state.IBlockState; -import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.init.SoundEvents; @@ -58,6 +58,6 @@ public ActionResult onItemUse(EntityPlayer player, World world, Block @Override public void addInformation(ItemStack itemStack, List lines) { - lines.add(I18n.format("behaviour.hoe")); + lines.add(LocalisationUtils.format("behaviour.hoe")); } } diff --git a/src/main/java/gregtech/common/items/behaviors/IntCircuitBehaviour.java b/src/main/java/gregtech/common/items/behaviors/IntCircuitBehaviour.java index af60100a22..5f2160c35c 100644 --- a/src/main/java/gregtech/common/items/behaviors/IntCircuitBehaviour.java +++ b/src/main/java/gregtech/common/items/behaviors/IntCircuitBehaviour.java @@ -9,7 +9,7 @@ import gregtech.api.items.metaitem.stats.IItemBehaviour; import gregtech.api.items.metaitem.stats.ISubItemHandler; import gregtech.api.recipes.ingredients.IntCircuitIngredient; -import net.minecraft.client.resources.I18n; +import gregtech.api.util.LocalisationUtils; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; @@ -27,7 +27,7 @@ public class IntCircuitBehaviour implements IItemBehaviour, ItemUIFactory, ISubI @Override public void addInformation(ItemStack itemStack, List lines) { int configuration = IntCircuitIngredient.getCircuitConfiguration(itemStack); - lines.add(I18n.format("metaitem.int_circuit.configuration", configuration)); + lines.add(LocalisationUtils.format("metaitem.int_circuit.configuration", configuration)); } @Override diff --git a/src/main/java/gregtech/common/items/behaviors/LighterBehaviour.java b/src/main/java/gregtech/common/items/behaviors/LighterBehaviour.java index 1f04429414..ebf29e6cdc 100644 --- a/src/main/java/gregtech/common/items/behaviors/LighterBehaviour.java +++ b/src/main/java/gregtech/common/items/behaviors/LighterBehaviour.java @@ -1,6 +1,6 @@ package gregtech.common.items.behaviors; -import net.minecraft.client.resources.I18n; +import gregtech.api.util.LocalisationUtils; import net.minecraft.entity.Entity; import net.minecraft.entity.monster.EntityCreeper; import net.minecraft.entity.player.EntityPlayer; @@ -53,11 +53,11 @@ public boolean tryIgniteBlock(World world, BlockPos pos) { @Override public void addInformation(ItemStack itemStack, List lines) { - lines.add(I18n.format("behaviour.lighter.tooltip")); + lines.add(LocalisationUtils.format("behaviour.lighter.tooltip")); if (totalUses > 1) { //do not add total uses amount for single-use items like matches int fuelAmount = getUsesLeft(itemStack); - lines.add(I18n.format("behaviour.lighter.uses", fuelAmount)); + lines.add(LocalisationUtils.format("behaviour.lighter.uses", fuelAmount)); } } } diff --git a/src/main/java/gregtech/common/items/behaviors/ModeSwitchBehavior.java b/src/main/java/gregtech/common/items/behaviors/ModeSwitchBehavior.java index fdf439f2a9..13b931e909 100644 --- a/src/main/java/gregtech/common/items/behaviors/ModeSwitchBehavior.java +++ b/src/main/java/gregtech/common/items/behaviors/ModeSwitchBehavior.java @@ -1,8 +1,8 @@ package gregtech.common.items.behaviors; import gregtech.api.items.metaitem.stats.IItemBehaviour; +import gregtech.api.util.LocalisationUtils; import gregtech.common.items.behaviors.ModeSwitchBehavior.ILocalizationKey; -import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; @@ -61,8 +61,8 @@ public ActionResult onItemRightClick(World world, EntityPlayer player @Override public void addInformation(ItemStack itemStack, List lines) { T currentMode = getModeFromItemStack(itemStack); - lines.add(I18n.format("metaitem.behavior.mode_switch.tooltip")); - lines.add(I18n.format("metaitem.behavior.mode_switch.current_mode", I18n.format(currentMode.getUnlocalizedName()))); + lines.add(LocalisationUtils.format("metaitem.behavior.mode_switch.tooltip")); + lines.add(LocalisationUtils.format("metaitem.behavior.mode_switch.current_mode", LocalisationUtils.format(currentMode.getUnlocalizedName()))); } public interface ILocalizationKey { diff --git a/src/main/java/gregtech/common/items/behaviors/PlungerBehaviour.java b/src/main/java/gregtech/common/items/behaviors/PlungerBehaviour.java index ae360a6390..e0ee81b25f 100755 --- a/src/main/java/gregtech/common/items/behaviors/PlungerBehaviour.java +++ b/src/main/java/gregtech/common/items/behaviors/PlungerBehaviour.java @@ -6,7 +6,7 @@ import gregtech.api.items.metaitem.stats.IItemBehaviour; import gregtech.api.items.metaitem.stats.IItemCapabilityProvider; import gregtech.api.util.GTUtility; -import net.minecraft.client.resources.I18n; +import gregtech.api.util.LocalisationUtils; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.SoundEvents; import net.minecraft.item.ItemStack; @@ -63,7 +63,7 @@ public EnumActionResult onItemUseFirst(EntityPlayer player, World world, BlockPo @Override public void addInformation(ItemStack itemStack, List lines) { - lines.addAll(Arrays.asList(I18n.format("behavior.plunger.description").split("/n"))); + lines.addAll(Arrays.asList(LocalisationUtils.format("behavior.plunger.description").split("/n"))); } @Override diff --git a/src/main/java/gregtech/common/items/behaviors/ScoopBehaviour.java b/src/main/java/gregtech/common/items/behaviors/ScoopBehaviour.java index 095806613d..dee18ca4f6 100644 --- a/src/main/java/gregtech/common/items/behaviors/ScoopBehaviour.java +++ b/src/main/java/gregtech/common/items/behaviors/ScoopBehaviour.java @@ -6,7 +6,7 @@ import gregtech.api.GTValues; import gregtech.api.items.metaitem.stats.IItemBehaviour; import gregtech.api.util.GTUtility; -import net.minecraft.client.resources.I18n; +import gregtech.api.util.LocalisationUtils; import net.minecraft.entity.Entity; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; @@ -49,6 +49,6 @@ private boolean processButterflyCatch(ItemStack itemStack, EntityPlayer player, @Override public void addInformation(ItemStack itemStack, List lines) { - lines.add(I18n.format("behaviour.scoop")); + lines.add(LocalisationUtils.format("behaviour.scoop")); } } diff --git a/src/main/java/gregtech/common/items/behaviors/SoftHammerBehaviour.java b/src/main/java/gregtech/common/items/behaviors/SoftHammerBehaviour.java index 1a658f8e91..f1c830e2cd 100644 --- a/src/main/java/gregtech/common/items/behaviors/SoftHammerBehaviour.java +++ b/src/main/java/gregtech/common/items/behaviors/SoftHammerBehaviour.java @@ -4,7 +4,7 @@ import gregtech.api.capability.IControllable; import gregtech.api.items.metaitem.stats.IItemBehaviour; import gregtech.api.util.GTUtility; -import net.minecraft.client.resources.I18n; +import gregtech.api.util.LocalisationUtils; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; @@ -49,6 +49,6 @@ public EnumActionResult onItemUseFirst(EntityPlayer player, World world, BlockPo @Override public void addInformation(ItemStack itemStack, List lines) { - lines.add(I18n.format("behaviour.soft_hammer")); + lines.add(LocalisationUtils.format("behaviour.soft_hammer")); } } diff --git a/src/main/java/gregtech/common/items/behaviors/ToggleEnergyConsumerBehavior.java b/src/main/java/gregtech/common/items/behaviors/ToggleEnergyConsumerBehavior.java index 692d1a437d..8482b15680 100644 --- a/src/main/java/gregtech/common/items/behaviors/ToggleEnergyConsumerBehavior.java +++ b/src/main/java/gregtech/common/items/behaviors/ToggleEnergyConsumerBehavior.java @@ -3,7 +3,7 @@ import gregtech.api.capability.GregtechCapabilities; import gregtech.api.capability.IElectricItem; import gregtech.api.items.metaitem.stats.IItemBehaviour; -import net.minecraft.client.resources.I18n; +import gregtech.api.util.LocalisationUtils; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; @@ -55,7 +55,7 @@ public void onUpdate(ItemStack itemStack, Entity entity) { @Override public void addInformation(ItemStack itemStack, List lines) { - lines.add(I18n.format("behavior.toggle_energy_consumer.tooltip")); + lines.add(LocalisationUtils.format("behavior.toggle_energy_consumer.tooltip")); } public boolean isItemActive(ItemStack itemStack) { diff --git a/src/main/java/gregtech/common/items/behaviors/TurbineRotorBehavior.java b/src/main/java/gregtech/common/items/behaviors/TurbineRotorBehavior.java index 4894461ec0..9e95e5f871 100644 --- a/src/main/java/gregtech/common/items/behaviors/TurbineRotorBehavior.java +++ b/src/main/java/gregtech/common/items/behaviors/TurbineRotorBehavior.java @@ -6,7 +6,7 @@ import gregtech.api.items.metaitem.stats.IItemMaxStackSizeProvider; import gregtech.api.unification.material.type.IngotMaterial; import gregtech.api.unification.material.type.SolidMaterial; -import net.minecraft.client.resources.I18n; +import gregtech.api.util.LocalisationUtils; import net.minecraft.item.ItemStack; import java.util.List; @@ -60,6 +60,6 @@ public int getMaxStackSize(ItemStack itemStack, int defaultValue) { @Override public void addInformation(ItemStack stack, List lines) { super.addInformation(stack, lines); - lines.add(I18n.format("metaitem.tool.tooltip.rotor.efficiency", (int) (getRotorEfficiency(stack) * 100))); + lines.add(LocalisationUtils.format("metaitem.tool.tooltip.rotor.efficiency", (int) (getRotorEfficiency(stack) * 100))); } } diff --git a/src/main/java/gregtech/common/items/behaviors/WrenchBehaviour.java b/src/main/java/gregtech/common/items/behaviors/WrenchBehaviour.java index 2dc0a75259..dce768d602 100644 --- a/src/main/java/gregtech/common/items/behaviors/WrenchBehaviour.java +++ b/src/main/java/gregtech/common/items/behaviors/WrenchBehaviour.java @@ -3,7 +3,7 @@ import gregtech.api.items.metaitem.stats.IItemBehaviour; import gregtech.api.metatileentity.MetaTileEntityHolder; import gregtech.api.util.GTUtility; -import net.minecraft.client.resources.I18n; +import gregtech.api.util.LocalisationUtils; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; @@ -41,6 +41,6 @@ public EnumActionResult onItemUseFirst(EntityPlayer player, World world, BlockPo @Override public void addInformation(ItemStack itemStack, List lines) { - lines.add(I18n.format("behaviour.wrench")); + lines.add(LocalisationUtils.format("behaviour.wrench")); } } diff --git a/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityAirCollector.java b/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityAirCollector.java index d58c86231c..2f3f5b2e17 100644 --- a/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityAirCollector.java +++ b/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityAirCollector.java @@ -11,8 +11,8 @@ import gregtech.api.metatileentity.TieredMetaTileEntity; import gregtech.api.render.Textures; import gregtech.api.unification.material.Materials; +import gregtech.api.util.LocalisationUtils; import gregtech.common.ConfigHolder; -import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; @@ -107,10 +107,10 @@ protected boolean openGUIOnRightClick() { @Override public void addInformation(ItemStack stack, @Nullable World player, List tooltip, boolean advanced) { - tooltip.add(I18n.format("gregtech.machine.air_collector.tooltip")); - tooltip.add(I18n.format("gregtech.machine.air_collector.collection_speed", getCollectedFluidAmount(), PRODUCTION_CYCLE_LENGTH)); - tooltip.add(I18n.format("gregtech.universal.tooltip.voltage_in", energyContainer.getInputVoltage(), GTValues.VN[getTier()])); - tooltip.add(I18n.format("gregtech.universal.tooltip.energy_storage_capacity", energyContainer.getEnergyCapacity())); - tooltip.add(I18n.format("gregtech.universal.tooltip.fluid_storage_capacity", exportFluids.getTankAt(0).getCapacity())); + tooltip.add(LocalisationUtils.format("gregtech.machine.air_collector.tooltip")); + tooltip.add(LocalisationUtils.format("gregtech.machine.air_collector.collection_speed", getCollectedFluidAmount(), PRODUCTION_CYCLE_LENGTH)); + tooltip.add(LocalisationUtils.format("gregtech.universal.tooltip.voltage_in", energyContainer.getInputVoltage(), GTValues.VN[getTier()])); + tooltip.add(LocalisationUtils.format("gregtech.universal.tooltip.energy_storage_capacity", energyContainer.getEnergyCapacity())); + tooltip.add(LocalisationUtils.format("gregtech.universal.tooltip.fluid_storage_capacity", exportFluids.getTankAt(0).getCapacity())); } } diff --git a/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityBatteryBuffer.java b/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityBatteryBuffer.java index a737d73e31..d9913df2de 100644 --- a/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityBatteryBuffer.java +++ b/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityBatteryBuffer.java @@ -16,8 +16,8 @@ import gregtech.api.metatileentity.MetaTileEntityHolder; import gregtech.api.metatileentity.TieredMetaTileEntity; import gregtech.api.render.Textures; +import gregtech.api.util.LocalisationUtils; import gregtech.api.util.PipelineUtil; -import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; @@ -146,11 +146,11 @@ protected ModularUI createUI(EntityPlayer entityPlayer) { public void addInformation(ItemStack stack, @Nullable World player, List tooltip, boolean advanced) { String tierName = GTValues.VN[getTier()]; - tooltip.add(I18n.format("gregtech.universal.tooltip.item_storage_capacity", inventorySize)); - tooltip.add(I18n.format("gregtech.universal.tooltip.voltage_in", energyContainer.getInputVoltage(), tierName)); - tooltip.add(I18n.format("gregtech.universal.tooltip.voltage_out", energyContainer.getOutputVoltage(), tierName)); - tooltip.add(I18n.format("gregtech.universal.tooltip.amperage_out_till", inventorySize)); - tooltip.add(I18n.format("gregtech.universal.tooltip.energy_storage_capacity", energyContainer.getEnergyCapacity())); + tooltip.add(LocalisationUtils.format("gregtech.universal.tooltip.item_storage_capacity", inventorySize)); + tooltip.add(LocalisationUtils.format("gregtech.universal.tooltip.voltage_in", energyContainer.getInputVoltage(), tierName)); + tooltip.add(LocalisationUtils.format("gregtech.universal.tooltip.voltage_out", energyContainer.getOutputVoltage(), tierName)); + tooltip.add(LocalisationUtils.format("gregtech.universal.tooltip.amperage_out_till", inventorySize)); + tooltip.add(LocalisationUtils.format("gregtech.universal.tooltip.energy_storage_capacity", energyContainer.getEnergyCapacity())); } @Override diff --git a/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityBlockBreaker.java b/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityBlockBreaker.java index 17f2a5b8b4..5027225d20 100644 --- a/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityBlockBreaker.java +++ b/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityBlockBreaker.java @@ -15,10 +15,10 @@ import gregtech.api.render.Textures; import gregtech.api.util.BlockUtility; import gregtech.api.util.GregFakePlayer; +import gregtech.api.util.LocalisationUtils; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; -import net.minecraft.client.resources.I18n; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; @@ -256,8 +256,8 @@ protected ModularUI createUI(EntityPlayer entityPlayer) { @Override public void addInformation(ItemStack stack, @Nullable World player, List tooltip, boolean advanced) { - tooltip.add(I18n.format("gregtech.universal.tooltip.item_storage_capacity", getInventorySize())); - tooltip.add(I18n.format("gregtech.machine.block_breaker.speed_bonus", (int) (getEfficiencyMultiplier() * 100))); - tooltip.add(I18n.format("gregtech.machine.block_breaker.consumption", getEnergyPerBlockBreak())); + tooltip.add(LocalisationUtils.format("gregtech.universal.tooltip.item_storage_capacity", getInventorySize())); + tooltip.add(LocalisationUtils.format("gregtech.machine.block_breaker.speed_bonus", (int) (getEfficiencyMultiplier() * 100))); + tooltip.add(LocalisationUtils.format("gregtech.machine.block_breaker.consumption", getEnergyPerBlockBreak())); } } diff --git a/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityCharger.java b/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityCharger.java index e8fa9c6997..d6321f5ea5 100644 --- a/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityCharger.java +++ b/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityCharger.java @@ -10,7 +10,7 @@ import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.metatileentity.MetaTileEntityHolder; import gregtech.api.metatileentity.TieredMetaTileEntity; -import net.minecraft.client.resources.I18n; +import gregtech.api.util.LocalisationUtils; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; @@ -107,8 +107,8 @@ protected ModularUI createUI(EntityPlayer entityPlayer) { @Override public void addInformation(ItemStack stack, @Nullable World player, List tooltip, boolean advanced) { - tooltip.add(I18n.format("gregtech.universal.tooltip.item_storage_capacity", inventorySize)); - tooltip.add(I18n.format("gregtech.universal.tooltip.voltage_in", energyContainer.getInputVoltage(), GTValues.VN[getTier()])); - tooltip.add(I18n.format("gregtech.universal.tooltip.energy_storage_capacity", energyContainer.getEnergyCapacity())); + tooltip.add(LocalisationUtils.format("gregtech.universal.tooltip.item_storage_capacity", inventorySize)); + tooltip.add(LocalisationUtils.format("gregtech.universal.tooltip.voltage_in", energyContainer.getInputVoltage(), GTValues.VN[getTier()])); + tooltip.add(LocalisationUtils.format("gregtech.universal.tooltip.energy_storage_capacity", energyContainer.getEnergyCapacity())); } } diff --git a/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityFisher.java b/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityFisher.java index 08f608c3c5..20ebd57fe2 100644 --- a/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityFisher.java +++ b/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityFisher.java @@ -12,9 +12,9 @@ import gregtech.api.metatileentity.TieredMetaTileEntity; import gregtech.api.render.Textures; import gregtech.api.unification.OreDictUnifier; +import gregtech.api.util.LocalisationUtils; import net.minecraft.block.BlockLiquid; import net.minecraft.block.material.Material; -import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; @@ -138,10 +138,10 @@ public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, @Override public void addInformation(ItemStack stack, @Nullable World player, List tooltip, boolean advanced) { - tooltip.add(I18n.format("gregtech.universal.tooltip.voltage_in", energyContainer.getInputVoltage(), GTValues.VN[getTier()])); - tooltip.add(I18n.format("gregtech.universal.tooltip.energy_storage_capacity", energyContainer.getEnergyCapacity())); - tooltip.add(I18n.format("gregtech.machine.fisher.speed", fishingTicks)); - tooltip.add(I18n.format("gregtech.machine.fisher.requirement", (int) Math.sqrt(WATER_CHECK_SIZE))); + tooltip.add(LocalisationUtils.format("gregtech.universal.tooltip.voltage_in", energyContainer.getInputVoltage(), GTValues.VN[getTier()])); + tooltip.add(LocalisationUtils.format("gregtech.universal.tooltip.energy_storage_capacity", energyContainer.getEnergyCapacity())); + tooltip.add(LocalisationUtils.format("gregtech.machine.fisher.speed", fishingTicks)); + tooltip.add(LocalisationUtils.format("gregtech.machine.fisher.requirement", (int) Math.sqrt(WATER_CHECK_SIZE))); } } diff --git a/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityHull.java b/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityHull.java index b4dfbe1ad8..5542540fb2 100644 --- a/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityHull.java +++ b/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityHull.java @@ -10,8 +10,8 @@ import gregtech.api.metatileentity.MetaTileEntityHolder; import gregtech.api.metatileentity.TieredMetaTileEntity; import gregtech.api.render.Textures; +import gregtech.api.util.LocalisationUtils; import gregtech.api.util.PipelineUtil; -import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; @@ -65,8 +65,8 @@ protected ModularUI createUI(EntityPlayer entityPlayer) { public void addInformation(ItemStack stack, @Nullable World player, List tooltip, boolean advanced) { String tierName = GTValues.VN[getTier()]; - tooltip.add(I18n.format("gregtech.universal.tooltip.voltage_in", energyContainer.getInputVoltage(), tierName)); - tooltip.add(I18n.format("gregtech.universal.tooltip.voltage_out", energyContainer.getOutputVoltage(), tierName)); - tooltip.add(I18n.format("gregtech.universal.tooltip.energy_storage_capacity", energyContainer.getEnergyCapacity())); + tooltip.add(LocalisationUtils.format("gregtech.universal.tooltip.voltage_in", energyContainer.getInputVoltage(), tierName)); + tooltip.add(LocalisationUtils.format("gregtech.universal.tooltip.voltage_out", energyContainer.getOutputVoltage(), tierName)); + tooltip.add(LocalisationUtils.format("gregtech.universal.tooltip.energy_storage_capacity", energyContainer.getEnergyCapacity())); } } diff --git a/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityItemCollector.java b/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityItemCollector.java index 42e42d46f5..9b0cc199ae 100644 --- a/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityItemCollector.java +++ b/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityItemCollector.java @@ -16,8 +16,8 @@ import gregtech.api.metatileentity.TieredMetaTileEntity; import gregtech.api.render.SimpleOverlayRenderer; import gregtech.api.render.Textures; +import gregtech.api.util.LocalisationUtils; import gregtech.common.covers.filter.ItemFilterContainer; -import net.minecraft.client.resources.I18n; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; @@ -168,11 +168,11 @@ protected void moveItemsInEffectRange() { @Override @SideOnly(Side.CLIENT) public void addInformation(ItemStack stack, @Nullable World player, List tooltip, boolean advanced) { - tooltip.add(I18n.format("gregtech.machine.item_collector.collect_range", maxItemSuckingRange, maxItemSuckingRange)); - tooltip.add(I18n.format("gregtech.universal.tooltip.max_voltage_in", energyContainer.getInputVoltage(), GTValues.VN[getTier()])); - tooltip.add(I18n.format("gregtech.universal.tooltip.energy_storage_capacity", energyContainer.getEnergyCapacity())); - tooltip.add(I18n.format("gregtech.machine.item_controller.tooltip.redstone")); - tooltip.add(I18n.format("gregtech.machine.item_controller.tooltip.consumption", getEnergyConsumedPerTick())); + tooltip.add(LocalisationUtils.format("gregtech.machine.item_collector.collect_range", maxItemSuckingRange, maxItemSuckingRange)); + tooltip.add(LocalisationUtils.format("gregtech.universal.tooltip.max_voltage_in", energyContainer.getInputVoltage(), GTValues.VN[getTier()])); + tooltip.add(LocalisationUtils.format("gregtech.universal.tooltip.energy_storage_capacity", energyContainer.getEnergyCapacity())); + tooltip.add(LocalisationUtils.format("gregtech.machine.item_controller.tooltip.redstone")); + tooltip.add(LocalisationUtils.format("gregtech.machine.item_controller.tooltip.consumption", getEnergyConsumedPerTick())); } @Override diff --git a/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityPump.java b/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityPump.java index 1fbaad8a12..9de7d48e06 100644 --- a/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityPump.java +++ b/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityPump.java @@ -19,9 +19,9 @@ import gregtech.api.metatileentity.TieredMetaTileEntity; import gregtech.api.render.Textures; import gregtech.api.util.GTUtility; +import gregtech.api.util.LocalisationUtils; import net.minecraft.block.BlockLiquid; import net.minecraft.block.state.IBlockState; -import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; @@ -291,10 +291,10 @@ public void readFromNBT(NBTTagCompound data) { @Override public void addInformation(ItemStack stack, @Nullable World player, List tooltip, boolean advanced) { int maxPumpRange = getMaxPumpRange(); - tooltip.add(I18n.format("gregtech.machine.pump.tooltip_range", maxPumpRange, maxPumpRange)); - tooltip.add(I18n.format("gregtech.machine.pump.tooltip_speed", getPumpingCycleLength())); - tooltip.add(I18n.format("gregtech.universal.tooltip.voltage_in", energyContainer.getInputVoltage(), GTValues.VN[getTier()])); - tooltip.add(I18n.format("gregtech.universal.tooltip.energy_storage_capacity", energyContainer.getEnergyCapacity())); - tooltip.add(I18n.format("gregtech.universal.tooltip.fluid_storage_capacity", exportFluids.getTankAt(0).getCapacity())); + tooltip.add(LocalisationUtils.format("gregtech.machine.pump.tooltip_range", maxPumpRange, maxPumpRange)); + tooltip.add(LocalisationUtils.format("gregtech.machine.pump.tooltip_speed", getPumpingCycleLength())); + tooltip.add(LocalisationUtils.format("gregtech.universal.tooltip.voltage_in", energyContainer.getInputVoltage(), GTValues.VN[getTier()])); + tooltip.add(LocalisationUtils.format("gregtech.universal.tooltip.energy_storage_capacity", energyContainer.getEnergyCapacity())); + tooltip.add(LocalisationUtils.format("gregtech.universal.tooltip.fluid_storage_capacity", exportFluids.getTankAt(0).getCapacity())); } } diff --git a/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityTransformer.java b/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityTransformer.java index 8f17588b1b..d520312388 100644 --- a/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityTransformer.java +++ b/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityTransformer.java @@ -13,9 +13,9 @@ import gregtech.api.metatileentity.MetaTileEntityHolder; import gregtech.api.metatileentity.TieredMetaTileEntity; import gregtech.api.render.Textures; +import gregtech.api.util.LocalisationUtils; import gregtech.api.util.PipelineUtil; import gregtech.common.tools.DamageValues; -import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; @@ -168,17 +168,17 @@ public void addInformation(ItemStack stack, @Nullable World player, List long lowerAmperage = energyContainer.getInputAmperage(); long higherAmperage = energyContainer.getOutputAmperage(); - tooltip.add(I18n.format("gregtech.machine.transformer.tooltip_tool_usage")); - tooltip.add(I18n.format("gregtech.universal.tooltip.energy_storage_capacity", energyContainer.getEnergyCapacity())); - tooltip.add(I18n.format("gregtech.machine.transformer.tooltip_transform_down")); - tooltip.add(I18n.format("gregtech.universal.tooltip.voltage_in", higherVoltage, higherTierName)); - tooltip.add(I18n.format("gregtech.universal.tooltip.voltage_out", lowerVoltage, lowerTierName)); - tooltip.add(I18n.format("gregtech.universal.tooltip.amperage_in", lowerAmperage)); - tooltip.add(I18n.format("gregtech.universal.tooltip.amperage_out", higherAmperage)); - tooltip.add(I18n.format("gregtech.machine.transformer.tooltip_transform_up")); - tooltip.add(I18n.format("gregtech.universal.tooltip.voltage_in", lowerVoltage, lowerTierName)); - tooltip.add(I18n.format("gregtech.universal.tooltip.voltage_out", higherVoltage, higherTierName)); - tooltip.add(I18n.format("gregtech.universal.tooltip.amperage_in", higherAmperage)); - tooltip.add(I18n.format("gregtech.universal.tooltip.amperage_out", lowerAmperage)); + tooltip.add(LocalisationUtils.format("gregtech.machine.transformer.tooltip_tool_usage")); + tooltip.add(LocalisationUtils.format("gregtech.universal.tooltip.energy_storage_capacity", energyContainer.getEnergyCapacity())); + tooltip.add(LocalisationUtils.format("gregtech.machine.transformer.tooltip_transform_down")); + tooltip.add(LocalisationUtils.format("gregtech.universal.tooltip.voltage_in", higherVoltage, higherTierName)); + tooltip.add(LocalisationUtils.format("gregtech.universal.tooltip.voltage_out", lowerVoltage, lowerTierName)); + tooltip.add(LocalisationUtils.format("gregtech.universal.tooltip.amperage_in", lowerAmperage)); + tooltip.add(LocalisationUtils.format("gregtech.universal.tooltip.amperage_out", higherAmperage)); + tooltip.add(LocalisationUtils.format("gregtech.machine.transformer.tooltip_transform_up")); + tooltip.add(LocalisationUtils.format("gregtech.universal.tooltip.voltage_in", lowerVoltage, lowerTierName)); + tooltip.add(LocalisationUtils.format("gregtech.universal.tooltip.voltage_out", higherVoltage, higherTierName)); + tooltip.add(LocalisationUtils.format("gregtech.universal.tooltip.amperage_in", higherAmperage)); + tooltip.add(LocalisationUtils.format("gregtech.universal.tooltip.amperage_out", lowerAmperage)); } } diff --git a/src/main/java/gregtech/common/metatileentities/electric/multiblockpart/MetaTileEntityEnergyHatch.java b/src/main/java/gregtech/common/metatileentities/electric/multiblockpart/MetaTileEntityEnergyHatch.java index dd4eb9d27b..f949fd569b 100644 --- a/src/main/java/gregtech/common/metatileentities/electric/multiblockpart/MetaTileEntityEnergyHatch.java +++ b/src/main/java/gregtech/common/metatileentities/electric/multiblockpart/MetaTileEntityEnergyHatch.java @@ -13,8 +13,8 @@ import gregtech.api.metatileentity.multiblock.MultiblockAbility; import gregtech.api.render.SimpleOverlayRenderer; import gregtech.api.render.Textures; +import gregtech.api.util.LocalisationUtils; import gregtech.api.util.PipelineUtil; -import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; @@ -77,12 +77,12 @@ public void addInformation(ItemStack stack, @Nullable World player, List String tierName = GTValues.VN[getTier()]; if (isExportHatch) { - tooltip.add(I18n.format("gregtech.universal.tooltip.voltage_out", energyContainer.getOutputVoltage(), tierName)); - tooltip.add(I18n.format("gregtech.universal.tooltip.amperage_out_till", energyContainer.getOutputAmperage())); + tooltip.add(LocalisationUtils.format("gregtech.universal.tooltip.voltage_out", energyContainer.getOutputVoltage(), tierName)); + tooltip.add(LocalisationUtils.format("gregtech.universal.tooltip.amperage_out_till", energyContainer.getOutputAmperage())); } else { - tooltip.add(I18n.format("gregtech.universal.tooltip.voltage_in", energyContainer.getInputVoltage(), tierName)); - tooltip.add(I18n.format("gregtech.universal.tooltip.amperage_in_till", energyContainer.getInputAmperage())); + tooltip.add(LocalisationUtils.format("gregtech.universal.tooltip.voltage_in", energyContainer.getInputVoltage(), tierName)); + tooltip.add(LocalisationUtils.format("gregtech.universal.tooltip.amperage_in_till", energyContainer.getInputAmperage())); } - tooltip.add(I18n.format("gregtech.universal.tooltip.energy_storage_capacity", energyContainer.getEnergyCapacity())); + tooltip.add(LocalisationUtils.format("gregtech.universal.tooltip.energy_storage_capacity", energyContainer.getEnergyCapacity())); } } diff --git a/src/main/java/gregtech/common/metatileentities/electric/multiblockpart/MetaTileEntityFluidHatch.java b/src/main/java/gregtech/common/metatileentities/electric/multiblockpart/MetaTileEntityFluidHatch.java index 332cff55ec..f06d73ec0f 100644 --- a/src/main/java/gregtech/common/metatileentities/electric/multiblockpart/MetaTileEntityFluidHatch.java +++ b/src/main/java/gregtech/common/metatileentities/electric/multiblockpart/MetaTileEntityFluidHatch.java @@ -17,7 +17,7 @@ import gregtech.api.metatileentity.multiblock.MultiblockAbility; import gregtech.api.render.SimpleOverlayRenderer; import gregtech.api.render.Textures; -import net.minecraft.client.resources.I18n; +import gregtech.api.util.LocalisationUtils; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; @@ -146,6 +146,6 @@ public ModularUI.Builder createTankUI(IFluidTank fluidTank, IItemHandlerModifiab @Override public void addInformation(ItemStack stack, @Nullable World player, List tooltip, boolean advanced) { - tooltip.add(I18n.format("gregtech.universal.tooltip.fluid_storage_capacity", getInventorySize())); + tooltip.add(LocalisationUtils.format("gregtech.universal.tooltip.fluid_storage_capacity", getInventorySize())); } } diff --git a/src/main/java/gregtech/common/metatileentities/electric/multiblockpart/MetaTileEntityItemBus.java b/src/main/java/gregtech/common/metatileentities/electric/multiblockpart/MetaTileEntityItemBus.java index a3703f5588..d45bc4a734 100644 --- a/src/main/java/gregtech/common/metatileentities/electric/multiblockpart/MetaTileEntityItemBus.java +++ b/src/main/java/gregtech/common/metatileentities/electric/multiblockpart/MetaTileEntityItemBus.java @@ -13,7 +13,7 @@ import gregtech.api.metatileentity.multiblock.MultiblockAbility; import gregtech.api.render.SimpleOverlayRenderer; import gregtech.api.render.Textures; -import net.minecraft.client.resources.I18n; +import gregtech.api.util.LocalisationUtils; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; @@ -113,6 +113,6 @@ private ModularUI.Builder createUITemplate(EntityPlayer player, int rowSize, int @Override public void addInformation(ItemStack stack, @Nullable World player, List tooltip, boolean advanced) { - tooltip.add(I18n.format("gregtech.universal.tooltip.item_storage_capacity", getInventorySize())); + tooltip.add(LocalisationUtils.format("gregtech.universal.tooltip.item_storage_capacity", getInventorySize())); } } diff --git a/src/main/java/gregtech/common/metatileentities/steam/boiler/SteamBoiler.java b/src/main/java/gregtech/common/metatileentities/steam/boiler/SteamBoiler.java index b63e5ba849..af1b14fe1d 100644 --- a/src/main/java/gregtech/common/metatileentities/steam/boiler/SteamBoiler.java +++ b/src/main/java/gregtech/common/metatileentities/steam/boiler/SteamBoiler.java @@ -16,8 +16,8 @@ import gregtech.api.render.SimpleSidedCubeRenderer; import gregtech.api.render.Textures; import gregtech.api.util.GTUtility; +import gregtech.api.util.LocalisationUtils; import net.minecraft.client.renderer.texture.TextureAtlasSprite; -import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.SoundEvents; import net.minecraft.item.ItemStack; @@ -296,6 +296,6 @@ private int getBoilingCycleLength() { @Override public void addInformation(ItemStack stack, @Nullable World player, List tooltip, boolean advanced) { - tooltip.add(I18n.format("gregtech.machine.steam_boiler.tooltip_produces", baseSteamOutput, getBoilingCycleLength())); + tooltip.add(LocalisationUtils.format("gregtech.machine.steam_boiler.tooltip_produces", baseSteamOutput, getBoilingCycleLength())); } } diff --git a/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityChest.java b/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityChest.java index c44558c1c5..083cb1dd35 100644 --- a/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityChest.java +++ b/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityChest.java @@ -18,8 +18,8 @@ import gregtech.api.render.Textures; import gregtech.api.unification.material.type.SolidMaterial; import gregtech.api.util.GTUtility; +import gregtech.api.util.LocalisationUtils; import net.minecraft.client.renderer.texture.TextureAtlasSprite; -import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.SoundEvents; import net.minecraft.item.ItemStack; @@ -307,6 +307,6 @@ protected boolean shouldSerializeInventories() { @Override public void addInformation(ItemStack stack, @Nullable World player, List tooltip, boolean advanced) { - tooltip.add(I18n.format("gregtech.universal.tooltip.item_storage_capacity", rowSize * amountOfRows)); + tooltip.add(LocalisationUtils.format("gregtech.universal.tooltip.item_storage_capacity", rowSize * amountOfRows)); } } diff --git a/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityQuantumChest.java b/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityQuantumChest.java index 3e58d838b2..4493e452b7 100644 --- a/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityQuantumChest.java +++ b/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityQuantumChest.java @@ -15,8 +15,8 @@ import gregtech.api.metatileentity.MetaTileEntityHolder; import gregtech.api.render.Textures; import gregtech.api.util.GTUtility; +import gregtech.api.util.LocalisationUtils; import net.minecraft.client.renderer.texture.TextureAtlasSprite; -import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; @@ -141,7 +141,7 @@ protected void addDisplayInformation(List textList) { @Override public void addInformation(ItemStack stack, @Nullable World player, List tooltip, boolean advanced) { super.addInformation(stack, player, tooltip, advanced); - tooltip.add(I18n.format("gregtech.machine.quantum_chest.capacity", maxStoredItems)); + tooltip.add(LocalisationUtils.format("gregtech.machine.quantum_chest.capacity", maxStoredItems)); NBTTagCompound compound = stack.getTagCompound(); if (compound != null) { @@ -156,9 +156,9 @@ public void addInformation(ItemStack stack, @Nullable World player, List count = tempStack.getCount(); } if (translationKey != null) { - tooltip.add(I18n.format("gregtech.machine.quantum_chest.tooltip.item", - I18n.format(translationKey))); - tooltip.add(I18n.format("gregtech.machine.quantum_chest.tooltip.count", count)); + tooltip.add(LocalisationUtils.format("gregtech.machine.quantum_chest.tooltip.item", + LocalisationUtils.format(translationKey))); + tooltip.add(LocalisationUtils.format("gregtech.machine.quantum_chest.tooltip.count", count)); } } } diff --git a/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityQuantumTank.java b/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityQuantumTank.java index 25e68b6bb5..9def1af641 100644 --- a/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityQuantumTank.java +++ b/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityQuantumTank.java @@ -18,8 +18,8 @@ import gregtech.api.metatileentity.MetaTileEntityHolder; import gregtech.api.render.Textures; import gregtech.api.util.GTUtility; +import gregtech.api.util.LocalisationUtils; import net.minecraft.client.renderer.texture.TextureAtlasSprite; -import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; @@ -165,12 +165,12 @@ public Pair getParticleTexture() { @Override public void addInformation(ItemStack stack, @Nullable World player, List tooltip, boolean advanced) { super.addInformation(stack, player, tooltip, advanced); - tooltip.add(I18n.format("gregtech.machine.quantum_tank.capacity", maxFluidCapacity)); + tooltip.add(LocalisationUtils.format("gregtech.machine.quantum_tank.capacity", maxFluidCapacity)); NBTTagCompound compound = stack.getTagCompound(); if (compound != null && compound.hasKey("FluidName")) { FluidStack fluidStack = new FluidStack(FluidRegistry.getFluid(compound.getString("FluidName")), 1000); - tooltip.add(I18n.format("gregtech.machine.quantum_tank.tooltip.name", fluidStack.getLocalizedName())); - tooltip.add(I18n.format("gregtech.machine.quantum_tank.tooltip.count", compound.getInteger("Amount"))); + tooltip.add(LocalisationUtils.format("gregtech.machine.quantum_tank.tooltip.name", fluidStack.getLocalizedName())); + tooltip.add(LocalisationUtils.format("gregtech.machine.quantum_tank.tooltip.count", compound.getInteger("Amount"))); } } diff --git a/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityTank.java b/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityTank.java index a907f3371a..c480b2058b 100644 --- a/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityTank.java +++ b/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityTank.java @@ -23,10 +23,10 @@ import gregtech.api.util.ByteBufUtils; import gregtech.api.util.FluidTooltipUtil; import gregtech.api.util.GTUtility; +import gregtech.api.util.LocalisationUtils; import gregtech.api.util.WatchedFluidTank; import gregtech.common.ConfigHolder; import net.minecraft.client.renderer.texture.TextureAtlasSprite; -import net.minecraft.client.resources.I18n; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; @@ -674,13 +674,13 @@ private FluidStack getFluidForRendering() { @Override @SideOnly(Side.CLIENT) public void addInformation(ItemStack stack, @Nullable World player, List tooltip, boolean advanced) { - tooltip.add(I18n.format("gregtech.universal.tooltip.fluid_storage_capacity", tankSize)); - tooltip.add(I18n.format("gregtech.machine.fluid_tank.max_multiblock", maxSizeHorizontal, maxSizeVertical, maxSizeHorizontal)); + tooltip.add(LocalisationUtils.format("gregtech.universal.tooltip.fluid_storage_capacity", tankSize)); + tooltip.add(LocalisationUtils.format("gregtech.machine.fluid_tank.max_multiblock", maxSizeHorizontal, maxSizeVertical, maxSizeHorizontal)); NBTTagCompound tagCompound = stack.getTagCompound(); if (tagCompound != null && tagCompound.hasKey("Fluid", NBT.TAG_COMPOUND)) { FluidStack fluidStack = FluidStack.loadFluidStackFromNBT(tagCompound.getCompoundTag("Fluid")); if (fluidStack != null) { - tooltip.add(I18n.format("gregtech.machine.fluid_tank.fluid", fluidStack.amount, fluidStack.getLocalizedName())); + tooltip.add(LocalisationUtils.format("gregtech.machine.fluid_tank.fluid", fluidStack.amount, fluidStack.getLocalizedName())); } String formula = FluidTooltipUtil.getFluidTooltip(fluidStack); if (formula != null) diff --git a/src/main/java/gregtech/common/pipelike/cable/ItemBlockCable.java b/src/main/java/gregtech/common/pipelike/cable/ItemBlockCable.java index f46f3248b9..6e887a354f 100644 --- a/src/main/java/gregtech/common/pipelike/cable/ItemBlockCable.java +++ b/src/main/java/gregtech/common/pipelike/cable/ItemBlockCable.java @@ -3,7 +3,7 @@ import gregtech.api.GTValues; import gregtech.api.pipenet.block.material.ItemBlockMaterialPipe; import gregtech.api.util.GTUtility; -import net.minecraft.client.resources.I18n; +import gregtech.api.util.LocalisationUtils; import net.minecraft.client.util.ITooltipFlag; import net.minecraft.item.ItemStack; import net.minecraft.world.World; @@ -24,8 +24,8 @@ public ItemBlockCable(BlockCable block) { public void addInformation(ItemStack stack, @Nullable World worldIn, List tooltip, ITooltipFlag flagIn) { WireProperties wireProperties = blockPipe.createItemProperties(stack); String voltageName = GTValues.VN[GTUtility.getTierByVoltage(wireProperties.voltage)]; - tooltip.add(I18n.format("gregtech.cable.voltage", wireProperties.voltage, voltageName)); - tooltip.add(I18n.format("gregtech.cable.amperage", wireProperties.amperage)); - tooltip.add(I18n.format("gregtech.cable.loss_per_block", wireProperties.lossPerBlock)); + tooltip.add(LocalisationUtils.format("gregtech.cable.voltage", wireProperties.voltage, voltageName)); + tooltip.add(LocalisationUtils.format("gregtech.cable.amperage", wireProperties.amperage)); + tooltip.add(LocalisationUtils.format("gregtech.cable.loss_per_block", wireProperties.lossPerBlock)); } } diff --git a/src/main/java/gregtech/common/pipelike/fluidpipe/ItemBlockFluidPipe.java b/src/main/java/gregtech/common/pipelike/fluidpipe/ItemBlockFluidPipe.java index 36b090dccc..e8c7888f09 100644 --- a/src/main/java/gregtech/common/pipelike/fluidpipe/ItemBlockFluidPipe.java +++ b/src/main/java/gregtech/common/pipelike/fluidpipe/ItemBlockFluidPipe.java @@ -1,7 +1,7 @@ package gregtech.common.pipelike.fluidpipe; import gregtech.api.pipenet.block.material.ItemBlockMaterialPipe; -import net.minecraft.client.resources.I18n; +import gregtech.api.util.LocalisationUtils; import net.minecraft.client.util.ITooltipFlag; import net.minecraft.item.ItemStack; import net.minecraft.world.World; @@ -21,8 +21,8 @@ public ItemBlockFluidPipe(BlockFluidPipe block) { @SideOnly(Side.CLIENT) public void addInformation(ItemStack stack, @Nullable World worldIn, List tooltip, ITooltipFlag flagIn) { FluidPipeProperties pipeProperties = blockPipe.createItemProperties(stack); - tooltip.add(I18n.format("gregtech.fluid_pipe.throughput", pipeProperties.throughput)); - tooltip.add(I18n.format("gregtech.fluid_pipe.max_temperature", pipeProperties.maxFluidTemperature)); - if (!pipeProperties.gasProof) tooltip.add(I18n.format("gregtech.fluid_pipe.non_gas_proof")); + tooltip.add(LocalisationUtils.format("gregtech.fluid_pipe.throughput", pipeProperties.throughput)); + tooltip.add(LocalisationUtils.format("gregtech.fluid_pipe.max_temperature", pipeProperties.maxFluidTemperature)); + if (!pipeProperties.gasProof) tooltip.add(LocalisationUtils.format("gregtech.fluid_pipe.non_gas_proof")); } } diff --git a/src/main/java/gregtech/common/tools/ToolHardHammer.java b/src/main/java/gregtech/common/tools/ToolHardHammer.java index c09ae3e32a..25d21d6fba 100644 --- a/src/main/java/gregtech/common/tools/ToolHardHammer.java +++ b/src/main/java/gregtech/common/tools/ToolHardHammer.java @@ -1,9 +1,9 @@ package gregtech.common.tools; import gregtech.api.recipes.RecipeMaps; +import gregtech.api.util.LocalisationUtils; import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; -import net.minecraft.client.resources.I18n; import net.minecraft.enchantment.Enchantment; import net.minecraft.enchantment.EnchantmentHelper; import net.minecraft.entity.EntityLivingBase; @@ -85,6 +85,6 @@ public void convertBlockDrops(World world, BlockPos blockPos, IBlockState blockS @Override public void addInformation(ItemStack stack, List lines, boolean isAdvanced) { - lines.add(I18n.format("metaitem.tool.tooltip.hammer.extra_drop")); + lines.add(LocalisationUtils.format("metaitem.tool.tooltip.hammer.extra_drop")); } } diff --git a/src/main/java/gregtech/integration/jei/GTJeiPlugin.java b/src/main/java/gregtech/integration/jei/GTJeiPlugin.java index fd03472d40..b38627344b 100755 --- a/src/main/java/gregtech/integration/jei/GTJeiPlugin.java +++ b/src/main/java/gregtech/integration/jei/GTJeiPlugin.java @@ -19,6 +19,7 @@ import gregtech.api.unification.material.type.DustMaterial; import gregtech.api.unification.material.type.Material; import gregtech.api.unification.ore.OrePrefix; +import gregtech.api.util.LocalisationUtils; import gregtech.api.worldgen.config.OreDepositDefinition; import gregtech.api.worldgen.config.WorldGenRegistry; import gregtech.common.blocks.MetaBlocks; @@ -39,7 +40,6 @@ import mezz.jei.api.ingredients.VanillaTypes; import mezz.jei.api.recipe.IRecipeCategoryRegistration; import mezz.jei.api.recipe.VanillaRecipeCategoryUid; -import net.minecraft.client.resources.I18n; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; @@ -140,7 +140,7 @@ public void register(IModRegistry registry) { registry.addRecipeCatalyst(MetaTileEntities.LARGE_TITANIUM_BOILER.getStackForm(), semiFluidMapId); registry.addRecipeCatalyst(MetaTileEntities.LARGE_TUNGSTENSTEEL_BOILER.getStackForm(), semiFluidMapId); - registry.addIngredientInfo(Objects.requireNonNull(Materials.Air.getFluid(1000)), VanillaTypes.FLUID, I18n.format("gregtech.machine.air_collector.jei_description")); + registry.addIngredientInfo(Objects.requireNonNull(Materials.Air.getFluid(1000)), VanillaTypes.FLUID, LocalisationUtils.format("gregtech.machine.air_collector.jei_description")); String primitiveBlastId = GTValues.MODID + ":" + "primitive_blast_furnace"; registry.addRecipes(RecipeMaps.PRIMITIVE_BLAST_FURNACE_RECIPES.stream() diff --git a/src/main/java/gregtech/integration/jei/GTOreInfo.java b/src/main/java/gregtech/integration/jei/GTOreInfo.java index dcf696cb21..d118eb34ae 100644 --- a/src/main/java/gregtech/integration/jei/GTOreInfo.java +++ b/src/main/java/gregtech/integration/jei/GTOreInfo.java @@ -2,6 +2,7 @@ import gregtech.api.unification.OreDictUnifier; import gregtech.api.unification.material.type.Material; +import gregtech.api.util.LocalisationUtils; import gregtech.api.worldgen.config.OreDepositDefinition; import gregtech.api.worldgen.filler.BlockFiller; import gregtech.api.worldgen.filler.FillerEntry; @@ -13,7 +14,6 @@ import mezz.jei.api.recipe.IRecipeWrapper; import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; -import net.minecraft.client.resources.I18n; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraft.world.biome.Biome; @@ -239,8 +239,8 @@ public void addTooltip(int slotIndex, boolean input, Object ingredient, List createBiomeTooltip() { if(!(entry.getValue() == weight)) { //Cannot Spawn if(entry.getValue() <= 0) { - tooltip.add(I18n.format("gregtech.jei.ore.biome_weighting_no_spawn", entry.getKey().getBiomeName())); + tooltip.add(LocalisationUtils.format("gregtech.jei.ore.biome_weighting_no_spawn", entry.getKey().getBiomeName())); } else { - tooltip.add(I18n.format("gregtech.jei.ore.biome_weighting", entry.getKey().getBiomeName(), entry.getValue())); + tooltip.add(LocalisationUtils.format("gregtech.jei.ore.biome_weighting", entry.getKey().getBiomeName(), entry.getValue())); } } } diff --git a/src/main/java/gregtech/integration/jei/multiblock/MultiblockInfoCategory.java b/src/main/java/gregtech/integration/jei/multiblock/MultiblockInfoCategory.java index 1873ce382b..9ea80f9a71 100644 --- a/src/main/java/gregtech/integration/jei/multiblock/MultiblockInfoCategory.java +++ b/src/main/java/gregtech/integration/jei/multiblock/MultiblockInfoCategory.java @@ -2,6 +2,7 @@ import gregtech.api.GTValues; import gregtech.api.gui.GuiTextures; +import gregtech.api.util.LocalisationUtils; import gregtech.common.metatileentities.MetaTileEntities; import gregtech.integration.jei.multiblock.infos.*; import mezz.jei.api.IJeiHelpers; @@ -13,7 +14,6 @@ import mezz.jei.api.ingredients.IIngredients; import mezz.jei.api.recipe.IRecipeCategory; import mezz.jei.gui.recipes.RecipeLayout; -import net.minecraft.client.resources.I18n; import java.util.HashMap; import java.util.Map; @@ -61,7 +61,7 @@ public String getUid() { @Override public String getTitle() { - return I18n.format("gregtech.multiblock.title"); + return LocalisationUtils.format("gregtech.multiblock.title"); } @Override diff --git a/src/main/java/gregtech/integration/jei/multiblock/MultiblockInfoPage.java b/src/main/java/gregtech/integration/jei/multiblock/MultiblockInfoPage.java index 917780515d..d4df6f5e88 100644 --- a/src/main/java/gregtech/integration/jei/multiblock/MultiblockInfoPage.java +++ b/src/main/java/gregtech/integration/jei/multiblock/MultiblockInfoPage.java @@ -3,10 +3,10 @@ import gregtech.api.GTValues; import gregtech.api.metatileentity.multiblock.MultiblockControllerBase; import gregtech.api.util.ItemStackHashStrategy; +import gregtech.api.util.LocalisationUtils; import gregtech.common.metatileentities.MetaTileEntities; import it.unimi.dsi.fastutil.Hash; import it.unimi.dsi.fastutil.objects.Object2ObjectOpenCustomHashMap; -import net.minecraft.client.resources.I18n; import net.minecraft.item.ItemStack; import net.minecraft.util.text.ITextComponent; import net.minecraft.util.text.Style; @@ -39,7 +39,7 @@ public List informationText() { return Stream.of("gregtech.multiblock.preview.tilt", "gregtech.multiblock.preview.zoom", "gregtech.multiblock.preview.pan", "gregtech.multiblock.preview.move", "gregtech.multiblock.preview.reset") - .map(I18n::format) + .map(LocalisationUtils::format) .collect(Collectors.toList()); } diff --git a/src/main/java/gregtech/integration/jei/multiblock/MultiblockInfoRecipeWrapper.java b/src/main/java/gregtech/integration/jei/multiblock/MultiblockInfoRecipeWrapper.java index 760ae0c264..ad6aacf103 100755 --- a/src/main/java/gregtech/integration/jei/multiblock/MultiblockInfoRecipeWrapper.java +++ b/src/main/java/gregtech/integration/jei/multiblock/MultiblockInfoRecipeWrapper.java @@ -13,6 +13,7 @@ import gregtech.api.util.BlockInfo; import gregtech.api.util.GTUtility; import gregtech.api.util.ItemStackKey; +import gregtech.api.util.LocalisationUtils; import mezz.jei.api.IGuiHelper; import mezz.jei.api.gui.IDrawable; import mezz.jei.api.gui.IGuiItemStackGroup; @@ -24,7 +25,6 @@ import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.client.resources.I18n; import net.minecraft.client.util.ITooltipFlag; import net.minecraft.client.util.ITooltipFlag.TooltipFlags; import net.minecraft.item.EnumRarity; @@ -317,7 +317,7 @@ private boolean isMouseWithinRange(int[] yRange, int[] xRange, int mouseY, int m } private void drawMultiblockName(int recipeWidth) { - String localizedName = I18n.format(infoPage.getController().getMetaFullName()); + String localizedName = LocalisationUtils.format(infoPage.getController().getMetaFullName()); GTUtility.drawCenteredSizedText(recipeWidth / 2, 0, localizedName, 0x333333, 1.3); } diff --git a/src/main/java/gregtech/integration/jei/multiblock/infos/CokeOvenInfo.java b/src/main/java/gregtech/integration/jei/multiblock/infos/CokeOvenInfo.java index e4469cd407..3127b4e640 100644 --- a/src/main/java/gregtech/integration/jei/multiblock/infos/CokeOvenInfo.java +++ b/src/main/java/gregtech/integration/jei/multiblock/infos/CokeOvenInfo.java @@ -2,12 +2,12 @@ import com.google.common.collect.Lists; import gregtech.api.metatileentity.multiblock.MultiblockControllerBase; +import gregtech.api.util.LocalisationUtils; import gregtech.common.blocks.BlockMetalCasing.MetalCasingType; import gregtech.common.blocks.MetaBlocks; import gregtech.common.metatileentities.MetaTileEntities; import gregtech.integration.jei.multiblock.MultiblockInfoPage; import gregtech.integration.jei.multiblock.MultiblockShapeInfo; -import net.minecraft.client.resources.I18n; import net.minecraft.init.Blocks; import net.minecraft.util.EnumFacing; @@ -36,7 +36,7 @@ public List getMatchingShapes() { @Override public String[] getDescription() { - return new String[]{I18n.format("gregtech.multiblock.coke_oven.description")}; + return new String[]{LocalisationUtils.format("gregtech.multiblock.coke_oven.description")}; } } diff --git a/src/main/java/gregtech/integration/jei/multiblock/infos/CrackerUnitInfo.java b/src/main/java/gregtech/integration/jei/multiblock/infos/CrackerUnitInfo.java index fe23c7c9dc..50366b2cad 100644 --- a/src/main/java/gregtech/integration/jei/multiblock/infos/CrackerUnitInfo.java +++ b/src/main/java/gregtech/integration/jei/multiblock/infos/CrackerUnitInfo.java @@ -3,13 +3,13 @@ import com.google.common.collect.Lists; import gregtech.api.GTValues; import gregtech.api.metatileentity.multiblock.MultiblockControllerBase; +import gregtech.api.util.LocalisationUtils; import gregtech.common.blocks.BlockMetalCasing; import gregtech.common.blocks.BlockWireCoil; import gregtech.common.blocks.MetaBlocks; import gregtech.common.metatileentities.MetaTileEntities; import gregtech.integration.jei.multiblock.MultiblockInfoPage; import gregtech.integration.jei.multiblock.MultiblockShapeInfo; -import net.minecraft.client.resources.I18n; import net.minecraft.init.Blocks; import net.minecraft.util.EnumFacing; import net.minecraft.util.text.ITextComponent; @@ -45,7 +45,7 @@ public List getMatchingShapes() { @Override public String[] getDescription() { - return new String[]{I18n.format("gregtech.multiblock.cracker.description")}; + return new String[]{LocalisationUtils.format("gregtech.multiblock.cracker.description")}; } @Override diff --git a/src/main/java/gregtech/integration/jei/multiblock/infos/DieselEngineInfo.java b/src/main/java/gregtech/integration/jei/multiblock/infos/DieselEngineInfo.java index 4c7e4dffd2..ffe31b7b01 100644 --- a/src/main/java/gregtech/integration/jei/multiblock/infos/DieselEngineInfo.java +++ b/src/main/java/gregtech/integration/jei/multiblock/infos/DieselEngineInfo.java @@ -3,6 +3,7 @@ import com.google.common.collect.Lists; import gregtech.api.GTValues; import gregtech.api.metatileentity.multiblock.MultiblockControllerBase; +import gregtech.api.util.LocalisationUtils; import gregtech.common.blocks.BlockMetalCasing.MetalCasingType; import gregtech.common.blocks.BlockMultiblockCasing; import gregtech.common.blocks.BlockTurbineCasing; @@ -10,7 +11,6 @@ import gregtech.common.metatileentities.MetaTileEntities; import gregtech.integration.jei.multiblock.MultiblockInfoPage; import gregtech.integration.jei.multiblock.MultiblockShapeInfo; -import net.minecraft.client.resources.I18n; import net.minecraft.init.Blocks; import net.minecraft.util.EnumFacing; @@ -43,7 +43,7 @@ public List getMatchingShapes() { @Override public String[] getDescription() { - return new String[]{I18n.format("gregtech.multiblock.diesel_engine.description")}; + return new String[]{LocalisationUtils.format("gregtech.multiblock.diesel_engine.description")}; } } diff --git a/src/main/java/gregtech/integration/jei/multiblock/infos/DistillationTowerInfo.java b/src/main/java/gregtech/integration/jei/multiblock/infos/DistillationTowerInfo.java index bcdd82e1b4..12493eef90 100644 --- a/src/main/java/gregtech/integration/jei/multiblock/infos/DistillationTowerInfo.java +++ b/src/main/java/gregtech/integration/jei/multiblock/infos/DistillationTowerInfo.java @@ -3,12 +3,12 @@ import com.google.common.collect.Lists; import gregtech.api.GTValues; import gregtech.api.metatileentity.multiblock.MultiblockControllerBase; +import gregtech.api.util.LocalisationUtils; import gregtech.common.blocks.BlockMetalCasing.MetalCasingType; import gregtech.common.blocks.MetaBlocks; import gregtech.common.metatileentities.MetaTileEntities; import gregtech.integration.jei.multiblock.MultiblockInfoPage; import gregtech.integration.jei.multiblock.MultiblockShapeInfo; -import net.minecraft.client.resources.I18n; import net.minecraft.init.Blocks; import net.minecraft.util.EnumFacing; import net.minecraft.util.text.ITextComponent; @@ -44,7 +44,7 @@ public List getMatchingShapes() { @Override public String[] getDescription() { - return new String[]{I18n.format("gregtech.multiblock.distillation_tower.description")}; + return new String[]{LocalisationUtils.format("gregtech.multiblock.distillation_tower.description")}; } @Override @@ -56,7 +56,7 @@ public float getDefaultZoom() { protected void generateBlockTooltips() { super.generateBlockTooltips(); ITextComponent tooltip = new TextComponentTranslation("gregtech.multiblock.preview.limit_per_layer", 1).setStyle(new Style().setColor(TextFormatting.DARK_RED)); - ITextComponent inputTooltip = new TextComponentTranslation("gregtech.multiblock.preview.only_location", I18n.format("gregtech.multiblock.preview.location.b_c")).setStyle(new Style().setColor(TextFormatting.DARK_RED)); + ITextComponent inputTooltip = new TextComponentTranslation("gregtech.multiblock.preview.only_location", LocalisationUtils.format("gregtech.multiblock.preview.location.b_c")).setStyle(new Style().setColor(TextFormatting.DARK_RED)); for(int i = 0; i < GTValues.V.length; i++) { addBlockTooltip(MetaTileEntities.FLUID_EXPORT_HATCH[i].getStackForm(), tooltip); diff --git a/src/main/java/gregtech/integration/jei/multiblock/infos/ElectricBlastFurnaceInfo.java b/src/main/java/gregtech/integration/jei/multiblock/infos/ElectricBlastFurnaceInfo.java index 23e35e6ccc..c2c7aaf73b 100644 --- a/src/main/java/gregtech/integration/jei/multiblock/infos/ElectricBlastFurnaceInfo.java +++ b/src/main/java/gregtech/integration/jei/multiblock/infos/ElectricBlastFurnaceInfo.java @@ -2,13 +2,13 @@ import gregtech.api.GTValues; import gregtech.api.metatileentity.multiblock.MultiblockControllerBase; +import gregtech.api.util.LocalisationUtils; import gregtech.common.blocks.BlockMetalCasing.MetalCasingType; import gregtech.common.blocks.BlockWireCoil.CoilType; import gregtech.common.blocks.MetaBlocks; import gregtech.common.metatileentities.MetaTileEntities; import gregtech.integration.jei.multiblock.MultiblockInfoPage; import gregtech.integration.jei.multiblock.MultiblockShapeInfo; -import net.minecraft.client.resources.I18n; import net.minecraft.init.Blocks; import net.minecraft.util.EnumFacing; import net.minecraft.util.text.ITextComponent; @@ -54,7 +54,7 @@ public List getMatchingShapes() { @Override public String[] getDescription() { - return new String[]{I18n.format("gregtech.multiblock.electric_blast_furnace.description")}; + return new String[]{LocalisationUtils.format("gregtech.multiblock.electric_blast_furnace.description")}; } @Override diff --git a/src/main/java/gregtech/integration/jei/multiblock/infos/ImplosionCompressorInfo.java b/src/main/java/gregtech/integration/jei/multiblock/infos/ImplosionCompressorInfo.java index 1c93a2f106..9708526421 100644 --- a/src/main/java/gregtech/integration/jei/multiblock/infos/ImplosionCompressorInfo.java +++ b/src/main/java/gregtech/integration/jei/multiblock/infos/ImplosionCompressorInfo.java @@ -3,12 +3,12 @@ import com.google.common.collect.Lists; import gregtech.api.GTValues; import gregtech.api.metatileentity.multiblock.MultiblockControllerBase; +import gregtech.api.util.LocalisationUtils; import gregtech.common.blocks.BlockMetalCasing.MetalCasingType; import gregtech.common.blocks.MetaBlocks; import gregtech.common.metatileentities.MetaTileEntities; import gregtech.integration.jei.multiblock.MultiblockInfoPage; import gregtech.integration.jei.multiblock.MultiblockShapeInfo; -import net.minecraft.client.resources.I18n; import net.minecraft.init.Blocks; import net.minecraft.util.EnumFacing; import net.minecraft.util.text.ITextComponent; @@ -43,7 +43,7 @@ public List getMatchingShapes() { @Override public String[] getDescription() { - return new String[]{I18n.format("gregtech.multiblock.implosion_compressor.description")}; + return new String[]{LocalisationUtils.format("gregtech.multiblock.implosion_compressor.description")}; } @Override diff --git a/src/main/java/gregtech/integration/jei/multiblock/infos/LargeBoilerInfo.java b/src/main/java/gregtech/integration/jei/multiblock/infos/LargeBoilerInfo.java index 1b8979ea75..b7de21c869 100644 --- a/src/main/java/gregtech/integration/jei/multiblock/infos/LargeBoilerInfo.java +++ b/src/main/java/gregtech/integration/jei/multiblock/infos/LargeBoilerInfo.java @@ -3,11 +3,11 @@ import com.google.common.collect.Lists; import gregtech.api.GTValues; import gregtech.api.metatileentity.multiblock.MultiblockControllerBase; +import gregtech.api.util.LocalisationUtils; import gregtech.common.metatileentities.MetaTileEntities; import gregtech.common.metatileentities.multi.MetaTileEntityLargeBoiler; import gregtech.integration.jei.multiblock.MultiblockInfoPage; import gregtech.integration.jei.multiblock.MultiblockShapeInfo; -import net.minecraft.client.resources.I18n; import net.minecraft.util.EnumFacing; import java.util.List; @@ -44,7 +44,7 @@ public List getMatchingShapes() { @Override public String[] getDescription() { - return new String[]{I18n.format("gregtech.multiblock.large_boiler.description")}; + return new String[]{LocalisationUtils.format("gregtech.multiblock.large_boiler.description")}; } } diff --git a/src/main/java/gregtech/integration/jei/multiblock/infos/LargeTurbineInfo.java b/src/main/java/gregtech/integration/jei/multiblock/infos/LargeTurbineInfo.java index 83dd3f6e73..2621bb3c77 100644 --- a/src/main/java/gregtech/integration/jei/multiblock/infos/LargeTurbineInfo.java +++ b/src/main/java/gregtech/integration/jei/multiblock/infos/LargeTurbineInfo.java @@ -6,6 +6,7 @@ import gregtech.api.metatileentity.multiblock.MultiblockControllerBase; import gregtech.api.unification.material.Materials; import gregtech.api.util.BlockInfo; +import gregtech.api.util.LocalisationUtils; import gregtech.common.blocks.MetaBlocks; import gregtech.common.items.MetaItems; import gregtech.common.items.behaviors.TurbineRotorBehavior; @@ -14,7 +15,6 @@ import gregtech.common.metatileentities.multi.electric.generator.MetaTileEntityLargeTurbine; import gregtech.integration.jei.multiblock.MultiblockInfoPage; import gregtech.integration.jei.multiblock.MultiblockShapeInfo; -import net.minecraft.client.resources.I18n; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; @@ -63,7 +63,7 @@ public List getMatchingShapes() { @Override public String[] getDescription() { - return new String[]{I18n.format("gregtech.multiblock.large_turbine.description")}; + return new String[]{LocalisationUtils.format("gregtech.multiblock.large_turbine.description")}; } } diff --git a/src/main/java/gregtech/integration/jei/multiblock/infos/MultiSmelterInfo.java b/src/main/java/gregtech/integration/jei/multiblock/infos/MultiSmelterInfo.java index 6e2aee9b29..b558cd31c1 100644 --- a/src/main/java/gregtech/integration/jei/multiblock/infos/MultiSmelterInfo.java +++ b/src/main/java/gregtech/integration/jei/multiblock/infos/MultiSmelterInfo.java @@ -2,13 +2,13 @@ import gregtech.api.GTValues; import gregtech.api.metatileentity.multiblock.MultiblockControllerBase; +import gregtech.api.util.LocalisationUtils; import gregtech.common.blocks.BlockMetalCasing.MetalCasingType; import gregtech.common.blocks.BlockWireCoil.CoilType; import gregtech.common.blocks.MetaBlocks; import gregtech.common.metatileentities.MetaTileEntities; import gregtech.integration.jei.multiblock.MultiblockInfoPage; import gregtech.integration.jei.multiblock.MultiblockShapeInfo; -import net.minecraft.client.resources.I18n; import net.minecraft.init.Blocks; import net.minecraft.util.EnumFacing; import net.minecraft.util.text.ITextComponent; @@ -48,7 +48,7 @@ public List getMatchingShapes() { @Override public String[] getDescription() { - return new String[]{I18n.format("gregtech.multiblock.multi_smelter.description")}; + return new String[]{LocalisationUtils.format("gregtech.multiblock.multi_smelter.description")}; } @Override diff --git a/src/main/java/gregtech/integration/jei/multiblock/infos/PrimitiveBlastFurnaceInfo.java b/src/main/java/gregtech/integration/jei/multiblock/infos/PrimitiveBlastFurnaceInfo.java index c289c8904e..0e3600a51a 100644 --- a/src/main/java/gregtech/integration/jei/multiblock/infos/PrimitiveBlastFurnaceInfo.java +++ b/src/main/java/gregtech/integration/jei/multiblock/infos/PrimitiveBlastFurnaceInfo.java @@ -2,12 +2,12 @@ import com.google.common.collect.Lists; import gregtech.api.metatileentity.multiblock.MultiblockControllerBase; +import gregtech.api.util.LocalisationUtils; import gregtech.common.blocks.BlockMetalCasing.MetalCasingType; import gregtech.common.blocks.MetaBlocks; import gregtech.common.metatileentities.MetaTileEntities; import gregtech.integration.jei.multiblock.MultiblockInfoPage; import gregtech.integration.jei.multiblock.MultiblockShapeInfo; -import net.minecraft.client.resources.I18n; import net.minecraft.init.Blocks; import net.minecraft.util.EnumFacing; @@ -35,7 +35,7 @@ public List getMatchingShapes() { @Override public String[] getDescription() { - return new String[]{I18n.format("gregtech.multiblock.primitive_blast_furnace.description")}; + return new String[]{LocalisationUtils.format("gregtech.multiblock.primitive_blast_furnace.description")}; } } diff --git a/src/main/java/gregtech/integration/jei/multiblock/infos/PyrolyzeOvenInfo.java b/src/main/java/gregtech/integration/jei/multiblock/infos/PyrolyzeOvenInfo.java index cdc01a05df..6c5ef1c30d 100644 --- a/src/main/java/gregtech/integration/jei/multiblock/infos/PyrolyzeOvenInfo.java +++ b/src/main/java/gregtech/integration/jei/multiblock/infos/PyrolyzeOvenInfo.java @@ -3,13 +3,13 @@ import com.google.common.collect.Lists; import gregtech.api.GTValues; import gregtech.api.metatileentity.multiblock.MultiblockControllerBase; +import gregtech.api.util.LocalisationUtils; import gregtech.common.blocks.BlockMachineCasing; import gregtech.common.blocks.BlockWireCoil; import gregtech.common.blocks.MetaBlocks; import gregtech.common.metatileentities.MetaTileEntities; import gregtech.integration.jei.multiblock.MultiblockInfoPage; import gregtech.integration.jei.multiblock.MultiblockShapeInfo; -import net.minecraft.client.resources.I18n; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; @@ -49,7 +49,7 @@ public List getMatchingShapes() { @Override public String[] getDescription() { - return new String[]{I18n.format("gregtech.multiblock.pyrolyze_oven.description")}; + return new String[]{LocalisationUtils.format("gregtech.multiblock.pyrolyze_oven.description")}; } @Override diff --git a/src/main/java/gregtech/integration/jei/multiblock/infos/VacuumFreezerInfo.java b/src/main/java/gregtech/integration/jei/multiblock/infos/VacuumFreezerInfo.java index f5db52e1b5..705fd28ec1 100644 --- a/src/main/java/gregtech/integration/jei/multiblock/infos/VacuumFreezerInfo.java +++ b/src/main/java/gregtech/integration/jei/multiblock/infos/VacuumFreezerInfo.java @@ -3,12 +3,12 @@ import com.google.common.collect.Lists; import gregtech.api.GTValues; import gregtech.api.metatileentity.multiblock.MultiblockControllerBase; +import gregtech.api.util.LocalisationUtils; import gregtech.common.blocks.BlockMetalCasing.MetalCasingType; import gregtech.common.blocks.MetaBlocks; import gregtech.common.metatileentities.MetaTileEntities; import gregtech.integration.jei.multiblock.MultiblockInfoPage; import gregtech.integration.jei.multiblock.MultiblockShapeInfo; -import net.minecraft.client.resources.I18n; import net.minecraft.init.Blocks; import net.minecraft.util.EnumFacing; import net.minecraft.util.text.ITextComponent; @@ -45,7 +45,7 @@ public List getMatchingShapes() { @Override public String[] getDescription() { - return new String[]{I18n.format("gregtech.multiblock.vacuum_freezer.description")}; + return new String[]{LocalisationUtils.format("gregtech.multiblock.vacuum_freezer.description")}; } @Override diff --git a/src/main/java/gregtech/integration/jei/recipe/GTRecipeWrapper.java b/src/main/java/gregtech/integration/jei/recipe/GTRecipeWrapper.java index 062f880915..c3d8efa090 100644 --- a/src/main/java/gregtech/integration/jei/recipe/GTRecipeWrapper.java +++ b/src/main/java/gregtech/integration/jei/recipe/GTRecipeWrapper.java @@ -7,6 +7,7 @@ import gregtech.api.recipes.recipeproperties.RecipeProperty; import gregtech.api.unification.OreDictUnifier; import gregtech.api.util.ItemStackHashStrategy; +import gregtech.api.util.LocalisationUtils; import gregtech.integration.jei.utils.JEIHelpers; import it.unimi.dsi.fastutil.Hash; import it.unimi.dsi.fastutil.objects.Object2ObjectOpenCustomHashMap; @@ -15,7 +16,6 @@ import mezz.jei.api.ingredients.VanillaTypes; import mezz.jei.api.recipe.IRecipeWrapper; import net.minecraft.client.Minecraft; -import net.minecraft.client.resources.I18n; import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.FluidStack; @@ -124,9 +124,9 @@ public void addTooltip(int slotIndex, boolean input, Object ingredient, List= 0 ? "gregtech.recipe.eu" : "gregtech.recipe.eu_inverted", Math.abs(recipe.getEUt()), JEIHelpers.getMinTierForVoltage(recipe.getEUt())), 0, yPosition += LINE_HEIGHT, 0x111111); - minecraft.fontRenderer.drawString(I18n.format("gregtech.recipe.duration", recipe.getDuration() / 20f), 0, yPosition += LINE_HEIGHT, 0x111111); + minecraft.fontRenderer.drawString(LocalisationUtils.format("gregtech.recipe.total", Math.abs((long) recipe.getEUt()) * recipe.getDuration()), 0, yPosition, 0x111111); + minecraft.fontRenderer.drawString(LocalisationUtils.format(recipe.getEUt() >= 0 ? "gregtech.recipe.eu" : "gregtech.recipe.eu_inverted", Math.abs(recipe.getEUt()), JEIHelpers.getMinTierForVoltage(recipe.getEUt())), 0, yPosition += LINE_HEIGHT, 0x111111); + minecraft.fontRenderer.drawString(LocalisationUtils.format("gregtech.recipe.duration", recipe.getDuration() / 20f), 0, yPosition += LINE_HEIGHT, 0x111111); for (Map.Entry, Object> propertyEntry : recipe.getRecipePropertyStorage().getRecipeProperties()) { if(!propertyEntry.getKey().isHidden()) { propertyEntry.getKey().drawInfo(minecraft, 0, yPosition += LINE_HEIGHT, 0x111111, propertyEntry.getValue()); diff --git a/src/main/java/gregtech/integration/jei/recipe/IntCircuitCategory.java b/src/main/java/gregtech/integration/jei/recipe/IntCircuitCategory.java index d687376318..5d94a83a78 100644 --- a/src/main/java/gregtech/integration/jei/recipe/IntCircuitCategory.java +++ b/src/main/java/gregtech/integration/jei/recipe/IntCircuitCategory.java @@ -4,6 +4,7 @@ import com.google.common.collect.Iterators; import gregtech.api.GTValues; import gregtech.api.recipes.ingredients.IntCircuitIngredient; +import gregtech.api.util.LocalisationUtils; import gregtech.common.items.MetaItems; import gregtech.integration.jei.GTJeiPlugin; import gregtech.integration.jei.utils.render.CompositeDrawable; @@ -23,7 +24,6 @@ import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.vertex.DefaultVertexFormats; -import net.minecraft.client.resources.I18n; import net.minecraft.client.shader.Framebuffer; import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; @@ -110,7 +110,7 @@ public String getUid() { @Override public String getTitle() { - return I18n.format("metaitem.circuit.integrated.gui"); + return LocalisationUtils.format("metaitem.circuit.integrated.gui"); } @Override diff --git a/src/main/java/gregtech/integration/jei/recipe/fuel/GTFuelRecipeWrapper.java b/src/main/java/gregtech/integration/jei/recipe/fuel/GTFuelRecipeWrapper.java index ad5d1f156b..f105c50e29 100644 --- a/src/main/java/gregtech/integration/jei/recipe/fuel/GTFuelRecipeWrapper.java +++ b/src/main/java/gregtech/integration/jei/recipe/fuel/GTFuelRecipeWrapper.java @@ -1,10 +1,10 @@ package gregtech.integration.jei.recipe.fuel; import gregtech.api.recipes.recipes.FuelRecipe; +import gregtech.api.util.LocalisationUtils; import mezz.jei.api.ingredients.IIngredients; import mezz.jei.api.recipe.IRecipeWrapper; import net.minecraft.client.Minecraft; -import net.minecraft.client.resources.I18n; import net.minecraftforge.fluids.FluidStack; public class GTFuelRecipeWrapper implements IRecipeWrapper { @@ -24,8 +24,8 @@ public void getIngredients(IIngredients ingredients) { public void drawInfo(Minecraft minecraft, int recipeWidth, int recipeHeight, int mouseX, int mouseY) { int duration = recipe.getDuration(); long voltage = recipe.getMinVoltage(); - minecraft.fontRenderer.drawString(I18n.format("gregtech.recipe.total", voltage * duration), 0, 70, 0x111111); - minecraft.fontRenderer.drawString(I18n.format("gregtech.recipe.eu_inverted", voltage), 0, 80, 0x111111); - minecraft.fontRenderer.drawString(I18n.format("gregtech.recipe.duration", duration / 20.0), 0, 90, 0x111111); + minecraft.fontRenderer.drawString(LocalisationUtils.format("gregtech.recipe.total", voltage * duration), 0, 70, 0x111111); + minecraft.fontRenderer.drawString(LocalisationUtils.format("gregtech.recipe.eu_inverted", voltage), 0, 80, 0x111111); + minecraft.fontRenderer.drawString(LocalisationUtils.format("gregtech.recipe.duration", duration / 20.0), 0, 90, 0x111111); } } diff --git a/src/main/java/gregtech/integration/jei/recipe/primitive/CokeOvenRecipeWrapper.java b/src/main/java/gregtech/integration/jei/recipe/primitive/CokeOvenRecipeWrapper.java index a8c45f043d..af019cf427 100644 --- a/src/main/java/gregtech/integration/jei/recipe/primitive/CokeOvenRecipeWrapper.java +++ b/src/main/java/gregtech/integration/jei/recipe/primitive/CokeOvenRecipeWrapper.java @@ -12,10 +12,10 @@ import gregtech.api.unification.OreDictUnifier; import gregtech.api.unification.material.Materials; import gregtech.api.unification.ore.OrePrefix; +import gregtech.api.util.LocalisationUtils; import mezz.jei.api.ingredients.IIngredients; import mezz.jei.api.recipe.IRecipeWrapper; import net.minecraft.client.Minecraft; -import net.minecraft.client.resources.I18n; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.FluidStack; @@ -51,7 +51,7 @@ public void getIngredients(IIngredients ingredients) { @Override public void drawInfo(Minecraft minecraft, int recipeWidth, int recipeHeight, int mouseX, int mouseY) { - minecraft.fontRenderer.drawString(I18n.format("gregtech.recipe.duration", this.recipe.getDuration() / 20f), 0, 60, 0x111111); + minecraft.fontRenderer.drawString(LocalisationUtils.format("gregtech.recipe.duration", this.recipe.getDuration() / 20f), 0, 60, 0x111111); } } diff --git a/src/main/java/gregtech/integration/jei/recipe/primitive/OreByProduct.java b/src/main/java/gregtech/integration/jei/recipe/primitive/OreByProduct.java index 4fe1af6966..b542413b15 100755 --- a/src/main/java/gregtech/integration/jei/recipe/primitive/OreByProduct.java +++ b/src/main/java/gregtech/integration/jei/recipe/primitive/OreByProduct.java @@ -14,10 +14,10 @@ import gregtech.api.unification.material.type.Material; import gregtech.api.unification.ore.OrePrefix; import gregtech.api.util.GTUtility; +import gregtech.api.util.LocalisationUtils; import mezz.jei.api.ingredients.IIngredients; import mezz.jei.api.recipe.IRecipeWrapper; import net.minecraft.client.Minecraft; -import net.minecraft.client.resources.I18n; import net.minecraft.item.ItemStack; public class OreByProduct implements IRecipeWrapper { @@ -126,7 +126,7 @@ public void addTooltip(int slotIndex, boolean input, Object ingredient, List tooltip, int byproduct, String machine, b Material byProductMaterial = GTUtility.selectItemInList(byproduct, material, material.oreByProducts, DustMaterial.class); if (!result) - tooltip.add(I18n.format("gregtech.jei.ore_by_product_from_ore", machine, byProductMaterial.getLocalizedName())); + tooltip.add(LocalisationUtils.format("gregtech.jei.ore_by_product_from_ore", machine, byProductMaterial.getLocalizedName())); else { String oreType = byproduct == 0 ? oreIngredients.get(0).getDisplayName() : oreProcessingSteps.get(byproduct - 1).getDisplayName(); - tooltip.add(I18n.format("gregtech.jei.ore_by_product_from_machine", oreType, machine)); + tooltip.add(LocalisationUtils.format("gregtech.jei.ore_by_product_from_machine", oreType, machine)); } } diff --git a/src/main/java/gregtech/integration/jei/recipe/primitive/PrimitiveBlastRecipeWrapper.java b/src/main/java/gregtech/integration/jei/recipe/primitive/PrimitiveBlastRecipeWrapper.java index c36490ed09..a59aeaedd1 100644 --- a/src/main/java/gregtech/integration/jei/recipe/primitive/PrimitiveBlastRecipeWrapper.java +++ b/src/main/java/gregtech/integration/jei/recipe/primitive/PrimitiveBlastRecipeWrapper.java @@ -4,11 +4,11 @@ import gregtech.api.recipes.CountableIngredient; import gregtech.api.recipes.recipes.PrimitiveBlastFurnaceRecipe; import gregtech.api.unification.OreDictUnifier; +import gregtech.api.util.LocalisationUtils; import gregtech.common.metatileentities.multi.MetaTileEntityPrimitiveBlastFurnace; import mezz.jei.api.ingredients.IIngredients; import mezz.jei.api.recipe.IRecipeWrapper; import net.minecraft.client.Minecraft; -import net.minecraft.client.resources.I18n; import net.minecraft.item.ItemStack; import java.util.ArrayList; @@ -50,7 +50,7 @@ public void getIngredients(IIngredients ingredients) { @Override public void drawInfo(Minecraft minecraft, int recipeWidth, int recipeHeight, int mouseX, int mouseY) { - minecraft.fontRenderer.drawString(I18n.format("gregtech.recipe.duration", this.recipe.getDuration() / 20f), 0, 55, 0x111111); + minecraft.fontRenderer.drawString(LocalisationUtils.format("gregtech.recipe.duration", this.recipe.getDuration() / 20f), 0, 55, 0x111111); } } diff --git a/src/main/java/gregtech/integration/jei/recipe/primitive/PrimitiveRecipeCategory.java b/src/main/java/gregtech/integration/jei/recipe/primitive/PrimitiveRecipeCategory.java index 03a85cc4ac..e89082bb52 100644 --- a/src/main/java/gregtech/integration/jei/recipe/primitive/PrimitiveRecipeCategory.java +++ b/src/main/java/gregtech/integration/jei/recipe/primitive/PrimitiveRecipeCategory.java @@ -1,13 +1,13 @@ package gregtech.integration.jei.recipe.primitive; import gregtech.api.GTValues; +import gregtech.api.util.LocalisationUtils; import mezz.jei.api.IGuiHelper; import mezz.jei.api.gui.IDrawable; import mezz.jei.api.recipe.IRecipeCategory; import mezz.jei.api.recipe.IRecipeWrapper; import mezz.jei.api.recipe.IRecipeWrapperFactory; import net.minecraft.client.Minecraft; -import net.minecraft.client.resources.I18n; import javax.annotation.Nullable; import java.util.Collections; @@ -21,7 +21,7 @@ public abstract class PrimitiveRecipeCategory imple public PrimitiveRecipeCategory(String uniqueName, String localKey, IDrawable background, IGuiHelper guiHelper) { this.uniqueName = uniqueName; - this.localizedName = I18n.format(localKey); + this.localizedName = LocalisationUtils.format(localKey); this.background = background; } diff --git a/src/main/java/gregtech/integration/jei/utils/CustomItemReturnRecipeWrapper.java b/src/main/java/gregtech/integration/jei/utils/CustomItemReturnRecipeWrapper.java index 738102e257..e6a71102d7 100644 --- a/src/main/java/gregtech/integration/jei/utils/CustomItemReturnRecipeWrapper.java +++ b/src/main/java/gregtech/integration/jei/utils/CustomItemReturnRecipeWrapper.java @@ -1,5 +1,6 @@ package gregtech.integration.jei.utils; +import gregtech.api.util.LocalisationUtils; import gregtech.loaders.recipe.CustomItemReturnShapedOreRecipeRecipe; import mezz.jei.api.IJeiHelpers; import mezz.jei.api.gui.IGuiItemStackGroup; @@ -12,7 +13,6 @@ import mezz.jei.util.Translator; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiScreen; -import net.minecraft.client.resources.I18n; import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; import net.minecraft.util.text.TextFormatting; @@ -69,7 +69,7 @@ public void setRecipe(IRecipeLayout recipeLayout, IIngredients ingredients) { if (slotIndex != craftOutputSlot) { if (customRecipe.shouldItemReturn(ingredient)) { - tooltip.add(I18n.format("gregtech.recipe.not_consumed")); + tooltip.add(LocalisationUtils.format("gregtech.recipe.not_consumed")); } } }); diff --git a/src/main/java/gregtech/integration/theoneprobe/provider/TransformerInfoProvider.java b/src/main/java/gregtech/integration/theoneprobe/provider/TransformerInfoProvider.java index 073678cd36..ca5630efc0 100644 --- a/src/main/java/gregtech/integration/theoneprobe/provider/TransformerInfoProvider.java +++ b/src/main/java/gregtech/integration/theoneprobe/provider/TransformerInfoProvider.java @@ -9,7 +9,6 @@ import mcjty.theoneprobe.api.ElementAlignment; import mcjty.theoneprobe.api.IProbeInfo; import mcjty.theoneprobe.api.TextStyleClass; -import net.minecraft.client.resources.I18n; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; From 6a27809a2ac64fd8a2939ece40619696b01ce2fd Mon Sep 17 00:00:00 2001 From: Florian Kostenzer Date: Fri, 30 Jul 2021 13:40:37 +0200 Subject: [PATCH 2/3] Only use LocalisationUtils where needed --- .../api/block/machines/MachineItemBlock.java | 10 +++---- .../api/gui/widgets/ClickButtonWidget.java | 4 +-- .../api/gui/widgets/CycleButtonWidget.java | 6 ++--- .../gregtech/api/gui/widgets/LabelWidget.java | 4 +-- .../api/gui/widgets/SimpleTextWidget.java | 4 +-- .../api/gui/widgets/SliderWidget.java | 4 +-- .../gregtech/api/gui/widgets/TankWidget.java | 20 +++++++------- .../api/gui/widgets/ToggleButtonWidget.java | 4 +-- .../api/gui/widgets/tab/ItemTabInfo.java | 4 +-- .../api/items/metaitem/ElectricStats.java | 4 +-- .../gregtech/api/items/metaitem/MetaItem.java | 12 +++++---- .../api/items/toolitem/ToolMetaItem.java | 10 ++++--- .../SimpleGeneratorMetaTileEntity.java | 6 ++--- .../WorkableTieredMetaTileEntity.java | 6 ++--- .../java/gregtech/api/recipes/RecipeMap.java | 1 + .../api/recipes/machines/FuelRecipeMap.java | 1 + .../BlastTemperatureProperty.java | 6 ++--- .../recipeproperties/DefaultProperty.java | 4 +-- .../unification/material/type/Material.java | 1 + .../api/unification/ore/OrePrefix.java | 4 +-- .../gregtech/api/util/LocalisationUtils.java | 23 +++++++++++++--- src/main/java/gregtech/common/MetaFluids.java | 7 ++--- .../gregtech/common/blocks/BlockWireCoil.java | 12 ++++----- .../gregtech/common/blocks/VariantBlock.java | 10 +++---- .../common/gui/widget/ItemListSlotWidget.java | 4 +-- .../java/gregtech/common/items/MetaItem1.java | 4 +-- .../AbstractMaterialPartBehavior.java | 6 +++-- .../items/behaviors/ColorSprayBehaviour.java | 8 +++--- .../common/items/behaviors/FacadeItem.java | 1 + .../common/items/behaviors/HoeBehaviour.java | 4 +-- .../items/behaviors/IntCircuitBehaviour.java | 4 +-- .../items/behaviors/LighterBehaviour.java | 6 ++--- .../items/behaviors/ModeSwitchBehavior.java | 6 ++--- .../items/behaviors/PlungerBehaviour.java | 4 +-- .../items/behaviors/ScoopBehaviour.java | 4 +-- .../items/behaviors/SoftHammerBehaviour.java | 4 +-- .../ToggleEnergyConsumerBehavior.java | 4 +-- .../items/behaviors/TurbineRotorBehavior.java | 4 +-- .../items/behaviors/WrenchBehaviour.java | 4 +-- .../electric/MetaTileEntityAirCollector.java | 12 ++++----- .../electric/MetaTileEntityBatteryBuffer.java | 12 ++++----- .../electric/MetaTileEntityBlockBreaker.java | 8 +++--- .../electric/MetaTileEntityCharger.java | 8 +++--- .../electric/MetaTileEntityFisher.java | 10 +++---- .../electric/MetaTileEntityHull.java | 8 +++--- .../electric/MetaTileEntityItemCollector.java | 12 ++++----- .../electric/MetaTileEntityPump.java | 12 ++++----- .../electric/MetaTileEntityTransformer.java | 26 +++++++++---------- .../MetaTileEntityEnergyHatch.java | 12 ++++----- .../MetaTileEntityFluidHatch.java | 4 +-- .../multiblockpart/MetaTileEntityItemBus.java | 4 +-- .../steam/boiler/SteamBoiler.java | 4 +-- .../storage/MetaTileEntityChest.java | 4 +-- .../storage/MetaTileEntityQuantumChest.java | 10 +++---- .../storage/MetaTileEntityQuantumTank.java | 8 +++--- .../storage/MetaTileEntityTank.java | 8 +++--- .../common/pipelike/cable/ItemBlockCable.java | 8 +++--- .../fluidpipe/ItemBlockFluidPipe.java | 8 +++--- .../gregtech/common/tools/ToolHardHammer.java | 4 +-- .../gregtech/integration/jei/GTJeiPlugin.java | 4 +-- .../gregtech/integration/jei/GTOreInfo.java | 10 +++---- .../multiblock/MultiblockInfoCategory.java | 4 +-- .../jei/multiblock/MultiblockInfoPage.java | 4 +-- .../MultiblockInfoRecipeWrapper.java | 4 +-- .../jei/multiblock/infos/CokeOvenInfo.java | 4 +-- .../jei/multiblock/infos/CrackerUnitInfo.java | 4 +-- .../multiblock/infos/DieselEngineInfo.java | 4 +-- .../infos/DistillationTowerInfo.java | 6 ++--- .../infos/ElectricBlastFurnaceInfo.java | 4 +-- .../infos/ImplosionCompressorInfo.java | 4 +-- .../jei/multiblock/infos/LargeBoilerInfo.java | 4 +-- .../multiblock/infos/LargeTurbineInfo.java | 4 +-- .../multiblock/infos/MultiSmelterInfo.java | 4 +-- .../infos/PrimitiveBlastFurnaceInfo.java | 4 +-- .../multiblock/infos/PyrolyzeOvenInfo.java | 4 +-- .../multiblock/infos/VacuumFreezerInfo.java | 4 +-- .../jei/recipe/GTRecipeWrapper.java | 12 ++++----- .../jei/recipe/IntCircuitCategory.java | 4 +-- .../jei/recipe/fuel/GTFuelRecipeWrapper.java | 8 +++--- .../primitive/CokeOvenRecipeWrapper.java | 4 +-- .../jei/recipe/primitive/OreByProduct.java | 8 +++--- .../PrimitiveBlastRecipeWrapper.java | 4 +-- .../primitive/PrimitiveRecipeCategory.java | 4 +-- .../utils/CustomItemReturnRecipeWrapper.java | 4 +-- 84 files changed, 282 insertions(+), 258 deletions(-) diff --git a/src/main/java/gregtech/api/block/machines/MachineItemBlock.java b/src/main/java/gregtech/api/block/machines/MachineItemBlock.java index d7eb0cbea2..e114133c69 100644 --- a/src/main/java/gregtech/api/block/machines/MachineItemBlock.java +++ b/src/main/java/gregtech/api/block/machines/MachineItemBlock.java @@ -4,8 +4,8 @@ import gregtech.api.GregTechAPI; import gregtech.api.metatileentity.ITieredMetaTileEntity; import gregtech.api.metatileentity.MetaTileEntity; -import gregtech.api.util.LocalisationUtils; import net.minecraft.block.state.IBlockState; +import net.minecraft.client.resources.I18n; import net.minecraft.client.util.ITooltipFlag; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemBlock; @@ -75,8 +75,8 @@ public void addInformation(ItemStack stack, @Nullable World worldIn, List 1000L && tooltipHoverString != null) { - List hoverList = Arrays.asList(LocalisationUtils.format(tooltipHoverString).split("/n")); + List hoverList = Arrays.asList(I18n.format(tooltipHoverString).split("/n")); drawHoveringText(ItemStack.EMPTY, hoverList, 300, mouseX, mouseY); } } diff --git a/src/main/java/gregtech/api/gui/widgets/LabelWidget.java b/src/main/java/gregtech/api/gui/widgets/LabelWidget.java index f43fae426a..c22a2f2753 100644 --- a/src/main/java/gregtech/api/gui/widgets/LabelWidget.java +++ b/src/main/java/gregtech/api/gui/widgets/LabelWidget.java @@ -2,12 +2,12 @@ import gregtech.api.gui.IRenderContext; import gregtech.api.gui.Widget; -import gregtech.api.util.LocalisationUtils; import gregtech.api.util.Position; import gregtech.api.util.Size; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.resources.I18n; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -36,7 +36,7 @@ public LabelWidget(int xPosition, int yPosition, String text, int color, Object[ } private String getResultText() { - return LocalisationUtils.format(text, formatting); + return I18n.format(text, formatting); } private void recomputeSize() { diff --git a/src/main/java/gregtech/api/gui/widgets/SimpleTextWidget.java b/src/main/java/gregtech/api/gui/widgets/SimpleTextWidget.java index caa48f3e0b..0995f47c8f 100644 --- a/src/main/java/gregtech/api/gui/widgets/SimpleTextWidget.java +++ b/src/main/java/gregtech/api/gui/widgets/SimpleTextWidget.java @@ -2,12 +2,12 @@ import gregtech.api.gui.IRenderContext; import gregtech.api.gui.Widget; -import gregtech.api.util.LocalisationUtils; import gregtech.api.util.Position; import gregtech.api.util.Size; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.resources.I18n; import net.minecraft.network.PacketBuffer; import java.util.function.Supplier; @@ -46,7 +46,7 @@ private void updateSize() { @Override public void drawInBackground(int mouseX, int mouseY, IRenderContext context) { FontRenderer fontRenderer = Minecraft.getMinecraft().fontRenderer; - String text = formatLocale.isEmpty() ? (LocalisationUtils.hasKey(lastText) ? LocalisationUtils.format(lastText) : lastText) : LocalisationUtils.format(formatLocale, lastText); + String text = formatLocale.isEmpty() ? (I18n.hasKey(lastText) ? I18n.format(lastText) : lastText) : I18n.format(formatLocale, lastText); Position position = getPosition(); fontRenderer.drawString(text, position.x - fontRenderer.getStringWidth(text) / 2, diff --git a/src/main/java/gregtech/api/gui/widgets/SliderWidget.java b/src/main/java/gregtech/api/gui/widgets/SliderWidget.java index 1d2d243d2b..a9d27eb220 100644 --- a/src/main/java/gregtech/api/gui/widgets/SliderWidget.java +++ b/src/main/java/gregtech/api/gui/widgets/SliderWidget.java @@ -5,13 +5,13 @@ import gregtech.api.gui.IRenderContext; import gregtech.api.gui.Widget; import gregtech.api.gui.resources.TextureArea; -import gregtech.api.util.LocalisationUtils; import gregtech.api.util.Position; import gregtech.api.util.Size; import gregtech.api.util.function.FloatConsumer; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.resources.I18n; import net.minecraft.network.PacketBuffer; import net.minecraft.util.math.MathHelper; @@ -21,7 +21,7 @@ public class SliderWidget extends Widget { - public static final BiFunction DEFAULT_TEXT_SUPPLIER = (name, value) -> LocalisationUtils.format(name, value.intValue()); + public static final BiFunction DEFAULT_TEXT_SUPPLIER = (name, value) -> I18n.format(name, value.intValue()); private int sliderWidth = 8; private TextureArea backgroundArea = GuiTextures.SLIDER_BACKGROUND; diff --git a/src/main/java/gregtech/api/gui/widgets/TankWidget.java b/src/main/java/gregtech/api/gui/widgets/TankWidget.java index f861b27fc2..6b52414f44 100644 --- a/src/main/java/gregtech/api/gui/widgets/TankWidget.java +++ b/src/main/java/gregtech/api/gui/widgets/TankWidget.java @@ -7,12 +7,12 @@ import gregtech.api.gui.resources.RenderUtil; import gregtech.api.gui.resources.TextureArea; import gregtech.api.util.FluidTooltipUtil; -import gregtech.api.util.LocalisationUtils; import gregtech.api.util.Position; import gregtech.api.util.Size; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; @@ -143,22 +143,22 @@ public void drawInForeground(int mouseX, int mouseY) { if (formula != null && !formula.isEmpty()) tooltips.add(ChatFormatting.GRAY.toString() + formula); - tooltips.add(LocalisationUtils.format("gregtech.fluid.amount", lastFluidInTank.amount, lastTankCapacity)); - tooltips.add(LocalisationUtils.format("gregtech.fluid.temperature", fluid.getTemperature(lastFluidInTank))); - tooltips.add(LocalisationUtils.format(fluid.isGaseous(lastFluidInTank) ? "gregtech.fluid.state_gas" : "gregtech.fluid.state_liquid")); + tooltips.add(I18n.format("gregtech.fluid.amount", lastFluidInTank.amount, lastTankCapacity)); + tooltips.add(I18n.format("gregtech.fluid.temperature", fluid.getTemperature(lastFluidInTank))); + tooltips.add(I18n.format(fluid.isGaseous(lastFluidInTank) ? "gregtech.fluid.state_gas" : "gregtech.fluid.state_liquid")); } else { - tooltips.add(LocalisationUtils.format("gregtech.fluid.empty")); - tooltips.add(LocalisationUtils.format("gregtech.fluid.amount", 0, lastTankCapacity)); + tooltips.add(I18n.format("gregtech.fluid.empty")); + tooltips.add(I18n.format("gregtech.fluid.amount", 0, lastTankCapacity)); } if (allowClickFilling) { tooltips.add(""); //add empty line to separate things - tooltips.add(LocalisationUtils.format("gregtech.fluid.click_to_fill")); - tooltips.add(LocalisationUtils.format("gregtech.fluid.click_to_fill.shift")); + tooltips.add(I18n.format("gregtech.fluid.click_to_fill")); + tooltips.add(I18n.format("gregtech.fluid.click_to_fill.shift")); } if (allowClickEmptying) { tooltips.add(""); //add empty line to separate things - tooltips.add(LocalisationUtils.format("gregtech.fluid.click_to_empty")); - tooltips.add(LocalisationUtils.format("gregtech.fluid.click_to_empty.shift")); + tooltips.add(I18n.format("gregtech.fluid.click_to_empty")); + tooltips.add(I18n.format("gregtech.fluid.click_to_empty.shift")); } drawHoveringText(ItemStack.EMPTY, tooltips, 300, mouseX, mouseY); GlStateManager.color(1.0f, 1.0f, 1.0f); diff --git a/src/main/java/gregtech/api/gui/widgets/ToggleButtonWidget.java b/src/main/java/gregtech/api/gui/widgets/ToggleButtonWidget.java index 0cf39d10ef..2df77959d4 100644 --- a/src/main/java/gregtech/api/gui/widgets/ToggleButtonWidget.java +++ b/src/main/java/gregtech/api/gui/widgets/ToggleButtonWidget.java @@ -6,10 +6,10 @@ import gregtech.api.gui.Widget; import gregtech.api.gui.resources.SizedTextureArea; import gregtech.api.gui.resources.TextureArea; -import gregtech.api.util.LocalisationUtils; import gregtech.api.util.Position; import gregtech.api.util.Size; import gregtech.api.util.function.BooleanConsumer; +import net.minecraft.client.resources.I18n; import net.minecraft.item.ItemStack; import net.minecraft.network.PacketBuffer; import net.minecraftforge.fml.relauncher.Side; @@ -69,7 +69,7 @@ public void drawInForeground(int mouseX, int mouseY) { if(isMouseOverElement(mouseX, mouseY) && tooltipText != null) { String postfix = isPressed ? ".enabled" : ".disabled"; String tooltipHoverString = tooltipText + postfix; - List hoverList = Arrays.asList(LocalisationUtils.format(tooltipHoverString).split("/n")); + List hoverList = Arrays.asList(I18n.format(tooltipHoverString).split("/n")); drawHoveringText(ItemStack.EMPTY, hoverList, 300, mouseX, mouseY); } } diff --git a/src/main/java/gregtech/api/gui/widgets/tab/ItemTabInfo.java b/src/main/java/gregtech/api/gui/widgets/tab/ItemTabInfo.java index d5e219a537..7630c782ef 100644 --- a/src/main/java/gregtech/api/gui/widgets/tab/ItemTabInfo.java +++ b/src/main/java/gregtech/api/gui/widgets/tab/ItemTabInfo.java @@ -2,11 +2,11 @@ import com.google.common.collect.Lists; import gregtech.api.gui.resources.TextureArea; -import gregtech.api.util.LocalisationUtils; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.ScaledResolution; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.RenderHelper; +import net.minecraft.client.resources.I18n; import net.minecraft.item.ItemStack; import net.minecraftforge.fml.client.config.GuiUtils; @@ -32,7 +32,7 @@ public void renderTab(TextureArea tabTexture, int posX, int posY, int xSize, int @Override public void renderHoverText(int posX, int posY, int xSize, int ySize, int guiWidth, int guiHeight, boolean isSelected, int mouseX, int mouseY) { - String localizedText = LocalisationUtils.format(nameLocale); + String localizedText = I18n.format(nameLocale); Minecraft mc = Minecraft.getMinecraft(); ScaledResolution resolution = new ScaledResolution(mc); GuiUtils.drawHoveringText(Lists.newArrayList(localizedText), mouseX, mouseY, diff --git a/src/main/java/gregtech/api/items/metaitem/ElectricStats.java b/src/main/java/gregtech/api/items/metaitem/ElectricStats.java index 8a679ff643..73a6b12a0e 100644 --- a/src/main/java/gregtech/api/items/metaitem/ElectricStats.java +++ b/src/main/java/gregtech/api/items/metaitem/ElectricStats.java @@ -7,7 +7,7 @@ import gregtech.api.items.metaitem.stats.IItemCapabilityProvider; import gregtech.api.items.metaitem.stats.IItemMaxStackSizeProvider; import gregtech.api.items.metaitem.stats.IItemComponent; -import gregtech.api.util.LocalisationUtils; +import net.minecraft.client.resources.I18n; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; @@ -115,7 +115,7 @@ private static void setInDischargeMode(ItemStack itemStack, boolean isDischargeM public void addInformation(ItemStack itemStack, List lines) { IElectricItem electricItem = itemStack.getCapability(GregtechCapabilities.CAPABILITY_ELECTRIC_ITEM, null); if(electricItem != null && electricItem.canProvideChargeExternally()) { - lines.add(LocalisationUtils.format("metaitem.electric.discharge_mode.tooltip")); + lines.add(I18n.format("metaitem.electric.discharge_mode.tooltip")); } } diff --git a/src/main/java/gregtech/api/items/metaitem/MetaItem.java b/src/main/java/gregtech/api/items/metaitem/MetaItem.java index 28100ca6da..f0064f4113 100644 --- a/src/main/java/gregtech/api/items/metaitem/MetaItem.java +++ b/src/main/java/gregtech/api/items/metaitem/MetaItem.java @@ -25,6 +25,7 @@ import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.block.model.ModelBakery; import net.minecraft.client.renderer.block.model.ModelResourceLocation; +import net.minecraft.client.resources.I18n; import net.minecraft.client.util.ITooltipFlag; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.enchantment.Enchantment; @@ -471,6 +472,7 @@ public boolean shouldCauseReequipAnimation(ItemStack oldStack, ItemStack newStac } @Override + @SuppressWarnings("deprecation") public String getItemStackDisplayName(ItemStack stack) { if (stack.getItemDamage() >= metaItemOffset) { T item = getItem(stack); @@ -498,13 +500,13 @@ public void addInformation(ItemStack itemStack, @Nullable World worldIn, List= metaItemOffset) { T item = getItem(stack); @@ -430,11 +432,11 @@ public void addInformation(ItemStack itemStack, @Nullable World worldIn, List 0) { - lines.add(LocalisationUtils.format("metaitem.tool.tooltip.durability", maxInternalDamage - getItemDamage(itemStack), maxInternalDamage)); + lines.add(I18n.format("metaitem.tool.tooltip.durability", maxInternalDamage - getItemDamage(itemStack), maxInternalDamage)); } - lines.add(LocalisationUtils.format("metaitem.tool.tooltip.primary_material", primaryMaterial.getLocalizedName(), getHarvestLevel(itemStack))); - lines.add(LocalisationUtils.format("metaitem.tool.tooltip.attack_damage", toolStats.getBaseDamage(itemStack) + primaryMaterial.harvestLevel)); - lines.add(LocalisationUtils.format("metaitem.tool.tooltip.mining_speed", getToolDigSpeed(itemStack))); + lines.add(I18n.format("metaitem.tool.tooltip.primary_material", primaryMaterial.getLocalizedName(), getHarvestLevel(itemStack))); + lines.add(I18n.format("metaitem.tool.tooltip.attack_damage", toolStats.getBaseDamage(itemStack) + primaryMaterial.harvestLevel)); + lines.add(I18n.format("metaitem.tool.tooltip.mining_speed", getToolDigSpeed(itemStack))); super.addInformation(itemStack, worldIn, lines, tooltipFlag); toolStats.addInformation(itemStack, lines, tooltipFlag.isAdvanced()); } diff --git a/src/main/java/gregtech/api/metatileentity/SimpleGeneratorMetaTileEntity.java b/src/main/java/gregtech/api/metatileentity/SimpleGeneratorMetaTileEntity.java index 31867eb64e..20c2815401 100644 --- a/src/main/java/gregtech/api/metatileentity/SimpleGeneratorMetaTileEntity.java +++ b/src/main/java/gregtech/api/metatileentity/SimpleGeneratorMetaTileEntity.java @@ -18,8 +18,8 @@ import gregtech.api.recipes.machines.FuelRecipeMap; import gregtech.api.render.OrientedOverlayRenderer; import gregtech.api.render.Textures; -import gregtech.api.util.LocalisationUtils; import gregtech.api.util.PipelineUtil; +import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; @@ -137,7 +137,7 @@ protected ModularUI createUI(EntityPlayer entityPlayer) { @Override public void addInformation(ItemStack stack, @Nullable World player, List tooltip, boolean advanced) { - tooltip.add(LocalisationUtils.format("gregtech.universal.tooltip.voltage_out", energyContainer.getOutputVoltage(), GTValues.VN[getTier()])); - tooltip.add(LocalisationUtils.format("gregtech.universal.tooltip.energy_storage_capacity", energyContainer.getEnergyCapacity())); + tooltip.add(I18n.format("gregtech.universal.tooltip.voltage_out", energyContainer.getOutputVoltage(), GTValues.VN[getTier()])); + tooltip.add(I18n.format("gregtech.universal.tooltip.energy_storage_capacity", energyContainer.getEnergyCapacity())); } } diff --git a/src/main/java/gregtech/api/metatileentity/WorkableTieredMetaTileEntity.java b/src/main/java/gregtech/api/metatileentity/WorkableTieredMetaTileEntity.java index 02c12da5aa..a64c9b1383 100644 --- a/src/main/java/gregtech/api/metatileentity/WorkableTieredMetaTileEntity.java +++ b/src/main/java/gregtech/api/metatileentity/WorkableTieredMetaTileEntity.java @@ -10,7 +10,7 @@ import gregtech.api.recipes.Recipe; import gregtech.api.recipes.RecipeMap; import gregtech.api.render.OrientedOverlayRenderer; -import gregtech.api.util.LocalisationUtils; +import net.minecraft.client.resources.I18n; import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; @@ -124,7 +124,7 @@ protected int getOutputTankCapacity(int index) { @Override public void addInformation(ItemStack stack, @Nullable World player, List tooltip, boolean advanced) { super.addInformation(stack, player, tooltip, advanced); - tooltip.add(LocalisationUtils.format("gregtech.universal.tooltip.voltage_in", energyContainer.getInputVoltage(), GTValues.VN[getTier()])); - tooltip.add(LocalisationUtils.format("gregtech.universal.tooltip.energy_storage_capacity", energyContainer.getEnergyCapacity())); + tooltip.add(I18n.format("gregtech.universal.tooltip.voltage_in", energyContainer.getInputVoltage(), GTValues.VN[getTier()])); + tooltip.add(I18n.format("gregtech.universal.tooltip.energy_storage_capacity", energyContainer.getEnergyCapacity())); } } diff --git a/src/main/java/gregtech/api/recipes/RecipeMap.java b/src/main/java/gregtech/api/recipes/RecipeMap.java index d648fe4644..f7a7e1b642 100644 --- a/src/main/java/gregtech/api/recipes/RecipeMap.java +++ b/src/main/java/gregtech/api/recipes/RecipeMap.java @@ -408,6 +408,7 @@ public List ccGetRecipeList() { } @ZenGetter("localizedName") + @SuppressWarnings("deprecation") public String getLocalizedName() { return LocalisationUtils.format("recipemap." + unlocalizedName + ".name"); } diff --git a/src/main/java/gregtech/api/recipes/machines/FuelRecipeMap.java b/src/main/java/gregtech/api/recipes/machines/FuelRecipeMap.java index f4cf6e6b56..2a7676294f 100644 --- a/src/main/java/gregtech/api/recipes/machines/FuelRecipeMap.java +++ b/src/main/java/gregtech/api/recipes/machines/FuelRecipeMap.java @@ -83,6 +83,7 @@ public List getRecipeList() { } @ZenGetter("localizedName") + @SuppressWarnings("deprecation") public String getLocalizedName() { return LocalisationUtils.format("recipemap." + unlocalizedName + ".name"); } diff --git a/src/main/java/gregtech/api/recipes/recipeproperties/BlastTemperatureProperty.java b/src/main/java/gregtech/api/recipes/recipeproperties/BlastTemperatureProperty.java index d75f1ccbf0..ec3a088c77 100644 --- a/src/main/java/gregtech/api/recipes/recipeproperties/BlastTemperatureProperty.java +++ b/src/main/java/gregtech/api/recipes/recipeproperties/BlastTemperatureProperty.java @@ -1,8 +1,8 @@ package gregtech.api.recipes.recipeproperties; import gregtech.api.unification.material.type.Material; -import gregtech.api.util.LocalisationUtils; import net.minecraft.client.Minecraft; +import net.minecraft.client.resources.I18n; import org.apache.commons.lang3.Validate; import java.util.Map; @@ -29,7 +29,7 @@ public static BlastTemperatureProperty getInstance() { @Override public void drawInfo(Minecraft minecraft, int x, int y, int color, Object value) { - minecraft.fontRenderer.drawString(LocalisationUtils.format("gregtech.recipe.blast_furnace_temperature", + minecraft.fontRenderer.drawString(I18n.format("gregtech.recipe.blast_furnace_temperature", value, getMinTierForTemperature(castValue(value))), x, y, color); } @@ -41,7 +41,7 @@ private String getMinTierForTemperature(Integer value) { if (mapValue instanceof Material) { name = ((Material) mapValue).getLocalizedName(); } else if (mapValue instanceof String) { - name = LocalisationUtils.format((String) mapValue); + name = I18n.format((String) mapValue); } } } diff --git a/src/main/java/gregtech/api/recipes/recipeproperties/DefaultProperty.java b/src/main/java/gregtech/api/recipes/recipeproperties/DefaultProperty.java index 00ddc2d02e..7c444f32bc 100644 --- a/src/main/java/gregtech/api/recipes/recipeproperties/DefaultProperty.java +++ b/src/main/java/gregtech/api/recipes/recipeproperties/DefaultProperty.java @@ -1,7 +1,7 @@ package gregtech.api.recipes.recipeproperties; -import gregtech.api.util.LocalisationUtils; import net.minecraft.client.Minecraft; +import net.minecraft.client.resources.I18n; public class DefaultProperty extends RecipeProperty { @@ -10,7 +10,7 @@ public DefaultProperty(String key, Class type) { } public void drawInfo(Minecraft minecraft, int x, int y, int color, Object value) { - minecraft.fontRenderer.drawString(LocalisationUtils.format("gregtech.recipe." + getKey(), + minecraft.fontRenderer.drawString(I18n.format("gregtech.recipe." + getKey(), castValue(value)), x, y, color); } diff --git a/src/main/java/gregtech/api/unification/material/type/Material.java b/src/main/java/gregtech/api/unification/material/type/Material.java index 6763d50cf9..95d7af13b0 100644 --- a/src/main/java/gregtech/api/unification/material/type/Material.java +++ b/src/main/java/gregtech/api/unification/material/type/Material.java @@ -382,6 +382,7 @@ public String getUnlocalizedName() { } @ZenGetter("localizedName") + @SuppressWarnings("deprecation") public String getLocalizedName() { return LocalisationUtils.format(getUnlocalizedName()); } diff --git a/src/main/java/gregtech/api/unification/ore/OrePrefix.java b/src/main/java/gregtech/api/unification/ore/OrePrefix.java index 768d5d4716..6ec01e978b 100644 --- a/src/main/java/gregtech/api/unification/ore/OrePrefix.java +++ b/src/main/java/gregtech/api/unification/ore/OrePrefix.java @@ -8,8 +8,7 @@ import gregtech.api.unification.stack.MaterialStack; import gregtech.api.util.GTUtility; import gregtech.api.util.LocalisationUtils; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import jdk.nashorn.internal.ir.annotations.Ignore; import org.apache.commons.lang3.Validate; import javax.annotation.Nullable; @@ -442,6 +441,7 @@ private void runGeneratedMaterialHandlers() { currentProcessingPrefix.set(null); } + @SuppressWarnings("deprecation") public String getLocalNameForItem(Material material) { String specfiedUnlocalized = "item." + material.toString() + "." + this.name(); if (LocalisationUtils.hasKey(specfiedUnlocalized)) return LocalisationUtils.format(specfiedUnlocalized); diff --git a/src/main/java/gregtech/api/util/LocalisationUtils.java b/src/main/java/gregtech/api/util/LocalisationUtils.java index ca2d6e19a0..1a420bad87 100644 --- a/src/main/java/gregtech/api/util/LocalisationUtils.java +++ b/src/main/java/gregtech/api/util/LocalisationUtils.java @@ -5,18 +5,33 @@ public class LocalisationUtils { + /** + * @deprecated + * This function should only be used when localisation is needed on the server. + * Helper function that automatically calls `net.minecraft.client.resources.I18n.format` when called on client + * or `net.minecraft.util.text.translation.I18n.translateToLocalFormatted` when called on server. + * @param p_format_0_ passed to the underlying format function as first parameter + * @param p_format_1_ passed to the underlying format function as second parameter + * @return the localized string. + */ + @Deprecated public static String format(String p_format_0_, Object... p_format_1_) { if (FMLCommonHandler.instance().getEffectiveSide() == Side.SERVER) { return net.minecraft.util.text.translation.I18n.translateToLocalFormatted(p_format_0_, p_format_1_); } else { return net.minecraft.client.resources.I18n.format(p_format_0_, p_format_1_); } - } - - public static String translateToLocal(String p_format_0_) { - return net.minecraft.util.text.translation.I18n.translateToLocal(p_format_0_); } + /** + * @deprecated + * This function should only be used when localisation is needed on the server. + * Helper function that automatically calls `net.minecraft.client.resources.I18n.hasKey` when called on client + * or `net.minecraft.util.text.translation.I18n.canTranslate` when called on server. + * @param p_hasKey_0_ passed to the underlying hasKey function as first parameter + * @return the localized string. + */ + @Deprecated public static boolean hasKey(String p_hasKey_0_) { if (FMLCommonHandler.instance().getEffectiveSide() == Side.SERVER) { return net.minecraft.util.text.translation.I18n.canTranslate(p_hasKey_0_); diff --git a/src/main/java/gregtech/common/MetaFluids.java b/src/main/java/gregtech/common/MetaFluids.java index fd98232d1d..1b72049db7 100644 --- a/src/main/java/gregtech/common/MetaFluids.java +++ b/src/main/java/gregtech/common/MetaFluids.java @@ -7,9 +7,9 @@ import gregtech.api.unification.material.type.Material; import gregtech.api.util.FluidTooltipUtil; import gregtech.api.util.GTUtility; -import gregtech.api.util.LocalisationUtils; import gregtech.common.blocks.MetaBlocks; import net.minecraft.client.renderer.texture.TextureMap; +import net.minecraft.client.resources.I18n; import net.minecraft.util.ResourceLocation; import net.minecraftforge.fluids.*; import net.minecraftforge.fml.relauncher.Side; @@ -244,10 +244,11 @@ public String getUnlocalizedName() { } @Override + @SideOnly(Side.CLIENT) public String getLocalizedName(FluidStack stack) { - String localizedName = LocalisationUtils.format(getUnlocalizedName()); + String localizedName = I18n.format(getUnlocalizedName()); if (state.prefixLocale != null) { - return LocalisationUtils.format(state.prefixLocale, localizedName); + return I18n.format(state.prefixLocale, localizedName); } return localizedName; } diff --git a/src/main/java/gregtech/common/blocks/BlockWireCoil.java b/src/main/java/gregtech/common/blocks/BlockWireCoil.java index 4a792972e2..8f0aebfa20 100644 --- a/src/main/java/gregtech/common/blocks/BlockWireCoil.java +++ b/src/main/java/gregtech/common/blocks/BlockWireCoil.java @@ -3,9 +3,9 @@ import gregtech.api.unification.material.MarkerMaterials.Tier; import gregtech.api.unification.material.Materials; import gregtech.api.unification.material.type.Material; -import gregtech.api.util.LocalisationUtils; import net.minecraft.block.SoundType; import net.minecraft.block.state.IBlockState; +import net.minecraft.client.resources.I18n; import net.minecraft.client.util.ITooltipFlag; import net.minecraft.entity.EntityLiving.SpawnPlacementType; import net.minecraft.item.ItemStack; @@ -40,12 +40,12 @@ public void addInformation(ItemStack itemStack, @Nullable World worldIn, List tooltip, ITooltipFlag advanced) { //tier less tooltip like: tile.turbine_casing.tooltip String unlocalizedVariantTooltip = getTranslationKey() + ".tooltip"; - if (LocalisationUtils.hasKey(unlocalizedVariantTooltip)) - tooltip.addAll(Arrays.asList(LocalisationUtils.format(unlocalizedVariantTooltip).split("/n"))); + if (I18n.hasKey(unlocalizedVariantTooltip)) + tooltip.addAll(Arrays.asList(I18n.format(unlocalizedVariantTooltip).split("/n"))); //item specific tooltip: tile.turbine_casing.bronze_gearbox.tooltip String unlocalizedTooltip = stack.getTranslationKey() + ".tooltip"; - if (LocalisationUtils.hasKey(unlocalizedTooltip)) - tooltip.addAll(Arrays.asList(LocalisationUtils.format(unlocalizedTooltip).split("/n"))); + if (I18n.hasKey(unlocalizedTooltip)) + tooltip.addAll(Arrays.asList(I18n.format(unlocalizedTooltip).split("/n"))); } @Override diff --git a/src/main/java/gregtech/common/gui/widget/ItemListSlotWidget.java b/src/main/java/gregtech/common/gui/widget/ItemListSlotWidget.java index e570a9fe76..29a3b8b8a7 100644 --- a/src/main/java/gregtech/common/gui/widget/ItemListSlotWidget.java +++ b/src/main/java/gregtech/common/gui/widget/ItemListSlotWidget.java @@ -4,12 +4,12 @@ import gregtech.api.gui.IRenderContext; import gregtech.api.gui.Widget; import gregtech.api.util.ItemStackKey; -import gregtech.api.util.LocalisationUtils; import gregtech.api.util.Position; import gregtech.api.util.Size; import gregtech.common.inventory.IItemInfo; import gregtech.common.inventory.IItemList; import gregtech.common.inventory.IItemList.InsertMode; +import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; import net.minecraft.network.PacketBuffer; @@ -62,7 +62,7 @@ public void drawInForeground(int mouseX, int mouseY) { ItemStack itemStack = itemInfo.getItemStackKey().getItemStackRaw(); List tooltip = getItemToolTip(itemStack); int totalItemStored = itemInfo.getTotalItemAmount(); - String itemStoredText = LocalisationUtils.format("gregtech.item_list.item_stored", totalItemStored); + String itemStoredText = I18n.format("gregtech.item_list.item_stored", totalItemStored); tooltip.add(TextFormatting.GRAY + itemStoredText); drawHoveringText(itemStack, tooltip, -1, mouseX, mouseY); } diff --git a/src/main/java/gregtech/common/items/MetaItem1.java b/src/main/java/gregtech/common/items/MetaItem1.java index 6a9e24c62e..2621aa62f7 100644 --- a/src/main/java/gregtech/common/items/MetaItem1.java +++ b/src/main/java/gregtech/common/items/MetaItem1.java @@ -15,11 +15,11 @@ import gregtech.api.unification.ore.OrePrefix; import gregtech.api.unification.stack.ItemMaterialInfo; import gregtech.api.unification.stack.MaterialStack; -import gregtech.api.util.LocalisationUtils; import gregtech.api.util.RandomPotionEffect; import gregtech.common.items.behaviors.*; import net.minecraft.block.BlockCauldron; import net.minecraft.block.state.IBlockState; +import net.minecraft.client.resources.I18n; import net.minecraft.client.util.ITooltipFlag; import net.minecraft.entity.item.EntityItem; import net.minecraft.init.Items; @@ -548,7 +548,7 @@ public boolean onEntityItemUpdate(EntityItem itemEntity) { @Override protected void addMaterialTooltip(ItemStack itemStack, OrePrefix prefix, Material material, List lines, ITooltipFlag tooltipFlag) { if (prefix == OrePrefix.dustImpure || prefix == OrePrefix.dustPure) { - lines.add(LocalisationUtils.format("metaitem.dust.tooltip.purify")); + lines.add(I18n.format("metaitem.dust.tooltip.purify")); } } diff --git a/src/main/java/gregtech/common/items/behaviors/AbstractMaterialPartBehavior.java b/src/main/java/gregtech/common/items/behaviors/AbstractMaterialPartBehavior.java index 57ffcccb84..039ac915e2 100644 --- a/src/main/java/gregtech/common/items/behaviors/AbstractMaterialPartBehavior.java +++ b/src/main/java/gregtech/common/items/behaviors/AbstractMaterialPartBehavior.java @@ -8,6 +8,7 @@ import gregtech.api.unification.material.type.IngotMaterial; import gregtech.api.unification.material.type.Material; import gregtech.api.util.LocalisationUtils; +import net.minecraft.client.resources.I18n; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.math.MathHelper; @@ -62,6 +63,7 @@ public void setPartDamage(ItemStack itemStack, int rotorDamage) { } @Override + @SuppressWarnings("deprecation") public String getItemStackDisplayName(ItemStack itemStack, String unlocalizedName) { IngotMaterial material = getPartMaterial(itemStack); return LocalisationUtils.format(unlocalizedName, material.getLocalizedName()); @@ -72,8 +74,8 @@ public void addInformation(ItemStack stack, List lines) { IngotMaterial material = getPartMaterial(stack); int maxRotorDurability = getPartMaxDurability(stack); int rotorDamage = getPartDamage(stack); - lines.add(LocalisationUtils.format("metaitem.tool.tooltip.durability", maxRotorDurability - rotorDamage, maxRotorDurability)); - lines.add(LocalisationUtils.format("metaitem.tool.tooltip.primary_material", material.getLocalizedName(), material.harvestLevel)); + lines.add(I18n.format("metaitem.tool.tooltip.durability", maxRotorDurability - rotorDamage, maxRotorDurability)); + lines.add(I18n.format("metaitem.tool.tooltip.primary_material", material.getLocalizedName(), material.harvestLevel)); } @Override diff --git a/src/main/java/gregtech/common/items/behaviors/ColorSprayBehaviour.java b/src/main/java/gregtech/common/items/behaviors/ColorSprayBehaviour.java index 09bc8d1e8c..7ef6f3f31f 100644 --- a/src/main/java/gregtech/common/items/behaviors/ColorSprayBehaviour.java +++ b/src/main/java/gregtech/common/items/behaviors/ColorSprayBehaviour.java @@ -1,10 +1,10 @@ package gregtech.common.items.behaviors; -import gregtech.api.util.LocalisationUtils; import net.minecraft.block.Block; import net.minecraft.block.BlockStainedGlass; import net.minecraft.block.BlockStainedGlassPane; import net.minecraft.block.state.IBlockState; +import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.item.EnumDyeColor; @@ -14,8 +14,6 @@ import net.minecraft.util.EnumHand; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; import java.util.List; @@ -68,7 +66,7 @@ private boolean tryPaintSpecialBlock(World world, BlockPos pos, Block block) { @Override public void addInformation(ItemStack itemStack, List lines) { int remainingUses = getUsesLeft(itemStack); - lines.add(LocalisationUtils.format("behaviour.paintspray." + this.color.getTranslationKey() + ".tooltip")); - lines.add(LocalisationUtils.format("behaviour.paintspray.uses", remainingUses)); + lines.add(I18n.format("behaviour.paintspray." + this.color.getTranslationKey() + ".tooltip")); + lines.add(I18n.format("behaviour.paintspray.uses", remainingUses)); } } diff --git a/src/main/java/gregtech/common/items/behaviors/FacadeItem.java b/src/main/java/gregtech/common/items/behaviors/FacadeItem.java index 68dd06015c..62ca90f454 100644 --- a/src/main/java/gregtech/common/items/behaviors/FacadeItem.java +++ b/src/main/java/gregtech/common/items/behaviors/FacadeItem.java @@ -21,6 +21,7 @@ public class FacadeItem implements IItemNameProvider, ISubItemHandler { @Override + @SuppressWarnings("deprecation") public String getItemStackDisplayName(ItemStack itemStack, String unlocalizedName) { ItemStack facadeStack = getFacadeStack(itemStack); String name = facadeStack.getItem().getItemStackDisplayName(facadeStack); diff --git a/src/main/java/gregtech/common/items/behaviors/HoeBehaviour.java b/src/main/java/gregtech/common/items/behaviors/HoeBehaviour.java index 8cf28dcba1..e6044b6a16 100644 --- a/src/main/java/gregtech/common/items/behaviors/HoeBehaviour.java +++ b/src/main/java/gregtech/common/items/behaviors/HoeBehaviour.java @@ -2,10 +2,10 @@ import gregtech.api.items.metaitem.stats.IItemBehaviour; import gregtech.api.util.GTUtility; -import gregtech.api.util.LocalisationUtils; import net.minecraft.block.Block; import net.minecraft.block.BlockDirt; import net.minecraft.block.state.IBlockState; +import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.init.SoundEvents; @@ -58,6 +58,6 @@ public ActionResult onItemUse(EntityPlayer player, World world, Block @Override public void addInformation(ItemStack itemStack, List lines) { - lines.add(LocalisationUtils.format("behaviour.hoe")); + lines.add(I18n.format("behaviour.hoe")); } } diff --git a/src/main/java/gregtech/common/items/behaviors/IntCircuitBehaviour.java b/src/main/java/gregtech/common/items/behaviors/IntCircuitBehaviour.java index 5f2160c35c..af60100a22 100644 --- a/src/main/java/gregtech/common/items/behaviors/IntCircuitBehaviour.java +++ b/src/main/java/gregtech/common/items/behaviors/IntCircuitBehaviour.java @@ -9,7 +9,7 @@ import gregtech.api.items.metaitem.stats.IItemBehaviour; import gregtech.api.items.metaitem.stats.ISubItemHandler; import gregtech.api.recipes.ingredients.IntCircuitIngredient; -import gregtech.api.util.LocalisationUtils; +import net.minecraft.client.resources.I18n; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; @@ -27,7 +27,7 @@ public class IntCircuitBehaviour implements IItemBehaviour, ItemUIFactory, ISubI @Override public void addInformation(ItemStack itemStack, List lines) { int configuration = IntCircuitIngredient.getCircuitConfiguration(itemStack); - lines.add(LocalisationUtils.format("metaitem.int_circuit.configuration", configuration)); + lines.add(I18n.format("metaitem.int_circuit.configuration", configuration)); } @Override diff --git a/src/main/java/gregtech/common/items/behaviors/LighterBehaviour.java b/src/main/java/gregtech/common/items/behaviors/LighterBehaviour.java index ebf29e6cdc..1f04429414 100644 --- a/src/main/java/gregtech/common/items/behaviors/LighterBehaviour.java +++ b/src/main/java/gregtech/common/items/behaviors/LighterBehaviour.java @@ -1,6 +1,6 @@ package gregtech.common.items.behaviors; -import gregtech.api.util.LocalisationUtils; +import net.minecraft.client.resources.I18n; import net.minecraft.entity.Entity; import net.minecraft.entity.monster.EntityCreeper; import net.minecraft.entity.player.EntityPlayer; @@ -53,11 +53,11 @@ public boolean tryIgniteBlock(World world, BlockPos pos) { @Override public void addInformation(ItemStack itemStack, List lines) { - lines.add(LocalisationUtils.format("behaviour.lighter.tooltip")); + lines.add(I18n.format("behaviour.lighter.tooltip")); if (totalUses > 1) { //do not add total uses amount for single-use items like matches int fuelAmount = getUsesLeft(itemStack); - lines.add(LocalisationUtils.format("behaviour.lighter.uses", fuelAmount)); + lines.add(I18n.format("behaviour.lighter.uses", fuelAmount)); } } } diff --git a/src/main/java/gregtech/common/items/behaviors/ModeSwitchBehavior.java b/src/main/java/gregtech/common/items/behaviors/ModeSwitchBehavior.java index 13b931e909..fdf439f2a9 100644 --- a/src/main/java/gregtech/common/items/behaviors/ModeSwitchBehavior.java +++ b/src/main/java/gregtech/common/items/behaviors/ModeSwitchBehavior.java @@ -1,8 +1,8 @@ package gregtech.common.items.behaviors; import gregtech.api.items.metaitem.stats.IItemBehaviour; -import gregtech.api.util.LocalisationUtils; import gregtech.common.items.behaviors.ModeSwitchBehavior.ILocalizationKey; +import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; @@ -61,8 +61,8 @@ public ActionResult onItemRightClick(World world, EntityPlayer player @Override public void addInformation(ItemStack itemStack, List lines) { T currentMode = getModeFromItemStack(itemStack); - lines.add(LocalisationUtils.format("metaitem.behavior.mode_switch.tooltip")); - lines.add(LocalisationUtils.format("metaitem.behavior.mode_switch.current_mode", LocalisationUtils.format(currentMode.getUnlocalizedName()))); + lines.add(I18n.format("metaitem.behavior.mode_switch.tooltip")); + lines.add(I18n.format("metaitem.behavior.mode_switch.current_mode", I18n.format(currentMode.getUnlocalizedName()))); } public interface ILocalizationKey { diff --git a/src/main/java/gregtech/common/items/behaviors/PlungerBehaviour.java b/src/main/java/gregtech/common/items/behaviors/PlungerBehaviour.java index e0ee81b25f..ae360a6390 100755 --- a/src/main/java/gregtech/common/items/behaviors/PlungerBehaviour.java +++ b/src/main/java/gregtech/common/items/behaviors/PlungerBehaviour.java @@ -6,7 +6,7 @@ import gregtech.api.items.metaitem.stats.IItemBehaviour; import gregtech.api.items.metaitem.stats.IItemCapabilityProvider; import gregtech.api.util.GTUtility; -import gregtech.api.util.LocalisationUtils; +import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.SoundEvents; import net.minecraft.item.ItemStack; @@ -63,7 +63,7 @@ public EnumActionResult onItemUseFirst(EntityPlayer player, World world, BlockPo @Override public void addInformation(ItemStack itemStack, List lines) { - lines.addAll(Arrays.asList(LocalisationUtils.format("behavior.plunger.description").split("/n"))); + lines.addAll(Arrays.asList(I18n.format("behavior.plunger.description").split("/n"))); } @Override diff --git a/src/main/java/gregtech/common/items/behaviors/ScoopBehaviour.java b/src/main/java/gregtech/common/items/behaviors/ScoopBehaviour.java index dee18ca4f6..095806613d 100644 --- a/src/main/java/gregtech/common/items/behaviors/ScoopBehaviour.java +++ b/src/main/java/gregtech/common/items/behaviors/ScoopBehaviour.java @@ -6,7 +6,7 @@ import gregtech.api.GTValues; import gregtech.api.items.metaitem.stats.IItemBehaviour; import gregtech.api.util.GTUtility; -import gregtech.api.util.LocalisationUtils; +import net.minecraft.client.resources.I18n; import net.minecraft.entity.Entity; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; @@ -49,6 +49,6 @@ private boolean processButterflyCatch(ItemStack itemStack, EntityPlayer player, @Override public void addInformation(ItemStack itemStack, List lines) { - lines.add(LocalisationUtils.format("behaviour.scoop")); + lines.add(I18n.format("behaviour.scoop")); } } diff --git a/src/main/java/gregtech/common/items/behaviors/SoftHammerBehaviour.java b/src/main/java/gregtech/common/items/behaviors/SoftHammerBehaviour.java index f1c830e2cd..1a658f8e91 100644 --- a/src/main/java/gregtech/common/items/behaviors/SoftHammerBehaviour.java +++ b/src/main/java/gregtech/common/items/behaviors/SoftHammerBehaviour.java @@ -4,7 +4,7 @@ import gregtech.api.capability.IControllable; import gregtech.api.items.metaitem.stats.IItemBehaviour; import gregtech.api.util.GTUtility; -import gregtech.api.util.LocalisationUtils; +import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; @@ -49,6 +49,6 @@ public EnumActionResult onItemUseFirst(EntityPlayer player, World world, BlockPo @Override public void addInformation(ItemStack itemStack, List lines) { - lines.add(LocalisationUtils.format("behaviour.soft_hammer")); + lines.add(I18n.format("behaviour.soft_hammer")); } } diff --git a/src/main/java/gregtech/common/items/behaviors/ToggleEnergyConsumerBehavior.java b/src/main/java/gregtech/common/items/behaviors/ToggleEnergyConsumerBehavior.java index 8482b15680..692d1a437d 100644 --- a/src/main/java/gregtech/common/items/behaviors/ToggleEnergyConsumerBehavior.java +++ b/src/main/java/gregtech/common/items/behaviors/ToggleEnergyConsumerBehavior.java @@ -3,7 +3,7 @@ import gregtech.api.capability.GregtechCapabilities; import gregtech.api.capability.IElectricItem; import gregtech.api.items.metaitem.stats.IItemBehaviour; -import gregtech.api.util.LocalisationUtils; +import net.minecraft.client.resources.I18n; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; @@ -55,7 +55,7 @@ public void onUpdate(ItemStack itemStack, Entity entity) { @Override public void addInformation(ItemStack itemStack, List lines) { - lines.add(LocalisationUtils.format("behavior.toggle_energy_consumer.tooltip")); + lines.add(I18n.format("behavior.toggle_energy_consumer.tooltip")); } public boolean isItemActive(ItemStack itemStack) { diff --git a/src/main/java/gregtech/common/items/behaviors/TurbineRotorBehavior.java b/src/main/java/gregtech/common/items/behaviors/TurbineRotorBehavior.java index 9e95e5f871..4894461ec0 100644 --- a/src/main/java/gregtech/common/items/behaviors/TurbineRotorBehavior.java +++ b/src/main/java/gregtech/common/items/behaviors/TurbineRotorBehavior.java @@ -6,7 +6,7 @@ import gregtech.api.items.metaitem.stats.IItemMaxStackSizeProvider; import gregtech.api.unification.material.type.IngotMaterial; import gregtech.api.unification.material.type.SolidMaterial; -import gregtech.api.util.LocalisationUtils; +import net.minecraft.client.resources.I18n; import net.minecraft.item.ItemStack; import java.util.List; @@ -60,6 +60,6 @@ public int getMaxStackSize(ItemStack itemStack, int defaultValue) { @Override public void addInformation(ItemStack stack, List lines) { super.addInformation(stack, lines); - lines.add(LocalisationUtils.format("metaitem.tool.tooltip.rotor.efficiency", (int) (getRotorEfficiency(stack) * 100))); + lines.add(I18n.format("metaitem.tool.tooltip.rotor.efficiency", (int) (getRotorEfficiency(stack) * 100))); } } diff --git a/src/main/java/gregtech/common/items/behaviors/WrenchBehaviour.java b/src/main/java/gregtech/common/items/behaviors/WrenchBehaviour.java index dce768d602..2dc0a75259 100644 --- a/src/main/java/gregtech/common/items/behaviors/WrenchBehaviour.java +++ b/src/main/java/gregtech/common/items/behaviors/WrenchBehaviour.java @@ -3,7 +3,7 @@ import gregtech.api.items.metaitem.stats.IItemBehaviour; import gregtech.api.metatileentity.MetaTileEntityHolder; import gregtech.api.util.GTUtility; -import gregtech.api.util.LocalisationUtils; +import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; @@ -41,6 +41,6 @@ public EnumActionResult onItemUseFirst(EntityPlayer player, World world, BlockPo @Override public void addInformation(ItemStack itemStack, List lines) { - lines.add(LocalisationUtils.format("behaviour.wrench")); + lines.add(I18n.format("behaviour.wrench")); } } diff --git a/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityAirCollector.java b/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityAirCollector.java index 2f3f5b2e17..d58c86231c 100644 --- a/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityAirCollector.java +++ b/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityAirCollector.java @@ -11,8 +11,8 @@ import gregtech.api.metatileentity.TieredMetaTileEntity; import gregtech.api.render.Textures; import gregtech.api.unification.material.Materials; -import gregtech.api.util.LocalisationUtils; import gregtech.common.ConfigHolder; +import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; @@ -107,10 +107,10 @@ protected boolean openGUIOnRightClick() { @Override public void addInformation(ItemStack stack, @Nullable World player, List tooltip, boolean advanced) { - tooltip.add(LocalisationUtils.format("gregtech.machine.air_collector.tooltip")); - tooltip.add(LocalisationUtils.format("gregtech.machine.air_collector.collection_speed", getCollectedFluidAmount(), PRODUCTION_CYCLE_LENGTH)); - tooltip.add(LocalisationUtils.format("gregtech.universal.tooltip.voltage_in", energyContainer.getInputVoltage(), GTValues.VN[getTier()])); - tooltip.add(LocalisationUtils.format("gregtech.universal.tooltip.energy_storage_capacity", energyContainer.getEnergyCapacity())); - tooltip.add(LocalisationUtils.format("gregtech.universal.tooltip.fluid_storage_capacity", exportFluids.getTankAt(0).getCapacity())); + tooltip.add(I18n.format("gregtech.machine.air_collector.tooltip")); + tooltip.add(I18n.format("gregtech.machine.air_collector.collection_speed", getCollectedFluidAmount(), PRODUCTION_CYCLE_LENGTH)); + tooltip.add(I18n.format("gregtech.universal.tooltip.voltage_in", energyContainer.getInputVoltage(), GTValues.VN[getTier()])); + tooltip.add(I18n.format("gregtech.universal.tooltip.energy_storage_capacity", energyContainer.getEnergyCapacity())); + tooltip.add(I18n.format("gregtech.universal.tooltip.fluid_storage_capacity", exportFluids.getTankAt(0).getCapacity())); } } diff --git a/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityBatteryBuffer.java b/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityBatteryBuffer.java index d9913df2de..a737d73e31 100644 --- a/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityBatteryBuffer.java +++ b/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityBatteryBuffer.java @@ -16,8 +16,8 @@ import gregtech.api.metatileentity.MetaTileEntityHolder; import gregtech.api.metatileentity.TieredMetaTileEntity; import gregtech.api.render.Textures; -import gregtech.api.util.LocalisationUtils; import gregtech.api.util.PipelineUtil; +import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; @@ -146,11 +146,11 @@ protected ModularUI createUI(EntityPlayer entityPlayer) { public void addInformation(ItemStack stack, @Nullable World player, List tooltip, boolean advanced) { String tierName = GTValues.VN[getTier()]; - tooltip.add(LocalisationUtils.format("gregtech.universal.tooltip.item_storage_capacity", inventorySize)); - tooltip.add(LocalisationUtils.format("gregtech.universal.tooltip.voltage_in", energyContainer.getInputVoltage(), tierName)); - tooltip.add(LocalisationUtils.format("gregtech.universal.tooltip.voltage_out", energyContainer.getOutputVoltage(), tierName)); - tooltip.add(LocalisationUtils.format("gregtech.universal.tooltip.amperage_out_till", inventorySize)); - tooltip.add(LocalisationUtils.format("gregtech.universal.tooltip.energy_storage_capacity", energyContainer.getEnergyCapacity())); + tooltip.add(I18n.format("gregtech.universal.tooltip.item_storage_capacity", inventorySize)); + tooltip.add(I18n.format("gregtech.universal.tooltip.voltage_in", energyContainer.getInputVoltage(), tierName)); + tooltip.add(I18n.format("gregtech.universal.tooltip.voltage_out", energyContainer.getOutputVoltage(), tierName)); + tooltip.add(I18n.format("gregtech.universal.tooltip.amperage_out_till", inventorySize)); + tooltip.add(I18n.format("gregtech.universal.tooltip.energy_storage_capacity", energyContainer.getEnergyCapacity())); } @Override diff --git a/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityBlockBreaker.java b/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityBlockBreaker.java index 5027225d20..17f2a5b8b4 100644 --- a/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityBlockBreaker.java +++ b/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityBlockBreaker.java @@ -15,10 +15,10 @@ import gregtech.api.render.Textures; import gregtech.api.util.BlockUtility; import gregtech.api.util.GregFakePlayer; -import gregtech.api.util.LocalisationUtils; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; +import net.minecraft.client.resources.I18n; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; @@ -256,8 +256,8 @@ protected ModularUI createUI(EntityPlayer entityPlayer) { @Override public void addInformation(ItemStack stack, @Nullable World player, List tooltip, boolean advanced) { - tooltip.add(LocalisationUtils.format("gregtech.universal.tooltip.item_storage_capacity", getInventorySize())); - tooltip.add(LocalisationUtils.format("gregtech.machine.block_breaker.speed_bonus", (int) (getEfficiencyMultiplier() * 100))); - tooltip.add(LocalisationUtils.format("gregtech.machine.block_breaker.consumption", getEnergyPerBlockBreak())); + tooltip.add(I18n.format("gregtech.universal.tooltip.item_storage_capacity", getInventorySize())); + tooltip.add(I18n.format("gregtech.machine.block_breaker.speed_bonus", (int) (getEfficiencyMultiplier() * 100))); + tooltip.add(I18n.format("gregtech.machine.block_breaker.consumption", getEnergyPerBlockBreak())); } } diff --git a/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityCharger.java b/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityCharger.java index d6321f5ea5..e8fa9c6997 100644 --- a/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityCharger.java +++ b/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityCharger.java @@ -10,7 +10,7 @@ import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.metatileentity.MetaTileEntityHolder; import gregtech.api.metatileentity.TieredMetaTileEntity; -import gregtech.api.util.LocalisationUtils; +import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; @@ -107,8 +107,8 @@ protected ModularUI createUI(EntityPlayer entityPlayer) { @Override public void addInformation(ItemStack stack, @Nullable World player, List tooltip, boolean advanced) { - tooltip.add(LocalisationUtils.format("gregtech.universal.tooltip.item_storage_capacity", inventorySize)); - tooltip.add(LocalisationUtils.format("gregtech.universal.tooltip.voltage_in", energyContainer.getInputVoltage(), GTValues.VN[getTier()])); - tooltip.add(LocalisationUtils.format("gregtech.universal.tooltip.energy_storage_capacity", energyContainer.getEnergyCapacity())); + tooltip.add(I18n.format("gregtech.universal.tooltip.item_storage_capacity", inventorySize)); + tooltip.add(I18n.format("gregtech.universal.tooltip.voltage_in", energyContainer.getInputVoltage(), GTValues.VN[getTier()])); + tooltip.add(I18n.format("gregtech.universal.tooltip.energy_storage_capacity", energyContainer.getEnergyCapacity())); } } diff --git a/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityFisher.java b/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityFisher.java index 20ebd57fe2..08f608c3c5 100644 --- a/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityFisher.java +++ b/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityFisher.java @@ -12,9 +12,9 @@ import gregtech.api.metatileentity.TieredMetaTileEntity; import gregtech.api.render.Textures; import gregtech.api.unification.OreDictUnifier; -import gregtech.api.util.LocalisationUtils; import net.minecraft.block.BlockLiquid; import net.minecraft.block.material.Material; +import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; @@ -138,10 +138,10 @@ public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, @Override public void addInformation(ItemStack stack, @Nullable World player, List tooltip, boolean advanced) { - tooltip.add(LocalisationUtils.format("gregtech.universal.tooltip.voltage_in", energyContainer.getInputVoltage(), GTValues.VN[getTier()])); - tooltip.add(LocalisationUtils.format("gregtech.universal.tooltip.energy_storage_capacity", energyContainer.getEnergyCapacity())); - tooltip.add(LocalisationUtils.format("gregtech.machine.fisher.speed", fishingTicks)); - tooltip.add(LocalisationUtils.format("gregtech.machine.fisher.requirement", (int) Math.sqrt(WATER_CHECK_SIZE))); + tooltip.add(I18n.format("gregtech.universal.tooltip.voltage_in", energyContainer.getInputVoltage(), GTValues.VN[getTier()])); + tooltip.add(I18n.format("gregtech.universal.tooltip.energy_storage_capacity", energyContainer.getEnergyCapacity())); + tooltip.add(I18n.format("gregtech.machine.fisher.speed", fishingTicks)); + tooltip.add(I18n.format("gregtech.machine.fisher.requirement", (int) Math.sqrt(WATER_CHECK_SIZE))); } } diff --git a/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityHull.java b/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityHull.java index 5542540fb2..b4dfbe1ad8 100644 --- a/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityHull.java +++ b/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityHull.java @@ -10,8 +10,8 @@ import gregtech.api.metatileentity.MetaTileEntityHolder; import gregtech.api.metatileentity.TieredMetaTileEntity; import gregtech.api.render.Textures; -import gregtech.api.util.LocalisationUtils; import gregtech.api.util.PipelineUtil; +import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; @@ -65,8 +65,8 @@ protected ModularUI createUI(EntityPlayer entityPlayer) { public void addInformation(ItemStack stack, @Nullable World player, List tooltip, boolean advanced) { String tierName = GTValues.VN[getTier()]; - tooltip.add(LocalisationUtils.format("gregtech.universal.tooltip.voltage_in", energyContainer.getInputVoltage(), tierName)); - tooltip.add(LocalisationUtils.format("gregtech.universal.tooltip.voltage_out", energyContainer.getOutputVoltage(), tierName)); - tooltip.add(LocalisationUtils.format("gregtech.universal.tooltip.energy_storage_capacity", energyContainer.getEnergyCapacity())); + tooltip.add(I18n.format("gregtech.universal.tooltip.voltage_in", energyContainer.getInputVoltage(), tierName)); + tooltip.add(I18n.format("gregtech.universal.tooltip.voltage_out", energyContainer.getOutputVoltage(), tierName)); + tooltip.add(I18n.format("gregtech.universal.tooltip.energy_storage_capacity", energyContainer.getEnergyCapacity())); } } diff --git a/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityItemCollector.java b/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityItemCollector.java index 9b0cc199ae..42e42d46f5 100644 --- a/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityItemCollector.java +++ b/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityItemCollector.java @@ -16,8 +16,8 @@ import gregtech.api.metatileentity.TieredMetaTileEntity; import gregtech.api.render.SimpleOverlayRenderer; import gregtech.api.render.Textures; -import gregtech.api.util.LocalisationUtils; import gregtech.common.covers.filter.ItemFilterContainer; +import net.minecraft.client.resources.I18n; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; @@ -168,11 +168,11 @@ protected void moveItemsInEffectRange() { @Override @SideOnly(Side.CLIENT) public void addInformation(ItemStack stack, @Nullable World player, List tooltip, boolean advanced) { - tooltip.add(LocalisationUtils.format("gregtech.machine.item_collector.collect_range", maxItemSuckingRange, maxItemSuckingRange)); - tooltip.add(LocalisationUtils.format("gregtech.universal.tooltip.max_voltage_in", energyContainer.getInputVoltage(), GTValues.VN[getTier()])); - tooltip.add(LocalisationUtils.format("gregtech.universal.tooltip.energy_storage_capacity", energyContainer.getEnergyCapacity())); - tooltip.add(LocalisationUtils.format("gregtech.machine.item_controller.tooltip.redstone")); - tooltip.add(LocalisationUtils.format("gregtech.machine.item_controller.tooltip.consumption", getEnergyConsumedPerTick())); + tooltip.add(I18n.format("gregtech.machine.item_collector.collect_range", maxItemSuckingRange, maxItemSuckingRange)); + tooltip.add(I18n.format("gregtech.universal.tooltip.max_voltage_in", energyContainer.getInputVoltage(), GTValues.VN[getTier()])); + tooltip.add(I18n.format("gregtech.universal.tooltip.energy_storage_capacity", energyContainer.getEnergyCapacity())); + tooltip.add(I18n.format("gregtech.machine.item_controller.tooltip.redstone")); + tooltip.add(I18n.format("gregtech.machine.item_controller.tooltip.consumption", getEnergyConsumedPerTick())); } @Override diff --git a/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityPump.java b/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityPump.java index 9de7d48e06..1fbaad8a12 100644 --- a/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityPump.java +++ b/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityPump.java @@ -19,9 +19,9 @@ import gregtech.api.metatileentity.TieredMetaTileEntity; import gregtech.api.render.Textures; import gregtech.api.util.GTUtility; -import gregtech.api.util.LocalisationUtils; import net.minecraft.block.BlockLiquid; import net.minecraft.block.state.IBlockState; +import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; @@ -291,10 +291,10 @@ public void readFromNBT(NBTTagCompound data) { @Override public void addInformation(ItemStack stack, @Nullable World player, List tooltip, boolean advanced) { int maxPumpRange = getMaxPumpRange(); - tooltip.add(LocalisationUtils.format("gregtech.machine.pump.tooltip_range", maxPumpRange, maxPumpRange)); - tooltip.add(LocalisationUtils.format("gregtech.machine.pump.tooltip_speed", getPumpingCycleLength())); - tooltip.add(LocalisationUtils.format("gregtech.universal.tooltip.voltage_in", energyContainer.getInputVoltage(), GTValues.VN[getTier()])); - tooltip.add(LocalisationUtils.format("gregtech.universal.tooltip.energy_storage_capacity", energyContainer.getEnergyCapacity())); - tooltip.add(LocalisationUtils.format("gregtech.universal.tooltip.fluid_storage_capacity", exportFluids.getTankAt(0).getCapacity())); + tooltip.add(I18n.format("gregtech.machine.pump.tooltip_range", maxPumpRange, maxPumpRange)); + tooltip.add(I18n.format("gregtech.machine.pump.tooltip_speed", getPumpingCycleLength())); + tooltip.add(I18n.format("gregtech.universal.tooltip.voltage_in", energyContainer.getInputVoltage(), GTValues.VN[getTier()])); + tooltip.add(I18n.format("gregtech.universal.tooltip.energy_storage_capacity", energyContainer.getEnergyCapacity())); + tooltip.add(I18n.format("gregtech.universal.tooltip.fluid_storage_capacity", exportFluids.getTankAt(0).getCapacity())); } } diff --git a/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityTransformer.java b/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityTransformer.java index d520312388..8f17588b1b 100644 --- a/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityTransformer.java +++ b/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityTransformer.java @@ -13,9 +13,9 @@ import gregtech.api.metatileentity.MetaTileEntityHolder; import gregtech.api.metatileentity.TieredMetaTileEntity; import gregtech.api.render.Textures; -import gregtech.api.util.LocalisationUtils; import gregtech.api.util.PipelineUtil; import gregtech.common.tools.DamageValues; +import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; @@ -168,17 +168,17 @@ public void addInformation(ItemStack stack, @Nullable World player, List long lowerAmperage = energyContainer.getInputAmperage(); long higherAmperage = energyContainer.getOutputAmperage(); - tooltip.add(LocalisationUtils.format("gregtech.machine.transformer.tooltip_tool_usage")); - tooltip.add(LocalisationUtils.format("gregtech.universal.tooltip.energy_storage_capacity", energyContainer.getEnergyCapacity())); - tooltip.add(LocalisationUtils.format("gregtech.machine.transformer.tooltip_transform_down")); - tooltip.add(LocalisationUtils.format("gregtech.universal.tooltip.voltage_in", higherVoltage, higherTierName)); - tooltip.add(LocalisationUtils.format("gregtech.universal.tooltip.voltage_out", lowerVoltage, lowerTierName)); - tooltip.add(LocalisationUtils.format("gregtech.universal.tooltip.amperage_in", lowerAmperage)); - tooltip.add(LocalisationUtils.format("gregtech.universal.tooltip.amperage_out", higherAmperage)); - tooltip.add(LocalisationUtils.format("gregtech.machine.transformer.tooltip_transform_up")); - tooltip.add(LocalisationUtils.format("gregtech.universal.tooltip.voltage_in", lowerVoltage, lowerTierName)); - tooltip.add(LocalisationUtils.format("gregtech.universal.tooltip.voltage_out", higherVoltage, higherTierName)); - tooltip.add(LocalisationUtils.format("gregtech.universal.tooltip.amperage_in", higherAmperage)); - tooltip.add(LocalisationUtils.format("gregtech.universal.tooltip.amperage_out", lowerAmperage)); + tooltip.add(I18n.format("gregtech.machine.transformer.tooltip_tool_usage")); + tooltip.add(I18n.format("gregtech.universal.tooltip.energy_storage_capacity", energyContainer.getEnergyCapacity())); + tooltip.add(I18n.format("gregtech.machine.transformer.tooltip_transform_down")); + tooltip.add(I18n.format("gregtech.universal.tooltip.voltage_in", higherVoltage, higherTierName)); + tooltip.add(I18n.format("gregtech.universal.tooltip.voltage_out", lowerVoltage, lowerTierName)); + tooltip.add(I18n.format("gregtech.universal.tooltip.amperage_in", lowerAmperage)); + tooltip.add(I18n.format("gregtech.universal.tooltip.amperage_out", higherAmperage)); + tooltip.add(I18n.format("gregtech.machine.transformer.tooltip_transform_up")); + tooltip.add(I18n.format("gregtech.universal.tooltip.voltage_in", lowerVoltage, lowerTierName)); + tooltip.add(I18n.format("gregtech.universal.tooltip.voltage_out", higherVoltage, higherTierName)); + tooltip.add(I18n.format("gregtech.universal.tooltip.amperage_in", higherAmperage)); + tooltip.add(I18n.format("gregtech.universal.tooltip.amperage_out", lowerAmperage)); } } diff --git a/src/main/java/gregtech/common/metatileentities/electric/multiblockpart/MetaTileEntityEnergyHatch.java b/src/main/java/gregtech/common/metatileentities/electric/multiblockpart/MetaTileEntityEnergyHatch.java index f949fd569b..dd4eb9d27b 100644 --- a/src/main/java/gregtech/common/metatileentities/electric/multiblockpart/MetaTileEntityEnergyHatch.java +++ b/src/main/java/gregtech/common/metatileentities/electric/multiblockpart/MetaTileEntityEnergyHatch.java @@ -13,8 +13,8 @@ import gregtech.api.metatileentity.multiblock.MultiblockAbility; import gregtech.api.render.SimpleOverlayRenderer; import gregtech.api.render.Textures; -import gregtech.api.util.LocalisationUtils; import gregtech.api.util.PipelineUtil; +import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; @@ -77,12 +77,12 @@ public void addInformation(ItemStack stack, @Nullable World player, List String tierName = GTValues.VN[getTier()]; if (isExportHatch) { - tooltip.add(LocalisationUtils.format("gregtech.universal.tooltip.voltage_out", energyContainer.getOutputVoltage(), tierName)); - tooltip.add(LocalisationUtils.format("gregtech.universal.tooltip.amperage_out_till", energyContainer.getOutputAmperage())); + tooltip.add(I18n.format("gregtech.universal.tooltip.voltage_out", energyContainer.getOutputVoltage(), tierName)); + tooltip.add(I18n.format("gregtech.universal.tooltip.amperage_out_till", energyContainer.getOutputAmperage())); } else { - tooltip.add(LocalisationUtils.format("gregtech.universal.tooltip.voltage_in", energyContainer.getInputVoltage(), tierName)); - tooltip.add(LocalisationUtils.format("gregtech.universal.tooltip.amperage_in_till", energyContainer.getInputAmperage())); + tooltip.add(I18n.format("gregtech.universal.tooltip.voltage_in", energyContainer.getInputVoltage(), tierName)); + tooltip.add(I18n.format("gregtech.universal.tooltip.amperage_in_till", energyContainer.getInputAmperage())); } - tooltip.add(LocalisationUtils.format("gregtech.universal.tooltip.energy_storage_capacity", energyContainer.getEnergyCapacity())); + tooltip.add(I18n.format("gregtech.universal.tooltip.energy_storage_capacity", energyContainer.getEnergyCapacity())); } } diff --git a/src/main/java/gregtech/common/metatileentities/electric/multiblockpart/MetaTileEntityFluidHatch.java b/src/main/java/gregtech/common/metatileentities/electric/multiblockpart/MetaTileEntityFluidHatch.java index f06d73ec0f..332cff55ec 100644 --- a/src/main/java/gregtech/common/metatileentities/electric/multiblockpart/MetaTileEntityFluidHatch.java +++ b/src/main/java/gregtech/common/metatileentities/electric/multiblockpart/MetaTileEntityFluidHatch.java @@ -17,7 +17,7 @@ import gregtech.api.metatileentity.multiblock.MultiblockAbility; import gregtech.api.render.SimpleOverlayRenderer; import gregtech.api.render.Textures; -import gregtech.api.util.LocalisationUtils; +import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; @@ -146,6 +146,6 @@ public ModularUI.Builder createTankUI(IFluidTank fluidTank, IItemHandlerModifiab @Override public void addInformation(ItemStack stack, @Nullable World player, List tooltip, boolean advanced) { - tooltip.add(LocalisationUtils.format("gregtech.universal.tooltip.fluid_storage_capacity", getInventorySize())); + tooltip.add(I18n.format("gregtech.universal.tooltip.fluid_storage_capacity", getInventorySize())); } } diff --git a/src/main/java/gregtech/common/metatileentities/electric/multiblockpart/MetaTileEntityItemBus.java b/src/main/java/gregtech/common/metatileentities/electric/multiblockpart/MetaTileEntityItemBus.java index d45bc4a734..a3703f5588 100644 --- a/src/main/java/gregtech/common/metatileentities/electric/multiblockpart/MetaTileEntityItemBus.java +++ b/src/main/java/gregtech/common/metatileentities/electric/multiblockpart/MetaTileEntityItemBus.java @@ -13,7 +13,7 @@ import gregtech.api.metatileentity.multiblock.MultiblockAbility; import gregtech.api.render.SimpleOverlayRenderer; import gregtech.api.render.Textures; -import gregtech.api.util.LocalisationUtils; +import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; @@ -113,6 +113,6 @@ private ModularUI.Builder createUITemplate(EntityPlayer player, int rowSize, int @Override public void addInformation(ItemStack stack, @Nullable World player, List tooltip, boolean advanced) { - tooltip.add(LocalisationUtils.format("gregtech.universal.tooltip.item_storage_capacity", getInventorySize())); + tooltip.add(I18n.format("gregtech.universal.tooltip.item_storage_capacity", getInventorySize())); } } diff --git a/src/main/java/gregtech/common/metatileentities/steam/boiler/SteamBoiler.java b/src/main/java/gregtech/common/metatileentities/steam/boiler/SteamBoiler.java index af1b14fe1d..b63e5ba849 100644 --- a/src/main/java/gregtech/common/metatileentities/steam/boiler/SteamBoiler.java +++ b/src/main/java/gregtech/common/metatileentities/steam/boiler/SteamBoiler.java @@ -16,8 +16,8 @@ import gregtech.api.render.SimpleSidedCubeRenderer; import gregtech.api.render.Textures; import gregtech.api.util.GTUtility; -import gregtech.api.util.LocalisationUtils; import net.minecraft.client.renderer.texture.TextureAtlasSprite; +import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.SoundEvents; import net.minecraft.item.ItemStack; @@ -296,6 +296,6 @@ private int getBoilingCycleLength() { @Override public void addInformation(ItemStack stack, @Nullable World player, List tooltip, boolean advanced) { - tooltip.add(LocalisationUtils.format("gregtech.machine.steam_boiler.tooltip_produces", baseSteamOutput, getBoilingCycleLength())); + tooltip.add(I18n.format("gregtech.machine.steam_boiler.tooltip_produces", baseSteamOutput, getBoilingCycleLength())); } } diff --git a/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityChest.java b/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityChest.java index 083cb1dd35..c44558c1c5 100644 --- a/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityChest.java +++ b/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityChest.java @@ -18,8 +18,8 @@ import gregtech.api.render.Textures; import gregtech.api.unification.material.type.SolidMaterial; import gregtech.api.util.GTUtility; -import gregtech.api.util.LocalisationUtils; import net.minecraft.client.renderer.texture.TextureAtlasSprite; +import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.SoundEvents; import net.minecraft.item.ItemStack; @@ -307,6 +307,6 @@ protected boolean shouldSerializeInventories() { @Override public void addInformation(ItemStack stack, @Nullable World player, List tooltip, boolean advanced) { - tooltip.add(LocalisationUtils.format("gregtech.universal.tooltip.item_storage_capacity", rowSize * amountOfRows)); + tooltip.add(I18n.format("gregtech.universal.tooltip.item_storage_capacity", rowSize * amountOfRows)); } } diff --git a/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityQuantumChest.java b/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityQuantumChest.java index 4493e452b7..3e58d838b2 100644 --- a/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityQuantumChest.java +++ b/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityQuantumChest.java @@ -15,8 +15,8 @@ import gregtech.api.metatileentity.MetaTileEntityHolder; import gregtech.api.render.Textures; import gregtech.api.util.GTUtility; -import gregtech.api.util.LocalisationUtils; import net.minecraft.client.renderer.texture.TextureAtlasSprite; +import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; @@ -141,7 +141,7 @@ protected void addDisplayInformation(List textList) { @Override public void addInformation(ItemStack stack, @Nullable World player, List tooltip, boolean advanced) { super.addInformation(stack, player, tooltip, advanced); - tooltip.add(LocalisationUtils.format("gregtech.machine.quantum_chest.capacity", maxStoredItems)); + tooltip.add(I18n.format("gregtech.machine.quantum_chest.capacity", maxStoredItems)); NBTTagCompound compound = stack.getTagCompound(); if (compound != null) { @@ -156,9 +156,9 @@ public void addInformation(ItemStack stack, @Nullable World player, List count = tempStack.getCount(); } if (translationKey != null) { - tooltip.add(LocalisationUtils.format("gregtech.machine.quantum_chest.tooltip.item", - LocalisationUtils.format(translationKey))); - tooltip.add(LocalisationUtils.format("gregtech.machine.quantum_chest.tooltip.count", count)); + tooltip.add(I18n.format("gregtech.machine.quantum_chest.tooltip.item", + I18n.format(translationKey))); + tooltip.add(I18n.format("gregtech.machine.quantum_chest.tooltip.count", count)); } } } diff --git a/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityQuantumTank.java b/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityQuantumTank.java index 9def1af641..25e68b6bb5 100644 --- a/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityQuantumTank.java +++ b/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityQuantumTank.java @@ -18,8 +18,8 @@ import gregtech.api.metatileentity.MetaTileEntityHolder; import gregtech.api.render.Textures; import gregtech.api.util.GTUtility; -import gregtech.api.util.LocalisationUtils; import net.minecraft.client.renderer.texture.TextureAtlasSprite; +import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; @@ -165,12 +165,12 @@ public Pair getParticleTexture() { @Override public void addInformation(ItemStack stack, @Nullable World player, List tooltip, boolean advanced) { super.addInformation(stack, player, tooltip, advanced); - tooltip.add(LocalisationUtils.format("gregtech.machine.quantum_tank.capacity", maxFluidCapacity)); + tooltip.add(I18n.format("gregtech.machine.quantum_tank.capacity", maxFluidCapacity)); NBTTagCompound compound = stack.getTagCompound(); if (compound != null && compound.hasKey("FluidName")) { FluidStack fluidStack = new FluidStack(FluidRegistry.getFluid(compound.getString("FluidName")), 1000); - tooltip.add(LocalisationUtils.format("gregtech.machine.quantum_tank.tooltip.name", fluidStack.getLocalizedName())); - tooltip.add(LocalisationUtils.format("gregtech.machine.quantum_tank.tooltip.count", compound.getInteger("Amount"))); + tooltip.add(I18n.format("gregtech.machine.quantum_tank.tooltip.name", fluidStack.getLocalizedName())); + tooltip.add(I18n.format("gregtech.machine.quantum_tank.tooltip.count", compound.getInteger("Amount"))); } } diff --git a/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityTank.java b/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityTank.java index c480b2058b..a907f3371a 100644 --- a/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityTank.java +++ b/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityTank.java @@ -23,10 +23,10 @@ import gregtech.api.util.ByteBufUtils; import gregtech.api.util.FluidTooltipUtil; import gregtech.api.util.GTUtility; -import gregtech.api.util.LocalisationUtils; import gregtech.api.util.WatchedFluidTank; import gregtech.common.ConfigHolder; import net.minecraft.client.renderer.texture.TextureAtlasSprite; +import net.minecraft.client.resources.I18n; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; @@ -674,13 +674,13 @@ private FluidStack getFluidForRendering() { @Override @SideOnly(Side.CLIENT) public void addInformation(ItemStack stack, @Nullable World player, List tooltip, boolean advanced) { - tooltip.add(LocalisationUtils.format("gregtech.universal.tooltip.fluid_storage_capacity", tankSize)); - tooltip.add(LocalisationUtils.format("gregtech.machine.fluid_tank.max_multiblock", maxSizeHorizontal, maxSizeVertical, maxSizeHorizontal)); + tooltip.add(I18n.format("gregtech.universal.tooltip.fluid_storage_capacity", tankSize)); + tooltip.add(I18n.format("gregtech.machine.fluid_tank.max_multiblock", maxSizeHorizontal, maxSizeVertical, maxSizeHorizontal)); NBTTagCompound tagCompound = stack.getTagCompound(); if (tagCompound != null && tagCompound.hasKey("Fluid", NBT.TAG_COMPOUND)) { FluidStack fluidStack = FluidStack.loadFluidStackFromNBT(tagCompound.getCompoundTag("Fluid")); if (fluidStack != null) { - tooltip.add(LocalisationUtils.format("gregtech.machine.fluid_tank.fluid", fluidStack.amount, fluidStack.getLocalizedName())); + tooltip.add(I18n.format("gregtech.machine.fluid_tank.fluid", fluidStack.amount, fluidStack.getLocalizedName())); } String formula = FluidTooltipUtil.getFluidTooltip(fluidStack); if (formula != null) diff --git a/src/main/java/gregtech/common/pipelike/cable/ItemBlockCable.java b/src/main/java/gregtech/common/pipelike/cable/ItemBlockCable.java index 6e887a354f..f46f3248b9 100644 --- a/src/main/java/gregtech/common/pipelike/cable/ItemBlockCable.java +++ b/src/main/java/gregtech/common/pipelike/cable/ItemBlockCable.java @@ -3,7 +3,7 @@ import gregtech.api.GTValues; import gregtech.api.pipenet.block.material.ItemBlockMaterialPipe; import gregtech.api.util.GTUtility; -import gregtech.api.util.LocalisationUtils; +import net.minecraft.client.resources.I18n; import net.minecraft.client.util.ITooltipFlag; import net.minecraft.item.ItemStack; import net.minecraft.world.World; @@ -24,8 +24,8 @@ public ItemBlockCable(BlockCable block) { public void addInformation(ItemStack stack, @Nullable World worldIn, List tooltip, ITooltipFlag flagIn) { WireProperties wireProperties = blockPipe.createItemProperties(stack); String voltageName = GTValues.VN[GTUtility.getTierByVoltage(wireProperties.voltage)]; - tooltip.add(LocalisationUtils.format("gregtech.cable.voltage", wireProperties.voltage, voltageName)); - tooltip.add(LocalisationUtils.format("gregtech.cable.amperage", wireProperties.amperage)); - tooltip.add(LocalisationUtils.format("gregtech.cable.loss_per_block", wireProperties.lossPerBlock)); + tooltip.add(I18n.format("gregtech.cable.voltage", wireProperties.voltage, voltageName)); + tooltip.add(I18n.format("gregtech.cable.amperage", wireProperties.amperage)); + tooltip.add(I18n.format("gregtech.cable.loss_per_block", wireProperties.lossPerBlock)); } } diff --git a/src/main/java/gregtech/common/pipelike/fluidpipe/ItemBlockFluidPipe.java b/src/main/java/gregtech/common/pipelike/fluidpipe/ItemBlockFluidPipe.java index e8c7888f09..36b090dccc 100644 --- a/src/main/java/gregtech/common/pipelike/fluidpipe/ItemBlockFluidPipe.java +++ b/src/main/java/gregtech/common/pipelike/fluidpipe/ItemBlockFluidPipe.java @@ -1,7 +1,7 @@ package gregtech.common.pipelike.fluidpipe; import gregtech.api.pipenet.block.material.ItemBlockMaterialPipe; -import gregtech.api.util.LocalisationUtils; +import net.minecraft.client.resources.I18n; import net.minecraft.client.util.ITooltipFlag; import net.minecraft.item.ItemStack; import net.minecraft.world.World; @@ -21,8 +21,8 @@ public ItemBlockFluidPipe(BlockFluidPipe block) { @SideOnly(Side.CLIENT) public void addInformation(ItemStack stack, @Nullable World worldIn, List tooltip, ITooltipFlag flagIn) { FluidPipeProperties pipeProperties = blockPipe.createItemProperties(stack); - tooltip.add(LocalisationUtils.format("gregtech.fluid_pipe.throughput", pipeProperties.throughput)); - tooltip.add(LocalisationUtils.format("gregtech.fluid_pipe.max_temperature", pipeProperties.maxFluidTemperature)); - if (!pipeProperties.gasProof) tooltip.add(LocalisationUtils.format("gregtech.fluid_pipe.non_gas_proof")); + tooltip.add(I18n.format("gregtech.fluid_pipe.throughput", pipeProperties.throughput)); + tooltip.add(I18n.format("gregtech.fluid_pipe.max_temperature", pipeProperties.maxFluidTemperature)); + if (!pipeProperties.gasProof) tooltip.add(I18n.format("gregtech.fluid_pipe.non_gas_proof")); } } diff --git a/src/main/java/gregtech/common/tools/ToolHardHammer.java b/src/main/java/gregtech/common/tools/ToolHardHammer.java index 25d21d6fba..c09ae3e32a 100644 --- a/src/main/java/gregtech/common/tools/ToolHardHammer.java +++ b/src/main/java/gregtech/common/tools/ToolHardHammer.java @@ -1,9 +1,9 @@ package gregtech.common.tools; import gregtech.api.recipes.RecipeMaps; -import gregtech.api.util.LocalisationUtils; import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; +import net.minecraft.client.resources.I18n; import net.minecraft.enchantment.Enchantment; import net.minecraft.enchantment.EnchantmentHelper; import net.minecraft.entity.EntityLivingBase; @@ -85,6 +85,6 @@ public void convertBlockDrops(World world, BlockPos blockPos, IBlockState blockS @Override public void addInformation(ItemStack stack, List lines, boolean isAdvanced) { - lines.add(LocalisationUtils.format("metaitem.tool.tooltip.hammer.extra_drop")); + lines.add(I18n.format("metaitem.tool.tooltip.hammer.extra_drop")); } } diff --git a/src/main/java/gregtech/integration/jei/GTJeiPlugin.java b/src/main/java/gregtech/integration/jei/GTJeiPlugin.java index b38627344b..fd03472d40 100755 --- a/src/main/java/gregtech/integration/jei/GTJeiPlugin.java +++ b/src/main/java/gregtech/integration/jei/GTJeiPlugin.java @@ -19,7 +19,6 @@ import gregtech.api.unification.material.type.DustMaterial; import gregtech.api.unification.material.type.Material; import gregtech.api.unification.ore.OrePrefix; -import gregtech.api.util.LocalisationUtils; import gregtech.api.worldgen.config.OreDepositDefinition; import gregtech.api.worldgen.config.WorldGenRegistry; import gregtech.common.blocks.MetaBlocks; @@ -40,6 +39,7 @@ import mezz.jei.api.ingredients.VanillaTypes; import mezz.jei.api.recipe.IRecipeCategoryRegistration; import mezz.jei.api.recipe.VanillaRecipeCategoryUid; +import net.minecraft.client.resources.I18n; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; @@ -140,7 +140,7 @@ public void register(IModRegistry registry) { registry.addRecipeCatalyst(MetaTileEntities.LARGE_TITANIUM_BOILER.getStackForm(), semiFluidMapId); registry.addRecipeCatalyst(MetaTileEntities.LARGE_TUNGSTENSTEEL_BOILER.getStackForm(), semiFluidMapId); - registry.addIngredientInfo(Objects.requireNonNull(Materials.Air.getFluid(1000)), VanillaTypes.FLUID, LocalisationUtils.format("gregtech.machine.air_collector.jei_description")); + registry.addIngredientInfo(Objects.requireNonNull(Materials.Air.getFluid(1000)), VanillaTypes.FLUID, I18n.format("gregtech.machine.air_collector.jei_description")); String primitiveBlastId = GTValues.MODID + ":" + "primitive_blast_furnace"; registry.addRecipes(RecipeMaps.PRIMITIVE_BLAST_FURNACE_RECIPES.stream() diff --git a/src/main/java/gregtech/integration/jei/GTOreInfo.java b/src/main/java/gregtech/integration/jei/GTOreInfo.java index d118eb34ae..dcf696cb21 100644 --- a/src/main/java/gregtech/integration/jei/GTOreInfo.java +++ b/src/main/java/gregtech/integration/jei/GTOreInfo.java @@ -2,7 +2,6 @@ import gregtech.api.unification.OreDictUnifier; import gregtech.api.unification.material.type.Material; -import gregtech.api.util.LocalisationUtils; import gregtech.api.worldgen.config.OreDepositDefinition; import gregtech.api.worldgen.filler.BlockFiller; import gregtech.api.worldgen.filler.FillerEntry; @@ -14,6 +13,7 @@ import mezz.jei.api.recipe.IRecipeWrapper; import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; +import net.minecraft.client.resources.I18n; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraft.world.biome.Biome; @@ -239,8 +239,8 @@ public void addTooltip(int slotIndex, boolean input, Object ingredient, List createBiomeTooltip() { if(!(entry.getValue() == weight)) { //Cannot Spawn if(entry.getValue() <= 0) { - tooltip.add(LocalisationUtils.format("gregtech.jei.ore.biome_weighting_no_spawn", entry.getKey().getBiomeName())); + tooltip.add(I18n.format("gregtech.jei.ore.biome_weighting_no_spawn", entry.getKey().getBiomeName())); } else { - tooltip.add(LocalisationUtils.format("gregtech.jei.ore.biome_weighting", entry.getKey().getBiomeName(), entry.getValue())); + tooltip.add(I18n.format("gregtech.jei.ore.biome_weighting", entry.getKey().getBiomeName(), entry.getValue())); } } } diff --git a/src/main/java/gregtech/integration/jei/multiblock/MultiblockInfoCategory.java b/src/main/java/gregtech/integration/jei/multiblock/MultiblockInfoCategory.java index 9ea80f9a71..1873ce382b 100644 --- a/src/main/java/gregtech/integration/jei/multiblock/MultiblockInfoCategory.java +++ b/src/main/java/gregtech/integration/jei/multiblock/MultiblockInfoCategory.java @@ -2,7 +2,6 @@ import gregtech.api.GTValues; import gregtech.api.gui.GuiTextures; -import gregtech.api.util.LocalisationUtils; import gregtech.common.metatileentities.MetaTileEntities; import gregtech.integration.jei.multiblock.infos.*; import mezz.jei.api.IJeiHelpers; @@ -14,6 +13,7 @@ import mezz.jei.api.ingredients.IIngredients; import mezz.jei.api.recipe.IRecipeCategory; import mezz.jei.gui.recipes.RecipeLayout; +import net.minecraft.client.resources.I18n; import java.util.HashMap; import java.util.Map; @@ -61,7 +61,7 @@ public String getUid() { @Override public String getTitle() { - return LocalisationUtils.format("gregtech.multiblock.title"); + return I18n.format("gregtech.multiblock.title"); } @Override diff --git a/src/main/java/gregtech/integration/jei/multiblock/MultiblockInfoPage.java b/src/main/java/gregtech/integration/jei/multiblock/MultiblockInfoPage.java index d4df6f5e88..917780515d 100644 --- a/src/main/java/gregtech/integration/jei/multiblock/MultiblockInfoPage.java +++ b/src/main/java/gregtech/integration/jei/multiblock/MultiblockInfoPage.java @@ -3,10 +3,10 @@ import gregtech.api.GTValues; import gregtech.api.metatileentity.multiblock.MultiblockControllerBase; import gregtech.api.util.ItemStackHashStrategy; -import gregtech.api.util.LocalisationUtils; import gregtech.common.metatileentities.MetaTileEntities; import it.unimi.dsi.fastutil.Hash; import it.unimi.dsi.fastutil.objects.Object2ObjectOpenCustomHashMap; +import net.minecraft.client.resources.I18n; import net.minecraft.item.ItemStack; import net.minecraft.util.text.ITextComponent; import net.minecraft.util.text.Style; @@ -39,7 +39,7 @@ public List informationText() { return Stream.of("gregtech.multiblock.preview.tilt", "gregtech.multiblock.preview.zoom", "gregtech.multiblock.preview.pan", "gregtech.multiblock.preview.move", "gregtech.multiblock.preview.reset") - .map(LocalisationUtils::format) + .map(I18n::format) .collect(Collectors.toList()); } diff --git a/src/main/java/gregtech/integration/jei/multiblock/MultiblockInfoRecipeWrapper.java b/src/main/java/gregtech/integration/jei/multiblock/MultiblockInfoRecipeWrapper.java index ad6aacf103..760ae0c264 100755 --- a/src/main/java/gregtech/integration/jei/multiblock/MultiblockInfoRecipeWrapper.java +++ b/src/main/java/gregtech/integration/jei/multiblock/MultiblockInfoRecipeWrapper.java @@ -13,7 +13,6 @@ import gregtech.api.util.BlockInfo; import gregtech.api.util.GTUtility; import gregtech.api.util.ItemStackKey; -import gregtech.api.util.LocalisationUtils; import mezz.jei.api.IGuiHelper; import mezz.jei.api.gui.IDrawable; import mezz.jei.api.gui.IGuiItemStackGroup; @@ -25,6 +24,7 @@ import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.resources.I18n; import net.minecraft.client.util.ITooltipFlag; import net.minecraft.client.util.ITooltipFlag.TooltipFlags; import net.minecraft.item.EnumRarity; @@ -317,7 +317,7 @@ private boolean isMouseWithinRange(int[] yRange, int[] xRange, int mouseY, int m } private void drawMultiblockName(int recipeWidth) { - String localizedName = LocalisationUtils.format(infoPage.getController().getMetaFullName()); + String localizedName = I18n.format(infoPage.getController().getMetaFullName()); GTUtility.drawCenteredSizedText(recipeWidth / 2, 0, localizedName, 0x333333, 1.3); } diff --git a/src/main/java/gregtech/integration/jei/multiblock/infos/CokeOvenInfo.java b/src/main/java/gregtech/integration/jei/multiblock/infos/CokeOvenInfo.java index 3127b4e640..e4469cd407 100644 --- a/src/main/java/gregtech/integration/jei/multiblock/infos/CokeOvenInfo.java +++ b/src/main/java/gregtech/integration/jei/multiblock/infos/CokeOvenInfo.java @@ -2,12 +2,12 @@ import com.google.common.collect.Lists; import gregtech.api.metatileentity.multiblock.MultiblockControllerBase; -import gregtech.api.util.LocalisationUtils; import gregtech.common.blocks.BlockMetalCasing.MetalCasingType; import gregtech.common.blocks.MetaBlocks; import gregtech.common.metatileentities.MetaTileEntities; import gregtech.integration.jei.multiblock.MultiblockInfoPage; import gregtech.integration.jei.multiblock.MultiblockShapeInfo; +import net.minecraft.client.resources.I18n; import net.minecraft.init.Blocks; import net.minecraft.util.EnumFacing; @@ -36,7 +36,7 @@ public List getMatchingShapes() { @Override public String[] getDescription() { - return new String[]{LocalisationUtils.format("gregtech.multiblock.coke_oven.description")}; + return new String[]{I18n.format("gregtech.multiblock.coke_oven.description")}; } } diff --git a/src/main/java/gregtech/integration/jei/multiblock/infos/CrackerUnitInfo.java b/src/main/java/gregtech/integration/jei/multiblock/infos/CrackerUnitInfo.java index 50366b2cad..fe23c7c9dc 100644 --- a/src/main/java/gregtech/integration/jei/multiblock/infos/CrackerUnitInfo.java +++ b/src/main/java/gregtech/integration/jei/multiblock/infos/CrackerUnitInfo.java @@ -3,13 +3,13 @@ import com.google.common.collect.Lists; import gregtech.api.GTValues; import gregtech.api.metatileentity.multiblock.MultiblockControllerBase; -import gregtech.api.util.LocalisationUtils; import gregtech.common.blocks.BlockMetalCasing; import gregtech.common.blocks.BlockWireCoil; import gregtech.common.blocks.MetaBlocks; import gregtech.common.metatileentities.MetaTileEntities; import gregtech.integration.jei.multiblock.MultiblockInfoPage; import gregtech.integration.jei.multiblock.MultiblockShapeInfo; +import net.minecraft.client.resources.I18n; import net.minecraft.init.Blocks; import net.minecraft.util.EnumFacing; import net.minecraft.util.text.ITextComponent; @@ -45,7 +45,7 @@ public List getMatchingShapes() { @Override public String[] getDescription() { - return new String[]{LocalisationUtils.format("gregtech.multiblock.cracker.description")}; + return new String[]{I18n.format("gregtech.multiblock.cracker.description")}; } @Override diff --git a/src/main/java/gregtech/integration/jei/multiblock/infos/DieselEngineInfo.java b/src/main/java/gregtech/integration/jei/multiblock/infos/DieselEngineInfo.java index ffe31b7b01..4c7e4dffd2 100644 --- a/src/main/java/gregtech/integration/jei/multiblock/infos/DieselEngineInfo.java +++ b/src/main/java/gregtech/integration/jei/multiblock/infos/DieselEngineInfo.java @@ -3,7 +3,6 @@ import com.google.common.collect.Lists; import gregtech.api.GTValues; import gregtech.api.metatileentity.multiblock.MultiblockControllerBase; -import gregtech.api.util.LocalisationUtils; import gregtech.common.blocks.BlockMetalCasing.MetalCasingType; import gregtech.common.blocks.BlockMultiblockCasing; import gregtech.common.blocks.BlockTurbineCasing; @@ -11,6 +10,7 @@ import gregtech.common.metatileentities.MetaTileEntities; import gregtech.integration.jei.multiblock.MultiblockInfoPage; import gregtech.integration.jei.multiblock.MultiblockShapeInfo; +import net.minecraft.client.resources.I18n; import net.minecraft.init.Blocks; import net.minecraft.util.EnumFacing; @@ -43,7 +43,7 @@ public List getMatchingShapes() { @Override public String[] getDescription() { - return new String[]{LocalisationUtils.format("gregtech.multiblock.diesel_engine.description")}; + return new String[]{I18n.format("gregtech.multiblock.diesel_engine.description")}; } } diff --git a/src/main/java/gregtech/integration/jei/multiblock/infos/DistillationTowerInfo.java b/src/main/java/gregtech/integration/jei/multiblock/infos/DistillationTowerInfo.java index 12493eef90..bcdd82e1b4 100644 --- a/src/main/java/gregtech/integration/jei/multiblock/infos/DistillationTowerInfo.java +++ b/src/main/java/gregtech/integration/jei/multiblock/infos/DistillationTowerInfo.java @@ -3,12 +3,12 @@ import com.google.common.collect.Lists; import gregtech.api.GTValues; import gregtech.api.metatileentity.multiblock.MultiblockControllerBase; -import gregtech.api.util.LocalisationUtils; import gregtech.common.blocks.BlockMetalCasing.MetalCasingType; import gregtech.common.blocks.MetaBlocks; import gregtech.common.metatileentities.MetaTileEntities; import gregtech.integration.jei.multiblock.MultiblockInfoPage; import gregtech.integration.jei.multiblock.MultiblockShapeInfo; +import net.minecraft.client.resources.I18n; import net.minecraft.init.Blocks; import net.minecraft.util.EnumFacing; import net.minecraft.util.text.ITextComponent; @@ -44,7 +44,7 @@ public List getMatchingShapes() { @Override public String[] getDescription() { - return new String[]{LocalisationUtils.format("gregtech.multiblock.distillation_tower.description")}; + return new String[]{I18n.format("gregtech.multiblock.distillation_tower.description")}; } @Override @@ -56,7 +56,7 @@ public float getDefaultZoom() { protected void generateBlockTooltips() { super.generateBlockTooltips(); ITextComponent tooltip = new TextComponentTranslation("gregtech.multiblock.preview.limit_per_layer", 1).setStyle(new Style().setColor(TextFormatting.DARK_RED)); - ITextComponent inputTooltip = new TextComponentTranslation("gregtech.multiblock.preview.only_location", LocalisationUtils.format("gregtech.multiblock.preview.location.b_c")).setStyle(new Style().setColor(TextFormatting.DARK_RED)); + ITextComponent inputTooltip = new TextComponentTranslation("gregtech.multiblock.preview.only_location", I18n.format("gregtech.multiblock.preview.location.b_c")).setStyle(new Style().setColor(TextFormatting.DARK_RED)); for(int i = 0; i < GTValues.V.length; i++) { addBlockTooltip(MetaTileEntities.FLUID_EXPORT_HATCH[i].getStackForm(), tooltip); diff --git a/src/main/java/gregtech/integration/jei/multiblock/infos/ElectricBlastFurnaceInfo.java b/src/main/java/gregtech/integration/jei/multiblock/infos/ElectricBlastFurnaceInfo.java index c2c7aaf73b..23e35e6ccc 100644 --- a/src/main/java/gregtech/integration/jei/multiblock/infos/ElectricBlastFurnaceInfo.java +++ b/src/main/java/gregtech/integration/jei/multiblock/infos/ElectricBlastFurnaceInfo.java @@ -2,13 +2,13 @@ import gregtech.api.GTValues; import gregtech.api.metatileentity.multiblock.MultiblockControllerBase; -import gregtech.api.util.LocalisationUtils; import gregtech.common.blocks.BlockMetalCasing.MetalCasingType; import gregtech.common.blocks.BlockWireCoil.CoilType; import gregtech.common.blocks.MetaBlocks; import gregtech.common.metatileentities.MetaTileEntities; import gregtech.integration.jei.multiblock.MultiblockInfoPage; import gregtech.integration.jei.multiblock.MultiblockShapeInfo; +import net.minecraft.client.resources.I18n; import net.minecraft.init.Blocks; import net.minecraft.util.EnumFacing; import net.minecraft.util.text.ITextComponent; @@ -54,7 +54,7 @@ public List getMatchingShapes() { @Override public String[] getDescription() { - return new String[]{LocalisationUtils.format("gregtech.multiblock.electric_blast_furnace.description")}; + return new String[]{I18n.format("gregtech.multiblock.electric_blast_furnace.description")}; } @Override diff --git a/src/main/java/gregtech/integration/jei/multiblock/infos/ImplosionCompressorInfo.java b/src/main/java/gregtech/integration/jei/multiblock/infos/ImplosionCompressorInfo.java index 9708526421..1c93a2f106 100644 --- a/src/main/java/gregtech/integration/jei/multiblock/infos/ImplosionCompressorInfo.java +++ b/src/main/java/gregtech/integration/jei/multiblock/infos/ImplosionCompressorInfo.java @@ -3,12 +3,12 @@ import com.google.common.collect.Lists; import gregtech.api.GTValues; import gregtech.api.metatileentity.multiblock.MultiblockControllerBase; -import gregtech.api.util.LocalisationUtils; import gregtech.common.blocks.BlockMetalCasing.MetalCasingType; import gregtech.common.blocks.MetaBlocks; import gregtech.common.metatileentities.MetaTileEntities; import gregtech.integration.jei.multiblock.MultiblockInfoPage; import gregtech.integration.jei.multiblock.MultiblockShapeInfo; +import net.minecraft.client.resources.I18n; import net.minecraft.init.Blocks; import net.minecraft.util.EnumFacing; import net.minecraft.util.text.ITextComponent; @@ -43,7 +43,7 @@ public List getMatchingShapes() { @Override public String[] getDescription() { - return new String[]{LocalisationUtils.format("gregtech.multiblock.implosion_compressor.description")}; + return new String[]{I18n.format("gregtech.multiblock.implosion_compressor.description")}; } @Override diff --git a/src/main/java/gregtech/integration/jei/multiblock/infos/LargeBoilerInfo.java b/src/main/java/gregtech/integration/jei/multiblock/infos/LargeBoilerInfo.java index b7de21c869..1b8979ea75 100644 --- a/src/main/java/gregtech/integration/jei/multiblock/infos/LargeBoilerInfo.java +++ b/src/main/java/gregtech/integration/jei/multiblock/infos/LargeBoilerInfo.java @@ -3,11 +3,11 @@ import com.google.common.collect.Lists; import gregtech.api.GTValues; import gregtech.api.metatileentity.multiblock.MultiblockControllerBase; -import gregtech.api.util.LocalisationUtils; import gregtech.common.metatileentities.MetaTileEntities; import gregtech.common.metatileentities.multi.MetaTileEntityLargeBoiler; import gregtech.integration.jei.multiblock.MultiblockInfoPage; import gregtech.integration.jei.multiblock.MultiblockShapeInfo; +import net.minecraft.client.resources.I18n; import net.minecraft.util.EnumFacing; import java.util.List; @@ -44,7 +44,7 @@ public List getMatchingShapes() { @Override public String[] getDescription() { - return new String[]{LocalisationUtils.format("gregtech.multiblock.large_boiler.description")}; + return new String[]{I18n.format("gregtech.multiblock.large_boiler.description")}; } } diff --git a/src/main/java/gregtech/integration/jei/multiblock/infos/LargeTurbineInfo.java b/src/main/java/gregtech/integration/jei/multiblock/infos/LargeTurbineInfo.java index 2621bb3c77..83dd3f6e73 100644 --- a/src/main/java/gregtech/integration/jei/multiblock/infos/LargeTurbineInfo.java +++ b/src/main/java/gregtech/integration/jei/multiblock/infos/LargeTurbineInfo.java @@ -6,7 +6,6 @@ import gregtech.api.metatileentity.multiblock.MultiblockControllerBase; import gregtech.api.unification.material.Materials; import gregtech.api.util.BlockInfo; -import gregtech.api.util.LocalisationUtils; import gregtech.common.blocks.MetaBlocks; import gregtech.common.items.MetaItems; import gregtech.common.items.behaviors.TurbineRotorBehavior; @@ -15,6 +14,7 @@ import gregtech.common.metatileentities.multi.electric.generator.MetaTileEntityLargeTurbine; import gregtech.integration.jei.multiblock.MultiblockInfoPage; import gregtech.integration.jei.multiblock.MultiblockShapeInfo; +import net.minecraft.client.resources.I18n; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; @@ -63,7 +63,7 @@ public List getMatchingShapes() { @Override public String[] getDescription() { - return new String[]{LocalisationUtils.format("gregtech.multiblock.large_turbine.description")}; + return new String[]{I18n.format("gregtech.multiblock.large_turbine.description")}; } } diff --git a/src/main/java/gregtech/integration/jei/multiblock/infos/MultiSmelterInfo.java b/src/main/java/gregtech/integration/jei/multiblock/infos/MultiSmelterInfo.java index b558cd31c1..6e2aee9b29 100644 --- a/src/main/java/gregtech/integration/jei/multiblock/infos/MultiSmelterInfo.java +++ b/src/main/java/gregtech/integration/jei/multiblock/infos/MultiSmelterInfo.java @@ -2,13 +2,13 @@ import gregtech.api.GTValues; import gregtech.api.metatileentity.multiblock.MultiblockControllerBase; -import gregtech.api.util.LocalisationUtils; import gregtech.common.blocks.BlockMetalCasing.MetalCasingType; import gregtech.common.blocks.BlockWireCoil.CoilType; import gregtech.common.blocks.MetaBlocks; import gregtech.common.metatileentities.MetaTileEntities; import gregtech.integration.jei.multiblock.MultiblockInfoPage; import gregtech.integration.jei.multiblock.MultiblockShapeInfo; +import net.minecraft.client.resources.I18n; import net.minecraft.init.Blocks; import net.minecraft.util.EnumFacing; import net.minecraft.util.text.ITextComponent; @@ -48,7 +48,7 @@ public List getMatchingShapes() { @Override public String[] getDescription() { - return new String[]{LocalisationUtils.format("gregtech.multiblock.multi_smelter.description")}; + return new String[]{I18n.format("gregtech.multiblock.multi_smelter.description")}; } @Override diff --git a/src/main/java/gregtech/integration/jei/multiblock/infos/PrimitiveBlastFurnaceInfo.java b/src/main/java/gregtech/integration/jei/multiblock/infos/PrimitiveBlastFurnaceInfo.java index 0e3600a51a..c289c8904e 100644 --- a/src/main/java/gregtech/integration/jei/multiblock/infos/PrimitiveBlastFurnaceInfo.java +++ b/src/main/java/gregtech/integration/jei/multiblock/infos/PrimitiveBlastFurnaceInfo.java @@ -2,12 +2,12 @@ import com.google.common.collect.Lists; import gregtech.api.metatileentity.multiblock.MultiblockControllerBase; -import gregtech.api.util.LocalisationUtils; import gregtech.common.blocks.BlockMetalCasing.MetalCasingType; import gregtech.common.blocks.MetaBlocks; import gregtech.common.metatileentities.MetaTileEntities; import gregtech.integration.jei.multiblock.MultiblockInfoPage; import gregtech.integration.jei.multiblock.MultiblockShapeInfo; +import net.minecraft.client.resources.I18n; import net.minecraft.init.Blocks; import net.minecraft.util.EnumFacing; @@ -35,7 +35,7 @@ public List getMatchingShapes() { @Override public String[] getDescription() { - return new String[]{LocalisationUtils.format("gregtech.multiblock.primitive_blast_furnace.description")}; + return new String[]{I18n.format("gregtech.multiblock.primitive_blast_furnace.description")}; } } diff --git a/src/main/java/gregtech/integration/jei/multiblock/infos/PyrolyzeOvenInfo.java b/src/main/java/gregtech/integration/jei/multiblock/infos/PyrolyzeOvenInfo.java index 6c5ef1c30d..cdc01a05df 100644 --- a/src/main/java/gregtech/integration/jei/multiblock/infos/PyrolyzeOvenInfo.java +++ b/src/main/java/gregtech/integration/jei/multiblock/infos/PyrolyzeOvenInfo.java @@ -3,13 +3,13 @@ import com.google.common.collect.Lists; import gregtech.api.GTValues; import gregtech.api.metatileentity.multiblock.MultiblockControllerBase; -import gregtech.api.util.LocalisationUtils; import gregtech.common.blocks.BlockMachineCasing; import gregtech.common.blocks.BlockWireCoil; import gregtech.common.blocks.MetaBlocks; import gregtech.common.metatileentities.MetaTileEntities; import gregtech.integration.jei.multiblock.MultiblockInfoPage; import gregtech.integration.jei.multiblock.MultiblockShapeInfo; +import net.minecraft.client.resources.I18n; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; @@ -49,7 +49,7 @@ public List getMatchingShapes() { @Override public String[] getDescription() { - return new String[]{LocalisationUtils.format("gregtech.multiblock.pyrolyze_oven.description")}; + return new String[]{I18n.format("gregtech.multiblock.pyrolyze_oven.description")}; } @Override diff --git a/src/main/java/gregtech/integration/jei/multiblock/infos/VacuumFreezerInfo.java b/src/main/java/gregtech/integration/jei/multiblock/infos/VacuumFreezerInfo.java index 705fd28ec1..f5db52e1b5 100644 --- a/src/main/java/gregtech/integration/jei/multiblock/infos/VacuumFreezerInfo.java +++ b/src/main/java/gregtech/integration/jei/multiblock/infos/VacuumFreezerInfo.java @@ -3,12 +3,12 @@ import com.google.common.collect.Lists; import gregtech.api.GTValues; import gregtech.api.metatileentity.multiblock.MultiblockControllerBase; -import gregtech.api.util.LocalisationUtils; import gregtech.common.blocks.BlockMetalCasing.MetalCasingType; import gregtech.common.blocks.MetaBlocks; import gregtech.common.metatileentities.MetaTileEntities; import gregtech.integration.jei.multiblock.MultiblockInfoPage; import gregtech.integration.jei.multiblock.MultiblockShapeInfo; +import net.minecraft.client.resources.I18n; import net.minecraft.init.Blocks; import net.minecraft.util.EnumFacing; import net.minecraft.util.text.ITextComponent; @@ -45,7 +45,7 @@ public List getMatchingShapes() { @Override public String[] getDescription() { - return new String[]{LocalisationUtils.format("gregtech.multiblock.vacuum_freezer.description")}; + return new String[]{I18n.format("gregtech.multiblock.vacuum_freezer.description")}; } @Override diff --git a/src/main/java/gregtech/integration/jei/recipe/GTRecipeWrapper.java b/src/main/java/gregtech/integration/jei/recipe/GTRecipeWrapper.java index c3d8efa090..062f880915 100644 --- a/src/main/java/gregtech/integration/jei/recipe/GTRecipeWrapper.java +++ b/src/main/java/gregtech/integration/jei/recipe/GTRecipeWrapper.java @@ -7,7 +7,6 @@ import gregtech.api.recipes.recipeproperties.RecipeProperty; import gregtech.api.unification.OreDictUnifier; import gregtech.api.util.ItemStackHashStrategy; -import gregtech.api.util.LocalisationUtils; import gregtech.integration.jei.utils.JEIHelpers; import it.unimi.dsi.fastutil.Hash; import it.unimi.dsi.fastutil.objects.Object2ObjectOpenCustomHashMap; @@ -16,6 +15,7 @@ import mezz.jei.api.ingredients.VanillaTypes; import mezz.jei.api.recipe.IRecipeWrapper; import net.minecraft.client.Minecraft; +import net.minecraft.client.resources.I18n; import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.FluidStack; @@ -124,9 +124,9 @@ public void addTooltip(int slotIndex, boolean input, Object ingredient, List= 0 ? "gregtech.recipe.eu" : "gregtech.recipe.eu_inverted", Math.abs(recipe.getEUt()), JEIHelpers.getMinTierForVoltage(recipe.getEUt())), 0, yPosition += LINE_HEIGHT, 0x111111); - minecraft.fontRenderer.drawString(LocalisationUtils.format("gregtech.recipe.duration", recipe.getDuration() / 20f), 0, yPosition += LINE_HEIGHT, 0x111111); + minecraft.fontRenderer.drawString(I18n.format("gregtech.recipe.total", Math.abs((long) recipe.getEUt()) * recipe.getDuration()), 0, yPosition, 0x111111); + minecraft.fontRenderer.drawString(I18n.format(recipe.getEUt() >= 0 ? "gregtech.recipe.eu" : "gregtech.recipe.eu_inverted", Math.abs(recipe.getEUt()), JEIHelpers.getMinTierForVoltage(recipe.getEUt())), 0, yPosition += LINE_HEIGHT, 0x111111); + minecraft.fontRenderer.drawString(I18n.format("gregtech.recipe.duration", recipe.getDuration() / 20f), 0, yPosition += LINE_HEIGHT, 0x111111); for (Map.Entry, Object> propertyEntry : recipe.getRecipePropertyStorage().getRecipeProperties()) { if(!propertyEntry.getKey().isHidden()) { propertyEntry.getKey().drawInfo(minecraft, 0, yPosition += LINE_HEIGHT, 0x111111, propertyEntry.getValue()); diff --git a/src/main/java/gregtech/integration/jei/recipe/IntCircuitCategory.java b/src/main/java/gregtech/integration/jei/recipe/IntCircuitCategory.java index 5d94a83a78..d687376318 100644 --- a/src/main/java/gregtech/integration/jei/recipe/IntCircuitCategory.java +++ b/src/main/java/gregtech/integration/jei/recipe/IntCircuitCategory.java @@ -4,7 +4,6 @@ import com.google.common.collect.Iterators; import gregtech.api.GTValues; import gregtech.api.recipes.ingredients.IntCircuitIngredient; -import gregtech.api.util.LocalisationUtils; import gregtech.common.items.MetaItems; import gregtech.integration.jei.GTJeiPlugin; import gregtech.integration.jei.utils.render.CompositeDrawable; @@ -24,6 +23,7 @@ import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.vertex.DefaultVertexFormats; +import net.minecraft.client.resources.I18n; import net.minecraft.client.shader.Framebuffer; import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; @@ -110,7 +110,7 @@ public String getUid() { @Override public String getTitle() { - return LocalisationUtils.format("metaitem.circuit.integrated.gui"); + return I18n.format("metaitem.circuit.integrated.gui"); } @Override diff --git a/src/main/java/gregtech/integration/jei/recipe/fuel/GTFuelRecipeWrapper.java b/src/main/java/gregtech/integration/jei/recipe/fuel/GTFuelRecipeWrapper.java index f105c50e29..ad5d1f156b 100644 --- a/src/main/java/gregtech/integration/jei/recipe/fuel/GTFuelRecipeWrapper.java +++ b/src/main/java/gregtech/integration/jei/recipe/fuel/GTFuelRecipeWrapper.java @@ -1,10 +1,10 @@ package gregtech.integration.jei.recipe.fuel; import gregtech.api.recipes.recipes.FuelRecipe; -import gregtech.api.util.LocalisationUtils; import mezz.jei.api.ingredients.IIngredients; import mezz.jei.api.recipe.IRecipeWrapper; import net.minecraft.client.Minecraft; +import net.minecraft.client.resources.I18n; import net.minecraftforge.fluids.FluidStack; public class GTFuelRecipeWrapper implements IRecipeWrapper { @@ -24,8 +24,8 @@ public void getIngredients(IIngredients ingredients) { public void drawInfo(Minecraft minecraft, int recipeWidth, int recipeHeight, int mouseX, int mouseY) { int duration = recipe.getDuration(); long voltage = recipe.getMinVoltage(); - minecraft.fontRenderer.drawString(LocalisationUtils.format("gregtech.recipe.total", voltage * duration), 0, 70, 0x111111); - minecraft.fontRenderer.drawString(LocalisationUtils.format("gregtech.recipe.eu_inverted", voltage), 0, 80, 0x111111); - minecraft.fontRenderer.drawString(LocalisationUtils.format("gregtech.recipe.duration", duration / 20.0), 0, 90, 0x111111); + minecraft.fontRenderer.drawString(I18n.format("gregtech.recipe.total", voltage * duration), 0, 70, 0x111111); + minecraft.fontRenderer.drawString(I18n.format("gregtech.recipe.eu_inverted", voltage), 0, 80, 0x111111); + minecraft.fontRenderer.drawString(I18n.format("gregtech.recipe.duration", duration / 20.0), 0, 90, 0x111111); } } diff --git a/src/main/java/gregtech/integration/jei/recipe/primitive/CokeOvenRecipeWrapper.java b/src/main/java/gregtech/integration/jei/recipe/primitive/CokeOvenRecipeWrapper.java index af019cf427..a8c45f043d 100644 --- a/src/main/java/gregtech/integration/jei/recipe/primitive/CokeOvenRecipeWrapper.java +++ b/src/main/java/gregtech/integration/jei/recipe/primitive/CokeOvenRecipeWrapper.java @@ -12,10 +12,10 @@ import gregtech.api.unification.OreDictUnifier; import gregtech.api.unification.material.Materials; import gregtech.api.unification.ore.OrePrefix; -import gregtech.api.util.LocalisationUtils; import mezz.jei.api.ingredients.IIngredients; import mezz.jei.api.recipe.IRecipeWrapper; import net.minecraft.client.Minecraft; +import net.minecraft.client.resources.I18n; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.FluidStack; @@ -51,7 +51,7 @@ public void getIngredients(IIngredients ingredients) { @Override public void drawInfo(Minecraft minecraft, int recipeWidth, int recipeHeight, int mouseX, int mouseY) { - minecraft.fontRenderer.drawString(LocalisationUtils.format("gregtech.recipe.duration", this.recipe.getDuration() / 20f), 0, 60, 0x111111); + minecraft.fontRenderer.drawString(I18n.format("gregtech.recipe.duration", this.recipe.getDuration() / 20f), 0, 60, 0x111111); } } diff --git a/src/main/java/gregtech/integration/jei/recipe/primitive/OreByProduct.java b/src/main/java/gregtech/integration/jei/recipe/primitive/OreByProduct.java index b542413b15..4fe1af6966 100755 --- a/src/main/java/gregtech/integration/jei/recipe/primitive/OreByProduct.java +++ b/src/main/java/gregtech/integration/jei/recipe/primitive/OreByProduct.java @@ -14,10 +14,10 @@ import gregtech.api.unification.material.type.Material; import gregtech.api.unification.ore.OrePrefix; import gregtech.api.util.GTUtility; -import gregtech.api.util.LocalisationUtils; import mezz.jei.api.ingredients.IIngredients; import mezz.jei.api.recipe.IRecipeWrapper; import net.minecraft.client.Minecraft; +import net.minecraft.client.resources.I18n; import net.minecraft.item.ItemStack; public class OreByProduct implements IRecipeWrapper { @@ -126,7 +126,7 @@ public void addTooltip(int slotIndex, boolean input, Object ingredient, List tooltip, int byproduct, String machine, b Material byProductMaterial = GTUtility.selectItemInList(byproduct, material, material.oreByProducts, DustMaterial.class); if (!result) - tooltip.add(LocalisationUtils.format("gregtech.jei.ore_by_product_from_ore", machine, byProductMaterial.getLocalizedName())); + tooltip.add(I18n.format("gregtech.jei.ore_by_product_from_ore", machine, byProductMaterial.getLocalizedName())); else { String oreType = byproduct == 0 ? oreIngredients.get(0).getDisplayName() : oreProcessingSteps.get(byproduct - 1).getDisplayName(); - tooltip.add(LocalisationUtils.format("gregtech.jei.ore_by_product_from_machine", oreType, machine)); + tooltip.add(I18n.format("gregtech.jei.ore_by_product_from_machine", oreType, machine)); } } diff --git a/src/main/java/gregtech/integration/jei/recipe/primitive/PrimitiveBlastRecipeWrapper.java b/src/main/java/gregtech/integration/jei/recipe/primitive/PrimitiveBlastRecipeWrapper.java index a59aeaedd1..c36490ed09 100644 --- a/src/main/java/gregtech/integration/jei/recipe/primitive/PrimitiveBlastRecipeWrapper.java +++ b/src/main/java/gregtech/integration/jei/recipe/primitive/PrimitiveBlastRecipeWrapper.java @@ -4,11 +4,11 @@ import gregtech.api.recipes.CountableIngredient; import gregtech.api.recipes.recipes.PrimitiveBlastFurnaceRecipe; import gregtech.api.unification.OreDictUnifier; -import gregtech.api.util.LocalisationUtils; import gregtech.common.metatileentities.multi.MetaTileEntityPrimitiveBlastFurnace; import mezz.jei.api.ingredients.IIngredients; import mezz.jei.api.recipe.IRecipeWrapper; import net.minecraft.client.Minecraft; +import net.minecraft.client.resources.I18n; import net.minecraft.item.ItemStack; import java.util.ArrayList; @@ -50,7 +50,7 @@ public void getIngredients(IIngredients ingredients) { @Override public void drawInfo(Minecraft minecraft, int recipeWidth, int recipeHeight, int mouseX, int mouseY) { - minecraft.fontRenderer.drawString(LocalisationUtils.format("gregtech.recipe.duration", this.recipe.getDuration() / 20f), 0, 55, 0x111111); + minecraft.fontRenderer.drawString(I18n.format("gregtech.recipe.duration", this.recipe.getDuration() / 20f), 0, 55, 0x111111); } } diff --git a/src/main/java/gregtech/integration/jei/recipe/primitive/PrimitiveRecipeCategory.java b/src/main/java/gregtech/integration/jei/recipe/primitive/PrimitiveRecipeCategory.java index e89082bb52..03a85cc4ac 100644 --- a/src/main/java/gregtech/integration/jei/recipe/primitive/PrimitiveRecipeCategory.java +++ b/src/main/java/gregtech/integration/jei/recipe/primitive/PrimitiveRecipeCategory.java @@ -1,13 +1,13 @@ package gregtech.integration.jei.recipe.primitive; import gregtech.api.GTValues; -import gregtech.api.util.LocalisationUtils; import mezz.jei.api.IGuiHelper; import mezz.jei.api.gui.IDrawable; import mezz.jei.api.recipe.IRecipeCategory; import mezz.jei.api.recipe.IRecipeWrapper; import mezz.jei.api.recipe.IRecipeWrapperFactory; import net.minecraft.client.Minecraft; +import net.minecraft.client.resources.I18n; import javax.annotation.Nullable; import java.util.Collections; @@ -21,7 +21,7 @@ public abstract class PrimitiveRecipeCategory imple public PrimitiveRecipeCategory(String uniqueName, String localKey, IDrawable background, IGuiHelper guiHelper) { this.uniqueName = uniqueName; - this.localizedName = LocalisationUtils.format(localKey); + this.localizedName = I18n.format(localKey); this.background = background; } diff --git a/src/main/java/gregtech/integration/jei/utils/CustomItemReturnRecipeWrapper.java b/src/main/java/gregtech/integration/jei/utils/CustomItemReturnRecipeWrapper.java index e6a71102d7..738102e257 100644 --- a/src/main/java/gregtech/integration/jei/utils/CustomItemReturnRecipeWrapper.java +++ b/src/main/java/gregtech/integration/jei/utils/CustomItemReturnRecipeWrapper.java @@ -1,6 +1,5 @@ package gregtech.integration.jei.utils; -import gregtech.api.util.LocalisationUtils; import gregtech.loaders.recipe.CustomItemReturnShapedOreRecipeRecipe; import mezz.jei.api.IJeiHelpers; import mezz.jei.api.gui.IGuiItemStackGroup; @@ -13,6 +12,7 @@ import mezz.jei.util.Translator; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiScreen; +import net.minecraft.client.resources.I18n; import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; import net.minecraft.util.text.TextFormatting; @@ -69,7 +69,7 @@ public void setRecipe(IRecipeLayout recipeLayout, IIngredients ingredients) { if (slotIndex != craftOutputSlot) { if (customRecipe.shouldItemReturn(ingredient)) { - tooltip.add(LocalisationUtils.format("gregtech.recipe.not_consumed")); + tooltip.add(I18n.format("gregtech.recipe.not_consumed")); } } }); From d43ef02569f785e450047e3d5417508d1b007522 Mon Sep 17 00:00:00 2001 From: Florian Kostenzer Date: Fri, 30 Jul 2021 16:48:16 +0200 Subject: [PATCH 3/3] Update LocalisationUtils docs --- .../gregtech/api/util/LocalisationUtils.java | 38 ++++++++++++------- 1 file changed, 24 insertions(+), 14 deletions(-) diff --git a/src/main/java/gregtech/api/util/LocalisationUtils.java b/src/main/java/gregtech/api/util/LocalisationUtils.java index 1a420bad87..f448d7d5d3 100644 --- a/src/main/java/gregtech/api/util/LocalisationUtils.java +++ b/src/main/java/gregtech/api/util/LocalisationUtils.java @@ -7,36 +7,46 @@ public class LocalisationUtils { /** * @deprecated - * This function should only be used when localisation is needed on the server. - * Helper function that automatically calls `net.minecraft.client.resources.I18n.format` when called on client + * This function calls `net.minecraft.client.resources.I18n.format` when called on client * or `net.minecraft.util.text.translation.I18n.translateToLocalFormatted` when called on server. - * @param p_format_0_ passed to the underlying format function as first parameter - * @param p_format_1_ passed to the underlying format function as second parameter + *
    + *
  • It is intended that translations should be done using `I18n` on the client.
  • + *
  • For setting up translations on the server you should use `TextComponentTranslatable`.
  • + *
  • `LocalisationUtils` is only for cases where some kind of translation is required on the server and there is no client/player in context.
  • + *
  • `LocalisationUtils` is "best effort" and will probably only work properly with en-us.
  • + *
+ * @param localisationKey the localisation key passed to the underlying format function + * @param substitutions the substitutions passed to the underlying format function * @return the localized string. */ @Deprecated - public static String format(String p_format_0_, Object... p_format_1_) { + public static String format(String localisationKey, Object... substitutions) { if (FMLCommonHandler.instance().getEffectiveSide() == Side.SERVER) { - return net.minecraft.util.text.translation.I18n.translateToLocalFormatted(p_format_0_, p_format_1_); + return net.minecraft.util.text.translation.I18n.translateToLocalFormatted(localisationKey, substitutions); } else { - return net.minecraft.client.resources.I18n.format(p_format_0_, p_format_1_); + return net.minecraft.client.resources.I18n.format(localisationKey, substitutions); } } /** * @deprecated - * This function should only be used when localisation is needed on the server. - * Helper function that automatically calls `net.minecraft.client.resources.I18n.hasKey` when called on client + * This function calls `net.minecraft.client.resources.I18n.hasKey` when called on client * or `net.minecraft.util.text.translation.I18n.canTranslate` when called on server. - * @param p_hasKey_0_ passed to the underlying hasKey function as first parameter - * @return the localized string. + *
    + *
  • It is intended that translations should be done using `I18n` on the client.
  • + *
  • For setting up translations on the server you should use `TextComponentTranslatable`.
  • + *
  • `LocalisationUtils` is only for cases where some kind of translation is required on the server and there is no client/player in context.
  • + *
  • `LocalisationUtils` is "best effort" and will probably only work properly with en-us.
  • + *
+ * @param localisationKey the localisation key passed to the underlying hasKey function + * @return a boolean indicating if the given localisation key has localisations */ @Deprecated - public static boolean hasKey(String p_hasKey_0_) { + public static boolean hasKey(String localisationKey) { if (FMLCommonHandler.instance().getEffectiveSide() == Side.SERVER) { - return net.minecraft.util.text.translation.I18n.canTranslate(p_hasKey_0_); + return net.minecraft.util.text.translation.I18n.canTranslate(localisationKey); } else { - return net.minecraft.client.resources.I18n.hasKey(p_hasKey_0_); + return net.minecraft.client.resources.I18n.hasKey(localisationKey); } }