mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-26 08:48:34 +01:00
Added digit separators for large numbers, closes #305
This commit is contained in:
parent
7a69273865
commit
f8f7940839
3 changed files with 12 additions and 3 deletions
|
@ -22,6 +22,7 @@ import net.minecraft.nbt.NBTTagCompound;
|
|||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraftforge.fml.client.config.GuiUtils;
|
||||
|
||||
import java.text.NumberFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
@ -102,7 +103,8 @@ public class EnergyDisplay extends Gui{
|
|||
}
|
||||
|
||||
private String getOverlayText(){
|
||||
return this.rfReference.getEnergyStored()+"/"+this.rfReference.getMaxEnergyStored()+(this.displayTesla ? " T" : " RF");
|
||||
NumberFormat format = NumberFormat.getInstance();
|
||||
return format.format(this.rfReference.getEnergyStored())+"/"+format.format(this.rfReference.getMaxEnergyStored())+(this.displayTesla ? " T" : " RF");
|
||||
}
|
||||
|
||||
private void changeDisplayMode(){
|
||||
|
|
|
@ -21,6 +21,7 @@ import net.minecraftforge.fluids.FluidStack;
|
|||
import net.minecraftforge.fluids.FluidTank;
|
||||
import net.minecraftforge.fml.client.config.GuiUtils;
|
||||
|
||||
import java.text.NumberFormat;
|
||||
import java.util.Collections;
|
||||
|
||||
public class FluidDisplay extends Gui{
|
||||
|
@ -103,7 +104,9 @@ public class FluidDisplay extends Gui{
|
|||
}
|
||||
|
||||
private String getOverlayText(){
|
||||
NumberFormat format = NumberFormat.getInstance();
|
||||
FluidStack stack = this.fluidReference.getFluid();
|
||||
return stack == null || stack.getFluid() == null ? "0/"+this.fluidReference.getCapacity()+" mB" : this.fluidReference.getFluidAmount()+"/"+this.fluidReference.getCapacity()+" mB "+stack.getLocalizedName();
|
||||
String cap = format.format(this.fluidReference.getCapacity());
|
||||
return stack == null || stack.getFluid() == null ? "0/"+cap+" mB" : format.format(this.fluidReference.getFluidAmount())+"/"+cap+" mB "+stack.getLocalizedName();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,6 +12,7 @@ package de.ellpeck.actuallyadditions.mod.items.base;
|
|||
|
||||
import cofh.api.energy.ItemEnergyContainer;
|
||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||
import de.ellpeck.actuallyadditions.mod.data.PlayerData;
|
||||
import de.ellpeck.actuallyadditions.mod.util.ItemUtil;
|
||||
import de.ellpeck.actuallyadditions.mod.util.compat.ItemTeslaWrapper;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
|
@ -24,6 +25,7 @@ import net.minecraftforge.common.capabilities.ICapabilityProvider;
|
|||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import java.text.NumberFormat;
|
||||
import java.util.List;
|
||||
|
||||
public abstract class ItemEnergy extends ItemEnergyContainer{
|
||||
|
@ -64,7 +66,9 @@ public abstract class ItemEnergy extends ItemEnergyContainer{
|
|||
|
||||
@Override
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean bool){
|
||||
list.add(this.getEnergyStored(stack)+"/"+this.getMaxEnergyStored(stack)+" RF");
|
||||
NumberFormat format = NumberFormat.getInstance();
|
||||
boolean tesla = PlayerData.getDataFromPlayer(player).theCompound.getBoolean("DisplayTesla");
|
||||
list.add(format.format(this.getEnergyStored(stack))+"/"+format.format(this.getMaxEnergyStored(stack))+(tesla ? " T" : " RF"));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in a new issue