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

Method mouseClicked

Minecraft-Utils/1.12/src/GuiList.java:375–397  ·  view source on GitHub ↗
(int mouseX, int mouseY)

Source from the content-addressed store, hash-verified

373 }
374
375 @Override
376 public void mouseClicked(int mouseX, int mouseY) {
377 if (mouseX >= getLeft() && mouseX <= getRight() && mouseY >= getTop() & mouseY <= getBottom()) {
378 synchronized (rows) {
379 for (int rowIndex = 0; rowIndex < heightMap.size(); ++rowIndex) {
380 int newY = (int) (getTop() + heightMap.get(rowIndex) + getHeaderPadding() - getCurrentScroll());
381 int slotHeight = rows.get(rowIndex).getLineHeight() - 4;
382 if ((newY <= getBottom()) && (newY + slotHeight >= getTop())) {
383 Row row = rows.get(rowIndex);
384 if (row instanceof RowExtended) {
385 IButton pressed = ((RowExtended) row).mousePressed(mouseX, mouseY);
386 if (pressed != null) {
387 if (selectedButton != null && pressed != selectedButton)
388 selectedButton.mouseClicked(mouseX, mouseY);
389 selectedButton = pressed;
390 return;
391 }
392 }
393 }
394 }
395 }
396 }
397 }
398
399 /**
400 * @return x-coordinate of the scroll bar

Callers

nothing calls this directly

Calls 11

getLeftMethod · 0.95
getRightMethod · 0.95
getTopMethod · 0.95
getBottomMethod · 0.95
getHeaderPaddingMethod · 0.95
getCurrentScrollMethod · 0.95
sizeMethod · 0.80
getMethod · 0.65
getLineHeightMethod · 0.65
mousePressedMethod · 0.65
mouseClickedMethod · 0.65

Tested by

no test coverage detected