diff options
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni')
7 files changed, 128 insertions, 14 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt index 20b664ae8..bc4c9dcbd 100644 --- a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt +++ b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt @@ -55,6 +55,7 @@ import at.hannibal2.skyhanni.features.misc.discordrpc.DiscordRPCManager import at.hannibal2.skyhanni.features.misc.ghostcounter.GhostCounter import at.hannibal2.skyhanni.features.misc.items.EstimatedItemValue import at.hannibal2.skyhanni.features.misc.items.EstimatedWardrobePrice +import at.hannibal2.skyhanni.features.misc.items.GlowingDroppedItems import at.hannibal2.skyhanni.features.misc.massconfiguration.DefaultConfigFeatures import at.hannibal2.skyhanni.features.misc.powdertracker.PowderTracker import at.hannibal2.skyhanni.features.misc.tabcomplete.PlayerTabComplete @@ -394,6 +395,7 @@ class SkyHanniMod { loadModule(CosmeticFollowingLine()) loadModule(SuperpairsClicksAlert()) loadModule(PowderTracker()) + loadModule(GlowingDroppedItems()) init() diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/MiscConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/MiscConfig.java index a610316b5..d9cd5c2b8 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/MiscConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/MiscConfig.java @@ -921,6 +921,32 @@ public class MiscConfig { } } + + @Expose + @ConfigOption(name = "Glowing Dropped Items", desc = "") + @Accordion + public GlowingDroppedItems glowingDroppedItems = new GlowingDroppedItems(); + + public static class GlowingDroppedItems { + + @Expose + @ConfigOption(name = "Enabled", desc = "Draws a glowing outline around all dropped items on the ground.") + @ConfigEditorBoolean + @FeatureToggle + public boolean enabled = false; + + @Expose + @ConfigOption(name = "Highlight Showcase Items", desc = "Draws a glowing outline around showcase items.") + @ConfigEditorBoolean + public boolean highlightShowcase = false; + + @Expose + @ConfigOption(name = "Highlight Fishing Bait", desc = "Draws a glowing outline around fishing bait.") + @ConfigEditorBoolean + public boolean highlightFishingBait = false; + + } + @Expose @ConfigOption(name = "Exp Bottles", desc = "Hides all the experience orbs lying on the ground.") @ConfigEditorBoolean diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FortuneUpgrades.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FortuneUpgrades.kt index c4f0848fe..63b32ebb4 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FortuneUpgrades.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FortuneUpgrades.kt @@ -254,7 +254,7 @@ object FortuneUpgrades { } ?: return FarmingFortuneDisplay.loadFortuneLineData(item, 0.0) - val increase = reforge[item.getItemRarity() + 1, FarmingFortuneDisplay.reforgeFortune] ?: return + val increase = reforge[item.getItemRarity().id + 1, FarmingFortuneDisplay.reforgeFortune] ?: return list.add( FortuneUpgrade("§7Recombobulate your ${item.displayName}", null, "RECOMBOBULATOR_3000", 1, increase) ) @@ -267,7 +267,7 @@ object FortuneUpgrades { copperPrice: Int? = null ) { FarmingFortuneDisplay.loadFortuneLineData(item, 0.0) - val increase = reforge[item.getItemRarity(), FarmingFortuneDisplay.reforgeFortune] ?: return + val increase = reforge[item.getItemRarity().id, FarmingFortuneDisplay.reforgeFortune] ?: return list.add( FortuneUpgrade( "§7Reforge your ${item.displayName} §7to ${reforge.reforgeName}", diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/items/GlowingDroppedItems.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/items/GlowingDroppedItems.kt new file mode 100644 index 000000000..4e7afc376 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/items/GlowingDroppedItems.kt @@ -0,0 +1,68 @@ +package at.hannibal2.skyhanni.features.misc.items
+
+import at.hannibal2.skyhanni.SkyHanniMod
+import at.hannibal2.skyhanni.data.IslandType
+import at.hannibal2.skyhanni.events.RenderEntityOutlineEvent
+import at.hannibal2.skyhanni.utils.ItemUtils.getItemRarityOrNull
+import at.hannibal2.skyhanni.utils.ItemUtils.name
+import at.hannibal2.skyhanni.utils.LorenzUtils
+import at.hannibal2.skyhanni.utils.LorenzUtils.equalsOneOf
+import net.minecraft.entity.Entity
+import net.minecraft.entity.item.EntityArmorStand
+import net.minecraft.entity.item.EntityItem
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+
+class GlowingDroppedItems {
+
+ private val config get() = SkyHanniMod.feature.misc.glowingDroppedItems
+
+ /**
+ * List of skyblock locations where we might see items in showcases
+ */
+ private val showcaseItemLocations = setOf(
+ "The End",
+ "Jerry's Workshop"
+ )
+
+ @SubscribeEvent
+ fun onRenderEntityOutlines(event: RenderEntityOutlineEvent) {
+ if (isEnabled() && event.type === RenderEntityOutlineEvent.Type.XRAY) {
+ event.queueEntitiesToOutline(getEntityOutlineColor)
+ }
+ }
+
+ private fun isEnabled() = LorenzUtils.inSkyBlock && config.enabled
+
+ private val getEntityOutlineColor: (entity: Entity) -> Int? = { entity ->
+ if (entity is EntityItem && !shouldHideShowcaseItem(entity)) {
+ val rarity = entity.entityItem.getItemRarityOrNull()
+
+ if (config.highlightFishingBait || entity.entityItem.name?.endsWith(" Bait") != true) {
+ rarity?.color?.toColor()?.rgb
+ } else null
+ } else null
+ }
+
+ private fun isShowcaseArea() =
+ showcaseItemLocations.contains(LorenzUtils.skyBlockArea) ||
+ LorenzUtils.skyBlockIsland.equalsOneOf(
+ IslandType.HUB,
+ IslandType.PRIVATE_ISLAND,
+ IslandType.PRIVATE_ISLAND_GUEST
+ )
+
+ private fun shouldHideShowcaseItem(entity: EntityItem): Boolean {
+ if (!isShowcaseArea() || config.highlightShowcase) return false
+
+ for (entityArmorStand in entity.worldObj.getEntitiesWithinAABB(
+ EntityArmorStand::class.java,
+ entity.entityBoundingBox
+ )) {
+ if (entityArmorStand.isInvisible) {
+ return true
+ }
+ }
+
+ return false
+ }
+}
\ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/utils/EntityOutlineRenderer.kt b/src/main/java/at/hannibal2/skyhanni/utils/EntityOutlineRenderer.kt index 049a89f0b..594c167e9 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/EntityOutlineRenderer.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/EntityOutlineRenderer.kt @@ -266,6 +266,7 @@ object EntityOutlineRenderer { // Add new features that need the entity outline logic here private fun isEnabled(): Boolean { if (SkyHanniMod.feature.fishing.rareSeaCreatureHighlight) return true + if (SkyHanniMod.feature.misc.glowingDroppedItems.enabled) return true return false } diff --git a/src/main/java/at/hannibal2/skyhanni/utils/ItemUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/ItemUtils.kt index bedbebc46..1433961d2 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/ItemUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/ItemUtils.kt @@ -152,19 +152,20 @@ object ItemUtils { return nbt.getCompoundTag("SkullOwner").getString("Id") } - fun ItemStack.getItemRarity(): Int { - //todo make into an enum in future + fun ItemStack.getItemRarity() = getItemRarityOrNull() ?: error("item rarity not detected for item '$name'") + + fun ItemStack.getItemRarityOrNull(): LorenzRarity? { return when (this.getLore().lastOrNull()?.take(4)) { - "§f§l" -> 0 // common - "§a§l" -> 1 // uncommon - "§9§l" -> 2 // rare - "§5§l" -> 3 // epic - "§6§l" -> 4 // legendary - "§d§l" -> 5 // mythic - "§b§l" -> 6 // divine - "§4§l" -> 7 // supreme - "§c§l" -> 8 // special/very special - else -> -1 // unknown + "§f§l" -> LorenzRarity.COMMON + "§a§l" -> LorenzRarity.UNCOMMON + "§9§l" -> LorenzRarity.RARE + "§5§l" -> LorenzRarity.EPIC + "§6§l" -> LorenzRarity.LEGENDARY + "§d§l" -> LorenzRarity.MYTHIC + "§b§l" -> LorenzRarity.DIVINE + "§4§l" -> LorenzRarity.SUPREME + "§c§l" -> LorenzRarity.SPECIAL + else -> null } } diff --git a/src/main/java/at/hannibal2/skyhanni/utils/LorenzRarity.kt b/src/main/java/at/hannibal2/skyhanni/utils/LorenzRarity.kt new file mode 100644 index 000000000..a6f6f6f06 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/utils/LorenzRarity.kt @@ -0,0 +1,16 @@ +package at.hannibal2.skyhanni.utils
+
+
+enum class LorenzRarity(val color: LorenzColor, val id: Int) {
+ COMMON(LorenzColor.WHITE, 0),
+ UNCOMMON(LorenzColor.GREEN, 1),
+ RARE(LorenzColor.BLUE, 2),
+ EPIC(LorenzColor.DARK_PURPLE, 3),
+ LEGENDARY(LorenzColor.GOLD, 4),
+ MYTHIC(LorenzColor.LIGHT_PURPLE, 5),
+ DIVINE(LorenzColor.AQUA, 6),
+ SUPREME(LorenzColor.DARK_RED, 7),
+ SPECIAL(LorenzColor.RED, 8),
+ ;
+
+}
\ No newline at end of file |