Skip to content

Commit

Permalink
Comma-tize the TOP/WAILA/HWYLA energy container display (#2597)
Browse files Browse the repository at this point in the history
  • Loading branch information
Zorbatron authored Oct 4, 2024
1 parent ec182a9 commit 3bc2560
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import gregtech.api.GTValues;
import gregtech.api.capability.GregtechCapabilities;
import gregtech.api.capability.IEnergyContainer;
import gregtech.api.util.TextFormattingUtil;

import net.minecraft.client.resources.I18n;
import net.minecraft.item.ItemStack;
Expand Down Expand Up @@ -59,7 +60,9 @@ public List<String> getWailaBody(ItemStack itemStack, List<String> tooltip, IWai
NBTTagCompound energyTag = accessor.getNBTData().getCompoundTag("gregtech.IEnergyContainer");
long stored = energyTag.getLong("Stored");
long capacity = energyTag.getLong("Capacity");
tooltip.add(I18n.format("gregtech.waila.energy_stored", stored, capacity));
tooltip.add(I18n.format("gregtech.waila.energy_stored",
TextFormattingUtil.formatNumbers(stored),
TextFormattingUtil.formatNumbers(capacity)));
}
return tooltip;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,11 @@ protected void addProbeInfo(@NotNull IEnergyContainer capability, @NotNull IProb
long stored = capability.getEnergyStored();
if (maxStorage == 0) return; // do not add empty max storage progress bar
probeInfo.progress(capability.getEnergyStored(), maxStorage, probeInfo.defaultProgressStyle()
.numberFormat(player.isSneaking() || stored < 10000 ? NumberFormat.FULL : NumberFormat.COMPACT)
.suffix(" / " + (player.isSneaking() || maxStorage < 10000 ? maxStorage + " EU" :
.numberFormat(player.isSneaking() || stored < 10000 ?
NumberFormat.COMMAS :
NumberFormat.COMPACT)
.suffix(" / " + (player.isSneaking() || maxStorage < 10000 ?
ElementProgress.format(maxStorage, NumberFormat.COMMAS, " EU") :
ElementProgress.format(maxStorage, NumberFormat.COMPACT, "EU")))
.filledColor(0xFFEEE600)
.alternateFilledColor(0xFFEEE600)
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/assets/gregtech/lang/en_us.lang
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ option.gregtech.steam_boiler=Steam Boilers
option.gregtech.transformer=Transformers
option.gregtech.workable=Workable Machines

gregtech.waila.energy_stored=Energy: %d EU / %d EU
gregtech.waila.energy_stored=Energy: %s EU / %s EU
gregtech.waila.progress_idle=Idle
gregtech.waila.progress_tick=Progress: %d t / %d t
gregtech.waila.progress_sec=Progress: %d s / %d s
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/assets/gregtech/lang/ja_jp.lang
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ gregtech.top.ld_pipe_output=搬出
gregtech.top.ld_pipe_input_endpoint=搬入口:
gregtech.top.ld_pipe_output_endpoint=搬出口:

gregtech.waila.energy_stored=エネルギー: %d EU / %d EU
gregtech.waila.energy_stored=エネルギー: %s EU / %s EU
gregtech.waila.progress_idle=停止中
gregtech.waila.progress_tick=進捗: %d t / %d t
gregtech.waila.progress_sec=進捗: %d s / %d s
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/assets/gregtech/lang/ru_ru.lang
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ gregtech.top.ld_pipe_input=Ввод
gregtech.top.ld_pipe_output=Вывод
gregtech.top.ld_pipe_input_endpoint=Входная конечная точка:
gregtech.top.ld_pipe_output_endpoint=Выходная конечная точка:
gregtech.waila.energy_stored=Энергия: %d EU / %d EU
gregtech.waila.energy_stored=Энергия: %s EU / %s EU
gregtech.waila.progress_idle=Простой
gregtech.waila.progress_tick=Прогресс: %d t / %d t
gregtech.waila.progress_sec=Прогресс: %d s / %d s
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/assets/gregtech/lang/zh_cn.lang
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ option.gregtech.steam_boiler=蒸汽锅炉
option.gregtech.transformer=变压器
option.gregtech.workable=机器工作状态

gregtech.waila.energy_stored=能量:%d EU / %d EU
gregtech.waila.energy_stored=能量:%s EU / %s EU
gregtech.waila.progress_idle=闲置
gregtech.waila.progress_tick=进度:%d t / %d t
gregtech.waila.progress_sec=进度:%d s / %d s
Expand Down

0 comments on commit 3bc2560

Please sign in to comment.