- Joined
- Aug 21, 2020
- Messages
- 27
- Reaction score
- 14
- Points
- 3
Ok, so:
First of all you wanna write the following code in the handleMouseInput() or handleMouseInputWithPos() method that exists in the GuiScreen class but can be overwritten in the gui of yours if it extends GuiScreen of minecraft. To get all your modules scrolling you need to set their y-position (according to your mousewheel action) down or up (on y-axis).
To do this you first of all whould check if the mouse got created succesfully to prevent potential errors.
After that you get the current mouse event "dwheel" and put it into a variable.
Next you check if your wheel (-variabel) is not 0 (which would mean the mousewheel wasn't moved) and if its positive (> 0, which means he scrolled up). If it would be negative (< 0, which would mean he scrolled down) you should do exactly the opposite and move you modules down instead of up.
If wheel (-variable) is positive you move all your modules (as example through a for loop) up.
This is all you have to do to get an working scrollable panel with all the modules in it moving up and down. If you have any issues you can always send me or @dirt a private message but its always nice if its in a thread so potentially everybody is possible to solve this (your) problem just by looking at it. But due to some poeple not helping properly this also is a solution.
First of all you wanna write the following code in the handleMouseInput() or handleMouseInputWithPos() method that exists in the GuiScreen class but can be overwritten in the gui of yours if it extends GuiScreen of minecraft. To get all your modules scrolling you need to set their y-position (according to your mousewheel action) down or up (on y-axis).
To do this you first of all whould check if the mouse got created succesfully to prevent potential errors.
Code:
if (Mouse.isCreated()) {
Code:
int wheel = Mouse.getEventDWheel();
Code:
if (wheel != 0){
if (wheel > 0){
Code:
for (Module module : moduleList) {
module.setPosition(module.getX(), module.getY() + [thescrollspeedyouwant])
}