Skip to content

Commit b75d1e2

Browse files
committed
fix(ItemUtils): if the item's custom data is empty, the skyblock ID is not being set
1 parent 6509ae8 commit b75d1e2

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

src/main/java/com/fix3dll/skyblockaddons/utils/ItemUtils.java

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -499,15 +499,11 @@ public static ItemStack createSkullItemStack(@NonNull JsonElement profile, JsonE
499499

500500
public static void setItemStackSkyblockID(ItemStack itemStack, String skyblockID) {
501501
CompoundTag ea = getExtraAttributes(itemStack);
502-
CustomData customData;
503-
if (ea != null) {
504-
ea.putString("id", skyblockID);
505-
customData = CustomData.of(ea);
506-
} else {
507-
customData = CustomData.of(new CompoundTag());
502+
if (ea == null) {
503+
ea = new CompoundTag();
508504
}
509-
510-
itemStack.set(DataComponents.CUSTOM_DATA, customData);
505+
ea.putString("id", skyblockID);
506+
itemStack.set(DataComponents.CUSTOM_DATA, CustomData.of(ea));
511507
}
512508

513509
/**

0 commit comments

Comments
 (0)