aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2022-09-08 17:00:49 +0200
committerGitHub <noreply@github.com>2022-09-08 17:00:49 +0200
commitd3805f080af87eb2bc7d2a2eac6c3f8db539324f (patch)
tree2aaf95a14d1cb82096c1c2d675ebe6b7147dab48 /src/main/java/io/github/moulberry/notenoughupdates/miscfeatures
parent827acac6fcf836c1dba5bea338f726694951d18e (diff)
downloadnotenoughupdates-d3805f080af87eb2bc7d2a2eac6c3f8db539324f.tar.gz
notenoughupdates-d3805f080af87eb2bc7d2a2eac6c3f8db539324f.tar.bz2
notenoughupdates-d3805f080af87eb2bc7d2a2eac6c3f8db539324f.zip
0.14 - Finished :) (#233)
Co-authored-by: nopo <noahogno@gmail.com> Co-authored-by: jani270 <69345714+jani270@users.noreply.github.com> Co-authored-by: Ascynx <78341107+Ascynx@users.noreply.github.com> Co-authored-by: NopoTheGamer <40329022+NopoTheGamer@users.noreply.github.com> Co-authored-by: Lulonaut <lulonaut@tutanota.de>
Diffstat (limited to 'src/main/java/io/github/moulberry/notenoughupdates/miscfeatures')
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/AuctionProfit.java6
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/BazaarSacksProfit.java9
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/DamageCommas.java29
3 files changed, 29 insertions, 15 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/AuctionProfit.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/AuctionProfit.java
index e1024eab..88ca0cc8 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/AuctionProfit.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/AuctionProfit.java
@@ -20,8 +20,8 @@
package io.github.moulberry.notenoughupdates.miscfeatures;
import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
+import io.github.moulberry.notenoughupdates.core.util.StringUtils;
import io.github.moulberry.notenoughupdates.mixins.AccessorGuiContainer;
-import io.github.moulberry.notenoughupdates.profileviewer.GuiProfileViewer;
import io.github.moulberry.notenoughupdates.util.Utils;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
@@ -145,10 +145,10 @@ public class AuctionProfit {
String coinsToCollectStr =
EnumChatFormatting.BOLD + EnumChatFormatting.DARK_GRAY.toString() + "Coins to collect: " +
EnumChatFormatting.RESET + EnumChatFormatting.DARK_GREEN + "" +
- GuiProfileViewer.shortNumberFormat(coinsToCollect, 0);
+ StringUtils.shortNumberFormat(coinsToCollect);
String valueIfSoldStr = EnumChatFormatting.BOLD + EnumChatFormatting.DARK_GRAY.toString() + "Value if all sold: " +
EnumChatFormatting.RESET + EnumChatFormatting.DARK_GREEN + "" +
- GuiProfileViewer.shortNumberFormat(coinsIfAllSold, 0);
+ StringUtils.shortNumberFormat(coinsIfAllSold);
fontRendererObj.drawString(coinsToCollectStr, a + 6, guiTop + 32, -1, false);
fontRendererObj.drawString(valueIfSoldStr, a + 6, guiTop + 42, -1, false);
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/BazaarSacksProfit.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/BazaarSacksProfit.java
index 084fd03f..7007f39b 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/BazaarSacksProfit.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/BazaarSacksProfit.java
@@ -68,7 +68,7 @@ public class BazaarSacksProfit {
@SubscribeEvent(priority = EventPriority.LOW)
public void onItemTooltipLow(ItemTooltipEvent event) {
- if (!NotEnoughUpdates.INSTANCE.config.tooltipTweaks.bazaarSacksProfit) return;
+ if (!NotEnoughUpdates.INSTANCE.config.bazaarTweaks.bazaarSacksProfit) return;
if (!inBazaar()) return;
ItemStack itemStack = event.itemStack;
@@ -89,6 +89,11 @@ public class BazaarSacksProfit {
out:
for (String line : ItemUtils.getLore(itemStack)) {
+
+ if (line.equals("§8Loading...")) {
+ dirty = true;
+ return;
+ }
if (line.contains("§7x ")) {
String[] split = line.split("§7x ");
String rawAmount = StringUtils.cleanColour(split[0]).replace(",", "").substring(1);
@@ -108,7 +113,7 @@ public class BazaarSacksProfit {
}
}
}
- System.out.println("no bazaar item in repo found for '" + bazaarName + "'");
+ System.err.println("no bazaar item in repo found for '" + bazaarName + "'");
invalidNames.add(bazaarName);
}
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/DamageCommas.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/DamageCommas.java
index 127edcde..b1ab11c1 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/DamageCommas.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/DamageCommas.java
@@ -45,15 +45,18 @@ public class DamageCommas {
};
private static final char STAR = '\u2727';
+ private static final char OVERLOAD_STAR = '\u272F';
private static final Pattern PATTERN_CRIT = Pattern.compile(
- "\u00a7f" + STAR + "((?:\u00a7.\\d)+)\u00a7." + STAR + "(.*)");
- private static final Pattern PATTERN_NO_CRIT = Pattern.compile("\u00a77(\\d+)(.*)");
+ "\u00a7f" + STAR + "((?:\u00a7.\\d(?:§.,)?)+)\u00a7." + STAR + "(.*)");
+ private static final Pattern PATTERN_NO_CRIT = Pattern.compile("(\u00a7.)([\\d+,]*)(.*)");
+ private static final Pattern OVERLOAD_PATTERN = Pattern.compile("(\u00a7.)" + OVERLOAD_STAR + "((?:\u00a7.[\\d,])+)(\u00a7.)" + OVERLOAD_STAR + "\u00a7r");
public static IChatComponent replaceName(EntityLivingBase entity) {
if (!entity.hasCustomName()) return entity.getDisplayName();
IChatComponent name = entity.getDisplayName();
- if (NotEnoughUpdates.INSTANCE.config.misc.damageIndicatorStyle == 0) return name;
+ if (!NotEnoughUpdates.INSTANCE.config.misc.damageIndicatorStyle2) return name;
+ if (!NotEnoughUpdates.INSTANCE.hasSkyblockScoreboard()) return name;
if (replacementMap.containsKey(entity)) {
ChatComponentText component = replacementMap.get(entity);
@@ -69,17 +72,23 @@ public class DamageCommas {
String suffix;
Matcher matcherCrit = PATTERN_CRIT.matcher(formatted);
+ Matcher matcherOverload = OVERLOAD_PATTERN.matcher(formatted);
if (matcherCrit.matches()) {
crit = true;
- numbers = StringUtils.cleanColour(matcherCrit.group(1));
+ numbers = StringUtils.cleanColour(matcherCrit.group(1)).replace(",", "");
prefix = "\u00a7f" + STAR;
suffix = "\u00a7f" + STAR + matcherCrit.group(2);
- } else {
+ } else if (matcherOverload.matches()) {
+ crit = true;
+ numbers = StringUtils.cleanColour(matcherOverload.group(2)).replace(",", "");
+ prefix = matcherOverload.group(1) + OVERLOAD_STAR;
+ suffix = matcherOverload.group(3) + OVERLOAD_STAR + "\u00a7r";
+ } else {
Matcher matcherNoCrit = PATTERN_NO_CRIT.matcher(formatted);
if (matcherNoCrit.matches()) {
- numbers = matcherNoCrit.group(1);
- prefix = "\u00A77";
- suffix = "\u00A7r" + matcherNoCrit.group(2);
+ numbers = matcherNoCrit.group(2).replace(",", "");
+ prefix = matcherNoCrit.group(1);
+ suffix = "\u00A7r" + matcherNoCrit.group(3);
} else {
replacementMap.put(entity, null);
return name;
@@ -91,10 +100,10 @@ public class DamageCommas {
try {
int number = Integer.parseInt(numbers);
- if (number > 999 && NotEnoughUpdates.INSTANCE.config.misc.damageIndicatorStyle == 2) {
+ if (number > 999) {
newFormatted.append(Utils.shortNumberFormat(number, 0));
} else {
- newFormatted.append(NumberFormat.getIntegerInstance().format(number));
+ return name;
}
} catch (NumberFormatException e) {
replacementMap.put(entity, null);