aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/Storage.java2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/farming/WildStrawberryDyeNotification.kt5
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/inventory/GardenPlotIcon.kt6
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/itemabilities/FireVeilWandParticles.kt5
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/misc/RestorePieceOfWizardPortalLore.kt5
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedItemValue.kt23
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/rift/RiftAPI.kt3
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/rift/area/wyldwoods/RiftOdonata.kt4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/motes/ShowMotesNpcSellPrice.kt9
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerItemsOnGround.kt4
10 files changed, 42 insertions, 24 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/config/Storage.java b/src/main/java/at/hannibal2/skyhanni/config/Storage.java
index 9f1455605..6f3fd7ddf 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/Storage.java
+++ b/src/main/java/at/hannibal2/skyhanni/config/Storage.java
@@ -212,7 +212,7 @@ public class Storage {
public static class PlotIcon {
@Expose
- public Map<Integer, String> plotList = new HashMap<>();
+ public Map<Integer, NEUInternalName> plotList = new HashMap<>();
}
@Expose
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/WildStrawberryDyeNotification.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/WildStrawberryDyeNotification.kt
index 4df8fc90a..2f65a9906 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/WildStrawberryDyeNotification.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/WildStrawberryDyeNotification.kt
@@ -8,6 +8,7 @@ import at.hannibal2.skyhanni.utils.ItemBlink
import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName
import at.hannibal2.skyhanni.utils.ItemUtils.name
import at.hannibal2.skyhanni.utils.LorenzUtils
+import at.hannibal2.skyhanni.utils.NEUInternalName.Companion.asInternalName
import at.hannibal2.skyhanni.utils.NEUItems
import at.hannibal2.skyhanni.utils.SoundUtils
import io.github.moulberry.notenoughupdates.util.MinecraftExecutor
@@ -17,6 +18,8 @@ import kotlin.time.Duration.Companion.seconds
class WildStrawberryDyeNotification {
var lastCloseTime = 0L
+ val item by lazy { "DYE_WILD_STRAWBERRY".asInternalName() }
+
@SubscribeEvent
fun onCloseWindow(event: GuiContainerEvent.CloseWindowEvent) {
lastCloseTime = System.currentTimeMillis()
@@ -34,7 +37,7 @@ class WildStrawberryDyeNotification {
if (diff < 1_000) return@execute
val internalName = event.itemStack.getInternalName()
- if (internalName.equals("DYE_WILD_STRAWBERRY")) {
+ if (internalName == item) {
val name = event.itemStack.name!!
LorenzUtils.sendTitle(name, 5.seconds)
LorenzUtils.chat("§e[SkyHanni] You found a $name§e!")
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/GardenPlotIcon.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/GardenPlotIcon.kt
index 39482850b..11318553c 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/GardenPlotIcon.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/GardenPlotIcon.kt
@@ -9,7 +9,7 @@ import at.hannibal2.skyhanni.features.garden.GardenAPI
import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName
import at.hannibal2.skyhanni.utils.ItemUtils.getLore
import at.hannibal2.skyhanni.utils.LorenzUtils.chat
-import at.hannibal2.skyhanni.utils.NEUItems
+import at.hannibal2.skyhanni.utils.NEUItems.getItemStack
import io.github.moulberry.notenoughupdates.events.ReplaceItemEvent
import io.github.moulberry.notenoughupdates.events.SlotClickEvent
import io.github.moulberry.notenoughupdates.util.Utils
@@ -47,7 +47,7 @@ object GardenPlotIcon {
val plotList = plotList ?: return
for ((index, internalName) in plotList) {
val old = originalStack[index]!!
- val new = NEUItems.getItemStack(internalName)
+ val new = internalName.getItemStack()
cachedStack[index] = Utils.editItemStackInfo(new, old.displayName, true, *old.getLore().toTypedArray())
}
}
@@ -118,7 +118,7 @@ object GardenPlotIcon {
return
}
val copyStack = copyStack ?: return
- plotList[event.slotId] = copyStack.getInternalName().asString()
+ plotList[event.slotId] = copyStack.getInternalName()
cachedStack[event.slotId] = copyStack
}
}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/itemabilities/FireVeilWandParticles.kt b/src/main/java/at/hannibal2/skyhanni/features/itemabilities/FireVeilWandParticles.kt
index 28b0d1d1f..499004f64 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/itemabilities/FireVeilWandParticles.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/itemabilities/FireVeilWandParticles.kt
@@ -9,6 +9,7 @@ import at.hannibal2.skyhanni.events.ReceiveParticleEvent
import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName
import at.hannibal2.skyhanni.utils.LorenzUtils
import at.hannibal2.skyhanni.utils.LorenzUtils.toChromaColor
+import at.hannibal2.skyhanni.utils.NEUInternalName.Companion.asInternalName
import at.hannibal2.skyhanni.utils.RenderUtils
import net.minecraft.client.Minecraft
import net.minecraft.util.EnumParticleTypes
@@ -19,6 +20,8 @@ class FireVeilWandParticles {
var lastClick = 0L
+ val item by lazy { "FIRE_VEIL_WAND".asInternalName() }
+
@SubscribeEvent
fun onChatPacket(event: ReceiveParticleEvent) {
if (!LorenzUtils.inSkyBlock) return
@@ -37,7 +40,7 @@ class FireVeilWandParticles {
if (event.clickType == ClickType.RIGHT_CLICK) {
val internalName = event.itemInHand?.getInternalName() ?: return
- if (internalName.equals("FIRE_VEIL_WAND")) {
+ if (internalName == item) {
lastClick = System.currentTimeMillis()
}
}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/RestorePieceOfWizardPortalLore.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/RestorePieceOfWizardPortalLore.kt
index af8b3bbbe..fe21f488f 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/misc/RestorePieceOfWizardPortalLore.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/misc/RestorePieceOfWizardPortalLore.kt
@@ -3,6 +3,7 @@ package at.hannibal2.skyhanni.features.misc
import at.hannibal2.skyhanni.SkyHanniMod
import at.hannibal2.skyhanni.events.LorenzToolTipEvent
import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName
+import at.hannibal2.skyhanni.utils.NEUInternalName.Companion.asInternalName
import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.getRecipientName
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
@@ -10,11 +11,13 @@ class RestorePieceOfWizardPortalLore {
private val config get() = SkyHanniMod.feature.misc
+ private val item by lazy { "WIZARD_PORTAL_MEMENTO".asInternalName() }
+
@SubscribeEvent
fun onTooltip(event: LorenzToolTipEvent) {
if (!config.restorePieceOfWizardPortalLore) return
val stack = event.itemStack
- if (!stack.getInternalName().equals("WIZARD_PORTAL_MEMENTO")) return
+ if (stack.getInternalName() != item) return
val recipient = stack.getRecipientName() ?: return
if (!event.toolTip[5].contains(recipient)) {
event.toolTip.add(5, "§7Earned by: $recipient")
diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedItemValue.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedItemValue.kt
index 79f555300..6300b0cfd 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedItemValue.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedItemValue.kt
@@ -38,6 +38,7 @@ import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.getAttributes
import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.getDrillUpgrades
import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.getDungeonStarCount
import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.getEnchantments
+import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.getEnrichment
import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.getExtraAttributes
import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.getFarmingForDummiesCount
import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.getGemstones
@@ -49,7 +50,6 @@ import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.getPowerScroll
import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.getReforgeName
import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.getRune
import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.getSilexCount
-import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.getEnrichment
import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.getTransmissionTunerCount
import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.hasArtOfPeace
import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.hasArtOfWar
@@ -635,6 +635,16 @@ object EstimatedItemValue {
return price
}
+ val hasAlwaysScavenger = listOf(
+ "CRYPT_DREADLORD_SWORD".asInternalName(),
+ "ZOMBIE_SOLDIER_CUTLASS".asInternalName(),
+ "CONJURING_SWORD".asInternalName(),
+ "EARTH_SHARD".asInternalName(),
+ "ZOMBIE_KNIGHT_SWORD".asInternalName(),
+ "SILENT_DEATH".asInternalName(),
+ "ZOMBIE_COMMANDER_WHIP".asInternalName(),
+ )
+
private fun addEnchantments(stack: ItemStack, list: MutableList<String>): Double {
val enchantments = stack.getEnchantments() ?: return 0.0
@@ -642,17 +652,8 @@ object EstimatedItemValue {
val map = mutableMapOf<String, Double>()
val tieredEnchants = listOf("compact", "cultivating", "champion", "expertise", "hecatomb")
- val hasAlwaysScavenger = listOf(
- "CRYPT_DREADLORD_SWORD",
- "ZOMBIE_SOLDIER_CUTLASS",
- "CONJURING_SWORD",
- "EARTH_SHARD",
- "ZOMBIE_KNIGHT_SWORD",
- "SILENT_DEATH",
- "ZOMBIE_COMMANDER_WHIP",
- )
- val internalName = stack.getInternalName().asString()
+ val internalName = stack.getInternalName()
for ((rawName, rawLevel) in enchantments) {
// efficiency 1-5 is cheap, 6-10 is handled by silex
if (rawName == "efficiency") continue
diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/RiftAPI.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/RiftAPI.kt
index d15eeb3be..3a37cc435 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/rift/RiftAPI.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/rift/RiftAPI.kt
@@ -6,6 +6,7 @@ import at.hannibal2.skyhanni.data.IslandType
import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName
import at.hannibal2.skyhanni.utils.LorenzUtils
import at.hannibal2.skyhanni.utils.NEUInternalName
+import at.hannibal2.skyhanni.utils.NEUInternalName.Companion.asInternalName
import net.minecraft.item.ItemStack
object RiftAPI {
@@ -16,6 +17,8 @@ object RiftAPI {
// internal name -> motes
var motesPrice = emptyMap<NEUInternalName, Double>()
+ val farmingTool by lazy { "FARMING_WAND".asInternalName() }
+
fun ItemStack.motesNpcPrice(): Double? {
val baseMotes = motesPrice[getInternalName()] ?: return null
val burgerStacks = config.motes.burgerStacks
diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/area/wyldwoods/RiftOdonata.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/area/wyldwoods/RiftOdonata.kt
index 61f7b55a6..ded7de44c 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/rift/area/wyldwoods/RiftOdonata.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/rift/area/wyldwoods/RiftOdonata.kt
@@ -9,6 +9,7 @@ import at.hannibal2.skyhanni.utils.EntityUtils.hasSkullTexture
import at.hannibal2.skyhanni.utils.InventoryUtils
import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName
import at.hannibal2.skyhanni.utils.LorenzUtils.toChromaColor
+import at.hannibal2.skyhanni.utils.NEUInternalName.Companion.asInternalName
import net.minecraft.entity.item.EntityArmorStand
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
@@ -17,6 +18,7 @@ class RiftOdonata {
private var hasBottleInHand = false
val odonataSkullTexture =
"eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvOWZkODA2ZGVmZGZkZjU5YjFmMjYwOWM4ZWUzNjQ2NjZkZTY2MTI3YTYyMzQxNWI1NDMwYzkzNThjNjAxZWY3YyJ9fX0="
+ private val emptyBottle by lazy { "EMPTY_ODONATA_BOTTLE".asInternalName() }
@SubscribeEvent
fun onTick(event: LorenzTickEvent) {
@@ -31,7 +33,7 @@ class RiftOdonata {
}
private fun checkHand() {
- hasBottleInHand = InventoryUtils.getItemInHand()?.getInternalName()?.equals("EMPTY_ODONATA_BOTTLE") ?: false
+ hasBottleInHand = InventoryUtils.getItemInHand()?.getInternalName() == emptyBottle
}
private fun findOdonatas() {
diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/motes/ShowMotesNpcSellPrice.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/motes/ShowMotesNpcSellPrice.kt
index 06ec9cd97..fe7cb2a73 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/motes/ShowMotesNpcSellPrice.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/motes/ShowMotesNpcSellPrice.kt
@@ -14,7 +14,8 @@ import at.hannibal2.skyhanni.utils.LorenzColor
import at.hannibal2.skyhanni.utils.LorenzUtils.addAsSingletonList
import at.hannibal2.skyhanni.utils.LorenzUtils.addSelector
import at.hannibal2.skyhanni.utils.LorenzUtils.chat
-import at.hannibal2.skyhanni.utils.NEUItems
+import at.hannibal2.skyhanni.utils.NEUInternalName
+import at.hannibal2.skyhanni.utils.NEUItems.getItemStack
import at.hannibal2.skyhanni.utils.NumberUtil
import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators
import at.hannibal2.skyhanni.utils.RenderUtils.highlight
@@ -29,7 +30,7 @@ class ShowMotesNpcSellPrice {
private val config get() = RiftAPI.config.motes
private var display = emptyList<List<Any>>()
private val pattern = ".*(?:§\\w)+You have (?:§\\w)+(?<amount>\\d) Grubber Stacks.*".toPattern()
- private val itemMap = mutableMapOf<String, Pair<MutableList<Int>, Double>>()
+ private val itemMap = mutableMapOf<NEUInternalName, Pair<MutableList<Int>, Double>>()
private var inInventory = false
private val slotList = mutableListOf<Int>()
@@ -108,7 +109,7 @@ class ShowMotesNpcSellPrice {
itemMap.clear()
for ((index, stack) in stacks) {
val itemValue = stack.motesNpcPrice() ?: continue
- val internalName = stack.getInternalName().asString()
+ val internalName = stack.getInternalName()
if (itemMap.contains(internalName)) {
val (oldIndex, oldValue) = itemMap[internalName] ?: return
oldIndex.add(index)
@@ -143,7 +144,7 @@ class ShowMotesNpcSellPrice {
newDisplay.add(buildList {
val (index, value) = pair
add(" §7- ")
- val stack = NEUItems.getItemStack(internalName)
+ val stack = internalName.getItemStack()
add(stack)
val price = value.formatPrice()
val valuePer = stack.motesNpcPrice() ?: continue
diff --git a/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerItemsOnGround.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerItemsOnGround.kt
index c3d5d9545..0c80973c4 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerItemsOnGround.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerItemsOnGround.kt
@@ -9,6 +9,7 @@ import at.hannibal2.skyhanni.utils.ItemUtils.name
import at.hannibal2.skyhanni.utils.LocationUtils
import at.hannibal2.skyhanni.utils.LorenzUtils
import at.hannibal2.skyhanni.utils.LorenzVec
+import at.hannibal2.skyhanni.utils.NEUInternalName
import at.hannibal2.skyhanni.utils.RenderUtils.drawString
import at.hannibal2.skyhanni.utils.RenderUtils.exactLocation
import com.google.common.cache.CacheBuilder
@@ -40,7 +41,8 @@ class SlayerItemsOnGround {
if (SlayerAPI.ignoreSlayerDrop(name)) continue
// happens in spiders den sometimes
if (itemStack.item == Items.spawn_egg) continue
- if (itemStack.getInternalName().equals("")) continue
+ if (itemStack.getInternalName().equals("")) continue // TODO remove, should never happen
+ if (itemStack.getInternalName() == NEUInternalName.NONE) continue
val (itemName, price) = SlayerAPI.getItemNameAndPrice(itemStack.getInternalName(), itemStack.stackSize)
if (config.minimumPrice > price) continue