Skip to content

Commit 5d003bd

Browse files
committed
Fix icons not being registered on the server side
1 parent f9531d2 commit 5d003bd

File tree

2 files changed

+138
-65
lines changed

2 files changed

+138
-65
lines changed

src/main/java/mchorse/mclib/CommonProxy.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package mchorse.mclib;
22

3+
import mchorse.mclib.client.gui.utils.Icons;
34
import mchorse.mclib.config.ConfigHandler;
45
import mchorse.mclib.config.ConfigManager;
56
import mchorse.mclib.network.mclib.Dispatcher;
@@ -26,5 +27,7 @@ public void preInit(FMLPreInitializationEvent event)
2627
public void init(FMLInitializationEvent event)
2728
{
2829
this.configs.register(this.configFolder);
30+
31+
Icons.register();
2932
}
3033
}

src/main/java/mchorse/mclib/client/gui/utils/Icons.java

Lines changed: 135 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -12,73 +12,143 @@ public class Icons
1212

1313
public static final Icon NONE = new Icon(null, 0, 0);
1414

15-
public static final Icon GEAR = IconRegistry.register("gear", new Icon(ICONS, 0, 0));
16-
public static final Icon MORE = IconRegistry.register("more", new Icon(ICONS, 16, 0));
17-
public static final Icon SAVED = IconRegistry.register("saved", new Icon(ICONS, 32, 0));
18-
public static final Icon SAVE = IconRegistry.register("save", new Icon(ICONS, 48, 0));
19-
public static final Icon ADD = IconRegistry.register("add", new Icon(ICONS, 64, 0));
20-
public static final Icon DUPE = IconRegistry.register("dupe", new Icon(ICONS, 80, 0));
21-
public static final Icon REMOVE = IconRegistry.register("remove", new Icon(ICONS, 96, 0));
22-
public static final Icon POSE = IconRegistry.register("pose", new Icon(ICONS, 112, 0));
23-
public static final Icon FILTER = IconRegistry.register("filter", new Icon(ICONS, 128, 0));
24-
public static final Icon MOVE_UP = IconRegistry.register("move_up", new Icon(ICONS, 144, 0, 16, 8));
25-
public static final Icon MOVE_DOWN = IconRegistry.register("move_down", new Icon(ICONS, 144, 8, 16, 8));
26-
public static final Icon LOCKED = IconRegistry.register("locked", new Icon(ICONS, 160, 0));
27-
public static final Icon UNLOCKED = IconRegistry.register("unlocked", new Icon(ICONS, 176, 0));
28-
public static final Icon COPY = IconRegistry.register("copy", new Icon(ICONS, 192, 0));
29-
public static final Icon PASTE = IconRegistry.register("paste", new Icon(ICONS, 208, 0));
30-
public static final Icon CUT = IconRegistry.register("cut", new Icon(ICONS, 224, 0));
31-
public static final Icon REFRESH = IconRegistry.register("refresh", new Icon(ICONS, 240, 0));
15+
public static final Icon GEAR = new Icon(ICONS, 0, 0);
16+
public static final Icon MORE = new Icon(ICONS, 16, 0);
17+
public static final Icon SAVED = new Icon(ICONS, 32, 0);
18+
public static final Icon SAVE = new Icon(ICONS, 48, 0);
19+
public static final Icon ADD = new Icon(ICONS, 64, 0);
20+
public static final Icon DUPE = new Icon(ICONS, 80, 0);
21+
public static final Icon REMOVE = new Icon(ICONS, 96, 0);
22+
public static final Icon POSE = new Icon(ICONS, 112, 0);
23+
public static final Icon FILTER = new Icon(ICONS, 128, 0);
24+
public static final Icon MOVE_UP = new Icon(ICONS, 144, 0, 16, 8);
25+
public static final Icon MOVE_DOWN = new Icon(ICONS, 144, 8, 16, 8);
26+
public static final Icon LOCKED = new Icon(ICONS, 160, 0);
27+
public static final Icon UNLOCKED = new Icon(ICONS, 176, 0);
28+
public static final Icon COPY = new Icon(ICONS, 192, 0);
29+
public static final Icon PASTE = new Icon(ICONS, 208, 0);
30+
public static final Icon CUT = new Icon(ICONS, 224, 0);
31+
public static final Icon REFRESH = new Icon(ICONS, 240, 0);
3232

