generated from isXander/FabricModTemplate
-
-
Notifications
You must be signed in to change notification settings - Fork 54
Open
Description
The exception is thrown upon clicking on the color picker button to open the picker. In ColorPickerWidget#render:
YetAnotherConfigLib/src/main/java/dev/isxander/yacl3/gui/controllers/ColorPickerWidget.java
Lines 151 to 155 in 5bf53ce
| //? if >=1.21.9 { | |
| if (isHoveringHueSlider(mouseX, mouseY)) { | |
| graphics.requestCursor(com.mojang.blaze3d.platform.cursor.CursorTypes.RESIZE_EW); | |
| } else if (isHoveringAlphaSlider(mouseX, mouseY)) { | |
| graphics.requestCursor(com.mojang.blaze3d.platform.cursor.CursorTypes.RESIZE_EW); |
The picker opens towards the bottom so the hue slider check is false,

so the else if branch for the alpha slider is entered next, which checks for the dimensions of the
alphaGradientDim field:YetAnotherConfigLib/src/main/java/dev/isxander/yacl3/gui/controllers/ColorPickerWidget.java
Lines 200 to 203 in 5bf53ce
| private boolean isHoveringAlphaSlider(double mouseX, double mouseY) { | |
| return mouseY >= alphaGradientDim.y() && mouseY <= alphaGradientDim.yLimit() | |
| && mouseX >= alphaGradientDim.x() && mouseX <= alphaGradientDim.xLimit(); | |
| } |
But this field is only initialized from ColorPickerWidget#setDimension, and is otherwise null:
YetAnotherConfigLib/src/main/java/dev/isxander/yacl3/gui/controllers/ColorPickerWidget.java
Lines 305 to 308 in 5bf53ce
| hueGradientDim = Dimension.ofInt(colorPickerDim.x(), colorPickerDim.yLimit() - sliderHeight - alphaSliderHeight, colorPickerDim.width(), sliderHeight); | |
| if (controller.allowAlpha()) { | |
| alphaGradientDim = Dimension.ofInt(hueGradientDim.x(), hueGradientDim.y() + alphaSliderHeight, hueGradientDim.width(), sliderHeight); | |
| } |
Hence, a NPE is thrown.
Fellteros, lugosieben, HintSystem, mrbuilder1961, Chilenderino and 2 more
Metadata
Metadata
Assignees
Labels
No labels