Skip to content

Commit

Permalink
Add mouse scroll functionality to the counting filter.
Browse files Browse the repository at this point in the history
  • Loading branch information
Direwolf20-MC committed Feb 1, 2024
1 parent 5c8254c commit 56c6b3a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,11 @@ public void openNode() {
Minecraft.getInstance().getSoundManager().play(SimpleSoundInstance.forUI(SoundEvents.UI_BUTTON_CLICK, 1.0F));
}

@Override
public boolean mouseScrolled(double mouseX, double mouseY, double delta) {
return super.mouseScrolled(mouseX, mouseY, delta);
}

@Override
public void saveSettings() {
if (showFilter)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -673,6 +673,14 @@ public boolean mouseReleased(double p_mouseReleased_1_, double p_mouseReleased_3

@Override
public boolean mouseScrolled(double mouseX, double mouseY, double delta) {
if (hoveredSlot == null)
return super.mouseScrolled(mouseX, mouseY, delta);
if (hoveredSlot instanceof FilterBasicSlot) {
if (filter.getItem() instanceof FilterCount) {
filterSlot(delta == 1d ? 0 : -1); //This just matches the logic of buttonClick where button 0 is +1 and any other button is -1
return true;
}
}
return super.mouseScrolled(mouseX, mouseY, delta);
}

Expand Down

0 comments on commit 56c6b3a

Please sign in to comment.