@@ -30,7 +30,7 @@ public class ModListWidget extends AlwaysSelectedEntryListWidget<ModListEntry> i
3030 private List <Mod > mods = null ;
3131 private final Set <Mod > addedMods = new HashSet <>();
3232 private String selectedModId = null ;
33- private boolean scrolling ;
33+ // private boolean scrolling;
3434 private final FabricIconHandler iconHandler = new FabricIconHandler ();
3535
3636 public ModListWidget (
@@ -50,15 +50,15 @@ public ModListWidget(
5050 }
5151
5252 @ Override
53- public void setScrollAmount (double amount ) {
54- super .setScrollAmount (amount );
55- int denominator = Math .max (0 , this .getMaxPosition () - (this .getBottom () - this .getY () - 4 ));
53+ public void setScrollY (double amount ) {
54+ super .setScrollY (amount );
55+ int denominator = Math .max (0 , this .getContentsHeightWithPadding () - (this .getBottom () - this .getY () - 4 ));
5656 if (denominator <= 0 ) {
5757 parent .updateScrollPercent (0 );
5858 } else {
59- parent .updateScrollPercent (getScrollAmount () / Math .max (
59+ parent .updateScrollPercent (getScrollY () / Math .max (
6060 0 ,
61- this .getMaxPosition () - (this .getBottom () - this .getY () - 4 )
61+ this .getContentsHeightWithPadding () - (this .getBottom () - this .getY () - 4 )
6262 ));
6363 }
6464 }
@@ -202,8 +202,8 @@ private void filter(String searchTerm, boolean refresh, boolean search) {
202202 }
203203 }
204204
205- if (getScrollAmount () > Math .max (0 , this .getMaxPosition () - (this .getBottom () - this .getY () - 4 ))) {
206- setScrollAmount (Math .max (0 , this .getMaxPosition () - (this .getBottom () - this .getY () - 4 )));
205+ if (getScrollY () > Math .max (0 , this .getContentsHeightWithPadding () - (this .getBottom () - this .getY () - 4 ))) {
206+ setScrollY (Math .max (0 , this .getContentsHeightWithPadding () - (this .getBottom () - this .getY () - 4 )));
207207 }
208208 }
209209
@@ -278,6 +278,8 @@ public void ensureVisible(ModListEntry entry) {
278278 super .ensureVisible (entry );
279279 }
280280
281+ // FIXME --> Was removed from super class (updateScrollingState / mouseClicked)
282+ /*
281283 @Override
282284 protected void updateScrollingState(double double_1, double double_2, int int_1) {
283285 super.updateScrollingState(double_1, double_2, int_1);
@@ -298,14 +300,15 @@ public boolean mouseClicked(double double_1, double double_2, int int_1) {
298300 return true;
299301 }
300302 } else if (int_1 == 0 && this.clickedHeader((int) (double_1 - (double) (this.getX() + this.width / 2 - this.getRowWidth() / 2)),
301- (int ) (double_2 - (double ) this .getY ()) + (int ) this .getScrollAmount () - 4
303+ (int) (double_2 - (double) this.getY()) + (int) this.getScrollY () - 4
302304 )) {
303305 return true;
304306 }
305307
306308 return this.scrolling;
307309 }
308310 }
311+ */
309312
310313 public boolean keyPressed (int keyCode , int scanCode , int modifiers ) {
311314 if (keyCode == GLFW .GLFW_KEY_UP || keyCode == GLFW .GLFW_KEY_DOWN ) {
@@ -318,7 +321,7 @@ public boolean keyPressed(int keyCode, int scanCode, int modifiers) {
318321 }
319322
320323 public final ModListEntry getEntryAtPos (double x , double y ) {
321- int int_5 = MathHelper .floor (y - (double ) this .getY ()) - this .headerHeight + (int ) this .getScrollAmount () - 4 ;
324+ int int_5 = MathHelper .floor (y - (double ) this .getY ()) - this .headerHeight + (int ) this .getScrollY () - 4 ;
322325 int index = int_5 / this .itemHeight ;
323326 return x < (double ) this .getScrollbarX () && x >= (double ) getRowLeft () && x <= (double ) (getRowLeft () + getRowWidth ()) && index >= 0 && int_5 >= 0 && index < this .getEntryCount () ?
324327 this .children ().get (index ) :
@@ -332,7 +335,7 @@ protected int getScrollbarX() {
332335
333336 @ Override
334337 public int getRowWidth () {
335- return this .width - (Math .max (0 , this .getMaxPosition () - (this .getBottom () - this .getY () - 4 )) > 0 ? 18 : 12 );
338+ return this .width - (Math .max (0 , this .getContentsHeightWithPadding () - (this .getBottom () - this .getY () - 4 )) > 0 ? 18 : 12 );
336339 }
337340
338341 @ Override
@@ -353,8 +356,8 @@ public ModsScreen getParent() {
353356 }
354357
355358 @ Override
356- protected int getMaxPosition () {
357- return super .getMaxPosition () + 4 ;
359+ protected int getContentsHeightWithPadding () {
360+ return super .getContentsHeightWithPadding () + 4 ;
358361 }
359362
360363 public int getDisplayedCountFor (Set <String > set ) {
0 commit comments