From f699fbef25bde9571a61b36e4d8915c3d33e663f Mon Sep 17 00:00:00 2001 From: hhhzzzsss Date: Tue, 20 Jun 2023 01:02:26 -0500 Subject: [PATCH] Rearranged item creation code --- .../hhhzzzsss/songplayer/item/SongItemCreatorThread.java | 1 + .../com/github/hhhzzzsss/songplayer/item/SongItemUtils.java | 4 ---- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/src/main/java/com/github/hhhzzzsss/songplayer/item/SongItemCreatorThread.java b/src/main/java/com/github/hhhzzzsss/songplayer/item/SongItemCreatorThread.java index 233ae45..d084db0 100644 --- a/src/main/java/com/github/hhhzzzsss/songplayer/item/SongItemCreatorThread.java +++ b/src/main/java/com/github/hhhzzzsss/songplayer/item/SongItemCreatorThread.java @@ -39,6 +39,7 @@ public class SongItemCreatorThread extends SongLoaderThread { ItemStack newStack; if (stack.isEmpty()) { newStack = Items.PAPER.getDefaultStack(); + newStack.getOrCreateNbt().putInt("CustomModelData", 751642938); } else { newStack = stack.copy(); diff --git a/src/main/java/com/github/hhhzzzsss/songplayer/item/SongItemUtils.java b/src/main/java/com/github/hhhzzzsss/songplayer/item/SongItemUtils.java index 3916706..6e2510f 100644 --- a/src/main/java/com/github/hhhzzzsss/songplayer/item/SongItemUtils.java +++ b/src/main/java/com/github/hhhzzzsss/songplayer/item/SongItemUtils.java @@ -15,12 +15,8 @@ public class SongItemUtils { public static final String SONG_DATA_KEY = "SongData"; public static final String FILE_NAME_KEY = "FileName"; public static final String DISPLAY_NAME_KEY = "DisplayName"; - public static final String MODEL_KEY = "CustomModelData"; public static ItemStack createSongItem(ItemStack stack, byte[] songData, String filename, String displayName) { - NbtCompound songPlayerInitNbt = new NbtCompound(); - songPlayerInitNbt.putInt(MODEL_KEY, new Integer("751642938")); - stack.setNbt(songPlayerInitNbt); NbtCompound songPlayerNbt = new NbtCompound(); stack.setSubNbt(SONG_ITEM_KEY, songPlayerNbt); songPlayerNbt.putString(SONG_DATA_KEY, Base64.getEncoder().encodeToString(songData));