aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/features/misc
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-05-22 20:06:36 +0200
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-05-22 20:06:36 +0200
commiteb68a59b4670d548fa4c0a493ad1d19029faeb5b (patch)
tree392483a857b584efbd8ea50fbfef9cb387e5e805 /src/main/java/at/hannibal2/skyhanni/features/misc
parent2e819d59253f91a5453d50cfaca7f998198a338b (diff)
downloadskyhanni-eb68a59b4670d548fa4c0a493ad1d19029faeb5b.tar.gz
skyhanni-eb68a59b4670d548fa4c0a493ad1d19029faeb5b.tar.bz2
skyhanni-eb68a59b4670d548fa4c0a493ad1d19029faeb5b.zip
Use getItemInHand()
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features/misc')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/misc/discordrpc/DiscordStatus.kt13
1 files changed, 5 insertions, 8 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/discordrpc/DiscordStatus.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/discordrpc/DiscordStatus.kt
index 9a57ddd5e..119351d63 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/misc/discordrpc/DiscordStatus.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/misc/discordrpc/DiscordStatus.kt
@@ -11,6 +11,7 @@ import at.hannibal2.skyhanni.data.HypixelData
import at.hannibal2.skyhanni.data.ProfileStorageData
import at.hannibal2.skyhanni.data.ScoreboardData
import at.hannibal2.skyhanni.features.garden.GardenAPI.getCropType
+import at.hannibal2.skyhanni.utils.InventoryUtils
import at.hannibal2.skyhanni.utils.LorenzUtils
import at.hannibal2.skyhanni.utils.LorenzUtils.colorCodeToRarity
import at.hannibal2.skyhanni.utils.StringUtils.firstLetterUppercase
@@ -85,12 +86,9 @@ enum class DiscordStatus(private val displayMessageSupplier: Supplier<String>?)
}),
ITEM({
- val player: net.minecraft.client.entity.EntityPlayerSP = net.minecraft.client.Minecraft.getMinecraft().thePlayer
- if (player.heldItem != null) {
- String.format("Holding ${player.heldItem.displayName.removeColor()}")
- } else {
- "No item in hand"
- }
+ InventoryUtils.getItemInHand()?.let {
+ String.format("Holding ${it.displayName.removeColor()}")
+ } ?: "No item in hand"
}),
TIME({
@@ -162,8 +160,7 @@ enum class DiscordStatus(private val displayMessageSupplier: Supplier<String>?)
}),
CROP_MILESTONES({
- val item = net.minecraft.client.Minecraft.getMinecraft().thePlayer.heldItem
- val crop = item.getCropType()
+ val crop = InventoryUtils.getItemInHand()?.getCropType()
val cropCounter = crop?.getCounter()
val tier = cropCounter?.let { getTierForCrops(it) }