(int mouseX, int mouseY)
| 285 | } |
| 286 | |
| 287 | private ey getChatComponent(int mouseX, int mouseY) { |
| 288 | if (!this.isChatOpened()) { |
| 289 | return null; |
| 290 | } else { |
| 291 | bdp scaledResolution = new bdp(((Variables) MinecraftFactory.getVars()).getMinecraft()); |
| 292 | int resolutionScaleFactor = scaledResolution.e(); |
| 293 | float chatScale = this.getChatScale(); |
| 294 | int x = mouseX / resolutionScaleFactor - MinecraftFactory.getVars().getScaledWidth() + getChatWidth(); |
| 295 | int y = mouseY / resolutionScaleFactor - 40; |
| 296 | x = op.d((float) x / chatScale); |
| 297 | y = op.d((float) y / chatScale); |
| 298 | if (x >= 0 && y >= 0) { |
| 299 | int lineCount = Math.min(this.getLineCount(), this.singleChatLines.size()); |
| 300 | if (x <= op.d((float) this.getChatWidth() / this.getChatScale() + 3 / getChatScale()) && y < MinecraftFactory.getVars().getFontHeight() * lineCount) { |
| 301 | int lineId = y / MinecraftFactory.getVars().getFontHeight() + this.scrollPos; |
| 302 | if (lineId >= 0 && lineId < this.singleChatLines.size()) { |
| 303 | GuiChatLine chatLine = this.singleChatLines.get(lineId); |
| 304 | int widthCounter = MinecraftFactory.getClassProxyCallback().is2ndChatTextLeftbound() ? 0 : |
| 305 | (int) ((getChatWidth() - MinecraftFactory.getVars().getStringWidth(optStripColor(chatLine.getChatComponent().d())) * chatScale) / chatScale); |
| 306 | |
| 307 | for (ey chatComponent : chatLine.getChatComponent()) { |
| 308 | if (chatComponent instanceof fe) { // ChatComponentText |
| 309 | widthCounter += MinecraftFactory.getVars().getStringWidth(optStripColor(((fe) chatComponent).g())); |
| 310 | if (widthCounter > x) { |
| 311 | return chatComponent; |
| 312 | } |
| 313 | } |
| 314 | } |
| 315 | } |
| 316 | |
| 317 | return null; |
| 318 | } else { |
| 319 | return null; |
| 320 | } |
| 321 | } else { |
| 322 | return null; |
| 323 | } |
| 324 | } |
| 325 | } |
| 326 | |
| 327 | private String optStripColor(String text) { |
| 328 | return bdt.a(text, false); |
no test coverage detected