mojira.dev
MC-94682

Loot table creation message for spectators displays twice for entities

The bug

When a player in spectator mode right clicks a container entity (currently only MinecartChest and HopperMinecart) the "Unable to open. Loot not generated yet." message is printed twice.

Note: This message has also one space too much at the end.

How to reproduce with MCP (1.11+) (easy)

  1. Locate net.minecraft.entity.player.EntityPlayerMP.displayGUIChest(IInventory chestInventory).

  2. Change the true in the following line to false.

    this.addChatComponentMessage((new TextComponentTranslation("container.spectatorCantOpen", new Object[0])).setStyle((new Style()).setColor(TextFormatting.RED)), true);
  3. Start Minecraft

  4. Summon for example a MinecartChest

    /summon chest_minecart ~ ~ ~ {LootTable:"chests/simple_dungeon"}
  5. Switch to Spectator mode

  6. Right-click the MinecartChest

How to reproduce (1.11+) (advanced)

Note: The following steps will cause the original version folder to be deteled

  1. Open the {{%appdata%\.minecraft\versions}} directory

  2. Copy the folder of the latest version and rename the copied folder to "MC-94682"

  3. Open the copied folder and apply @unknown's modification (requires Python)

  4. Rename the .jar file to "MC-94682"

  5. Open the .json file in the copied folder with a text editor

    1. Set "MC-94682" as id

    2. Remove the contents of the downloads key at the end of the the file

  6. Start Minecraft

  7. Select the version called "MC-94682"

  8. Summon for example a MinecartChest

    /summon chest_minecart ~ ~ ~ {LootTable:"chests/simple_dungeon"}
  9. Switch to Spectator mode

  10. Right-click the MinecartChest

Delete the folder of the version you modified again and rename the copy to the original name

The reason

The following is based on a decompiled version of Minecraft 1.9 using MCP 9.24 beta.

The reason why this happens is because the method net.minecraft.client.multiplayer.PlayerControllerMP.func_187097_a(EntityPlayer, Entity, ItemStack, EnumHand) returns EnumActionResult.PASS for players in spectator mode. Because of this the player right clicks with his main- and offhand on the entity. This could be solved by having the method net.minecraft.client.Minecraft.rightClickMouse() in general run only for the mainhand if the player is in spectator mode.

Linked issues

Comments 9

James (inactive)

Confirmed for 15w51b.

Confirmed for 1.10-pre2.

Confirmed for 1.10.

Confirmed for 1.10.1.

Can't tell whether this bug is fixed in 16w33a since the message was moved to the action bar.

You don't need MCP to check this. Just manipulate the bytecode using this python script that uses jawa. Should be easy enough to confirm in any version with it.

Thank you very much! How do you prevent the launcher from replacing the modified jar file when starting the game?

Open the JSON and delete the contents of the downloads section.

Uriel Salischiker

Is this still a issue in the latest version of the game(currently 1.13.1)?

If so, please add it to the affected versions, thanks!

marcono1234

migrated

Community Consensus

loot-table, minecart

Minecraft 15w51b, Minecraft 16w15b, Minecraft 1.9.4, Minecraft 16w20a, Minecraft 16w21a, ..., Minecraft 1.10.1, Minecraft 1.10.2, Minecraft 16w33a, Minecraft 1.11, Minecraft 1.12

Retrieved