diff options
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/utils')
4 files changed, 8 insertions, 28 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/ColorUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/ColorUtils.kt index 3b1986d40..97a1342c1 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/ColorUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/ColorUtils.kt @@ -34,5 +34,3 @@ object ColorUtils { fun Color.withAlpha(alpha: Int): Int = (alpha.coerceIn(0, 255) shl 24) or (this.rgb and 0x00ffffff) } - - diff --git a/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt index c292abafd..bf258dab9 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt @@ -15,7 +15,6 @@ import at.hannibal2.skyhanni.test.TestBingo import at.hannibal2.skyhanni.utils.ChatUtils.lastButtonClicked import at.hannibal2.skyhanni.utils.ItemUtils.getItemCategoryOrNull import at.hannibal2.skyhanni.utils.NEUItems.getItemStackOrNull -import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators import at.hannibal2.skyhanni.utils.StringUtils.capAtMinecraftLength import at.hannibal2.skyhanni.utils.StringUtils.removeColor import at.hannibal2.skyhanni.utils.StringUtils.toDashlessUUID @@ -133,11 +132,6 @@ object LorenzUtils { fun formatPercentage(percentage: Double, format: String?): String = DecimalFormat(format).format(percentage * 100).replace(',', '.') + "%" - @Deprecated("old code", ReplaceWith("d.round(round).addSeparators()")) - fun formatDouble(d: Double, round: Int = 1): String { - return d.round(round).addSeparators() - } - fun consoleLog(text: String) { SkyHanniMod.consoleLog(text) } diff --git a/src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt b/src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt index 2330a6a1d..87a265c84 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt @@ -93,9 +93,6 @@ object NEUItems { return map } - @Deprecated("moved", ReplaceWith("NEUInternalName.fromItemNameOrNull(itemName)")) - fun getInternalNameOrNull(itemName: String): NEUInternalName? = NEUInternalName.fromItemNameOrNull(itemName) - fun getInternalName(itemStack: ItemStack): String? = ItemResolutionQuery(manager) .withCurrentGuiContext() .withItemStack(itemStack) @@ -171,9 +168,9 @@ object NEUItems { val translateX: Float val translateY: Float if (isSkull) { - val skulldiff = ((scaleMultiplier) * 2.5).toFloat() - translateX = x - skulldiff - translateY = y - skulldiff + val skullDiff = ((scaleMultiplier) * 2.5).toFloat() + translateX = x - skullDiff + translateY = y - skullDiff } else { translateX = x translateY = y @@ -277,19 +274,10 @@ object NEUItems { return result } - @Deprecated("Do not use strings as id", ReplaceWith("NEUItems.getMultiplier(internalName.asInternalName())")) - fun getMultiplier(internalName: String, tryCount: Int = 0): Pair<String, Int> { - val pair = getMultiplier(internalName.asInternalName(), tryCount) - return Pair(pair.first.asString(), pair.second) - } - fun getRecipes(internalName: NEUInternalName): Set<NeuRecipe> { - if (recipesCache.contains(internalName)) { - return recipesCache[internalName]!! + return recipesCache.getOrPut(internalName) { + manager.getRecipesFor(internalName.asString()) } - val recipes = manager.getRecipesFor(internalName.asString()) - recipesCache[internalName] = recipes - return recipes } fun NeuRecipe.getCachedIngredients() = ingredientsCache.getOrPut(this) { ingredients } diff --git a/src/main/java/at/hannibal2/skyhanni/utils/NumberUtil.kt b/src/main/java/at/hannibal2/skyhanni/utils/NumberUtil.kt index f9b1ceb7a..e2df5349f 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/NumberUtil.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/NumberUtil.kt @@ -170,11 +170,11 @@ object NumberUtil { lastDecimal + decimal } - val pattern = "^[0-9]*$".toPattern() - val formatPattern = "^[0-9,.]*[kmb]?$".toPattern() + private val numberPattern = "^[0-9]*$".toPattern() + private val formatPattern = "^[0-9,.]*[kmb]?$".toPattern() fun String.isInt(): Boolean { - return isNotEmpty() && pattern.matcher(this).matches() + return isNotEmpty() && numberPattern.matcher(this).matches() } fun String.isFormatNumber(): Boolean { |