Skip to content

Commit fcaf61b

Browse files
committed
fix disabled hover textures on AbstractCycleButtonWidget
1 parent c25615d commit fcaf61b

File tree

1 file changed

+24
-2
lines changed

1 file changed

+24
-2
lines changed

src/main/java/com/cleanroommc/modularui/widgets/AbstractCycleButtonWidget.java

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ public WidgetTheme getWidgetThemeInternal(ITheme theme) {
105105
public IDrawable getCurrentBackground(ITheme theme, WidgetTheme widgetTheme) {
106106
// make sure texture is up-to-date
107107
int state = getState();
108-
if (isHovering() && this.hoverBackground != null && this.hoverBackground[state] != null) {
108+
if (isHovering() && this.hoverBackground != null && this.hoverBackground[state] != null && this.hoverBackground[state] != IDrawable.NONE) {
109109
return this.hoverBackground[state];
110110
}
111111
return this.background != null && this.background[state] != null ? this.background[state] : super.getCurrentBackground(theme, widgetTheme);
@@ -114,7 +114,7 @@ public IDrawable getCurrentBackground(ITheme theme, WidgetTheme widgetTheme) {
114114
@Override
115115
public IDrawable getCurrentOverlay(ITheme theme, WidgetTheme widgetTheme) {
116116
int state = getState();
117-
if (isHovering() && this.hoverOverlay != null && this.hoverOverlay[state] != null) {
117+
if (isHovering() && this.hoverOverlay != null && this.hoverOverlay[state] != null && this.hoverBackground[state] != IDrawable.NONE) {
118118
return this.hoverOverlay[state];
119119
}
120120
return this.overlay != null && this.overlay[state] != null ? this.overlay[state] : super.getCurrentOverlay(theme, widgetTheme);
@@ -144,6 +144,28 @@ public void markTooltipDirty() {
144144
return tooltip;
145145
}
146146

147+
@Override
148+
public W disableHoverBackground() {
149+
if (this.hoverBackground != null) {
150+
Arrays.fill(this.hoverBackground, IDrawable.NONE);
151+
}
152+
if (getHoverBackground() == null) {
153+
super.hoverBackground(IDrawable.NONE);
154+
}
155+
return getThis();
156+
}
157+
158+
@Override
159+
public W disableHoverOverlay() {
160+
if (this.hoverOverlay != null) {
161+
Arrays.fill(this.hoverOverlay, IDrawable.NONE);
162+
}
163+
if (getHoverOverlay() == null) {
164+
super.hoverOverlay(IDrawable.NONE);
165+
}
166+
return getThis();
167+
}
168+
147169
protected W value(IIntValue<?> value) {
148170
this.intValue = value;
149171
setValue(value);

0 commit comments

Comments
 (0)