Rearranged item creation code

This commit is contained in:
hhhzzzsss 2023-06-20 01:02:26 -05:00
parent af5cb8d3e8
commit f699fbef25
2 changed files with 1 additions and 4 deletions

View file

@ -39,6 +39,7 @@ public class SongItemCreatorThread extends SongLoaderThread {
ItemStack newStack; ItemStack newStack;
if (stack.isEmpty()) { if (stack.isEmpty()) {
newStack = Items.PAPER.getDefaultStack(); newStack = Items.PAPER.getDefaultStack();
newStack.getOrCreateNbt().putInt("CustomModelData", 751642938);
} }
else { else {
newStack = stack.copy(); newStack = stack.copy();

View file

@ -15,12 +15,8 @@ public class SongItemUtils {
public static final String SONG_DATA_KEY = "SongData"; public static final String SONG_DATA_KEY = "SongData";
public static final String FILE_NAME_KEY = "FileName"; public static final String FILE_NAME_KEY = "FileName";
public static final String DISPLAY_NAME_KEY = "DisplayName"; 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) { 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(); NbtCompound songPlayerNbt = new NbtCompound();
stack.setSubNbt(SONG_ITEM_KEY, songPlayerNbt); stack.setSubNbt(SONG_ITEM_KEY, songPlayerNbt);
songPlayerNbt.putString(SONG_DATA_KEY, Base64.getEncoder().encodeToString(songData)); songPlayerNbt.putString(SONG_DATA_KEY, Base64.getEncoder().encodeToString(songData));