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