Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -528,10 +528,10 @@ public void run() {
EnumChatFormatting moneyPrefix = money>50*1000*1000?
(money>200*1000*1000?EnumChatFormatting.GREEN:EnumChatFormatting.YELLOW):EnumChatFormatting.RED;
Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(
g+"Purse: "+moneyPrefix+Utils.shortNumberFormat(purseBalance, 0) + g+" - Bank: " +
g+"Purse: "+moneyPrefix+Utils.shortNumberFormat(purseBalance) + g+" - Bank: " +
(bankBalance == -1 ? EnumChatFormatting.YELLOW+"N/A" : moneyPrefix+
(isMe?"4.8b":Utils.shortNumberFormat(bankBalance, 0))) +
(networth > 0 ? g+" - Net: "+moneyPrefix+Utils.shortNumberFormat(networth, 0) : "")));
(isMe?"4.8b":Utils.shortNumberFormat(bankBalance))) +
(networth > 0 ? g+" - Net: "+moneyPrefix+Utils.shortNumberFormat(networth, 2) : "")));

overallScore += Math.min(2, money/(100f*1000*1000));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,14 +148,14 @@ public void render() {

String lowestPriceStr;
if(lowestPrice > 999) {
lowestPriceStr = Utils.shortNumberFormat(lowestPrice, 0);
lowestPriceStr = Utils.shortNumberFormat(lowestPrice);
} else {
lowestPriceStr = ""+lowestPrice;
}

String sellingPriceStr;
if(sellingPrice > 999) {
sellingPriceStr = Utils.shortNumberFormat(sellingPrice, 0);
sellingPriceStr = Utils.shortNumberFormat(sellingPrice);
} else {
sellingPriceStr = ""+sellingPrice;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public static IChatComponent replaceName(EntityLivingBase entity) {
int number = Integer.parseInt(numbers);

if(number > 999 && NotEnoughUpdates.INSTANCE.config.misc.damageIndicatorStyle == 2) {
newFormatted.append(Utils.shortNumberFormat(number, 0));
newFormatted.append(Utils.shortNumberFormat(number, 2));
} else {
newFormatted.append(NumberFormat.getIntegerInstance().format(number));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -357,8 +357,8 @@ private List<String> createStringsForPet(Pet currentPet, boolean secondPet) {
roundFloat(currentPet.petLevel.currentLevelRequirement)
+ EnumChatFormatting.YELLOW + " (" + getLevelPercent(currentPet) + "%)";

String lvlString = EnumChatFormatting.AQUA + "" + Utils.shortNumberFormat(levelXp, 0) + "/" +
Utils.shortNumberFormat(currentPet.petLevel.currentLevelRequirement, 0)
String lvlString = EnumChatFormatting.AQUA + "" + Utils.shortNumberFormat(levelXp) + "/" +
Utils.shortNumberFormat(currentPet.petLevel.currentLevelRequirement)
+ EnumChatFormatting.YELLOW + " (" + getLevelPercent(currentPet) + "%)";

float xpGain;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -255,15 +255,15 @@ public static String chromaString(String str, float offset, boolean bold) {
return rainbowText.toString();
}

private static char[] c = new char[]{'k', 'm', 'b', 't'};
public static String shortNumberFormat(double n, int iteration) {
double d = ((long) n / 100) / 10.0;
boolean isRound = (d * 10) %10 == 0;
return (d < 1000?
((d > 99.9 || isRound || (!isRound && d > 9.99)?
(int) d * 10 / 10 : d + ""
) + "" + c[iteration])
: shortNumberFormat(d, iteration+1));
private static char[] c = new char[]{'k', 'M', 'B', 't', 'q', 'Q', 's', 'S'};
public static String shortNumberFormat(double n, int dp) {
int pow1k = (int) Math.floor(Math.log(n) / Math.log(1000));
if (pow1k == 0 || pow1k > 8) {return String.valueOf(n);}
double mantissa = n / (Math.pow(1000, pow1k));
return (String.format("%." + dp + "f", mantissa) + c[pow1k - 1]);
}
public static String shortNumberFormat(double n) {
return shortNumberFormat(n, 1);
}

public static String trimIgnoreColour(String str) {
Expand Down