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

Method handleMouseInput

Minecraft-Utils/1.8/src/FileSelector.java:321–403  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

319 }
320
321 @Override
322 public void handleMouseInput() {
323 if (!isMouseWithinSlotBounds())
324 return;
325
326 int var;
327 if (Mouse.getEventButton() == 0 && Mouse.getEventButtonState() && mouseY >= top && mouseY <= bottom) {
328 int x = mouseX - left;
329 int y = mouseY - top + (int) amountScrolled - 4;
330 int idY = y / getSlotHeight();
331 int idX = x / selectionBoxWidth;
332 int id = idX + idY * columnCount;
333 if (id < files.size() && id >= 0 && x >= 0 && y >= 0 && idX < columnCount) {
334 selectedFile = id;
335 elementClicked(id, false, mouseX, mouseY);
336 } else if (id < 0) {
337 //this.a(mouseX - var, mouseY - top + (int) this.n - 4);
338 }
339 }
340
341 if (Mouse.isButtonDown(0)) {
342 if (initialClickY == -1) {
343 boolean var9 = true;
344 if (mouseY >= top && mouseY <= bottom) {
345 int x = mouseX - left;
346 int y = mouseY - top + (int) amountScrolled - 4;
347 int idY = y / getSlotHeight();
348 int idX = x / selectionBoxWidth;
349 int id = idX + idY * columnCount;
350 if (id < files.size() && id >= 0 && x >= 0 && y >= 0 && idX < columnCount) {
351 boolean doubleClick = id == selectedFile && MinecraftFactory.getVars().getSystemTime() - lastClicked < 250L;
352 this.selectedFile = id;
353 elementClicked(id, doubleClick, mouseX, mouseY);
354 this.lastClicked = MinecraftFactory.getVars().getSystemTime();
355 } else if (id < 0) {
356 //this.a(mouseX - var1, mouseY - top + (int) this.n - 4);
357 var9 = false;
358 }
359
360 int scrollBarX0 = getScrollBarX();
361 int scrollBarX1 = scrollBarX0 + 6;
362 if (mouseX >= scrollBarX0 && mouseX <= scrollBarX1) {
363 scrollMultiplier = -1.0F;
364 int var7 = m();
365 if (var7 < 1) {
366 var7 = 1;
367 }
368
369 int var8 = (int) ((float) ((bottom - top) * (bottom - top)) / (float) getContentHeight());
370 var8 = uv.a(var8, 32, bottom - top - 8);
371 scrollMultiplier /= (float) (bottom - top - var8) / (float) var7;
372 } else {
373 scrollMultiplier = 1.0F;
374 }
375
376 if (var9) {
377 initialClickY = mouseY;
378 } 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