diff options
Diffstat (limited to 'src/main/kotlin/com/dulkirfabric/util')
-rw-r--r-- | src/main/kotlin/com/dulkirfabric/util/Utils.kt | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/main/kotlin/com/dulkirfabric/util/Utils.kt b/src/main/kotlin/com/dulkirfabric/util/Utils.kt index c2d65c3..18a442e 100644 --- a/src/main/kotlin/com/dulkirfabric/util/Utils.kt +++ b/src/main/kotlin/com/dulkirfabric/util/Utils.kt @@ -4,7 +4,11 @@ import com.dulkirfabric.events.PlaySoundEvent import com.dulkirfabric.events.SlayerBossEvents import com.dulkirfabric.events.chat.ChatEvents import meteordevelopment.orbit.EventHandler +import net.minecraft.block.entity.SkullBlockEntity +import net.minecraft.client.texture.PlayerSkinProvider import net.minecraft.entity.Entity +import net.minecraft.item.ItemStack +import net.minecraft.nbt.NbtHelper import net.minecraft.util.math.Vec3d object Utils { @@ -42,4 +46,9 @@ object Utils { SlayerBossEvents.Fail(ScoreBoardUtils.slayerType ?: return ScoreBoardUtils.err()).post() } } + + fun getSkullTexture(itemStack: ItemStack): String? { + return itemStack.getSubNbt(SkullBlockEntity.SKULL_OWNER_KEY)?.let(NbtHelper::toGameProfile)?.properties?.get( + PlayerSkinProvider.TEXTURES)?.first()?.value + } }
\ No newline at end of file |