From 0a67907bea1b5cb6ae1470bfd96ba452082edb18 Mon Sep 17 00:00:00 2001 From: hhhzzzsss Date: Fri, 16 Jun 2023 20:32:14 -0500 Subject: [PATCH] Fix setsongname --- .../com/github/hhhzzzsss/songplayer/CommandProcessor.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/github/hhhzzzsss/songplayer/CommandProcessor.java b/src/main/java/com/github/hhhzzzsss/songplayer/CommandProcessor.java index 3a85aad..f292c5e 100644 --- a/src/main/java/com/github/hhhzzzsss/songplayer/CommandProcessor.java +++ b/src/main/java/com/github/hhhzzzsss/songplayer/CommandProcessor.java @@ -846,8 +846,8 @@ public class CommandProcessor { return true; } - ItemStack stack = MC.player.getMainHandStack().copy(); - NbtCompound songPlayerNBT = stack.getSubNbt("SongPlayerData"); + ItemStack stack = MC.player.getMainHandStack(); + NbtCompound songPlayerNBT = SongItemUtils.getSongItemTag(stack); String[] split = args.split(" "); switch (split[0].toLowerCase()) { @@ -867,6 +867,7 @@ public class CommandProcessor { } String name = String.join(" ", Arrays.copyOfRange(split, 1, split.length)); songPlayerNBT.putString(SongItemUtils.DISPLAY_NAME_KEY, name); + MC.player.setStackInHand(Hand.MAIN_HAND, stack); MC.interactionManager.clickCreativeStack(MC.player.getStackInHand(Hand.MAIN_HAND), 36 + MC.player.getInventory().selectedSlot); SongPlayer.addChatMessage("§6Set song's display name to §3" + name); return true;