diff options
3 files changed, 40 insertions, 18 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/data/ItemRenderBackground.kt b/src/main/java/at/hannibal2/skyhanni/data/ItemRenderBackground.kt index bdbb86c31..f62ebd800 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/ItemRenderBackground.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/ItemRenderBackground.kt @@ -13,27 +13,28 @@ class ItemRenderBackground { companion object { private val backgroundColor = mutableMapOf<ItemStack, Int>() + private val backgroundTime = mutableMapOf<ItemStack, Long>() private val borderLineColor = mutableMapOf<ItemStack, Int>() - private val mapTime = mutableMapOf<ItemStack, Long>() + private val borderTime = mutableMapOf<ItemStack, Long>() var ItemStack.background: Int get() { - if (System.currentTimeMillis() > mapTime.getOrDefault(this, 0) + 60) return -1 + if (System.currentTimeMillis() > backgroundTime.getOrDefault(this, 0) + 60) return -1 return backgroundColor.getOrDefault(this, -1) } set(value) { backgroundColor[this] = value - mapTime[this] = System.currentTimeMillis() + backgroundTime[this] = System.currentTimeMillis() } var ItemStack.borderLine: Int get() { - if (System.currentTimeMillis() > mapTime.getOrDefault(this, 0) + 60) return -1 + if (System.currentTimeMillis() > borderTime.getOrDefault(this, 0) + 60) return -1 return borderLineColor.getOrDefault(this, -1) } set(value) { borderLineColor[this] = value - mapTime[this] = System.currentTimeMillis() + borderTime[this] = System.currentTimeMillis() } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterOverlay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterOverlay.kt index 3cdc0b699..0cd611e2d 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterOverlay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterOverlay.kt @@ -32,22 +32,9 @@ class ComposterOverlay { private var fuelFactors: Map<String, Double> = emptyMap() private val config get() = SkyHanniMod.feature.garden - private val hidden get() = SkyHanniMod.feature.hidden private var organicMatterDisplay = listOf<List<Any>>() private var fuelExtraDisplay = listOf<List<Any>>() - private var currentOrganicMatterItem: String - get() = hidden.gardenComposterCurrentOrganicMatterItem - set(value) { - hidden.gardenComposterCurrentOrganicMatterItem = value - } - - private var currentFuelItem: String - get() = hidden.gardenComposterCurrentFuelItem - set(value) { - hidden.gardenComposterCurrentFuelItem = value - } - private var currentTimeType = TimeType.HOUR private var inComposter = false private var inComposterUpgrades = false @@ -61,7 +48,21 @@ class ComposterOverlay { private var lastHovered = 0L companion object { + private val hidden get() = SkyHanniMod.feature.hidden + var currentOrganicMatterItem: String + get() = hidden.gardenComposterCurrentOrganicMatterItem + private set(value) { + hidden.gardenComposterCurrentOrganicMatterItem = value + } + + var currentFuelItem: String + get() = hidden.gardenComposterCurrentFuelItem + private set(value) { + hidden.gardenComposterCurrentFuelItem = value + } + var testOffset = 0 + fun onCommand(args: Array<String>) { if (args.size != 1) { LorenzUtils.chat("§cUsage: /shtestcomposter <offset>") diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/HideNotClickableItems.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/HideNotClickableItems.kt index 84cb782ae..1b53bbf0e 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/HideNotClickableItems.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/HideNotClickableItems.kt @@ -6,10 +6,12 @@ import at.hannibal2.skyhanni.data.ItemRenderBackground.Companion.borderLine import at.hannibal2.skyhanni.events.GuiContainerEvent import at.hannibal2.skyhanni.events.RepositoryReloadEvent import at.hannibal2.skyhanni.features.bazaar.BazaarApi +import at.hannibal2.skyhanni.features.garden.composter.ComposterOverlay import at.hannibal2.skyhanni.features.garden.visitor.GardenVisitorFeatures import at.hannibal2.skyhanni.utils.* import at.hannibal2.skyhanni.utils.InventoryUtils.getInventoryName 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.ItemUtils.isEnchanted import at.hannibal2.skyhanni.utils.ItemUtils.isVanilla @@ -166,12 +168,30 @@ class HideNotClickableItems { hidePrivateIslandChest(chestName, stack) -> true hideAttributeFusion(chestName, stack) -> true hideYourEquipment(chestName, stack) -> true + hideComposter(chestName, stack) -> true else -> { false } } } + private fun hideComposter(chestName: String, stack: ItemStack): Boolean { + if (!ComposterOverlay.inInventory) return false + + reverseColor = true + + val internalName = stack.getInternalName() + if (internalName == ComposterOverlay.currentOrganicMatterItem) { + return false + } + if (internalName == ComposterOverlay.currentFuelItem) { + return false + } + + hideReason = "Only sell the selected items!" + return true + } + private fun hideYourEquipment(chestName: String, stack: ItemStack): Boolean { if (!chestName.startsWith("Your Equipment")) return false |