Fix setsongname

This commit is contained in:
hhhzzzsss 2023-06-16 20:32:14 -05:00
parent 155ac3bda3
commit 0a67907bea

View file

@ -846,8 +846,8 @@ public class CommandProcessor {
return true; return true;
} }
ItemStack stack = MC.player.getMainHandStack().copy(); ItemStack stack = MC.player.getMainHandStack();
NbtCompound songPlayerNBT = stack.getSubNbt("SongPlayerData"); NbtCompound songPlayerNBT = SongItemUtils.getSongItemTag(stack);
String[] split = args.split(" "); String[] split = args.split(" ");
switch (split[0].toLowerCase()) { switch (split[0].toLowerCase()) {
@ -867,6 +867,7 @@ public class CommandProcessor {
} }
String name = String.join(" ", Arrays.copyOfRange(split, 1, split.length)); String name = String.join(" ", Arrays.copyOfRange(split, 1, split.length));
songPlayerNBT.putString(SongItemUtils.DISPLAY_NAME_KEY, name); 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); MC.interactionManager.clickCreativeStack(MC.player.getStackInHand(Hand.MAIN_HAND), 36 + MC.player.getInventory().selectedSlot);
SongPlayer.addChatMessage("§6Set song's display name to §3" + name); SongPlayer.addChatMessage("§6Set song's display name to §3" + name);
return true; return true;