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 @@ -22,10 +22,7 @@
import codes.biscuit.skyblockaddons.misc.scheduler.NewScheduler;
import codes.biscuit.skyblockaddons.misc.scheduler.Scheduler;
import codes.biscuit.skyblockaddons.newgui.GuiManager;
import codes.biscuit.skyblockaddons.utils.EnumUtils;
import codes.biscuit.skyblockaddons.utils.InventoryUtils;
import codes.biscuit.skyblockaddons.utils.SkyblockAddonsMessageFactory;
import codes.biscuit.skyblockaddons.utils.Utils;
import codes.biscuit.skyblockaddons.utils.*;
import codes.biscuit.skyblockaddons.utils.data.DataUtils;
import codes.biscuit.skyblockaddons.utils.gson.GsonInitializableTypeAdapter;
import codes.biscuit.skyblockaddons.utils.gson.PatternAdapter;
Expand Down Expand Up @@ -191,6 +188,10 @@ public void init(FMLInitializationEvent e) {
usingLabymod = utils.isModLoaded("labymod");
usingOofModv1 = utils.isModLoaded("refractionoof", "1.0");
usingPatcher = utils.isModLoaded("patcher");

if (!this.configValues.isEnabled(Feature.NUMBER_SEPARATORS)) {
TextUtils.NUMBER_FORMAT.setGroupingUsed(false);
}
}

@Mod.EventHandler
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -515,7 +515,6 @@ private <E extends Enum<?>, F extends Enum<?>> void deserializeEnumEnumMapFromID
}
}

