Skip to content

Commit

Permalink
Fix items not having a gameprofile in <= 1.20.4. Fix #150
Browse files Browse the repository at this point in the history
  • Loading branch information
tr7zw committed Apr 23, 2024
1 parent ee820f2 commit b10dee1
Showing 1 changed file with 16 additions and 15 deletions.
31 changes: 16 additions & 15 deletions src/main/java/dev/tr7zw/skinlayers/util/NMSWrapper.java
Original file line number Diff line number Diff line change
Expand Up @@ -83,20 +83,7 @@ public static ResourceLocation getPlayerSkin(GameProfile gameprofile) {

public static GameProfile getGameProfile(ItemStack itemStack) {
// spotless:off
//#if MC <= 12004
//$ if (itemStack.hasTag()) {
//$ CompoundTag compoundTag = itemStack.getTag();
//$ if (compoundTag.contains("CustomModelData")) {
//$ return null; // do not try to 3d-fy custom head models
//$ }
//$ if (compoundTag.contains("SkullOwner", 10)) {
//$ return NbtUtils.readGameProfile(compoundTag.getCompound("SkullOwner"));
//$ } else if (compoundTag.contains("SkullOwner", 8)
//$ && !StringUtils.isBlank(compoundTag.getString("SkullOwner"))) {
//$ return new GameProfile(Util.NIL_UUID, compoundTag.getString("SkullOwner"));
//$ }
//$ }
//#else
//#if MC >= 12005
if(itemStack.getComponents().has(DataComponents.CUSTOM_MODEL_DATA)) {
return null;
}
Expand All @@ -113,9 +100,23 @@ public static GameProfile getGameProfile(ItemStack itemStack) {
return resolvableProfile.gameProfile();
}
}
return null;
//#else
//$$ if (itemStack.hasTag()) {
//$$ CompoundTag compoundTag = itemStack.getTag();
//$$ if (compoundTag.contains("CustomModelData")) {
//$$ return null; // do not try to 3d-fy custom head models
//$$ }
//$$ if (compoundTag.contains("SkullOwner", 10)) {
//$$ return NbtUtils.readGameProfile(compoundTag.getCompound("SkullOwner"));
//$$ } else if (compoundTag.contains("SkullOwner", 8)
//$$ && !StringUtils.isBlank(compoundTag.getString("SkullOwner"))) {
//$$ return new GameProfile(Util.NIL_UUID, compoundTag.getString("SkullOwner"));
//$$ }
//$$ }
//$$ return null;
//#endif
//spotless:on
return null;
}

}

0 comments on commit b10dee1

Please sign in to comment.