Skip to content

Commit 1a29d89

Browse files
if to switch
1 parent a603770 commit 1a29d89

File tree

1 file changed

+17
-7
lines changed

1 file changed

+17
-7
lines changed

src/main/java/gregtech/api/gui/widgets/SituationWidget.java

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import gregtech.api.gui.IRenderContext;
55
import gregtech.api.gui.Widget;
66
import gregtech.api.gui.resources.TextureArea;
7+
import gregtech.api.situation.SituationTypes;
78
import gregtech.api.util.Position;
89
import gregtech.api.util.Size;
910
import net.minecraft.client.resources.I18n;
@@ -36,13 +37,22 @@ public void setTooltipHoverString() {
3637
}
3738

3839
public SituationWidget setImage() {
39-
Enum iconTextureEnum = getSituationFromId(currentError).situationTypes;
40-
if (iconTextureEnum.equals(ERROR)) this.area = GuiTextures.STATUS_ERROR;
41-
else if (iconTextureEnum.equals(WARNING)) this.area = GuiTextures.STATUS_WARNING;
42-
else if (iconTextureEnum.equals(WORKING)) this.area = GuiTextures.STATUS_WORKING;
43-
else if (iconTextureEnum.equals(IDLE)) this.area = GuiTextures.STATUS_IDLING;
44-
else {
45-
this.area = null;
40+
SituationTypes iconTextures = getSituationFromId(currentError).situationTypes;
41+
switch (iconTextures) {
42+
case IDLE:
43+
this.area = GuiTextures.STATUS_IDLING;
44+
return this;
45+
case WORKING:
46+
this.area = GuiTextures.STATUS_WORKING;
47+
return this;
48+
case WARNING:
49+
this.area = GuiTextures.STATUS_WARNING;
50+
return this;
51+
case ERROR:
52+
this.area = GuiTextures.STATUS_ERROR;
53+
return this;
54+
default:
55+
this.area = null;
4656
}
4757
return this;
4858
}

0 commit comments

Comments
 (0)