33-
public static final Icon DOWNLOAD = IconRegistry.register("download", new Icon(ICONS, 0, 16));
34-
public static final Icon UPLOAD = IconRegistry.register("upload", new Icon(ICONS, 16, 16));
35-
public static final Icon SERVER = IconRegistry.register("server", new Icon(ICONS, 32, 16));
36-
public static final Icon FOLDER = IconRegistry.register("folder", new Icon(ICONS, 48, 16));
37-
public static final Icon IMAGE = IconRegistry.register("image", new Icon(ICONS, 64, 16));
38-
public static final Icon EDIT = IconRegistry.register("edit", new Icon(ICONS, 80, 16));
39-
public static final Icon MATERIAL = IconRegistry.register("material", new Icon(ICONS, 96, 16));
40-
public static final Icon CLOSE = IconRegistry.register("close", new Icon(ICONS, 112, 16));
41-
public static final Icon LIMB = IconRegistry.register("limb", new Icon(ICONS, 128, 16));
42-
public static final Icon CODE = IconRegistry.register("code", new Icon(ICONS, 144, 16));
43-
public static final Icon MOVE_LEFT = IconRegistry.register("move_left", new Icon(ICONS, 144, 16, 8, 16));
44-
public static final Icon MOVE_RIGHT = IconRegistry.register("move_right", new Icon(ICONS, 152, 16, 8, 16));
45-
public static final Icon HELP = IconRegistry.register("help", new Icon(ICONS, 160, 16));
46-
public static final Icon LEFT_HANDLE = IconRegistry.register("left_handle", new Icon(ICONS, 176, 16));
47-
public static final Icon MAIN_HANDLE = IconRegistry.register("main_handle", new Icon(ICONS, 192, 16));
48-
public static final Icon RIGHT_HANDLE = IconRegistry.register("right_handle", new Icon(ICONS, 208, 16));
49-
public static final Icon REVERSE = IconRegistry.register("reverse", new Icon(ICONS, 224, 16));
50-
public static final Icon BLOCK = IconRegistry.register("block", new Icon(ICONS, 240, 16));
33+
public static final Icon DOWNLOAD = new Icon(ICONS, 0, 16);
34+
public static final Icon UPLOAD = new Icon(ICONS, 16, 16);
35+
public static final Icon SERVER = new Icon(ICONS, 32, 16);
36+
public static final Icon FOLDER = new Icon(ICONS, 48, 16);
37+
public static final Icon IMAGE = new Icon(ICONS, 64, 16);
38+
public static final Icon EDIT = new Icon(ICONS, 80, 16);
39+
public static final Icon MATERIAL = new Icon(ICONS, 96, 16);
40+
public static final Icon CLOSE = new Icon(ICONS, 112, 16);
41+
public static final Icon LIMB = new Icon(ICONS, 128, 16);
42+
public static final Icon CODE = new Icon(ICONS, 144, 16);
43+
public static final Icon MOVE_LEFT = new Icon(ICONS, 144, 16, 8, 16);
44+
public static final Icon MOVE_RIGHT = new Icon(ICONS, 152, 16, 8, 16);
45+
public static final Icon HELP = new Icon(ICONS, 160, 16);
46+
public static final Icon LEFT_HANDLE = new Icon(ICONS, 176, 16);
47+
public static final Icon MAIN_HANDLE = new Icon(ICONS, 192, 16);
48+
public static final Icon RIGHT_HANDLE = new Icon(ICONS, 208, 16);
49+
public static final Icon REVERSE = new Icon(ICONS, 224, 16);
50+
public static final Icon BLOCK = new Icon(ICONS, 240, 16);
5151

