From 04cfe48dbbc58da81c8390dfb20216a7258cba3e Mon Sep 17 00:00:00 2001 From: appable Date: Mon, 10 Apr 2023 17:44:46 -0700 Subject: Farming fortune display (#34) --- .../skyhanni/utils/SkyBlockItemModifierUtils.kt | 24 ++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'src/main/java/at/hannibal2/skyhanni/utils') diff --git a/src/main/java/at/hannibal2/skyhanni/utils/SkyBlockItemModifierUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/SkyBlockItemModifierUtils.kt index 15bd4ff0b..a7e97bb0e 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/SkyBlockItemModifierUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/SkyBlockItemModifierUtils.kt @@ -31,6 +31,30 @@ object SkyBlockItemModifierUtils { return 0 } + fun ItemStack.getCultivatingCount(): Int? { + for (tags in tagCompound.keySet) { + if (tags != "ExtraAttributes") continue + val extraAttributes = tagCompound.getCompoundTag(tags) + for (attributes in extraAttributes.keySet) { + if (attributes != "farmed_cultivating") continue + return extraAttributes.getInteger(attributes) + } + } + return null + } + + fun ItemStack.getCounter(): Int? { + for (tags in tagCompound.keySet) { + if (tags != "ExtraAttributes") continue + val extraAttributes = tagCompound.getCompoundTag(tags) + for (attributes in extraAttributes.keySet) { + if (attributes != "mined_crops") continue + return extraAttributes.getInteger(attributes) + } + } + return null + } + fun ItemStack.getSilexCount(): Int { var silexTier = 0 for ((name, amount) in getEnchantments()) { -- cgit