From d87ff9d1e7dc0b35cca886fe648a0df6eb841dfc Mon Sep 17 00:00:00 2001 From: Sebastian Hartte Date: Sun, 13 Sep 2020 22:18:38 +0200 Subject: [PATCH] Formatting fixes. --- .../client/gui/widgets/EventRepeater.java | 21 +++++++++++-------- .../appeng/client/gui/widgets/Scrollbar.java | 19 +++++++++-------- 2 files changed, 22 insertions(+), 18 deletions(-) diff --git a/src/main/java/appeng/client/gui/widgets/EventRepeater.java b/src/main/java/appeng/client/gui/widgets/EventRepeater.java index bac50ec5c..8c804c2d8 100644 --- a/src/main/java/appeng/client/gui/widgets/EventRepeater.java +++ b/src/main/java/appeng/client/gui/widgets/EventRepeater.java @@ -21,15 +21,16 @@ package appeng.client.gui.widgets; import java.time.Duration; /** - * This class can be used to implement repeating events such as holding down a button to fire - * an event repeatedly while the button is still being held, or repeatedly scrolling down - * a page, while the mouse is held down on the scrollbar. + * This class can be used to implement repeating events such as holding down a + * button to fire an event repeatedly while the button is still being held, or + * repeatedly scrolling down a page, while the mouse is held down on the + * scrollbar. */ public class EventRepeater { /** - * -1 if no repeat event is scheduled. - * Otherwise contains the {@link System#nanoTime()} at which the next event should occur. + * -1 if no repeat event is scheduled. Otherwise contains the + * {@link System#nanoTime()} at which the next event should occur. */ private long nextEventTime = -1; @@ -49,7 +50,8 @@ public class EventRepeater { return; // No event scheduled } - // Use nanoTime here because it is monotonically increasing, while System.currentTimeMillis is not + // Use nanoTime here because it is monotonically increasing, while + // System.currentTimeMillis is not long nanoTime = System.nanoTime(); if (nanoTime < this.nextEventTime) { return; // Event time not reached @@ -63,10 +65,11 @@ public class EventRepeater { } /** - * Schedule the given callback to be called after a given initial delay, and then - * after the given interval repeatedly. + * Schedule the given callback to be called after a given initial delay, and + * then after the given interval repeatedly. * - *

Replaces any previously queued callback. + *

+ * Replaces any previously queued callback. */ public void repeat(EventCallback callback) { long time = System.nanoTime(); diff --git a/src/main/java/appeng/client/gui/widgets/Scrollbar.java b/src/main/java/appeng/client/gui/widgets/Scrollbar.java index 2a6b02ea5..b25b0e703 100644 --- a/src/main/java/appeng/client/gui/widgets/Scrollbar.java +++ b/src/main/java/appeng/client/gui/widgets/Scrollbar.java @@ -18,13 +18,15 @@ package appeng.client.gui.widgets; -import appeng.client.gui.AEBaseScreen; +import java.time.Duration; + import com.mojang.blaze3d.matrix.MatrixStack; + import net.minecraft.client.gui.AbstractGui; import net.minecraft.client.renderer.Rectangle2d; import net.minecraft.util.ResourceLocation; -import java.time.Duration; +import appeng.client.gui.AEBaseScreen; public class Scrollbar extends AbstractGui implements IScrollSource { @@ -86,10 +88,7 @@ public class Scrollbar extends AbstractGui implements IScrollSource { */ private boolean dragging; - private final EventRepeater eventRepeater = new EventRepeater( - Duration.ofMillis(250), - Duration.ofMillis(150) - ); + private final EventRepeater eventRepeater = new EventRepeater(Duration.ofMillis(250), Duration.ofMillis(150)); /** * Draws the handle of the scrollbar. @@ -101,7 +100,8 @@ public class Scrollbar extends AbstractGui implements IScrollSource { setBlitOffset(g.getBlitOffset()); // Draw the track (nice for debugging) - // fill(matrices, displayX, displayY, this.displayX + width, this.displayY + height, 0xffff0000); + // fill(matrices, displayX, displayY, this.displayX + width, this.displayY + + // height, 0xffff0000); g.bindTexture(TEXTURE); @@ -248,8 +248,9 @@ public class Scrollbar extends AbstractGui implements IScrollSource { } /** - * Ticks the scrollbar for the purposes of input-repeats (since mouse-downs are not repeat-triggered), - * used to repeatedly page-up or page-down when the mouse is held in the area above or below the scrollbar handle. + * Ticks the scrollbar for the purposes of input-repeats (since mouse-downs are + * not repeat-triggered), used to repeatedly page-up or page-down when the mouse + * is held in the area above or below the scrollbar handle. */ public void tick() { this.eventRepeater.tick();