[MC-95554] Tab-complete doesn't work correctly for /playsound Created: 13/Jan/16  Updated: 07/Jun/16  Resolved: 07/Jun/16

Status: Resolved
Project: Minecraft: Java Edition
Component/s: None
Affects Version/s: Minecraft 16w02a, Minecraft 1.9 Pre-Release 1, Minecraft 1.9, Minecraft 1.9.4, Minecraft 16w21b
Fix Version/s: Minecraft 1.10 Pre-Release 2

Type: Bug
Reporter: NOPEname Assignee: [Mojang] Grum (Erik Broes)
Resolution: Fixed Votes: 4
Labels: None

Attachments: PNG File 2016-01-13_19.58.01.png    
Issue Links:
Duplicate
is duplicated by MC-102617 /playsound not working correctly with... Resolved
CHK:
Confirmation Status: Confirmed

 Description   

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



 Comments   
Comment by [Mod] FVbico (Steven Verberne) [ 13/Jan/16 ]

confirmed

Comment by [Helper] Marcono1234 [ 17/Feb/16 ]

Confirmed for

  • 1.9-pre1
Comment by [Helper] Marcono1234 [ 06/Mar/16 ]

Confirmed for

  • 1.9
Comment by [Helper] Marcono1234 [ 06/Mar/16 ]

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())));
}
Generated at Thu Dec 14 02:27:46 CST 2017 using JIRA 7.2.8#72010-sha1:dc33de34ffa065bef267bff4768b99ca94e2c00c.