aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/utils
diff options
context:
space:
mode:
authorLorenz <lo.scherf@gmail.com>2022-08-23 23:37:38 +0200
committerLorenz <lo.scherf@gmail.com>2022-08-23 23:37:38 +0200
commit1611350edab186e13ca8ae86b6422e6f12c4453c (patch)
tree394fb1120fdf4cf7989eb485813b003e6a770a97 /src/main/java/at/hannibal2/skyhanni/utils
parent959337dad2341a1ad8699c69c43065158d17ae27 (diff)
downloadSkyHanni-1611350edab186e13ca8ae86b6422e6f12c4453c.tar.gz
SkyHanni-1611350edab186e13ca8ae86b6422e6f12c4453c.tar.bz2
SkyHanni-1611350edab186e13ca8ae86b6422e6f12c4453c.zip
added minion hopper coins per day display
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/utils')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/InventoryUtils.kt17
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/ItemUtils.kt26
2 files changed, 19 insertions, 24 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/InventoryUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/InventoryUtils.kt
index 18a4ce635..1d51d1be9 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/InventoryUtils.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/InventoryUtils.kt
@@ -3,6 +3,7 @@ package at.hannibal2.skyhanni.utils
import net.minecraft.client.Minecraft
import net.minecraft.client.gui.inventory.GuiChest
import net.minecraft.inventory.ContainerChest
+import net.minecraft.inventory.Slot
object InventoryUtils {
@@ -15,4 +16,20 @@ object InventoryUtils {
return chest.lowerChestInventory.displayName.unformattedText.trim()
}
+ fun getItemsInOpenChest(): List<Slot> {
+ val list = mutableListOf<Slot>()
+ val guiChest = Minecraft.getMinecraft().currentScreen as GuiChest
+ val inventorySlots = guiChest.inventorySlots.inventorySlots
+ val skipAt = inventorySlots.size - 9 * 4
+ var i = 0
+ for (slot in inventorySlots) {
+ val stack = slot.stack
+ if (stack != null) {
+ list.add(slot)
+ }
+ i++
+ if (i == skipAt) break
+ }
+ return list
+ }
} \ No newline at end of file
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/ItemUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/ItemUtils.kt
index 24c3d822a..b1d3ef7a7 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/ItemUtils.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/ItemUtils.kt
@@ -5,9 +5,7 @@ import at.hannibal2.skyhanni.utils.StringUtils.removeColor
import com.google.gson.GsonBuilder
import com.google.gson.JsonObject
import net.minecraft.client.Minecraft
-import net.minecraft.client.gui.inventory.GuiChest
import net.minecraft.init.Items
-import net.minecraft.inventory.Slot
import net.minecraft.item.ItemStack
import net.minecraftforge.common.util.Constants
import java.util.*
@@ -17,30 +15,10 @@ object ItemUtils {
fun ItemStack.cleanName() = this.displayName.removeColor()
- fun getItemsInOpenChest(): List<Slot> {
- val list = mutableListOf<Slot>()
- val guiChest = Minecraft.getMinecraft().currentScreen as GuiChest
- val inventorySlots = guiChest.inventorySlots.inventorySlots
- val skipAt = inventorySlots.size - 9 * 4
- var i = 0
- for (slot in inventorySlots) {
- val stack = slot.stack
- if (stack != null) {
- list.add(slot)
- }
- i++
- if (i == skipAt) break
- }
- return list
- }
-
fun isSack(name: String): Boolean = name.endsWith(" Sack")//TODO change
- fun ItemStack.getLore() = getLoree(this)
-
-
- fun getLoree(`is`: ItemStack): List<String> {
- val tagCompound = `is`.tagCompound ?: return emptyList()
+ fun ItemStack.getLore(): List<String> {
+ val tagCompound = this.tagCompound ?: return emptyList()
val tagList = tagCompound.getCompoundTag("display").getTagList("Lore", 8)
val list: MutableList<String> = ArrayList()
for (i in 0 until tagList.tagCount()) {