aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-01-22 19:46:57 +0100
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-01-22 19:46:57 +0100
commit7c0c1b2935b7edaabd5efa12ef23ede0365c1d5b (patch)
tree56368862648a7788c55cdf4abf5035c70671aa46 /src/main/java
parent8a255ddfcaec09ce31f12c7412f889b34e209768 (diff)
downloadskyhanni-7c0c1b2935b7edaabd5efa12ef23ede0365c1d5b.tar.gz
skyhanni-7c0c1b2935b7edaabd5efa12ef23ede0365c1d5b.tar.bz2
skyhanni-7c0c1b2935b7edaabd5efa12ef23ede0365c1d5b.zip
Adding green line around items that are clickable.
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/Inventory.java6
-rw-r--r--src/main/java/at/hannibal2/skyhanni/data/ItemRenderBackground.kt57
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/inventory/HideNotClickableItems.kt33
4 files changed, 73 insertions, 25 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java
index e4656df28..aaca16d2d 100644
--- a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java
+++ b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java
@@ -60,7 +60,7 @@ import java.util.List;
public class SkyHanniMod {
public static final String MODID = "skyhanni";
- public static final String VERSION = "0.15";
+ public static final String VERSION = "0.16.UNRELEASED";
public static Features feature;
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/Inventory.java b/src/main/java/at/hannibal2/skyhanni/config/features/Inventory.java
index 175dcb42d..61b11da6c 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/features/Inventory.java
+++ b/src/main/java/at/hannibal2/skyhanni/config/features/Inventory.java
@@ -32,6 +32,12 @@ public class Inventory {
@ConfigAccordionId(id = 0)
public int hideNotClickableOpacity = 180;
+ @Expose
+ @ConfigOption(name = "Green line", desc = "Adds green line around items that are clickable.")
+ @ConfigEditorBoolean
+ @ConfigAccordionId(id = 0)
+ public boolean hideNotClickableItemsGreenLine = true;
+
@ConfigOption(name = "RNG Meter", desc = "")
@ConfigEditorAccordion(id = 1)
public boolean rngMeter = false;
diff --git a/src/main/java/at/hannibal2/skyhanni/data/ItemRenderBackground.kt b/src/main/java/at/hannibal2/skyhanni/data/ItemRenderBackground.kt
index 1576ff4ca..bdbb86c31 100644
--- a/src/main/java/at/hannibal2/skyhanni/data/ItemRenderBackground.kt
+++ b/src/main/java/at/hannibal2/skyhanni/data/ItemRenderBackground.kt
@@ -12,16 +12,27 @@ class ItemRenderBackground {
companion object {
- private val mapColor = mutableMapOf<ItemStack, Int>()
+ private val backgroundColor = mutableMapOf<ItemStack, Int>()
+ private val borderLineColor = mutableMapOf<ItemStack, Int>()
private val mapTime = mutableMapOf<ItemStack, Long>()
var ItemStack.background: Int
get() {
- if (System.currentTimeMillis() > mapTime.getOrDefault(this, 0) + 200) return -1
- return mapColor.getOrDefault(this, -1)
+ if (System.currentTimeMillis() > mapTime.getOrDefault(this, 0) + 60) return -1
+ return backgroundColor.getOrDefault(this, -1)
}
set(value) {
- mapColor[this] = value
+ backgroundColor[this] = value
+ mapTime[this] = System.currentTimeMillis()
+ }
+
+ var ItemStack.borderLine: Int
+ get() {
+ if (System.currentTimeMillis() > mapTime.getOrDefault(this, 0) + 60) return -1
+ return borderLineColor.getOrDefault(this, -1)
+ }
+ set(value) {
+ borderLineColor[this] = value
mapTime[this] = System.currentTimeMillis()
}
}
@@ -30,18 +41,32 @@ class ItemRenderBackground {
@SubscribeEvent
fun renderOverlayLol(event: RenderRealOverlayEvent) {
val stack = event.stack
- if (LorenzUtils.inSkyBlock) {
- if (stack != null) {
- val color = stack.background
- if (color != -1) {
- GlStateManager.pushMatrix()
- GlStateManager.translate(0f, 0f, 110 + Minecraft.getMinecraft().renderItem.zLevel)
- val x = event.x
- val y = event.y
- Gui.drawRect(x, y, x + 16, y + 16, color)
- GlStateManager.popMatrix()
- }
- }
+ if (!LorenzUtils.inSkyBlock) return
+ if (stack == null) return
+
+ val backgroundColor = stack.background
+ if (backgroundColor != -1) {
+ GlStateManager.pushMatrix()
+ GlStateManager.translate(0f, 0f, 110 + Minecraft.getMinecraft().renderItem.zLevel)
+ val x = event.x
+ val y = event.y
+ Gui.drawRect(x, y, x + 16, y + 16, backgroundColor)
+ GlStateManager.popMatrix()
+ }
+
+ val borderLineColor = stack.borderLine
+ if (borderLineColor != -1) {
+ GlStateManager.pushMatrix()
+ GlStateManager.translate(0f, 0f, 110 + Minecraft.getMinecraft().renderItem.zLevel)
+ val x = event.x
+ val y = event.y
+
+ Gui.drawRect(x, y, x + 1, y + 16, borderLineColor)
+ Gui.drawRect(x, y, x + 16, y + 1, borderLineColor)
+
+ Gui.drawRect(x, y + 15, x + 16, y + 16, borderLineColor)
+ Gui.drawRect(x + 15, y, x + 16, y + 16, borderLineColor)
+ GlStateManager.popMatrix()
}
}
} \ No newline at end of file
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 afdc446f9..11994a0c8 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/inventory/HideNotClickableItems.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/HideNotClickableItems.kt
@@ -2,6 +2,7 @@ package at.hannibal2.skyhanni.features.inventory
import at.hannibal2.skyhanni.SkyHanniMod
import at.hannibal2.skyhanni.data.ItemRenderBackground.Companion.background
+import at.hannibal2.skyhanni.data.ItemRenderBackground.Companion.borderLine
import at.hannibal2.skyhanni.data.VanillaItemManager
import at.hannibal2.skyhanni.events.GuiContainerEvent
import at.hannibal2.skyhanni.events.RepositoryReloadEvent
@@ -24,6 +25,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
class HideNotClickableItems {
private var hideReason = ""
+ private var reverseColor = false
private var lastClickTime = 0L
private var bypassUntil = 0L
@@ -80,11 +82,12 @@ class HideNotClickableItems {
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
+ } else if (reverseColor && SkyHanniMod.feature.inventory.hideNotClickableItemsGreenLine) {
+ val color = LorenzColor.GREEN.addOpacity(200)
+ slot.stack.borderLine = color.rgb
}
}
}
@@ -147,6 +150,8 @@ class HideNotClickableItems {
private fun hide(chestName: String, stack: ItemStack): Boolean {
hideReason = ""
+ reverseColor = false
+
return when {
hideNpcSell(chestName, stack) -> true
hideInStorage(chestName, stack) -> true
@@ -160,7 +165,9 @@ class HideNotClickableItems {
hidePrivateIslandChest(chestName, stack) -> true
hideAttributeFusion(chestName, stack) -> true
hideYourEquipment(chestName, stack) -> true
- else -> false
+ else -> {
+ false
+ }
}
}
@@ -181,6 +188,7 @@ class HideNotClickableItems {
)
for (type in list) {
if (stack.getLore().any { it.contains("§l") && it.contains(type) }) {//todo use item api
+ reverseColor = true
return false
}
}
@@ -197,6 +205,8 @@ class HideNotClickableItems {
private fun hideAttributeFusion(chestName: String, stack: ItemStack): Boolean {
if (!chestName.startsWith("Attribute Fusion")) return false
+ reverseColor = true
+
if (ItemUtils.hasAttributes(stack)) return false
hideReason = "This item has no attributes!"
@@ -205,6 +215,7 @@ class HideNotClickableItems {
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
@@ -221,6 +232,7 @@ class HideNotClickableItems {
return true
}
+ reverseColor = true
if (stack.cleanName().endsWith(" Potion")) return false
hideReason = "This item is not a potion!"
@@ -235,6 +247,7 @@ class HideNotClickableItems {
return true
}
+ reverseColor = true
if (stack.getLore().any { it.removeColor() == "Fishing Bait" }) {
return false
}
@@ -244,20 +257,23 @@ class HideNotClickableItems {
private fun hideSackOfSacks(chestName: String, stack: ItemStack): Boolean {
if (!chestName.startsWith("Sack of Sacks")) return false
+ if (isSkyBlockMenuItem(stack)) return false
val name = stack.cleanName()
+ reverseColor = true
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 (!chestName.startsWith("Accessory Bag") && !chestName.startsWith("Accessory Bag (")) return false
+ if (isSkyBlockMenuItem(stack)) return false
+ reverseColor = true
if (stack.getLore().any { it.contains("ACCESSORY") }) return false
- if (isSkyBlockMenuItem(stack)) return false
hideReason = "This item is not an accessory!"
return true
@@ -291,6 +307,7 @@ class HideNotClickableItems {
private fun hideNpcSell(chestName: String, stack: ItemStack): Boolean {
if (!tradeNpcFilter.match(chestName)) return false
+ reverseColor = true
var name = stack.cleanName()
val size = stack.stackSize
@@ -346,6 +363,7 @@ class HideNotClickableItems {
private fun hideSalvage(chestName: String, stack: ItemStack): Boolean {
if (chestName != "Salvage Item") return false
+ reverseColor = true
if (ItemUtils.isRecombobulated(stack)) {
hideReason = "This item should not be salvaged! (Recombobulated)"
@@ -380,8 +398,7 @@ class HideNotClickableItems {
val auctionHouseInventory =
chestName == "Co-op Auction House" || chestName == "Auction House" || chestName == "Create BIN Auction" || chestName == "Create Auction"
if (!bazaarInventory && !auctionHouseInventory) return false
-
-
+ reverseColor = true
if (isSkyBlockMenuItem(stack)) {
if (bazaarInventory) hideReason = "The SkyBlock Menu is not a Bazaar Product!"