MCPcopy Create free account
hub / github.com/5zig/The-5zig-Mod / mouseClicked

Method mouseClicked

Minecraft-Utils/1.13/src/GuiList.java:339–377  ·  view source on GitHub ↗
(int mouseX, int mouseY)

Source from the content-addressed store, hash-verified

337 }
338
339 @Override
340 public void mouseClicked(int mouseX, int mouseY) {
341 hasSelected = mouseX >= getLeft() && mouseX <= getRight() && mouseY >= getTop() & mouseY <= getBottom();
342
343 if (this.m() && this.b((double)mouseX, (double)mouseY)) {
344 int var6 = this.a((double)mouseX, (double)mouseY);
345 if (var6 == -1) {
346 this.a((int)(mouseX - (double)(this.k + this.f / 2 - this.e() / 2)), (int)(mouseY - (double)this.h) + (int)this.o - 4); // TODO
347 } else if (this.a(var6, 0, (double)mouseX, (double)mouseY)) {
348 if (this.b().size() > var6) {
349 this.a(this.b().get(var6));
350 }
351
352 this.e(true);
353 this.b(var6);
354 }
355 }
356
357 if (hasSelected) {
358 synchronized (rows) {
359 for (int rowIndex = 0; rowIndex < heightMap.size(); ++rowIndex) {
360 int newY = (int) (getTop() + heightMap.get(rowIndex) + getHeaderPadding() - getCurrentScroll());
361 int slotHeight = rows.get(rowIndex).getLineHeight() - 4;
362 if ((newY <= getBottom()) && (newY + slotHeight >= getTop())) {
363 Row row = rows.get(rowIndex);
364 if (row instanceof RowExtended) {
365 IButton pressed = ((RowExtended) row).mousePressed(mouseX, mouseY);
366 if (pressed != null) {
367 if (selectedButton != null && pressed != selectedButton)
368 selectedButton.mouseClicked(mouseX, mouseY);
369 selectedButton = pressed;
370 return;
371 }
372 }
373 }
374 }
375 }
376 }
377 }
378
379 /**
380 * @return x-coordinate of the scroll bar

Callers

nothing calls this directly

Calls 15

getLeftMethod · 0.95
getRightMethod · 0.95
getTopMethod · 0.95
getBottomMethod · 0.95
bMethod · 0.95
aMethod · 0.95
eMethod · 0.95
getHeaderPaddingMethod · 0.95
getCurrentScrollMethod · 0.95
sizeMethod · 0.80
getMethod · 0.65
getLineHeightMethod · 0.65

Tested by

no test coverage detected