Welcome on MasterOf13FPS! MasterOf13FPS

Register today or sign up if you are already a member and never miss any cool content again :)

How to make in click gui scrollable module list?

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.
Code:
if (Mouse.isCreated()) {
After that you get the current mouse event "dwheel" and put it into a variable.
Code:
int wheel = Mouse.getEventDWheel();
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.
Code:
if (wheel != 0){
    if (wheel > 0){
If wheel (-variable) is positive you move all your modules (as example through a for loop) up.
Code:
for (Module module : moduleList) {
    module.setPosition(module.getX(), module.getY() + [thescrollspeedyouwant])
}
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.
 
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.
Code:
if (Mouse.isCreated()) {
After that you get the current mouse event "dwheel" and put it into a variable.
Code:
int wheel = Mouse.getEventDWheel();
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.
Code:
if (wheel != 0){
    if (wheel > 0){
If wheel (-variable) is positive you move all your modules (as example through a for loop) up.
Code:
for (Module module : moduleList) {
    module.setPosition(module.getX(), module.getY() + [thescrollspeedyouwant])
}
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.
thanks, btw, my settings in the group box don't scrolls and self group box too, but I found how to make a scroll and group box scrolls now, but settings not.
 
be human, I just asked about scrolling, no need to strain so much because of my "stupidity"
Also called code of people who worked on it alteast for multiple years trash in a post asking how to make scrolling 🤦‍♂️
 
shape1
shape2
shape3
shape4
shape5
shape6
Back
Top