diff options
author | Aaron <51387595+AzureAaron@users.noreply.github.com> | 2024-04-28 15:06:24 -0400 |
---|---|---|
committer | Aaron <51387595+AzureAaron@users.noreply.github.com> | 2024-04-28 15:06:24 -0400 |
commit | 45bcbe967ac58a2dc5ef606381e1653003ac17e3 (patch) | |
tree | 65b14c285a6489acdc070f991b1ca9e798829246 /src/main/java/de/hysky/skyblocker/utils | |
parent | 75547cb59396252f8e5bde41181b9f27c655ccf2 (diff) | |
download | Skyblocker-45bcbe967ac58a2dc5ef606381e1653003ac17e3.tar.gz Skyblocker-45bcbe967ac58a2dc5ef606381e1653003ac17e3.tar.bz2 Skyblocker-45bcbe967ac58a2dc5ef606381e1653003ac17e3.zip |
Add invisible armour stand toggle and dumping head textures to debug
Diffstat (limited to 'src/main/java/de/hysky/skyblocker/utils')
-rw-r--r-- | src/main/java/de/hysky/skyblocker/utils/ItemUtils.java | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/main/java/de/hysky/skyblocker/utils/ItemUtils.java b/src/main/java/de/hysky/skyblocker/utils/ItemUtils.java index 32ca36ca..086686a7 100644 --- a/src/main/java/de/hysky/skyblocker/utils/ItemUtils.java +++ b/src/main/java/de/hysky/skyblocker/utils/ItemUtils.java @@ -2,6 +2,7 @@ package de.hysky.skyblocker.utils; import com.google.gson.Gson; import com.google.gson.JsonParser; +import com.mojang.authlib.properties.Property; import com.mojang.authlib.properties.PropertyMap; import com.mojang.brigadier.Command; import com.mojang.brigadier.builder.LiteralArgumentBuilder; @@ -199,7 +200,19 @@ public class ItemUtils { } public static PropertyMap propertyMapWithTexture(String textureValue) { - return Codecs.GAME_PROFILE_PROPERTY_MAP.parse(JsonOps.INSTANCE, JsonParser.parseString("[{\"name\":\"textures\",\"value\":\"" + textureValue + "\"}]")).getOrThrow(); + return Codecs.GAME_PROFILE_PROPERTY_MAP.parse(JsonOps.INSTANCE, JsonParser.parseString("[{\"name\":\"textures\",\"value\":\"" + textureValue + "\"}]")).getOrThrow(); + } + + public static String getHeadTexture(ItemStack stack) { + if (!stack.isOf(Items.PLAYER_HEAD) || !stack.contains(DataComponentTypes.PROFILE)) return ""; + + ProfileComponent profile = stack.get(DataComponentTypes.PROFILE); + String texture = profile.properties().get("textures").stream() + .map(Property::value) + .findFirst() + .orElse(""); + + return texture; } public static ItemStack getSkyblockerStack() { |