diff options
author | Lorenz <lo.scherf@gmail.com> | 2022-08-14 11:08:35 +0200 |
---|---|---|
committer | Lorenz <lo.scherf@gmail.com> | 2022-08-14 11:08:35 +0200 |
commit | 2b786f4997136509da9efda4e12af57b579fe62b (patch) | |
tree | 8db4269d624e405494a4997ebf1d00586995c52b /src/main/java/at/hannibal2/skyhanni/utils | |
parent | 8cfb6d1de8b0dbee96d73f56720596541dafb304 (diff) | |
download | skyhanni-2b786f4997136509da9efda4e12af57b579fe62b.tar.gz skyhanni-2b786f4997136509da9efda4e12af57b579fe62b.tar.bz2 skyhanni-2b786f4997136509da9efda4e12af57b579fe62b.zip |
adding summon soul display
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/utils')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/utils/ItemUtils.kt | 12 | ||||
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/utils/LocationUtils.kt | 20 |
2 files changed, 31 insertions, 1 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/ItemUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/ItemUtils.kt index a4482247f..b9b11479f 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/ItemUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/ItemUtils.kt @@ -6,7 +6,9 @@ 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.item.ItemStack +import net.minecraftforge.common.util.Constants import java.util.* object ItemUtils { @@ -87,7 +89,6 @@ object ItemUtils { } } } - return list } @@ -181,4 +182,13 @@ object ItemUtils { return internalName } + + fun ItemStack.getSkullTexture(): String? { + if (item != Items.skull) return null + if (tagCompound == null) return null + val nbt = tagCompound + if (!nbt.hasKey("SkullOwner")) return null + return nbt.getCompoundTag("SkullOwner").getCompoundTag("Properties") + .getTagList("textures", Constants.NBT.TAG_COMPOUND).getCompoundTagAt(0).getString("Value") + } }
\ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/utils/LocationUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/LocationUtils.kt new file mode 100644 index 000000000..eee60ea02 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/utils/LocationUtils.kt @@ -0,0 +1,20 @@ +package at.hannibal2.skyhanni.utils + +import net.minecraft.client.Minecraft + +object LocationUtils { + + fun canSee(a: LorenzVec, b: LorenzVec): Boolean { + return Minecraft.getMinecraft().theWorld.rayTraceBlocks(a.toVec3(), b.toVec3()) == null + } + + fun playerLocation(): LorenzVec { + return Minecraft.getMinecraft().thePlayer.getLorenzVec() + } + + fun playerEyeLocation(): LorenzVec { + val player = Minecraft.getMinecraft().thePlayer + val vec = player.getLorenzVec() + return vec.add(0.0, 0.0 + player.getEyeHeight(), 0.0) + } +}
\ No newline at end of file |