aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/utils
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-04-12 04:14:51 +0200
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-04-12 04:14:51 +0200
commite3f8ef1c7efe1e4f16aa960756ef1297d10192fa (patch)
treeb30daa53cd9687757bcb9c0e93f72fb878726d1d /src/main/java/at/hannibal2/skyhanni/utils
parent7f7ad4a745c584892b773732ab84557ca4596470 (diff)
downloadskyhanni-e3f8ef1c7efe1e4f16aa960756ef1297d10192fa.tar.gz
skyhanni-e3f8ef1c7efe1e4f16aa960756ef1297d10192fa.tar.bz2
skyhanni-e3f8ef1c7efe1e4f16aa960756ef1297d10192fa.zip
Rename util methods
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/utils')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/BlockUtils.kt15
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/SkyBlockItemModifierUtils.kt4
2 files changed, 17 insertions, 2 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/BlockUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/BlockUtils.kt
index 5138ebf35..e16df26e9 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/BlockUtils.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/BlockUtils.kt
@@ -1,6 +1,7 @@
package at.hannibal2.skyhanni.utils
import net.minecraft.block.Block
+import net.minecraft.block.properties.PropertyInteger
import net.minecraft.block.state.IBlockState
import net.minecraft.client.Minecraft
import net.minecraft.tileentity.TileEntitySkull
@@ -24,4 +25,18 @@ object BlockUtils {
return serializeNBT.getCompoundTag("Owner").getCompoundTag("Properties")
.getTagList("textures", Constants.NBT.TAG_COMPOUND).getCompoundTagAt(0).getString("Value")
}
+
+ fun IBlockState.isBabyCrop(): Boolean {
+ for (property in block.blockState.properties) {
+ val name = property.name
+ if (name != "age") continue
+
+ if (property is PropertyInteger) {
+ val value = getValue(property)!!
+ if (value == 0) return true
+ }
+ }
+
+ return false
+ }
} \ No newline at end of file
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/SkyBlockItemModifierUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/SkyBlockItemModifierUtils.kt
index 3ff2e54e6..bb1c8705e 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/SkyBlockItemModifierUtils.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/SkyBlockItemModifierUtils.kt
@@ -11,9 +11,9 @@ object SkyBlockItemModifierUtils {
fun ItemStack.getFarmingForDummiesCount() = getAttributeInt("farming_for_dummies_count")
- fun ItemStack.getCultivatingCount() = getAttributeInt("farmed_cultivating")
+ fun ItemStack.getCultivatingCounter() = getAttributeInt("farmed_cultivating")
- fun ItemStack.getCounter() = getAttributeInt("mined_crops")
+ fun ItemStack.getHoeCounter() = getAttributeInt("mined_crops")
fun ItemStack.getSilexCount(): Int? {
val enchantments = getEnchantments() ?: return null