52-
public static final Icon FAVORITE = IconRegistry.register("favorite", new Icon(ICONS, 0, 32));
53-
public static final Icon VISIBLE = IconRegistry.register("visible", new Icon(ICONS, 16, 32));
54-
public static final Icon INVISIBLE = IconRegistry.register("invisible", new Icon(ICONS, 32, 32));
55-
public static final Icon PLAY = IconRegistry.register("play", new Icon(ICONS, 48, 32));
56-
public static final Icon PAUSE = IconRegistry.register("pause", new Icon(ICONS, 64, 32));
57-
public static final Icon MAXIMIZE = IconRegistry.register("maximize", new Icon(ICONS, 80, 32));
58-
public static final Icon MINIMIZE = IconRegistry.register("minimize", new Icon(ICONS, 96, 32));
59-
public static final Icon STOP = IconRegistry.register("stop", new Icon(ICONS, 112, 32));
60-
public static final Icon FULLSCREEN = IconRegistry.register("fullscreen", new Icon(ICONS, 128, 32));
61-
public static final Icon ALL_DIRECTIONS = IconRegistry.register("all_directions", new Icon(ICONS, 144, 32));
62-
public static final Icon SPHERE = IconRegistry.register("sphere", new Icon(ICONS, 160, 32));
63-
public static final Icon SHIFT_TO = IconRegistry.register("shift_to", new Icon(ICONS, 176, 32));
64-
public static final Icon SHIFT_FORWARD = IconRegistry.register("shift_forward", new Icon(ICONS, 192, 32));
65-
public static final Icon SHIFT_BACKWARD = IconRegistry.register("shift_backward", new Icon(ICONS, 208, 32));
66-
public static final Icon MOVE_TO = IconRegistry.register("move_to", new Icon(ICONS, 224, 32));
67-
public static final Icon GRAPH = IconRegistry.register("graph", new Icon(ICONS, 240, 32));
52+
public static final Icon FAVORITE = new Icon(ICONS, 0, 32);
53+
public static final Icon VISIBLE = new Icon(ICONS, 16, 32);
54+
public static final Icon INVISIBLE = new Icon(ICONS, 32, 32);
55+
public static final Icon PLAY = new Icon(ICONS, 48, 32);
56+
public static final Icon PAUSE = new Icon(ICONS, 64, 32);
57+
public static final Icon MAXIMIZE = new Icon(ICONS, 80, 32);
58+
public static final Icon MINIMIZE = new Icon(ICONS, 96, 32);
59+
public static final Icon STOP = new Icon(ICONS, 112, 32);
60+
public static final Icon FULLSCREEN = new Icon(ICONS, 128, 32);
61+
public static final Icon ALL_DIRECTIONS = new Icon(ICONS, 144, 32);
62+
public static final Icon SPHERE = new Icon(ICONS, 160, 32);
63+
public static final Icon SHIFT_TO = new Icon(ICONS, 176, 32);
64+
public static final Icon SHIFT_FORWARD = new Icon(ICONS, 192, 32);
65+
public static final Icon SHIFT_BACKWARD = new Icon(ICONS, 208, 32);
66+
public static final Icon MOVE_TO = new Icon(ICONS, 224, 32);
67+
public static final Icon GRAPH = new Icon(ICONS, 240, 32);
6868

69-
public static final Icon WRENCH = IconRegistry.register("wrench", new Icon(ICONS, 0, 48));
70-
public static final Icon EXCLAMATION = IconRegistry.register("exclamation", new Icon(ICONS, 16, 48));
71-
public static final Icon LEFTLOAD = IconRegistry.register("leftload", new Icon(ICONS, 32, 48));
72-
public static final Icon RIGHTLOAD = IconRegistry.register("rightload", new Icon(ICONS, 48, 48));
73-
public static final Icon BUBBLE = IconRegistry.register("bubble", new Icon(ICONS, 64, 48));
74-
public static final Icon FILE = IconRegistry.register("file", new Icon(ICONS, 80, 48));
75-
public static final Icon PROCESSOR = IconRegistry.register("processor", new Icon(ICONS, 96, 48));
76-
public static final Icon MAZE = IconRegistry.register("maze", new Icon(ICONS, 112, 48));
77-
public static final Icon BOOKMARK = IconRegistry.register("bookmark", new Icon(ICONS, 128, 48));
78-
public static final Icon SOUND = IconRegistry.register("sound", new Icon(ICONS, 144, 48));
79-
public static final Icon SEARCH = IconRegistry.register("search", new Icon(ICONS, 160, 48));
69+
public static final Icon WRENCH = new Icon(ICONS, 0, 48);
70+
public static final Icon EXCLAMATION = new Icon(ICONS, 16, 48);
71+
public static final Icon LEFTLOAD = new Icon(ICONS, 32, 48);
72+
public static final Icon RIGHTLOAD = new Icon(ICONS, 48, 48);
73+
public static final Icon BUBBLE = new Icon(ICONS, 64, 48);
74+
public static final Icon FILE = new Icon(ICONS, 80, 48);
75+
public static final Icon PROCESSOR = new Icon(ICONS, 96, 48);
76+
public static final Icon MAZE = new Icon(ICONS, 112, 48);
77+
public static final Icon BOOKMARK = new Icon(ICONS, 128, 48);
78+
public static final Icon SOUND = new Icon(ICONS, 144, 48);
79+
public static final Icon SEARCH = new Icon(ICONS, 160, 48);
8080

