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

Method getHoverItem

Minecraft-Utils/1.11/src/GuiList.java:660–682  ·  view source on GitHub ↗
(int mouseX, int mouseY)

Source from the content-addressed store, hash-verified

658 }
659
660 @Override
661 public E getHoverItem(int mouseX, int mouseY) {
662 int x1, x2;
663 if (leftbound) {
664 x1 = getLeft();
665 x2 = getLeft() + getRowWidth();
666 } else {
667 x1 = getLeft() + (getWidth() / 2 - getRowWidth() / 2);
668 x2 = getLeft() + getWidth() / 2 + getRowWidth() / 2;
669 }
670 if (mouseX >= x1 && mouseX <= x2) {
671 synchronized (rows) {
672 for (int i = 0; i < heightMap.size(); i++) {
673 Integer y = (int) (heightMap.get(i) + getTop() + getHeaderPadding() - getCurrentScroll());
674 E element = rows.get(i);
675 if (mouseY >= y && mouseY <= y + element.getLineHeight()) {
676 return element;
677 }
678 }
679 }
680 }
681 return null;
682 }
683
684 @Override
685 public boolean isDrawDefaultBackground() {

Callers

nothing calls this directly

Calls 9

getLeftMethod · 0.95
getRowWidthMethod · 0.95
getWidthMethod · 0.95
getTopMethod · 0.95
getHeaderPaddingMethod · 0.95
getCurrentScrollMethod · 0.95
sizeMethod · 0.80
getMethod · 0.65
getLineHeightMethod · 0.65

Tested by

no test coverage detected