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

Method handleMouseInput

Minecraft-Utils/1.10/src/FileSelector.java:300–382  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

298 }
299
300 @Override
301 public void handleMouseInput() {
302 if (!isMouseWithinSlotBounds())
303 return;
304
305 int var;
306 if (Mouse.getEventButton() == 0 && Mouse.getEventButtonState() && mouseY >= top && mouseY <= bottom) {
307 int x = mouseX - left;
308 int y = mouseY - top + (int) amountScrolled - 4;
309 int idY = y / getSlotHeight();
310 int idX = x / selectionBoxWidth;
311 int id = idX + idY * columnCount;
312 if (id < files.size() && id >= 0 && x >= 0 && y >= 0 && idX < columnCount) {
313 selectedFile = id;
314 elementClicked(id, false, mouseX, mouseY);
315 } else if (id < 0) {
316 //this.a(mouseX - var, mouseY - top + (int) this.n - 4);
317 }
318 }
319
320 if (Mouse.isButtonDown(0)) {
321 if (initialClickY == -1) {
322 boolean var9 = true;
323 if (mouseY >= top && mouseY <= bottom) {
324 int x = mouseX - left;
325 int y = mouseY - top + (int) amountScrolled - 4;
326 int idY = y / getSlotHeight();
327 int idX = x / selectionBoxWidth;
328 int id = idX + idY * columnCount;
329 if (id < files.size() && id >= 0 && x >= 0 && y >= 0 && idX < columnCount) {
330 boolean doubleClick = id == selectedFile && MinecraftFactory.getVars().getSystemTime() - lastClicked < 250L;
331 this.selectedFile = id;
332 elementClicked(id, doubleClick, mouseX, mouseY);
333 this.lastClicked = MinecraftFactory.getVars().getSystemTime();
334 } else if (id < 0) {
335 //this.a(mouseX - var1, mouseY - top + (int) this.n - 4);
336 var9 = false;
337 }
338
339 int scrollBarX0 = getScrollBarX();
340 int scrollBarX1 = scrollBarX0 + 6;
341 if (mouseX >= scrollBarX0 && mouseX <= scrollBarX1) {
342 scrollMultiplier = -1.0F;
343 int var7 = m();
344 if (var7 < 1) {
345 var7 = 1;
346 }
347
348 int var8 = (int) ((float) ((bottom - top) * (bottom - top)) / (float) getContentHeight());
349 var8 = op.a(var8, 32, bottom - top - 8);
350 scrollMultiplier /= (float) (bottom - top - var8) / (float) var7;
351 } else {
352 scrollMultiplier = 1.0F;
353 }
354
355 if (var9) {
356 initialClickY = mouseY;
357 } else {

Callers

nothing calls this directly

Calls 11

getSlotHeightMethod · 0.95
elementClickedMethod · 0.95
isButtonDownMethod · 0.95
getVarsMethod · 0.95
getScrollBarXMethod · 0.95
mMethod · 0.95
getContentHeightMethod · 0.95
sizeMethod · 0.80
getSystemTimeMethod · 0.65
aMethod · 0.45

Tested by

no test coverage detected