@SuppressWarnings("unchecked")
private <E extends Enum<?>, N extends Number> void deserializeEnumNumberMapFromID(Map<E, N> map, String path, Class<E> keyClass, Class<N> numberClass) {
deserializeEnumNumberMapFromID(loadedConfig, map, path, keyClass, numberClass);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,11 +213,13 @@ public enum Feature {
SHOW_SKYBLOCK_ITEM_ID(213, "settings.showSkyblockItemId", null, true),
RESET_SALVAGED_ESSENCES_AFTER_LEAVING_MENU(214, "settings.resetSalvagedEssencesAfterLeavingMenu", null, false),
CHANGE_DUNGEON_MAP_ZOOM_WITH_KEYBOARD(215, "settings.changeDungeonMapZoomWithKeyboard", null, false),
// Release 1.7
PLAYER_SYMBOLS_IN_CHAT(216, "settings.showPlayerSymbolsInChat", null, false, EnumUtils.FeatureSetting.SHOW_PROFILE_TYPE, EnumUtils.FeatureSetting.SHOW_NETHER_FACTION),
CRIMSON_ARMOR_ABILITY_STACKS(217, "settings.crimsonArmorAbilityStacks", new GuiFeatureData(EnumUtils.DrawType.TEXT, ColorCode.GOLD), false),
HIDE_TRUE_DEFENSE(218, "settings.hideTrueDefense", new GuiFeatureData(ColorCode.RED), false),
SHOW_PROFILE_TYPE(219, "settings.showProfileType", false),
SHOW_NETHER_FACTION(220,"settings.showNetherFaction", false),
NUMBER_SEPARATORS(221, "settings.numberSeparators", null, false),

WARNING_TIME(-1, "settings.warningDuration", null, false),
WARP_ADVANCED_MODE(-1, "settings.advancedMode", null, true),
Expand Down Expand Up @@ -285,7 +287,7 @@ public enum Feature {
*/
@Getter
private static final Set<Feature> generalTabFeatures = new LinkedHashSet<>(Arrays.asList(TEXT_STYLE, WARNING_TIME, CHROMA_SPEED, CHROMA_MODE,
CHROMA_SIZE, TURN_ALL_FEATURES_CHROMA, CHROMA_SATURATION, CHROMA_BRIGHTNESS, USE_NEW_CHROMA_EFFECT, DEVELOPER_MODE));
CHROMA_SIZE, TURN_ALL_FEATURES_CHROMA, CHROMA_SATURATION, CHROMA_BRIGHTNESS, USE_NEW_CHROMA_EFFECT, NUMBER_SEPARATORS, DEVELOPER_MODE));

private static final int ID_AT_PREVIOUS_UPDATE = 199;

Expand Down Expand Up @@ -315,7 +317,7 @@ public enum Feature {
}

/**
* Called when a features enable state is changed.
* Called right after a feature's enable state is changed.
*/
public void onToggle() {
if (this.id == DEVELOPER_MODE.id) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import codes.biscuit.skyblockaddons.utils.TextUtils;

import java.text.DecimalFormat;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

Expand Down Expand Up @@ -120,7 +119,7 @@ public String toString() {
monthName,
DAY + TextUtils.getOrdinalSuffix(DAY),
HOUR,
TextUtils.NUMBER_FORMAT.format(MINUTE),
TextUtils.formatNumber(MINUTE),
PERIOD);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
*/
public class DungeonManager {

private static final Pattern PATTERN_MILESTONE = Pattern.compile("^.+?(Healer|Tank|Mage|Archer|Berserk) Milestone .+?([❶-❿]).+?§r§.(\\d+)§.§7 .+?");
private static final Pattern PATTERN_MILESTONE = Pattern.compile("^.+?(Healer|Tank|Mage|Archer|Berserk) Milestone .+?([❶-❿]).+?§r§.([\\d,.]+)§.§7 .+?");
private static final Pattern PATTERN_COLLECTED_ESSENCES = Pattern.compile("§.+?(\\d+) (Wither|Spider|Undead|Dragon|Gold|Diamond|Ice) Essence");
private static final Pattern PATTERN_BONUS_ESSENCE = Pattern.compile("^§.+?[^You] .+?found a .+?(Wither|Spider|Undead|Dragon|Gold|Diamond|Ice) Essence.+?");
private static final Pattern PATTERN_SALVAGE_ESSENCES = Pattern.compile("\\+(?<essenceNum>[0-9]+) (?<essenceType>Wither|Spider|Undead|Dragon|Gold|Diamond|Ice) Essence!");
Expand All @@ -42,7 +42,7 @@ public class DungeonManager {

/**
* Represents the number of essences from salvaged items by the player.
*
* <p>
* It's in a separate map to avoid conflict with the collected map.
*/
@Getter private final Map<EssenceType, Integer> salvagedEssences = new EnumMap<>(EssenceType.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

/**
* Statuses that are shown on the Discord RPC feature
*
* <p>
* This file has LF line endings because ForgeGradle is weird and will throw a NullPointerException if it's CRLF.
*/
public enum DiscordStatus implements ButtonSelect.SelectItem {
Expand All @@ -36,9 +36,9 @@ public enum DiscordStatus implements ButtonSelect.SelectItem {
String coinString = " Coin";

if (coins == 1) {
return TextUtils.formatDouble(coins) + coinString;
return TextUtils.formatNumber(coins) + coinString;
} else {
return TextUtils.formatDouble(coins) + coinString + 's';
return TextUtils.formatNumber(coins) + coinString + 's';
}
}),

Expand All @@ -48,9 +48,9 @@ public enum DiscordStatus implements ButtonSelect.SelectItem {
String bitString = " Bit";

if (bits == 1) {
return TextUtils.formatDouble(bits) + bitString;
return TextUtils.formatNumber(bits) + bitString;
} else {
return TextUtils.formatDouble(bits) + bitString + 's';
return TextUtils.formatNumber(bits) + bitString + 's';
}
}),

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@ public class DungeonMapManager {
/** The factor the player's coordinates are multiplied by to calculate their map marker coordinates */
private static final float COORDINATE_FACTOR = 1.33F;

/** {@link EntityPlayerSP#lastReportedPosX} */
/** {@code EntityPlayerSP#lastReportedPosX} */
static final Field lastReportedPosX;
/** {@link EntityPlayerSP#lastReportedPosZ} */
/** {@code EntityPlayerSP#lastReportedPosZ} */
static final Field lastReportedPosZ;

private static MapData mapData;
Expand Down Expand Up @@ -505,16 +505,16 @@ public static void decreaseZoomByStep() {
}

/**
* Returns the map zoom factor from {@link codes.biscuit.skyblockaddons.config.ConfigValues#mapZoom}.
* Returns the map zoom factor from {@code codes.biscuit.skyblockaddons.config.ConfigValues#mapZoom}.
*
* @return the map zoom factor from {@link codes.biscuit.skyblockaddons.config.ConfigValues#mapZoom}
* @return the map zoom factor from {@code codes.biscuit.skyblockaddons.config.ConfigValues#mapZoom}
*/
public static float getMapZoom() {
return main.getConfigValues().getMapZoom().getValue();
}

/**
* Sets the map zoom factor in {@link codes.biscuit.skyblockaddons.config.ConfigValues#mapZoom}.
* Sets the map zoom factor in {@code codes.biscuit.skyblockaddons.config.ConfigValues#mapZoom}.
* The new value must be between 0.5f and 5f inclusive.
*
* @param value the new map zoom factor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
*
* This class allows us to approximate the trail of fish particles made by a fish converging to the player's bobber.
* To do this, we use a variant on the Bellman Ford algorithm, as well as the exponentiation-by-squaring algorithm
*
* <p>
* In general, we wish to identify those splash particles that belong to a fish converging on the player's bobber.
* Notice several identifying features of these converging particles:
* 1) Particles spawn at a radial distance from the cast hook.
Expand All @@ -25,15 +25,15 @@
* 3 standard distributions (12 degrees)
* 3) Sequential particles approaching the hook generally come in every tick, but we can allow for 2 or 3 ticks
* 4) Particles will not spawn farther than 8 blocks away from the cast hook
*
* <p>
* (These are mostly discoverable in the EntityFishHook.java file. Hopefully, my making this algorithm won't cause servers to go ballistic...)
*
* <p>
* Consideration of time complexity is a huge part of the algorithm.
* It is an O(n^2) algorithm, which for a large number of particles is unsustainable.
* Each tick only gives us 50 milliseconds to compute stuff, so we're using bitwise operations.
* Unfortunately, the longest primitive is 64 bits, so we're limited to tracking 64 particles at the moment.
* This means when 10+ fishers are in the same spot, we may not be able to link the particles before we overwrite with new ones.
*
* <p>
* Processing the per-particle step takes <.025 milliseconds and the per-tick step generally takes <.050 milliseconds
* So we are well below any critical thresholds for computation time.
*
Expand Down Expand Up @@ -187,7 +187,7 @@ else if (hook != null) {
* Find a few (i.e. a "trail" of) particles that each meet the criteria for the subsequent particle in the trail
* E.g. we find a trail 1 -> 5 -> 6 -> 10 (particle 1 meets the criteria for 5, 5 meets the criteria for 6, and so on)
* Finding the trail of length n is found by computing M^n, where M is the pairwise matchings for each particle combination
*
* <p>
* Given the particle trail, spawn a distinct particle (lava drip) at the most recently spawned particle in the particle trail.
*/
private static void calculateTrails() {
Expand Down Expand Up @@ -249,7 +249,7 @@ public static void clearParticleCache() {

/**
* Performs a bitwise square of a matrix
*
* <p>
* Saves the resulting matrix to result in row form
* @param result saved result of the matrix squaring
* @param rows input 64 x 64 bit matrix
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
import java.awt.*;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.text.DecimalFormat;
import java.text.ParseException;
import java.util.List;
import java.util.*;

Expand Down Expand Up @@ -315,7 +315,7 @@ private void renderWarnings(ScaledResolution scaledResolution) {
break;
case NO_ARROWS_LEFT_ALERT:
if (arrowsLeft != -1) {
Translations.getMessage("messages.noArrowsLeft", TextUtils.NUMBER_FORMAT.format(arrowsLeft));
Translations.getMessage("messages.noArrowsLeft", TextUtils.formatNumber(arrowsLeft));
}
break;
}
Expand Down Expand Up @@ -674,22 +674,23 @@ public void drawText(Feature feature, float scale, Minecraft mc, ButtonLocation
String text;
int color = main.getConfigValues().getColor(feature);
if (feature == Feature.MANA_TEXT) {
text = NUMBER_FORMAT.format(getAttribute(Attribute.MANA)) + "/" + NUMBER_FORMAT.format(getAttribute(Attribute.MAX_MANA));
text = TextUtils.formatNumber(getAttribute(Attribute.MANA)) + "/" + TextUtils.formatNumber(getAttribute(Attribute.MAX_MANA));

} else if (feature == Feature.OVERFLOW_MANA) {
if (getAttribute(Attribute.OVERFLOW_MANA) != 0 || buttonLocation != null) {
text = getAttribute(Attribute.OVERFLOW_MANA) + "ʬ";
text = TextUtils.formatNumber(getAttribute(Attribute.OVERFLOW_MANA)) + "ʬ";
} else {
return;
}
} else if (feature == Feature.HEALTH_TEXT) {
text = NUMBER_FORMAT.format(getAttribute(Attribute.HEALTH)) + "/" + NUMBER_FORMAT.format(getAttribute(Attribute.MAX_HEALTH));
text = TextUtils.formatNumber(getAttribute(Attribute.HEALTH)) + "/" + TextUtils.formatNumber(getAttribute(Attribute.MAX_HEALTH));

} else if (feature == Feature.CRIMSON_ARMOR_ABILITY_STACKS) {
text = getCrimsonArmorAbilityStacks();
if (text == null) return;

} else if (feature == Feature.DEFENCE_TEXT) {
text = NUMBER_FORMAT.format(getAttribute(Attribute.DEFENCE));
text = TextUtils.formatNumber(getAttribute(Attribute.DEFENCE));

} else if (feature == Feature.OTHER_DEFENCE_STATS) {
text = main.getPlayerListener().getActionBarParser().getOtherDefense();
Expand All @@ -701,7 +702,7 @@ public void drawText(Feature feature, float scale, Minecraft mc, ButtonLocation
}

} else if (feature == Feature.EFFECTIVE_HEALTH_TEXT) {
text = NUMBER_FORMAT.format(Math.round(getAttribute(Attribute.HEALTH) * (1 + getAttribute(Attribute.DEFENCE) / 100F)));
text = TextUtils.formatNumber(Math.round(getAttribute(Attribute.HEALTH) * (1 + getAttribute(Attribute.DEFENCE) / 100F)));

} else if (feature == Feature.DRILL_FUEL_TEXT) {
if (!ItemUtils.isDrill(mc.thePlayer.getHeldItem())) {
Expand All @@ -715,7 +716,7 @@ public void drawText(Feature feature, float scale, Minecraft mc, ButtonLocation
text = bigDecimal + "%";

} else if (feature == Feature.SPEED_PERCENTAGE) {
String walkSpeed = NUMBER_FORMAT.format(Minecraft.getMinecraft().thePlayer.capabilities.getWalkSpeed() * 1000);
String walkSpeed = TextUtils.formatNumber(Minecraft.getMinecraft().thePlayer.capabilities.getWalkSpeed() * 1000);
text = walkSpeed.substring(0, Math.min(walkSpeed.length(), 3));

if (text.endsWith(".")) text = text.substring(0, text.indexOf('.')); //remove trailing periods
Expand All @@ -727,7 +728,7 @@ public void drawText(Feature feature, float scale, Minecraft mc, ButtonLocation
if (buttonLocation == null) {
if (healthUpdate != null) {
color = healthUpdate > 0 ? ColorCode.GREEN.getColor() : ColorCode.RED.getColor();
text = (healthUpdate > 0 ? "+" : "-") + NUMBER_FORMAT.format(Math.abs(healthUpdate));
text = (healthUpdate > 0 ? "+" : "-") + TextUtils.formatNumber(Math.abs(healthUpdate));
} else {
return;
}
Expand Down Expand Up @@ -1176,10 +1177,15 @@ public void drawText(Feature feature, float scale, Minecraft mc, ButtonLocation
renderItem(dungeonMilestone.getDungeonClass().getItem(), x, y);
FontRendererHook.setupFeatureFont(feature);
DrawUtils.drawText(text, x + 18, y, color);
double amount = Double.parseDouble(dungeonMilestone.getValue());
DecimalFormat formatter = new DecimalFormat("#,###");
DrawUtils.drawText(formatter.format(amount), x + 18 + mc.fontRendererObj.getStringWidth(text) / 2F
- mc.fontRendererObj.getStringWidth(formatter.format(amount)) / 2F, y + 9, color);
Number amount;
try {
amount = NUMBER_FORMAT.parse(dungeonMilestone.getValue());
} catch (ParseException e) {
amount = -1;
}
String formattedAmount = TextUtils.formatNumber(amount);
DrawUtils.drawText(formattedAmount, x + 18 + mc.fontRendererObj.getStringWidth(text) / 2F
- mc.fontRendererObj.getStringWidth(formattedAmount) / 2F, y + 9, color);
FontRendererHook.endFeatureFont();

} else if (feature == Feature.DUNGEONS_COLLECTED_ESSENCES_DISPLAY) {
Expand Down Expand Up @@ -2231,18 +2237,18 @@ private void drawDetailedPowerOrbStatus(Minecraft mc, float scale, ButtonLocatio
double healIncrease = powerOrb.getHealIncrease() * 100;

List<String> display = new LinkedList<>();
display.add(String.format("§c+%s ❤/s", TextUtils.formatDouble(healthRegen)));
display.add(String.format("§c+%s ❤/s", TextUtils.formatNumber(healthRegen)));
if (powerOrb.getManaRegen() > 0) {
float maxMana = main.getUtils().getAttributes().get(Attribute.MAX_MANA).getValue();
float manaRegen = (float) Math.floor(maxMana / 50);
manaRegen = (float) (manaRegen + manaRegen * powerOrb.getManaRegen());
display.add(String.format("§b+%s ✎/s", TextUtils.formatDouble(manaRegen)));
display.add(String.format("§b+%s ✎/s", TextUtils.formatNumber(manaRegen)));
}
if (powerOrb.getStrength() > 0) {
display.add(String.format("§4+%d ❁", powerOrb.getStrength()));
}
if (healIncrease > 0) {
display.add(String.format("§2+%s%% Healing", TextUtils.formatDouble(healIncrease)));
display.add(String.format("§2+%s%% Healing", TextUtils.formatNumber(healIncrease)));
}

Optional<String> longestLine = display.stream().max(Comparator.comparingInt(String::length));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

/**
* This class provides methods to check what opengl capabilities are supported.
*
* <p>
* Please use the provided methods instead of calling opengl methods directly to avoid crashes!
*/
public class ShaderHelper {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@

/**
* This shader shows a chroma color on a pixel depending on its position in the world
*
* <p>
* This shader does:
* - Take in account its position in 3-dimensional space
*
* <p>
* This shader does not:
* - Preserve the brightness and saturation of the original color
* - Work with textures
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

/**
* This shader shows a chroma color on a pixel depending on its position on the screen.
*
* <p>
* This shader does:
* - Preserve the brightness and saturation of the original color (for text shadows)
*
* <p>
* This shader does not:
* - Take in account world position, scale, etc.
* - Work with textures (see {@link ChromaScreenTexturedShader} for a textured version).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

/**
* This shader shows a chroma color on a pixel depending on its position on the screen.
*
* <p>
* This shader does:
* - Work with textures (see {@link ChromaScreenShader} for a non-textured version).
* - Preserve the brightness and saturation of the original color (for text shadows)
*
* <p>
* This shader does not:
* - Take in account world position, scale, etc.
*/
Expand Down
Loading