(int mouseX, int mouseY)
| 275 | } |
| 276 | |
| 277 | private hh getChatComponent(int mouseX, int mouseY) { |
| 278 | if (!this.isChatOpened()) { |
| 279 | return null; |
| 280 | } else { |
| 281 | bit scaledResolution = new bit(((Variables) MinecraftFactory.getVars()).getMinecraft()); |
| 282 | int resolutionScaleFactor = scaledResolution.e(); |
| 283 | float chatScale = this.getChatScale(); |
| 284 | int x = mouseX / resolutionScaleFactor - MinecraftFactory.getVars().getScaledWidth() + getChatWidth(); |
| 285 | int y = mouseY / resolutionScaleFactor - 40; |
| 286 | x = rk.d((float) x / chatScale); |
| 287 | y = rk.d((float) y / chatScale); |
| 288 | if (x >= 0 && y >= 0) { |
| 289 | int lineCount = Math.min(this.getLineCount(), this.singleChatLines.size()); |
| 290 | if (x <= rk.d((float) this.getChatWidth() / this.getChatScale() + 3 / getChatScale()) && y < MinecraftFactory.getVars().getFontHeight() * lineCount) { |
| 291 | int lineId = y / MinecraftFactory.getVars().getFontHeight() + this.scrollPos; |
| 292 | if (lineId >= 0 && lineId < this.singleChatLines.size()) { |
| 293 | GuiChatLine chatLine = this.singleChatLines.get(lineId); |
| 294 | int widthCounter = MinecraftFactory.getClassProxyCallback().is2ndChatTextLeftbound() ? 0 : |
| 295 | (int) ((getChatWidth() - MinecraftFactory.getVars().getStringWidth(optStripColor(chatLine.getChatComponent().d())) * chatScale) / chatScale); |
| 296 | |
| 297 | for (hh chatComponent : chatLine.getChatComponent()) { |
| 298 | if (chatComponent instanceof ho) { // ChatComponentText |
| 299 | widthCounter += MinecraftFactory.getVars().getStringWidth(optStripColor(((ho) chatComponent).g())); |
| 300 | if (widthCounter > x) { |
| 301 | return chatComponent; |
| 302 | } |
| 303 | } |
| 304 | } |
| 305 | } |
| 306 | |
| 307 | return null; |
| 308 | } else { |
| 309 | return null; |
| 310 | } |
| 311 | } else { |
| 312 | return null; |
| 313 | } |
| 314 | } |
| 315 | } |
| 316 | |
| 317 | private String optStripColor(String text) { |
| 318 | return bjc.a(text, false); |
no test coverage detected