mojira.dev
MC-30954

Chat pop-ups being displayed when chat disappears

The bug

When using the new /tellraw command I kept clicking it and as the message rose above the visible messages in chat, when I hover over where the pop up would appear it appears and it is still click-able for 2 more times.
Also affects hoverEvents.

Code analysis

Code analysis by @unknown can be found in this comment.

Linked issues

Attachments

Comments 12

Confirmed. Use this command for testing:

/tellraw @p {"text":"test","color":"blue","clickEvent":{"action":"run_command","value":"/give @p minecraft:tnt"}}

This issue is still unresolved and i recorded a video showing the bug. I use the command /tellraw @p {"text":"test","color":"blue","clickEvent":{"action":"run_command","value":"/give @p minecraft:dirt"}} and click the test button as far as i can go. As you can see in the video it goes 3 over what it is meant to.

https://www.youtube.com/watch?v=3JxwBrr44TA&feature=youtu.be

Confirmed for

  • 15w45a Also affects hoverEvent s

Confirmed for

  • 15w50a

The reason for that is that in the getChatComponent(int p_146236_1_, int p_146236_2_) method of the /Client/src/net/minecraft/client/gui/GuiNewChat.java class (MCP 1.8 names) the number of visible lines was added to the the calculated visible chat height. Removing this fixed the problem. However the fact that the methods calculateChatboxWidth(float p_146233_0_) and calculateChatboxHeight(float p_146243_0_) are partwise used is problematic as they do not consider the custom chat settings (for example Minecraft.getMinecraft().gameSettings.chatWidth).

public IChatComponent getChatComponent(int p_146236_1_, int p_146236_2_)
{
	if (!this.getChatOpen())
	{
		return null;
	}
	else
	{
		//...

		if (var6 >= 0 && var7 >= 0)
		{
			int var8 = Math.min(this.getLineCount(), this.field_146253_i.size());
			
			// Changed this
			//if (var6 <= MathHelper.floor_float((float)this.getChatWidth() / this.getChatScale()) && var7 < this.mc.fontRendererObj.FONT_HEIGHT * var8 + var8)
			if (var6 <= MathHelper.floor_float((float)this.getChatWidth() / this.getChatScale()) && var7 < this.mc.fontRendererObj.FONT_HEIGHT * var8)
			{
				//...

				return null;
			}
			else
			{
				return null;
			}
		}
		else
		{
			return null;
		}
	}
}
2 more comments

Confirmed for 1.13.1.

Confirmed for 1.15 pre-6

Confirmed in 1.16.1.

Confirmed in 1.18.2

This has been fixed in 22w45a. I attached two videos: one demonstrating a fixed version, the other demonstrating a bugged version.

Morgan Armstrong

(Unassigned)

Confirmed

UI

chat, offset

Minecraft 13w37a, Minecraft 1.8, Minecraft 1.8.1-pre3, Minecraft 15w45a, Minecraft 15w50a, ..., Minecraft 1.12 Pre-Release 2, Minecraft 1.13.1, 1.15 Pre-release 6, 1.16.1, 1.18.2

22w45a

Retrieved