(int mouseX, int mouseY)
| 416 | } |
| 417 | |
| 418 | private fj getChatComponent(int mouseX, int mouseY) { |
| 419 | if (!this.isChatOpened()) { |
| 420 | return null; |
| 421 | } else { |
| 422 | int resolutionScaleFactor = MinecraftFactory.getVars().getScaleFactor(); |
| 423 | float chatScale = this.getChatScale(); |
| 424 | int x = mouseX / resolutionScaleFactor - MinecraftFactory.getVars().getScaledWidth() + getChatWidth() + 6; |
| 425 | int y = mouseY / resolutionScaleFactor - 27; |
| 426 | x = qh.d((float) x / chatScale); |
| 427 | y = qh.d((float) y / chatScale); |
| 428 | if (x >= 0 && y >= 0) { |
| 429 | int lineCount = Math.min(this.getLineCount(), this.singleChatLines.size()); |
| 430 | if (x <= qh.d((float) this.getChatWidth() / this.getChatScale() + 3 / getChatScale()) && y < MinecraftFactory.getVars().getFontHeight() * lineCount) { |
| 431 | int lineId = y / MinecraftFactory.getVars().getFontHeight() + this.scrollPos; |
| 432 | if (lineId >= 0 && lineId < this.singleChatLines.size()) { |
| 433 | GuiChatLine chatLine = this.singleChatLines.get(lineId); |
| 434 | int widthCounter = MinecraftFactory.getClassProxyCallback().is2ndChatTextLeftbound() ? 0 : |
| 435 | (int) ((getChatWidth() - MinecraftFactory.getVars().getStringWidth(strip(chatLine.getChatComponent().d(), false)) * chatScale) / chatScale); |
| 436 | |
| 437 | for (Object chatComponentObject : chatLine.getChatComponent()) { |
| 438 | fj chatComponent = (fj) chatComponentObject; |
| 439 | if (chatComponent instanceof fq) { // ChatComponentText |
| 440 | widthCounter += MinecraftFactory.getVars().getStringWidth(strip(((fq) chatComponent).g(), false)); |
| 441 | if (widthCounter > x) { |
| 442 | return chatComponent; |
| 443 | } |
| 444 | } |
| 445 | } |
| 446 | } |
| 447 | |
| 448 | return null; |
| 449 | } else { |
| 450 | return null; |
| 451 | } |
| 452 | } else { |
| 453 | return null; |
| 454 | } |
| 455 | } |
| 456 | } |
| 457 | |
| 458 | public boolean isChatOpened() { |
| 459 | return MinecraftFactory.getVars().getMinecraftScreen() instanceof bct; |
no test coverage detected