Skip to content

Commit

Permalink
fix quick configure button
Browse files Browse the repository at this point in the history
it appeared on the wrong entry if the mod list was scrolled down
  • Loading branch information
SpaceWalkerRS committed Jan 29, 2024
1 parent 173d8b4 commit 8bb9577
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ public class ModListWidget extends EntryListWidget implements AutoCloseable {
private List<Mod> mods = null;
private final Set<Mod> addedMods = new HashSet<>();
private String selectedModId = null;
private boolean scrolling;
private final FabricIconHandler iconHandler = new FabricIconHandler();
private ModListEntry selected;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public abstract class EntryListWidget extends ListWidget implements ListWidgetHe
protected int mouseX;
protected int mouseY;
protected double scrollAmount;
private boolean scrolling;
protected boolean scrolling;

public EntryListWidget(Minecraft minecraft, int i, int j, int k, int l, int m) {
super(minecraft, i, j, k, l, m);
Expand Down Expand Up @@ -90,7 +90,7 @@ public void render(int mouseX, int mouseY, float tickDelta) {
this.mouseYStart = -2.0f;
}
} else if (this.mouseYStart >= 0.0f) {
this.scrollAmount -= ((float) mouseY - this.mouseYStart) * this.scrollSpeedMultiplier;
super.scrollAmount = (float) (this.scrollAmount -= ((float) mouseY - this.mouseYStart) * this.scrollSpeedMultiplier);
this.mouseYStart = mouseY;
}
} else {
Expand All @@ -102,7 +102,7 @@ public void render(int mouseX, int mouseY, float tickDelta) {
} else if (n9 < 0) {
n9 = 1;
}
this.scrollAmount += (float) (n9 * this.entryHeight / 2);
super.scrollAmount = (float) (this.scrollAmount += (float) (n9 * this.entryHeight / 2));
}
this.minecraft.screen.handleMouse();
}
Expand Down Expand Up @@ -285,7 +285,7 @@ public int getScrollAmount() {
}

protected void scroll(int i) {
this.setScrollAmount(this.getScrollAmount() + (double)i);
this.setScrollAmount(this.scrollAmount + (double)i);
this.mouseYStart = -2.0F;
}

Expand All @@ -296,7 +296,7 @@ public void setScrollAmount(double amount) {
if (amount > getMaxScroll()) {
amount = getMaxScroll();
}
this.scrollAmount = amount;
super.scrollAmount = (float) (this.scrollAmount = amount);
}

@Override
Expand All @@ -306,10 +306,10 @@ public void doCapScrolling() {
max /= 2;
}
if (this.scrollAmount < 0.0F) {
this.scrollAmount = 0.0F;
super.scrollAmount = (float) (this.scrollAmount = 0.0F);
}
if (this.scrollAmount > max) {
this.scrollAmount = max;
super.scrollAmount = (float) (this.scrollAmount = max);
}
}

Expand Down

0 comments on commit 8bb9577

Please sign in to comment.