diff options
author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2022-09-17 10:20:41 +0200 |
---|---|---|
committer | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2022-09-17 10:20:41 +0200 |
commit | 71986bac22e7458afb9cb106ec8327100f55cdf0 (patch) | |
tree | 25b7efa76494f1c91526f034d4b8dac0764975d0 /src/main/java/at | |
parent | 147ab9c7ecb212a2104158e9750aed9925b86936 (diff) | |
download | skyhanni-71986bac22e7458afb9cb106ec8327100f55cdf0.tar.gz skyhanni-71986bac22e7458afb9cb106ec8327100f55cdf0.tar.bz2 skyhanni-71986bac22e7458afb9cb106ec8327100f55cdf0.zip |
add skin texture to copyentities
Diffstat (limited to 'src/main/java/at')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/test/command/CopyNearbyEntitiesCommand.kt | 44 | ||||
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/utils/EntityUtils.kt | 11 |
2 files changed, 48 insertions, 7 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/test/command/CopyNearbyEntitiesCommand.kt b/src/main/java/at/hannibal2/skyhanni/test/command/CopyNearbyEntitiesCommand.kt index 1467f2b85..a5e7a0b79 100644 --- a/src/main/java/at/hannibal2/skyhanni/test/command/CopyNearbyEntitiesCommand.kt +++ b/src/main/java/at/hannibal2/skyhanni/test/command/CopyNearbyEntitiesCommand.kt @@ -1,5 +1,6 @@ package at.hannibal2.skyhanni.test.command +import at.hannibal2.skyhanni.utils.EntityUtils.getSkinTexture import at.hannibal2.skyhanni.utils.ItemUtils.cleanName import at.hannibal2.skyhanni.utils.ItemUtils.getSkullTexture import at.hannibal2.skyhanni.utils.ItemUtils.name @@ -9,6 +10,7 @@ import at.hannibal2.skyhanni.utils.LorenzUtils.baseMaxHealth import at.hannibal2.skyhanni.utils.OSUtils import at.hannibal2.skyhanni.utils.toLorenzVec import net.minecraft.client.Minecraft +import net.minecraft.client.entity.EntityOtherPlayerMP import net.minecraft.entity.EntityLivingBase import net.minecraft.entity.item.EntityArmorStand import net.minecraft.entity.item.EntityItem @@ -55,6 +57,13 @@ object CopyNearbyEntitiesCommand { val ridingEntity = entity.ridingEntity resultList.add("ridingEntity: $ridingEntity") + if (entity is EntityLivingBase) { + resultList.add("EntityLivingBase:") + val baseMaxHealth = entity.baseMaxHealth.toInt() + val health = entity.health.toInt() + resultList.add("- baseMaxHealth: $baseMaxHealth") + resultList.add("- health: $health") + } when (entity) { is EntityArmorStand -> { @@ -106,16 +115,37 @@ object CopyNearbyEntitiesCommand { resultList.add("- itemDamage: '$itemDamage'") resultList.add("- stackSize: '$stackSize'") resultList.add("- maxStackSize: '$maxStackSize'") + } + is EntityOtherPlayerMP -> { + resultList.add("EntityOtherPlayerMP:") + + val skinTexture = entity.getSkinTexture() + resultList.add("- skin texture: $skinTexture") + +// val gameProfile = entity.gameProfile +// if (gameProfile == null) { +// resultList.add("- gameProfile is null!") +// } else { +// val id = gameProfile.id +// val name = gameProfile.name +// +// resultList.add("- gameProfile id: $id") +// resultList.add("- gameProfile name: $name") +// val properties = gameProfile.properties +// resultList.add("- gameProfile properties: (${properties.size()})") +// for (entry in properties.entries()) { +// val key = entry.key +// val property = entry.value +// resultList.add("- key: '$key'") +// val name1 = property.name +// val value = property.value +// resultList.add("- property name: '$name1'") +// resultList.add("- property value: '$value'") +// } +// } } } - if (entity is EntityLivingBase) { - resultList.add("EntityLivingBase:") - val baseMaxHealth = entity.baseMaxHealth.toInt() - val health = entity.health.toInt() - resultList.add("- baseMaxHealth: $baseMaxHealth") - resultList.add("- health: $health") - } resultList.add("") resultList.add("") counter++ diff --git a/src/main/java/at/hannibal2/skyhanni/utils/EntityUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/EntityUtils.kt index d057abd90..e9621b319 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/EntityUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/EntityUtils.kt @@ -4,6 +4,7 @@ import at.hannibal2.skyhanni.utils.LorenzUtils.baseMaxHealth import net.minecraft.entity.EntityLiving import net.minecraft.entity.EntityLivingBase import net.minecraft.entity.item.EntityArmorStand +import net.minecraft.entity.player.EntityPlayer import net.minecraft.util.AxisAlignedBB object EntityUtils { @@ -88,4 +89,14 @@ object EntityUtils { else -> false } } + + fun EntityPlayer.getSkinTexture(): String? { + val gameProfile = gameProfile ?: return null + + return gameProfile.properties.entries() + .filter { it.key == "textures" } + .map { it.value } + .firstOrNull { it.name == "textures" } + ?.value + } }
\ No newline at end of file |