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 6a159cf commit 0456157
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 @@ -15,7 +15,7 @@
public abstract class EntryListWidget extends ListWidget implements ListWidgetHelper {

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 @@ -88,7 +88,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 @@ -100,7 +100,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 @@ -283,7 +283,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 @@ -294,7 +294,7 @@ public void setScrollAmount(double amount) {
if (amount > getMaxScroll()) {
amount = getMaxScroll();
}
this.scrollAmount = amount;
super.scrollAmount = (float) (this.scrollAmount = amount);
}

@Override
Expand All @@ -304,10 +304,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 0456157

Please sign in to comment.