From 5d003bd84669110dbad4570cccad6c5e603705ac Mon Sep 17 00:00:00 2001 From: McHorse Date: Wed, 11 Aug 2021 08:29:55 +0100 Subject: [PATCH] Fix icons not being registered on the server side --- src/main/java/mchorse/mclib/CommonProxy.java | 3 + .../mchorse/mclib/client/gui/utils/Icons.java | 200 ++++++++++++------ 2 files changed, 138 insertions(+), 65 deletions(-) diff --git a/src/main/java/mchorse/mclib/CommonProxy.java b/src/main/java/mchorse/mclib/CommonProxy.java index 939ea4f9..35c0c377 100644 --- a/src/main/java/mchorse/mclib/CommonProxy.java +++ b/src/main/java/mchorse/mclib/CommonProxy.java @@ -1,5 +1,6 @@ package mchorse.mclib; +import mchorse.mclib.client.gui.utils.Icons; import mchorse.mclib.config.ConfigHandler; import mchorse.mclib.config.ConfigManager; import mchorse.mclib.network.mclib.Dispatcher; @@ -26,5 +27,7 @@ public void preInit(FMLPreInitializationEvent event) public void init(FMLInitializationEvent event) { this.configs.register(this.configFolder); + + Icons.register(); } } \ No newline at end of file diff --git a/src/main/java/mchorse/mclib/client/gui/utils/Icons.java b/src/main/java/mchorse/mclib/client/gui/utils/Icons.java index 8df46cfe..7ede7469 100644 --- a/src/main/java/mchorse/mclib/client/gui/utils/Icons.java +++ b/src/main/java/mchorse/mclib/client/gui/utils/Icons.java @@ -12,73 +12,143 @@ public class Icons public static final Icon NONE = new Icon(null, 0, 0); - public static final Icon GEAR = IconRegistry.register("gear", new Icon(ICONS, 0, 0)); - public static final Icon MORE = IconRegistry.register("more", new Icon(ICONS, 16, 0)); - public static final Icon SAVED = IconRegistry.register("saved", new Icon(ICONS, 32, 0)); - public static final Icon SAVE = IconRegistry.register("save", new Icon(ICONS, 48, 0)); - public static final Icon ADD = IconRegistry.register("add", new Icon(ICONS, 64, 0)); - public static final Icon DUPE = IconRegistry.register("dupe", new Icon(ICONS, 80, 0)); - public static final Icon REMOVE = IconRegistry.register("remove", new Icon(ICONS, 96, 0)); - public static final Icon POSE = IconRegistry.register("pose", new Icon(ICONS, 112, 0)); - public static final Icon FILTER = IconRegistry.register("filter", new Icon(ICONS, 128, 0)); - public static final Icon MOVE_UP = IconRegistry.register("move_up", new Icon(ICONS, 144, 0, 16, 8)); - public static final Icon MOVE_DOWN = IconRegistry.register("move_down", new Icon(ICONS, 144, 8, 16, 8)); - public static final Icon LOCKED = IconRegistry.register("locked", new Icon(ICONS, 160, 0)); - public static final Icon UNLOCKED = IconRegistry.register("unlocked", new Icon(ICONS, 176, 0)); - public static final Icon COPY = IconRegistry.register("copy", new Icon(ICONS, 192, 0)); - public static final Icon PASTE = IconRegistry.register("paste", new Icon(ICONS, 208, 0)); - public static final Icon CUT = IconRegistry.register("cut", new Icon(ICONS, 224, 0)); - public static final Icon REFRESH = IconRegistry.register("refresh", new Icon(ICONS, 240, 0)); + public static final Icon GEAR = new Icon(ICONS, 0, 0); + public static final Icon MORE = new Icon(ICONS, 16, 0); + public static final Icon SAVED = new Icon(ICONS, 32, 0); + public static final Icon SAVE = new Icon(ICONS, 48, 0); + public static final Icon ADD = new Icon(ICONS, 64, 0); + public static final Icon DUPE = new Icon(ICONS, 80, 0); + public static final Icon REMOVE = new Icon(ICONS, 96, 0); + public static final Icon POSE = new Icon(ICONS, 112, 0); + public static final Icon FILTER = new Icon(ICONS, 128, 0); + public static final Icon MOVE_UP = new Icon(ICONS, 144, 0, 16, 8); + public static final Icon MOVE_DOWN = new Icon(ICONS, 144, 8, 16, 8); + public static final Icon LOCKED = new Icon(ICONS, 160, 0); + public static final Icon UNLOCKED = new Icon(ICONS, 176, 0); + public static final Icon COPY = new Icon(ICONS, 192, 0); + public static final Icon PASTE = new Icon(ICONS, 208, 0); + public static final Icon CUT = new Icon(ICONS, 224, 0); + public static final Icon REFRESH = new Icon(ICONS, 240, 0); - public static final Icon DOWNLOAD = IconRegistry.register("download", new Icon(ICONS, 0, 16)); - public static final Icon UPLOAD = IconRegistry.register("upload", new Icon(ICONS, 16, 16)); - public static final Icon SERVER = IconRegistry.register("server", new Icon(ICONS, 32, 16)); - public static final Icon FOLDER = IconRegistry.register("folder", new Icon(ICONS, 48, 16)); - public static final Icon IMAGE = IconRegistry.register("image", new Icon(ICONS, 64, 16)); - public static final Icon EDIT = IconRegistry.register("edit", new Icon(ICONS, 80, 16)); - public static final Icon MATERIAL = IconRegistry.register("material", new Icon(ICONS, 96, 16)); - public static final Icon CLOSE = IconRegistry.register("close", new Icon(ICONS, 112, 16)); - public static final Icon LIMB = IconRegistry.register("limb", new Icon(ICONS, 128, 16)); - public static final Icon CODE = IconRegistry.register("code", new Icon(ICONS, 144, 16)); - public static final Icon MOVE_LEFT = IconRegistry.register("move_left", new Icon(ICONS, 144, 16, 8, 16)); - public static final Icon MOVE_RIGHT = IconRegistry.register("move_right", new Icon(ICONS, 152, 16, 8, 16)); - public static final Icon HELP = IconRegistry.register("help", new Icon(ICONS, 160, 16)); - public static final Icon LEFT_HANDLE = IconRegistry.register("left_handle", new Icon(ICONS, 176, 16)); - public static final Icon MAIN_HANDLE = IconRegistry.register("main_handle", new Icon(ICONS, 192, 16)); - public static final Icon RIGHT_HANDLE = IconRegistry.register("right_handle", new Icon(ICONS, 208, 16)); - public static final Icon REVERSE = IconRegistry.register("reverse", new Icon(ICONS, 224, 16)); - public static final Icon BLOCK = IconRegistry.register("block", new Icon(ICONS, 240, 16)); + public static final Icon DOWNLOAD = new Icon(ICONS, 0, 16); + public static final Icon UPLOAD = new Icon(ICONS, 16, 16); + public static final Icon SERVER = new Icon(ICONS, 32, 16); + public static final Icon FOLDER = new Icon(ICONS, 48, 16); + public static final Icon IMAGE = new Icon(ICONS, 64, 16); + public static final Icon EDIT = new Icon(ICONS, 80, 16); + public static final Icon MATERIAL = new Icon(ICONS, 96, 16); + public static final Icon CLOSE = new Icon(ICONS, 112, 16); + public static final Icon LIMB = new Icon(ICONS, 128, 16); + public static final Icon CODE = new Icon(ICONS, 144, 16); + public static final Icon MOVE_LEFT = new Icon(ICONS, 144, 16, 8, 16); + public static final Icon MOVE_RIGHT = new Icon(ICONS, 152, 16, 8, 16); + public static final Icon HELP = new Icon(ICONS, 160, 16); + public static final Icon LEFT_HANDLE = new Icon(ICONS, 176, 16); + public static final Icon MAIN_HANDLE = new Icon(ICONS, 192, 16); + public static final Icon RIGHT_HANDLE = new Icon(ICONS, 208, 16); + public static final Icon REVERSE = new Icon(ICONS, 224, 16); + public static final Icon BLOCK = new Icon(ICONS, 240, 16); - public static final Icon FAVORITE = IconRegistry.register("favorite", new Icon(ICONS, 0, 32)); - public static final Icon VISIBLE = IconRegistry.register("visible", new Icon(ICONS, 16, 32)); - public static final Icon INVISIBLE = IconRegistry.register("invisible", new Icon(ICONS, 32, 32)); - public static final Icon PLAY = IconRegistry.register("play", new Icon(ICONS, 48, 32)); - public static final Icon PAUSE = IconRegistry.register("pause", new Icon(ICONS, 64, 32)); - public static final Icon MAXIMIZE = IconRegistry.register("maximize", new Icon(ICONS, 80, 32)); - public static final Icon MINIMIZE = IconRegistry.register("minimize", new Icon(ICONS, 96, 32)); - public static final Icon STOP = IconRegistry.register("stop", new Icon(ICONS, 112, 32)); - public static final Icon FULLSCREEN = IconRegistry.register("fullscreen", new Icon(ICONS, 128, 32)); - public static final Icon ALL_DIRECTIONS = IconRegistry.register("all_directions", new Icon(ICONS, 144, 32)); - public static final Icon SPHERE = IconRegistry.register("sphere", new Icon(ICONS, 160, 32)); - public static final Icon SHIFT_TO = IconRegistry.register("shift_to", new Icon(ICONS, 176, 32)); - public static final Icon SHIFT_FORWARD = IconRegistry.register("shift_forward", new Icon(ICONS, 192, 32)); - public static final Icon SHIFT_BACKWARD = IconRegistry.register("shift_backward", new Icon(ICONS, 208, 32)); - public static final Icon MOVE_TO = IconRegistry.register("move_to", new Icon(ICONS, 224, 32)); - public static final Icon GRAPH = IconRegistry.register("graph", new Icon(ICONS, 240, 32)); + public static final Icon FAVORITE = new Icon(ICONS, 0, 32); + public static final Icon VISIBLE = new Icon(ICONS, 16, 32); + public static final Icon INVISIBLE = new Icon(ICONS, 32, 32); + public static final Icon PLAY = new Icon(ICONS, 48, 32); + public static final Icon PAUSE = new Icon(ICONS, 64, 32); + public static final Icon MAXIMIZE = new Icon(ICONS, 80, 32); + public static final Icon MINIMIZE = new Icon(ICONS, 96, 32); + public static final Icon STOP = new Icon(ICONS, 112, 32); + public static final Icon FULLSCREEN = new Icon(ICONS, 128, 32); + public static final Icon ALL_DIRECTIONS = new Icon(ICONS, 144, 32); + public static final Icon SPHERE = new Icon(ICONS, 160, 32); + public static final Icon SHIFT_TO = new Icon(ICONS, 176, 32); + public static final Icon SHIFT_FORWARD = new Icon(ICONS, 192, 32); + public static final Icon SHIFT_BACKWARD = new Icon(ICONS, 208, 32); + public static final Icon MOVE_TO = new Icon(ICONS, 224, 32); + public static final Icon GRAPH = new Icon(ICONS, 240, 32); - public static final Icon WRENCH = IconRegistry.register("wrench", new Icon(ICONS, 0, 48)); - public static final Icon EXCLAMATION = IconRegistry.register("exclamation", new Icon(ICONS, 16, 48)); - public static final Icon LEFTLOAD = IconRegistry.register("leftload", new Icon(ICONS, 32, 48)); - public static final Icon RIGHTLOAD = IconRegistry.register("rightload", new Icon(ICONS, 48, 48)); - public static final Icon BUBBLE = IconRegistry.register("bubble", new Icon(ICONS, 64, 48)); - public static final Icon FILE = IconRegistry.register("file", new Icon(ICONS, 80, 48)); - public static final Icon PROCESSOR = IconRegistry.register("processor", new Icon(ICONS, 96, 48)); - public static final Icon MAZE = IconRegistry.register("maze", new Icon(ICONS, 112, 48)); - public static final Icon BOOKMARK = IconRegistry.register("bookmark", new Icon(ICONS, 128, 48)); - public static final Icon SOUND = IconRegistry.register("sound", new Icon(ICONS, 144, 48)); - public static final Icon SEARCH = IconRegistry.register("search", new Icon(ICONS, 160, 48)); + public static final Icon WRENCH = new Icon(ICONS, 0, 48); + public static final Icon EXCLAMATION = new Icon(ICONS, 16, 48); + public static final Icon LEFTLOAD = new Icon(ICONS, 32, 48); + public static final Icon RIGHTLOAD = new Icon(ICONS, 48, 48); + public static final Icon BUBBLE = new Icon(ICONS, 64, 48); + public static final Icon FILE = new Icon(ICONS, 80, 48); + public static final Icon PROCESSOR = new Icon(ICONS, 96, 48); + public static final Icon MAZE = new Icon(ICONS, 112, 48); + public static final Icon BOOKMARK = new Icon(ICONS, 128, 48); + public static final Icon SOUND = new Icon(ICONS, 144, 48); + public static final Icon SEARCH = new Icon(ICONS, 160, 48); - public static final Icon CHECKBOARD = IconRegistry.register("checkboard", new Icon(ICONS, 0, 240)); - public static final Icon DISABLED = IconRegistry.register("disabled", new Icon(ICONS, 16, 240)); - public static final Icon CURSOR = IconRegistry.register("cursor", new Icon(ICONS, 32, 240)); + public static final Icon CHECKBOARD = new Icon(ICONS, 0, 240); + public static final Icon DISABLED = new Icon(ICONS, 16, 240); + public static final Icon CURSOR = new Icon(ICONS, 32, 240); + + public static void register() + { + IconRegistry.register("gear", GEAR); + IconRegistry.register("more", MORE); + IconRegistry.register("saved", SAVED); + IconRegistry.register("save", SAVE); + IconRegistry.register("add", ADD); + IconRegistry.register("dupe", DUPE); + IconRegistry.register("remove", REMOVE); + IconRegistry.register("pose", POSE); + IconRegistry.register("filter", FILTER); + IconRegistry.register("move_up", MOVE_UP); + IconRegistry.register("move_down", MOVE_DOWN); + IconRegistry.register("locked", LOCKED); + IconRegistry.register("unlocked", UNLOCKED); + IconRegistry.register("copy", COPY); + IconRegistry.register("paste", PASTE); + IconRegistry.register("cut", CUT); + IconRegistry.register("refresh", REFRESH); + + IconRegistry.register("download", DOWNLOAD); + IconRegistry.register("upload", UPLOAD); + IconRegistry.register("server", SERVER); + IconRegistry.register("folder", FOLDER); + IconRegistry.register("image", IMAGE); + IconRegistry.register("edit", EDIT); + IconRegistry.register("material", MATERIAL); + IconRegistry.register("close", CLOSE); + IconRegistry.register("limb", LIMB); + IconRegistry.register("code", CODE); + IconRegistry.register("move_left", MOVE_LEFT); + IconRegistry.register("move_right", MOVE_RIGHT); + IconRegistry.register("help", HELP); + IconRegistry.register("left_handle", LEFT_HANDLE); + IconRegistry.register("main_handle", MAIN_HANDLE); + IconRegistry.register("right_handle", RIGHT_HANDLE); + IconRegistry.register("reverse", REVERSE); + IconRegistry.register("block", BLOCK); + IconRegistry.register("favorite", FAVORITE); + IconRegistry.register("visible", VISIBLE); + IconRegistry.register("invisible", INVISIBLE); + IconRegistry.register("play", PLAY); + IconRegistry.register("pause", PAUSE); + IconRegistry.register("maximize", MAXIMIZE); + IconRegistry.register("minimize", MINIMIZE); + IconRegistry.register("stop", STOP); + IconRegistry.register("fullscreen", FULLSCREEN); + IconRegistry.register("all_directions", ALL_DIRECTIONS); + IconRegistry.register("sphere", SPHERE); + IconRegistry.register("shift_to", SHIFT_TO); + IconRegistry.register("shift_forward", SHIFT_FORWARD); + IconRegistry.register("shift_backward", SHIFT_BACKWARD); + IconRegistry.register("move_to", MOVE_TO); + IconRegistry.register("graph", GRAPH); + IconRegistry.register("wrench", WRENCH); + IconRegistry.register("exclamation", EXCLAMATION); + IconRegistry.register("leftload", LEFTLOAD); + IconRegistry.register("rightload", RIGHTLOAD); + IconRegistry.register("bubble", BUBBLE); + IconRegistry.register("file", FILE); + IconRegistry.register("processor", PROCESSOR); + IconRegistry.register("maze", MAZE); + IconRegistry.register("bookmark", BOOKMARK); + IconRegistry.register("sound", SOUND); + IconRegistry.register("search", SEARCH); + IconRegistry.register("checkboard", CHECKBOARD); + IconRegistry.register("disabled", DISABLED); + IconRegistry.register("cursor", CURSOR); + } } \ No newline at end of file