mirror of
https://github.com/GTNewHorizons/waila.git
synced 2026-11-27 15:33:10 +00:00
Added some protection if icons are invalid (which should never happen...)
This commit is contained in:
1 parent
80a17c9af4
commit
ea105c698f
4 files changed
+19
-6
No files matched your search
@@ -3,10 +3,13 @@ import static mcp.mobius.waila.api.SpecialChars.*;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import mcp.mobius.waila.Waila;
|
||||
|
||||
public enum IconUI {
|
||||
HEART (52, 0, 9, 9, 52, 9, 9, 9, "a"),
|
||||
HHEART(61, 0, 9, 9, 52, 9, 9, 9, "b"),
|
||||
EHEART(52, 9, 9, 9, "c");
|
||||
EHEART(52, 9, 9, 9, "c"),
|
||||
BUBBLEEXP(25, 18, 9, 9, "x");
|
||||
|
||||
private final static HashMap<String, IconUI> lk = new HashMap<String, IconUI>();
|
||||
static {
|
||||
@@ -36,7 +39,13 @@ EHEART(52, 9, 9, 9, "c");
|
||||
}
|
||||
|
||||
public static IconUI bySymbol(String s){
|
||||
return lk.get(s);
|
||||
IconUI iconUI = lk.get(s);
|
||||
if (iconUI == null){
|
||||
return lk.get("x");
|
||||
}
|
||||
else {
|
||||
return lk.get(s);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -145,6 +145,10 @@ public class OverlayRenderer {
|
||||
|
||||
public static void renderIcon(int x, int y, int sx, int sy, IconUI icon){
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture(Gui.icons);
|
||||
|
||||
if (icon == null)
|
||||
return;
|
||||
|
||||
if (icon.bu != -1)
|
||||
drawTexturedModalRect(x, y, icon.bu, icon.bv, sx, sy, icon.bsu, icon.bsv);
|
||||
drawTexturedModalRect(x, y, icon.u, icon.v, sx, sy, icon.su, icon.sv);
|
||||
|
||||
Reference in new issue
Block a user