mojira.dev
MC-95554

Tab-complete doesn't work correctly for /playsound

When aiming at a block and tab-completing the playsound command, the first coordinate of that block is skipped.

Code analysis: https://bugs.mojang.com/browse/MC-95554?focusedCommentId=293058&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-293058

Linked issues

Attachments

Comments 4

Confirmed for

  • 1.9-pre1

Please link to this comment in the description

The following is based on decompiled version of Minecraft 1.9 using MCP 9.24 beta. All method and class names are the names used in the decompiled version.

The reason why this happens it because the net.minecraft.command.CommandPlaySound.getTabCompletionOptions(MinecraftServer, ICommandSender, String[], BlockPos) method uses the wrong index for the block coordinates. It uses 2 instead of 3.

public List<String> getTabCompletionOptions(MinecraftServer server, ICommandSender sender, String[] args, BlockPos pos)
{
    // Replaced this
    //return args.length == 1 ? getListOfStringsMatchingLastWord(args, SoundEvent.soundEventRegistry.getKeys()) : (args.length == 2 ? getListOfStringsMatchingLastWord(args, SoundCategory.func_187949_b()) : (args.length == 3 ? getListOfStringsMatchingLastWord(args, server.getAllUsernames()) : (args.length > 3 && args.length <= 6 ? func_175771_a(args, 2, pos) : Collections.<String>emptyList())));
    return args.length == 1 ? getListOfStringsMatchingLastWord(args, SoundEvent.soundEventRegistry.getKeys()) : (args.length == 2 ? getListOfStringsMatchingLastWord(args, SoundCategory.func_187949_b()) : (args.length == 3 ? getListOfStringsMatchingLastWord(args, server.getAllUsernames()) : (args.length > 3 && args.length <= 6 ? func_175771_a(args, 3, pos) : Collections.<String>emptyList())));
}

NOPEname

Erik Broes

Confirmed

Minecraft 16w02a, Minecraft 1.9 Pre-Release 1, Minecraft 1.9, Minecraft 1.9.4, Minecraft 16w21b

Minecraft 1.10 Pre-Release 2

Retrieved