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)
- Locate net.minecraft.entity.player.EntityPlayerMP.displayGUIChest(IInventory chestInventory).
- 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); - Start Minecraft
- Summon for example a MinecartChest
/summon chest_minecart ~ ~ ~ {LootTable:"chests/simple_dungeon"} - Switch to Spectator mode
- Right-click the MinecartChest
How to reproduce (1.11+) (advanced)
Note: The following steps will cause the original version folder to be deteled
- Open the %appdata%\.minecraft\versions directory
- Copy the folder of the latest version and rename the copied folder to "
MC-94682" - Open the copied folder and apply [Mod] Pokechu22's modification (requires Python)
- Rename the .jar file to "
MC-94682" - Open the .json file in the copied folder with a text editor
- Set "
MC-94682" as id - Remove the contents of the downloads key at the end of the the file
- Set "
- Start Minecraft
- Select the version called "
MC-94682" - Summon for example a MinecartChest
/summon chest_minecart ~ ~ ~ {LootTable:"chests/simple_dungeon"} - Switch to Spectator mode
- 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.
ProfMobius (Thomas Guimbretiere)
2015-12-22, 04:58 PM
2018-10-02, 11:25 PM
2018-10-02, 11:25 PM
7
7
Minecraft 15w51b - Minecraft 1.12
Minecraft 15w51b, Minecraft 16w15b, Minecraft 1.9.4, Minecraft 16w20a, Minecraft 16w21a, Minecraft 16w21b, Minecraft 1.10 Pre-Release 1, Minecraft 1.10 Pre-Release 2, Minecraft 1.10, Minecraft 1.10.1, Minecraft 1.10.2, Minecraft 16w33a, Minecraft 1.11, Minecraft 1.12
-