feat: Added scrolling to change slot

This commit is contained in:
Jakub Žitník 2025-03-09 12:08:52 +01:00
parent 9e42e7ade8
commit 0f6d02a92e
Signed by: jzitnik
GPG Key ID: C577A802A6AF4EF3

View File

@ -39,6 +39,23 @@ public class MouseHandler {
} }
private void scroll(MouseEvent mouseEvent) { private void scroll(MouseEvent mouseEvent) {
if (game.getWindow() == Window.WORLD) {
if (mouseEvent.getButton() == MouseEvent.Button.WheelUp) {
if (game.getInventory().getItemInhHandIndex() == 0) {
game.changeSlot(8, screenRenderer);
} else {
game.changeSlot(game.getInventory().getItemInhHandIndex() - 1, screenRenderer);
}
}
if (mouseEvent.getButton() == MouseEvent.Button.WheelDown) {
if (game.getInventory().getItemInhHandIndex() == 8) {
game.changeSlot(0, screenRenderer);
} else {
game.changeSlot(game.getInventory().getItemInhHandIndex() + 1, screenRenderer);
}
}
}
} }
private void leftClick(MouseEvent mouseEvent) { private void leftClick(MouseEvent mouseEvent) {