81-
public static final Icon CHECKBOARD = IconRegistry.register("checkboard", new Icon(ICONS, 0, 240));
82-
public static final Icon DISABLED = IconRegistry.register("disabled", new Icon(ICONS, 16, 240));
83-
public static final Icon CURSOR = IconRegistry.register("cursor", new Icon(ICONS, 32, 240));
81+
public static final Icon CHECKBOARD = new Icon(ICONS, 0, 240);
82+
public static final Icon DISABLED = new Icon(ICONS, 16, 240);
83+
public static final Icon CURSOR = new Icon(ICONS, 32, 240);
84+
85+
public static void register()
86+
{
87+
IconRegistry.register("gear", GEAR);
88+
IconRegistry.register("more", MORE);
89+
IconRegistry.register("saved", SAVED);
90+
IconRegistry.register("save", SAVE);
91+
IconRegistry.register("add", ADD);
92+
IconRegistry.register("dupe", DUPE);
93+
IconRegistry.register("remove", REMOVE);
94+
IconRegistry.register("pose", POSE);
95+
IconRegistry.register("filter", FILTER);
96+
IconRegistry.register("move_up", MOVE_UP);
97+
IconRegistry.register("move_down", MOVE_DOWN);
98+
IconRegistry.register("locked", LOCKED);
99+
IconRegistry.register("unlocked", UNLOCKED);
100+
IconRegistry.register("copy", COPY);
101+
IconRegistry.register("paste", PASTE);
102+
IconRegistry.register("cut", CUT);
103+
IconRegistry.register("refresh", REFRESH);
104+
105+
IconRegistry.register("download", DOWNLOAD);
106+
IconRegistry.register("upload", UPLOAD);
107+
IconRegistry.register("server", SERVER);
108+
IconRegistry.register("folder", FOLDER);
109+
IconRegistry.register("image", IMAGE);
110+
IconRegistry.register("edit", EDIT);
111+
IconRegistry.register("material", MATERIAL);
112+
IconRegistry.register("close", CLOSE);
113+
IconRegistry.register("limb", LIMB);
114+
IconRegistry.register("code", CODE);
115+
IconRegistry.register("move_left", MOVE_LEFT);
116+
IconRegistry.register("move_right", MOVE_RIGHT);
117+
IconRegistry.register("help", HELP);
118+
IconRegistry.register("left_handle", LEFT_HANDLE);
119+
IconRegistry.register("main_handle", MAIN_HANDLE);
120+
IconRegistry.register("right_handle", RIGHT_HANDLE);
121+
IconRegistry.register("reverse", REVERSE);
122+
IconRegistry.register("block", BLOCK);
123+
IconRegistry.register("favorite", FAVORITE);
124+
IconRegistry.register("visible", VISIBLE);
125+
IconRegistry.register("invisible", INVISIBLE);
126+
IconRegistry.register("play", PLAY);
127+
IconRegistry.register("pause", PAUSE);
128+
IconRegistry.register("maximize", MAXIMIZE);
129+
IconRegistry.register("minimize", MINIMIZE);
130+
IconRegistry.register("stop", STOP);
131+
IconRegistry.register("fullscreen", FULLSCREEN);
132+
IconRegistry.register("all_directions", ALL_DIRECTIONS);
133+
IconRegistry.register("sphere", SPHERE);
134+
IconRegistry.register("shift_to", SHIFT_TO);
135+
IconRegistry.register("shift_forward", SHIFT_FORWARD);
136+
IconRegistry.register("shift_backward", SHIFT_BACKWARD);
137+
IconRegistry.register("move_to", MOVE_TO);
138+
IconRegistry.register("graph", GRAPH);
139+
IconRegistry.register("wrench", WRENCH);
140+
IconRegistry.register("exclamation", EXCLAMATION);
141+
IconRegistry.register("leftload", LEFTLOAD);
142+
IconRegistry.register("rightload", RIGHTLOAD);
143+
IconRegistry.register("bubble", BUBBLE);
144+
IconRegistry.register("file", FILE);
145+
IconRegistry.register("processor", PROCESSOR);
146+
IconRegistry.register("maze", MAZE);
147+
IconRegistry.register("bookmark", BOOKMARK);
148+
IconRegistry.register("sound", SOUND);
149+
IconRegistry.register("search", SEARCH);
150+
IconRegistry.register("checkboard", CHECKBOARD);
151+
IconRegistry.register("disabled", DISABLED);
152+
IconRegistry.register("cursor", CURSOR);
153+
}
84154
}

0 commit comments

Comments
 (0)