summaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/features/items
diff options
context:
space:
mode:
authorLorenz <lo.scherf@gmail.com>2022-09-12 00:01:31 +0200
committerLorenz <lo.scherf@gmail.com>2022-09-12 00:01:31 +0200
commitc6b688f864c28fcd7c1cbcb248086e5caee7f230 (patch)
treedc3a1f86ae8fa46d520567a668dbff2be181a9ac /src/main/java/at/hannibal2/skyhanni/features/items
parent8e55249bf19a44d829d802f14d31668a12239a12 (diff)
downloadskyhanni-c6b688f864c28fcd7c1cbcb248086e5caee7f230.tar.gz
skyhanni-c6b688f864c28fcd7c1cbcb248086e5caee7f230.tar.bz2
skyhanni-c6b688f864c28fcd7c1cbcb248086e5caee7f230.zip
edited features order and made better wording
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features/items')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/items/HideNotClickableItems.kt418
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/items/ItemDisplayOverlayFeatures.kt120
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/items/ItemStars.kt150
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/items/RngMeterInventory.kt91
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/items/VanillaItemManager.kt53
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/items/abilitycooldown/ItemAbilityCooldown.kt214
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/items/abilitycooldown/WitherImpactDetection.kt74
7 files changed, 0 insertions, 1120 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/items/HideNotClickableItems.kt b/src/main/java/at/hannibal2/skyhanni/features/items/HideNotClickableItems.kt
deleted file mode 100644
index 2829742dc..000000000
--- a/src/main/java/at/hannibal2/skyhanni/features/items/HideNotClickableItems.kt
+++ /dev/null
@@ -1,418 +0,0 @@
-package at.hannibal2.skyhanni.features.items
-
-import at.hannibal2.skyhanni.SkyHanniMod
-import at.hannibal2.skyhanni.data.ItemRenderBackground.Companion.background
-import at.hannibal2.skyhanni.events.GuiContainerEvent
-import at.hannibal2.skyhanni.events.RepositoryReloadEvent
-import at.hannibal2.skyhanni.features.bazaar.BazaarApi
-import at.hannibal2.skyhanni.utils.*
-import at.hannibal2.skyhanni.utils.ItemUtils.cleanName
-import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName
-import at.hannibal2.skyhanni.utils.ItemUtils.getLore
-import at.hannibal2.skyhanni.utils.StringUtils.removeColor
-import com.google.gson.JsonObject
-import net.minecraft.client.Minecraft
-import net.minecraft.client.gui.inventory.GuiChest
-import net.minecraft.inventory.ContainerChest
-import net.minecraft.item.ItemStack
-import net.minecraftforge.event.entity.player.ItemTooltipEvent
-import net.minecraftforge.fml.common.eventhandler.EventPriority
-import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
-
-class HideNotClickableItems {
-
- private var hideReason = ""
-
- private var lastClickTime = 0L
- private var bypassUntil = 0L
-
- private val hideNpcSellFilter = MultiFilter()
- private val hideInStorageFilter = MultiFilter()
- private val tradeNpcFilter = MultiFilter()
- private val itemsToSalvage = mutableListOf<String>()
- private val hidePlayerTradeFilter = MultiFilter()
- private val notAuctionableFilter = MultiFilter()
-
- @SubscribeEvent
- fun onRepoReload(event: RepositoryReloadEvent) {
- try {
- val hideNotClickableItems = event.getConstant("HideNotClickableItems")!!
- hideNpcSellFilter.load(hideNotClickableItems["hide_npc_sell"].asJsonObject)
- hideInStorageFilter.load(hideNotClickableItems["hide_in_storage"].asJsonObject)
- tradeNpcFilter.load(event.getConstant("TradeNpcs")!!)
- updateSalvageList(hideNotClickableItems)
- hidePlayerTradeFilter.load(hideNotClickableItems["hide_player_trade"].asJsonObject)
- notAuctionableFilter.load(hideNotClickableItems["not_auctionable"].asJsonObject)
-
- } catch (e: Exception) {
- e.printStackTrace()
- LorenzUtils.error("error in RepositoryReloadEvent")
- }
- }
-
- private fun updateSalvageList(hideNotClickableItems: JsonObject) {
- itemsToSalvage.clear()
- val salvage = hideNotClickableItems["salvage"].asJsonObject
- itemsToSalvage.addAll(salvage.asJsonObject["items"].asJsonArray.map { it.asString })
- for (armor in salvage.asJsonObject["armor"].asJsonArray.map { it.asString }) {
- itemsToSalvage.add("$armor Helmet")
- itemsToSalvage.add("$armor Chestplate")
- itemsToSalvage.add("$armor Leggings")
- itemsToSalvage.add("$armor Boots")
- }
- }
-
- @SubscribeEvent
- fun onBackgroundDrawn(event: GuiContainerEvent.BackgroundDrawnEvent) {
- if (!LorenzUtils.inSkyblock) return
- if (isDisabled()) return
- if (event.gui !is GuiChest) return
- val guiChest = event.gui
- val chest = guiChest.inventorySlots as ContainerChest
- val chestName = chest.lowerChestInventory.displayName.unformattedText.trim()
-
- for (slot in chest.inventorySlots) {
- if (slot == null) continue
-
- if (slot.slotNumber == slot.slotIndex) continue
- if (slot.stack == null) continue
-
- if (hide(chestName, slot.stack)) {
-// val color = LorenzColor.DARK_GRAY.addOpacity(160)
-// val color = LorenzColor.DARK_GRAY.addOpacity(LorenzTest.a.toInt())
- val opacity = SkyHanniMod.feature.inventory.hideNotClickableOpacity
- val color = LorenzColor.DARK_GRAY.addOpacity(opacity)
- slot.stack.background = color.rgb
- }
- }
- }
-
- @SubscribeEvent(priority = EventPriority.LOWEST)
- fun onTooltip(event: ItemTooltipEvent) {
- if (isDisabled()) return
- if (event.toolTip == null) return
- val guiChest = Minecraft.getMinecraft().currentScreen
- if (guiChest !is GuiChest) return
- val chest = guiChest.inventorySlots as ContainerChest
- val chestName = chest.lowerChestInventory.displayName.unformattedText.trim()
-
- val stack = event.itemStack
- if (InventoryUtils.getItemsInOpenChest().map { it.stack }.contains(stack)) return
- if (!ItemUtils.getItemsInInventory().contains(stack)) return
-
- if (hide(chestName, stack)) {
- val first = event.toolTip[0]
- event.toolTip.clear()
- event.toolTip.add("§7" + first.removeColor())
- event.toolTip.add("")
- if (hideReason == "") {
- event.toolTip.add("§4No hide reason!")
- LorenzUtils.warning("No hide reason for not clickable item!")
- } else {
- event.toolTip.add("§c$hideReason")
- }
- }
- }
-
- @SubscribeEvent
- fun onSlotClick(event: GuiContainerEvent.SlotClickEvent) {
- if (isDisabled()) return
- if (event.gui !is GuiChest) return
- val guiChest = event.gui
- val chest = guiChest.inventorySlots as ContainerChest
- val chestName = chest.lowerChestInventory.displayName.unformattedText.trim()
-
- val slot = event.slot ?: return
-
- if (slot.slotNumber == slot.slotIndex) return
- if (slot.stack == null) return
-
- val stack = slot.stack
-
- if (hide(chestName, stack)) {
- event.isCanceled = true
-
- if (System.currentTimeMillis() > lastClickTime + 5_000) {
- lastClickTime = System.currentTimeMillis()
- }
- return
- }
- }
-
- private fun isDisabled(): Boolean {
- if (bypassUntil > System.currentTimeMillis()) return true
-
- return !SkyHanniMod.feature.inventory.hideNotClickableItems
- }
-
- private fun hide(chestName: String, stack: ItemStack): Boolean {
- hideReason = ""
- return when {
- hideNpcSell(chestName, stack) -> true
- hideInStorage(chestName, stack) -> true
- hideSalvage(chestName, stack) -> true
- hidePlayerTrade(chestName, stack) -> true
- hideBazaarOrAH(chestName, stack) -> true
- hideAccessoryBag(chestName, stack) -> true
- hideSackOfSacks(chestName, stack) -> true
- hideFishingBag(chestName, stack) -> true
- hidePotionBag(chestName, stack) -> true
- hidePrivateIslandChest(chestName, stack) -> true
- hideAttributeFusion(chestName, stack) -> true
- hideYourEquipment(chestName, stack) -> true
- else -> false
- }
- }
-
- private fun hideYourEquipment(chestName: String, stack: ItemStack): Boolean {
- if (!chestName.startsWith("Your Equipment")) return false
-
- val list = listOf(
- "HELMET",
- "CHESTPLATE",
- "LEGGINGS",
- "BOOTS",
-
- "NECKLACE",
- "CLOAK",
- "BELT",
- "GLOVES",
- "BRACELET"
- )
- for (type in list) {
- if (stack.getLore().any { it.contains("§l") && it.contains(type) }) {//todo use item api
- return false
- }
- }
-
- if (isSkyBlockMenuItem(stack)) {
- hideReason = "The SkyBlock Menu cannot be put into the potion bag!"
- return true
- }
-
- hideReason = "This item cannot be put into your equipment!"
- return true
- }
-
- private fun hideAttributeFusion(chestName: String, stack: ItemStack): Boolean {
- if (!chestName.startsWith("Attribute Fusion")) return false
-
- if (ItemUtils.hasAttributes(stack)) return false
-
- hideReason = "This item has no attributes!"
- return true
- }
-
- private fun hidePrivateIslandChest(chestName: String, stack: ItemStack): Boolean {
- if (chestName != "Chest" && chestName != "Large Chest") return false
- //TODO make check if player is on private island
-
- if (!ItemUtils.isSoulBound(stack)) return false
-
- hideReason = "This item cannot be stored into a chest!"
- return true
- }
-
- private fun hidePotionBag(chestName: String, stack: ItemStack): Boolean {
- if (!chestName.startsWith("Potion Bag")) return false
-
- if (isSkyBlockMenuItem(stack)) {
- hideReason = "The SkyBlock Menu cannot be put into the potion bag!"
- return true
- }
-
- if (stack.cleanName().endsWith(" Potion")) return false
-
- hideReason = "This item is not a potion!"
- return true
- }
-
- private fun hideFishingBag(chestName: String, stack: ItemStack): Boolean {
- if (!chestName.startsWith("Fishing Bag")) return false
-
- if (isSkyBlockMenuItem(stack)) {
- hideReason = "The SkyBlock Menu cannot be put into the fishing bag!"
- return true
- }
-
- if (stack.getLore().any { it.removeColor() == "Fishing Bait" }) {
- return false
- }
- hideReason = "This item is not a fishing bait!"
- return true
- }
-
- private fun hideSackOfSacks(chestName: String, stack: ItemStack): Boolean {
- if (!chestName.startsWith("Sack of Sacks")) return false
-
- val name = stack.cleanName()
- if (ItemUtils.isSack(name)) return false
- if (isSkyBlockMenuItem(stack)) return false
-
- hideReason = "This item is not a sack!"
- return true
- }
-
- private fun hideAccessoryBag(chestName: String, stack: ItemStack): Boolean {
- if (!chestName.startsWith("Accessory Bag")) return false
-
- if (stack.getLore().any { it.contains("ACCESSORY") }) return false
- if (isSkyBlockMenuItem(stack)) return false
-
- hideReason = "This item is not an accessory!"
- return true
- }
-
- private fun hidePlayerTrade(chestName: String, stack: ItemStack): Boolean {
- if (!chestName.startsWith("You ")) return false
-
- if (ItemUtils.isCoopSoulBound(stack)) {
- hideReason = "Soulbound items cannot be traded!"
- return true
- }
-
- if (isSkyBlockMenuItem(stack)) {
- hideReason = "The SkyBlock Menu cannot be traded!"
- return true
- }
-
- val name = stack.cleanName()
-
- if (ItemUtils.isSack(name)) {
- hideReason = "Sacks cannot be traded!"
- return true
- }
-
- val result = hidePlayerTradeFilter.match(name)
- LorenzDebug.log("hidePlayerTradeList filter result for '$name': $result")
-
- if (result) hideReason = "This item cannot be traded!"
- return result
- }
-
- private fun hideNpcSell(chestName: String, stack: ItemStack): Boolean {
- if (!tradeNpcFilter.match(chestName)) return false
-
- var name = stack.cleanName()
- val size = stack.stackSize
- val amountText = " x$size"
- if (name.endsWith(amountText)) {
- name = name.substring(0, name.length - amountText.length)
- }
-
- if (isSkyBlockMenuItem(stack)) {
- hideReason = "The SkyBlock Menu cannot be sold at the NPC!"
- return true
- }
-
- if (!ItemUtils.isRecombobulated(stack)) {
- if (hideNpcSellFilter.match(name)) return false
-
- val id = stack.getInternalName()
- if (VanillaItemManager.isVanillaItem(id) && !stack.isItemEnchanted) {
- return false
- }
- }
-
- hideReason = "This item should not be sold at the NPC!"
- return true
- }
-
- private fun hideInStorage(chestName: String, stack: ItemStack): Boolean {
- if (!chestName.contains("Ender Chest") && !chestName.contains("Backpack") && chestName != "Storage") return false
-
- if (isSkyBlockMenuItem(stack)) {
- hideReason = "The SkyBlock Menu cannot be put into the storage!"
- return true
- }
-
- val name = stack.cleanName()
-
- if (ItemUtils.isSack(name)) {
- hideReason = "Sacks cannot be put into the storage!"
- return true
- }
-
- val result = hideInStorageFilter.match(name)
-
- if (result) hideReason = "Bags cannot be put into the storage!"
- return result
- }
-
- private fun hideSalvage(chestName: String, stack: ItemStack): Boolean {
- if (chestName != "Salvage Item") return false
-
- if (ItemUtils.isRecombobulated(stack)) {
- hideReason = "This item should not be salvaged! (Recombobulated)"
- return true
- }
- for (line in stack.getLore()) {
- if (line.contains("LEGENDARY DUNGEON")) {
- hideReason = "This item should not be salvaged! (Legendary)"
- return true
- }
- }
-
- if (isSkyBlockMenuItem(stack)) {
- hideReason = "The SkyBlock Menu cannot be salvaged!"
- return true
- }
-
- val name = stack.cleanName()
- for (item in itemsToSalvage) {
- if (name.endsWith(item)) {
- return false
- }
- }
-
- hideReason = "This item cannot be salvaged!"
- return true
- }
-
- private fun hideBazaarOrAH(chestName: String, stack: ItemStack): Boolean {
- val bazaarInventory = BazaarApi.isBazaarInventory(chestName)
-
- val auctionHouseInventory =
- chestName == "Co-op Auction House" || chestName == "Auction House" || chestName == "Create BIN Auction" || chestName == "Create Auction"
- if (!bazaarInventory && !auctionHouseInventory) return false
-
-
-
- if (isSkyBlockMenuItem(stack)) {
- if (bazaarInventory) hideReason = "The SkyBlock Menu is not a Bazaar Product!"
- if (auctionHouseInventory) hideReason = "The SkyBlock Menu cannot be auctioned!"
- return true
- }
-
- if (bazaarInventory != BazaarApi.isBazaarItem(stack)) {
- if (bazaarInventory) hideReason = "This item is not a Bazaar Product!"
- if (auctionHouseInventory) hideReason = "Bazaar Products cannot be auctioned!"
-
- return true
- }
-
- if (isNotAuctionable(stack)) return true
-
- return false
- }
-
- private fun isNotAuctionable(stack: ItemStack): Boolean {
- if (ItemUtils.isCoopSoulBound(stack)) {
- hideReason = "Soulbound items cannot be auctioned!"
- return true
- }
-
- val name = stack.cleanName()
-
- if (ItemUtils.isSack(name)) {
- hideReason = "Sacks cannot be auctioned!"
- return true
- }
-
- val result = notAuctionableFilter.match(name)
- if (result) hideReason = "This item cannot be auctioned!"
- return result
- }
-
- private fun isSkyBlockMenuItem(stack: ItemStack): Boolean = stack.getInternalName() == "SKYBLOCK_MENU"
-}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/items/ItemDisplayOverlayFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/items/ItemDisplayOverlayFeatures.kt
deleted file mode 100644
index bc4caf181..000000000
--- a/src/main/java/at/hannibal2/skyhanni/features/items/ItemDisplayOverlayFeatures.kt
+++ /dev/null
@@ -1,120 +0,0 @@
-package at.hannibal2.skyhanni.features.items
-
-import at.hannibal2.skyhanni.SkyHanniMod
-import at.hannibal2.skyhanni.events.GuiRenderItemEvent
-import at.hannibal2.skyhanni.utils.ItemUtils
-import at.hannibal2.skyhanni.utils.ItemUtils.cleanName
-import at.hannibal2.skyhanni.utils.ItemUtils.getLore
-import at.hannibal2.skyhanni.utils.LorenzUtils
-import at.hannibal2.skyhanni.utils.LorenzUtils.between
-import at.hannibal2.skyhanni.utils.LorenzUtils.matchRegex
-import at.hannibal2.skyhanni.utils.NumberUtil.romanToDecimal
-import net.minecraft.client.renderer.GlStateManager
-import net.minecraft.item.ItemStack
-import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
-
-class ItemDisplayOverlayFeatures {
-
- @SubscribeEvent
- fun onRenderItemOverlayPost(event: GuiRenderItemEvent.RenderOverlayEvent.Post) {
- val stack = event.stack ?: return
-
- if (!LorenzUtils.inSkyblock || stack.stackSize != 1) return
-
- val stackTip = getStackTip(stack)
-
- if (stackTip.isNotEmpty()) {
- GlStateManager.disableLighting()
- GlStateManager.disableDepth()
- GlStateManager.disableBlend()
- event.fontRenderer.drawStringWithShadow(
- stackTip,
- (event.x + 17 - event.fontRenderer.getStringWidth(stackTip)).toFloat(),
- (event.y + 9).toFloat(),
- 16777215
- )
- GlStateManager.enableLighting()
- GlStateManager.enableDepth()
- }
- }
-
- private fun getStackTip(item: ItemStack): String {
- val name = item.cleanName()
-
- if (SkyHanniMod.feature.inventory.itemNumberAsStackSize.contains(0)) {
- when (name) {
- "First Master Star" -> return "1"
- "Second Master Star" -> return "2"
- "Third Master Star" -> return "3"
- "Fourth Master Star" -> return "4"
- "Fifth Master Star" -> return "5"
- }
- }
-
- if (SkyHanniMod.feature.inventory.itemNumberAsStackSize.contains(1)) {
- if (name.matchRegex("(.*)Master Skull - Tier .")) {
- return name.substring(name.length - 1)
- }
- }
-
- if (SkyHanniMod.feature.inventory.itemNumberAsStackSize.contains(2)) {
- if (name.contains("Golden ") || name.contains("Diamond ")) {
- when {
- name.contains("Bonzo") -> return "1"
- name.contains("Scarf") -> return "2"
- name.contains("Professor") -> return "3"
- name.contains("Thorn") -> return "4"
- name.contains("Livid") -> return "5"
- name.contains("Sadan") -> return "6"
- name.contains("Necron") -> return "7"
- }
- }
- }
-
- if (SkyHanniMod.feature.inventory.itemNumberAsStackSize.contains(3)) {
- if (name.startsWith("New Year Cake (")) {
- return "§b" + name.between("(Year ", ")")
- }
- }
-
- if (SkyHanniMod.feature.inventory.itemNumberAsStackSize.contains(4)) {
- if (ItemUtils.isPet(name)) {
- val level = name.between("Lvl ", "] ").toInt()
- if (level != ItemUtils.maxPetLevel(name)) {
- return "$level"
- }
- }
- }
-
- if (SkyHanniMod.feature.inventory.itemNumberAsStackSize.contains(5)) {
- if (name.contains(" Minion ")) {
- if (item.getLore().any { it.contains("Place this minion") }) {
- val array = name.split(" ")
- val last = array[array.size - 1]
- return last.romanToDecimal().toString()
- }
- }
- }
-
- if (SkyHanniMod.feature.inventory.displaySackName) {
- if (ItemUtils.isSack(name)) {
- //TODO fix this and replace other
-// val sackName = grabSackName(name)
- val split = name.split(" ")
- val sackName = split[split.size - 2]
- return (if (name.contains("Enchanted")) "§5" else "") + sackName.substring(0, 2)
- }
- }
-
- return ""
- }
-
-// private fun grabSackName(name: String): String {
-// val split = name.split(" ")
-// val text = split[0]
-// for (line in arrayOf("Large", "Medium", "Small", "Enchanted")) {
-// if (text == line) return grabSackName(name.substring(text.length + 1))
-// }
-// return text
-// }
-} \ No newline at end of file
diff --git a/src/main/java/at/hannibal2/skyhanni/features/items/ItemStars.kt b/src/main/java/at/hannibal2/skyhanni/features/items/ItemStars.kt
deleted file mode 100644
index 0301ddb53..000000000
--- a/src/main/java/at/hannibal2/skyhanni/features/items/ItemStars.kt
+++ /dev/null
@@ -1,150 +0,0 @@
-package at.hannibal2.skyhanni.features.items
-
-import at.hannibal2.skyhanni.SkyHanniMod
-import at.hannibal2.skyhanni.events.GuiRenderItemEvent
-import at.hannibal2.skyhanni.events.RepositoryReloadEvent
-import at.hannibal2.skyhanni.utils.ItemUtils.name
-import at.hannibal2.skyhanni.utils.LorenzUtils
-import net.minecraft.client.renderer.GlStateManager
-import net.minecraftforge.event.entity.player.ItemTooltipEvent
-import net.minecraftforge.fml.common.eventhandler.EventPriority
-import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
-import java.util.regex.Pattern
-
-class ItemStars {
-
- private val armorNames = mutableListOf<String>()
- private val tiers = mutableMapOf<String, Int>()
- private val STAR_FIND_PATCHER = Pattern.compile("(.*)§.✪(.*)")
- private val armorParts = listOf("Helmet", "Chestplate", "Leggings", "Boots")
-
- @SubscribeEvent(priority = EventPriority.LOW)
- fun onTooltip(event: ItemTooltipEvent) {
- if (!LorenzUtils.inSkyblock) return
-
- val stack = event.itemStack ?: return
- if (stack.stackSize != 1) return
- if (!SkyHanniMod.feature.inventory.itemStars) return
-
- val itemName = stack.name ?: return
- val stars = getStars(itemName)
-
- if (stars > 0) {
- var name = itemName
- while (STAR_FIND_PATCHER.matcher(name).matches()) {
- name = name.replaceFirst("§.✪".toRegex(), "")
- }
- name = name.trim()
- event.toolTip[0] = "$name §c$stars✪"
- }
- }
-
- @SubscribeEvent
- fun onRepoReload(event: RepositoryReloadEvent) {
- try {
- val items = event.getConstant("Items")!!
- if (items.has("crimson_armors")) {
- armorNames.clear()
- armorNames.addAll(items.getAsJsonArray("crimson_armors").map { it.asString })
- }
-
- tiers.clear()
- if (items.has("crimson_tiers")) {
- items.getAsJsonObject("crimson_tiers").entrySet().forEach {
- tiers[it.key] = it.value.asInt
- }
- }
-
- } catch (e: Exception) {
- e.printStackTrace()
- LorenzUtils.error("error in RepositoryReloadEvent")
- }
- }
-
- @SubscribeEvent
- fun onRenderItemOverlayPost(event: GuiRenderItemEvent.RenderOverlayEvent.Post) {
- if (!LorenzUtils.inSkyblock) return
- if (!SkyHanniMod.feature.inventory.itemNumberAsStackSize.contains(6)) return
-
- val stack = event.stack ?: return
- if (stack.stackSize != 1) return
- val number = getCrimsonStars(stack.name ?: return)
- val stackTip = if (number == -1) "" else number.toString()
-
- if (stackTip.isNotEmpty()) {
- GlStateManager.disableLighting()
- GlStateManager.disableDepth()
- GlStateManager.disableBlend()
- event.fontRenderer.drawStringWithShadow(
- stackTip,
- (event.x + 17 - event.fontRenderer.getStringWidth(stackTip)).toFloat(),//TODO search for this line and replace all other methods into an api
- (event.y + 9).toFloat(),
- 16777215
- )
- GlStateManager.enableLighting()
- GlStateManager.enableDepth()
- }
- }
-
- private fun getStars(name: String): Int {
- val stars = getCrimsonStars(name)
- if (stars != -1) {
- return stars
- }
-
- return getOtherStars(name)
- }
-
- private fun getCrimsonStars(name: String): Int {
- if (!armorNames.any { name.contains(it) } || !armorParts.any { name.contains(it) }) {
- return -1
- }
- var name1 = name
- var gold = 0
- var pink = 0
- var aqua = 0
- while (name1.contains("§6✪")) {
- name1 = name1.replaceFirst("§6✪", "")
- gold++
- }
- while (name1.contains("§d✪")) {
- name1 = name1.replaceFirst("§d✪", "")
- pink++
- }
- while (name1.contains("§b✪")) {
- name1 = name1.replaceFirst("§b✪", "")
- aqua++
- }
- return (tiers.entries.find { name1.contains(it.key) }?.value ?: 0) + if (aqua > 0) {
- 10 + aqua
- } else if (pink > 0) {
- 5 + pink
- } else {
- gold
- }
- }
-
- private fun getOtherStars(originalName: String): Int {
- var name = originalName
-
- var gold = 0
- var red = 0
- while (name.contains("§6✪")) {
- name = name.replaceFirst("§6✪", "")
- gold++
- }
- while (name.contains("§c✪")) {
- name = name.replaceFirst("§c✪", "")
- red++
- }
- while (name.contains("§d✪")) {
- name = name.replaceFirst("§d✪", "")
- red++
- }
-
- if (red > 0) return 5 + red
- if (gold > 0) return gold
-
- return -1
- }
-} \ No newline at end of file
diff --git a/src/main/java/at/hannibal2/skyhanni/features/items/RngMeterInventory.kt b/src/main/java/at/hannibal2/skyhanni/features/items/RngMeterInventory.kt
deleted file mode 100644
index 19c4ea249..000000000
--- a/src/main/java/at/hannibal2/skyhanni/features/items/RngMeterInventory.kt
+++ /dev/null
@@ -1,91 +0,0 @@
-package at.hannibal2.skyhanni.features.items
-
-import at.hannibal2.skyhanni.SkyHanniMod
-import at.hannibal2.skyhanni.events.GuiContainerEvent
-import at.hannibal2.skyhanni.events.GuiRenderItemEvent
-import at.hannibal2.skyhanni.utils.InventoryUtils
-import at.hannibal2.skyhanni.utils.ItemUtils.getLore
-import at.hannibal2.skyhanni.utils.ItemUtils.name
-import at.hannibal2.skyhanni.utils.LorenzColor
-import at.hannibal2.skyhanni.utils.LorenzUtils
-import at.hannibal2.skyhanni.utils.LorenzUtils.between
-import at.hannibal2.skyhanni.utils.RenderUtils.highlight
-import at.hannibal2.skyhanni.utils.StringUtils.removeColor
-import net.minecraft.client.Minecraft
-import net.minecraft.client.gui.inventory.GuiChest
-import net.minecraft.client.renderer.GlStateManager
-import net.minecraft.inventory.ContainerChest
-import net.minecraftforge.fml.common.eventhandler.EventPriority
-import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
-
-class RngMeterInventory {
-
- @SubscribeEvent
- fun onRenderItemOverlayPost(event: GuiRenderItemEvent.RenderOverlayEvent.Post) {
- if (!LorenzUtils.inSkyblock) return
-
- val screen = Minecraft.getMinecraft().currentScreen
- if (screen !is GuiChest) return
- val chest = screen.inventorySlots as ContainerChest
- val chestName = chest.lowerChestInventory.displayName.unformattedText.trim()
-
- var stackTip = ""
-
- val stack = event.stack ?: return
- if (SkyHanniMod.feature.inventory.rngMeterFloorName) {
- if (chestName == "Catacombs RNG Meter") {
- val name = stack.name ?: return
- if (name.removeColor() == "RNG Meter") {
- stackTip = stack.getLore()[0].between("(", ")")
- }
- }
- }
-
-
- if (stackTip.isNotEmpty()) {
- GlStateManager.disableLighting()
- GlStateManager.disableDepth()
- GlStateManager.disableBlend()
- event.fontRenderer.drawStringWithShadow(
- stackTip,
- (event.x + 17 - event.fontRenderer.getStringWidth(stackTip)).toFloat(),
- (event.y + 9).toFloat(),
- 16777215
- )
- GlStateManager.enableLighting()
- GlStateManager.enableDepth()
- }
- }
-
- @SubscribeEvent(priority = EventPriority.LOW)
- fun onBackgroundDrawn(event: GuiContainerEvent.BackgroundDrawnEvent) {
- if (!LorenzUtils.inSkyblock) return
-
- if (event.gui !is GuiChest) return
- val guiChest = event.gui
- val chest = guiChest.inventorySlots as ContainerChest
- val chestName = chest.lowerChestInventory.displayName.unformattedText.trim()
-
- if (SkyHanniMod.feature.inventory.rngMeterNoDrop) {
- if (chestName == "Catacombs RNG Meter") {
- for (slot in InventoryUtils.getItemsInOpenChest()) {
- val stack = slot.stack
- if (stack.getLore().any { it.contains("You don't have an RNG drop") }) {
- slot highlight LorenzColor.RED
- }
- }
- }
- }
-
- if (SkyHanniMod.feature.inventory.rngMeterSelectedDrop) {
- if (chestName.endsWith(" RNG Meter")) {
- for (slot in InventoryUtils.getItemsInOpenChest()) {
- val stack = slot.stack
- if (stack.getLore().any { it.contains("§aSELECTED") }) {
- slot highlight LorenzColor.YELLOW
- }
- }
- }
- }
- }
-} \ No newline at end of file
diff --git a/src/main/java/at/hannibal2/skyhanni/features/items/VanillaItemManager.kt b/src/main/java/at/hannibal2/skyhanni/features/items/VanillaItemManager.kt
deleted file mode 100644
index f138d9c23..000000000
--- a/src/main/java/at/hannibal2/skyhanni/features/items/VanillaItemManager.kt
+++ /dev/null
@@ -1,53 +0,0 @@
-package at.hannibal2.skyhanni.features.items
-
-import com.google.gson.GsonBuilder
-import com.google.gson.JsonObject
-import java.io.BufferedReader
-import java.io.File
-import java.io.FileInputStream
-import java.io.InputStreamReader
-import java.nio.charset.StandardCharsets
-
-class VanillaItemManager {
- private val gson = GsonBuilder().setPrettyPrinting().create()
-
- companion object {
- private val vanillaItems: MutableList<String> = ArrayList()
-
- fun isVanillaItem(internalName: String): Boolean {
- return vanillaItems.contains(internalName)
- }
- }
-
- init {
- load()
- }
-
- private fun load() {
- vanillaItems.clear()
- val itemDirectory = File("config/notenoughupdates/repo/items")
- if (!itemDirectory.isDirectory) return
- val files = itemDirectory.listFiles() ?: return
- for (file in files) {
- val jsonObject = getJsonFromFile(file)
- if (jsonObject != null) {
- if (jsonObject.has("vanilla") && jsonObject["vanilla"].asBoolean) {
- val name = file.name
- val internalName = name.split(".")[0]
- vanillaItems.add(internalName)
- }
- }
- }
-
- }
-
- private fun getJsonFromFile(file: File): JsonObject? {
- try {
- BufferedReader(InputStreamReader(FileInputStream(file),
- StandardCharsets.UTF_8
- )).use { reader -> return gson.fromJson(reader, JsonObject::class.java) }
- } catch (e: Exception) {
- return null
- }
- }
-} \ No newline at end of file
diff --git a/src/main/java/at/hannibal2/skyhanni/features/items/abilitycooldown/ItemAbilityCooldown.kt b/src/main/java/at/hannibal2/skyhanni/features/items/abilitycooldown/ItemAbilityCooldown.kt
deleted file mode 100644
index b2974837b..000000000
--- a/src/main/java/at/hannibal2/skyhanni/features/items/abilitycooldown/ItemAbilityCooldown.kt
+++ /dev/null
@@ -1,214 +0,0 @@
-package at.hannibal2.skyhanni.features.items.abilitycooldown
-
-import at.hannibal2.skyhanni.SkyHanniMod
-import at.hannibal2.skyhanni.data.ItemRenderBackground.Companion.background
-import at.hannibal2.skyhanni.events.GuiRenderItemEvent
-import at.hannibal2.skyhanni.events.LorenzActionBarEvent
-import at.hannibal2.skyhanni.utils.ItemUtils
-import at.hannibal2.skyhanni.utils.ItemUtils.cleanName
-import at.hannibal2.skyhanni.utils.LorenzColor
-import at.hannibal2.skyhanni.utils.LorenzUtils
-import at.hannibal2.skyhanni.utils.LorenzUtils.between
-import net.minecraft.client.Minecraft
-import net.minecraft.client.renderer.GlStateManager
-import net.minecraft.item.ItemStack
-import net.minecraftforge.common.MinecraftForge
-import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
-import net.minecraftforge.fml.common.gameevent.TickEvent
-
-class ItemAbilityCooldown {
-
- var lastAbility = ""
- var tick = 0
- val items = mutableMapOf<ItemStack, ItemText>()
- val witherImpactDetection = WitherImpactDetection(this)