Everything posted by MiSt Rocky
-
Configuration GUI (Version 1.8.x)
Thanks for the suggestions, I have been trying to find people who still do 1.7 or 1.8 modding, and haven't had much luck yet. I will try GTNH Devs next, I guess, and the Hypixel community (many mods for hypixel are 1.8)
-
Configuration GUI (Version 1.8.x)
I tried planet minecraft and it wasn't helpful, but have currently posted the question on the gamedev stackexchange, hopefully that will work.
-
Configuration GUI (Version 1.8.x)
OK, thanks! Is there an outdated versions forum or does forge not have anything like that?
-
Configuration GUI (Version 1.8.x)
So I have recently been working on a 1.8.9 forge mod, just to play around and see what there is (eventually I am planning on making a utilities mod with versions for 1.8-1.19, which is why I'm so far back). I have had no problems... until I got to configs. I already have code to create and read from a config file, but I can not figure out how to use Forge's mod options > config menu to allow GUI modification of the settings. I have had no luck finding any information on how to do this back in 1.8, so if anyone could help me out a bit (linking sources, giving example code, or referring me to a forge class that has the relevant code in it), I would greatly appreciate it. My current config code (in the Main class): public static Configuration config; private File confDir; public static Logger lmao; public static Configuration getConfig() { return config; } @EventHandler public void preinit(FMLPreInitializationEvent event) { lmao = event.getModLog(); confDir = event.getModConfigurationDirectory(); config = null; File configFile = new File(confDir,"config.cfg"); config = new Configuration(configFile); syncConfig(true); event.getModLog().log(Level.ALL,"Preinitialization complete."); } private static void syncConfig(boolean load) { List<String> propOrder = new ArrayList<String>(); if (!config.isChild) { if (load) { config.load(); } Property enableGlobalCfg = config.get(CATEGORY_GENERAL, "enableGlobalConfig", false).setShowInGui(false); if (enableGlobalCfg.getBoolean(false)) { Configuration.enableGlobalConfig(); } } Property prop; //set prop value, then: //propOrder.add(prop.getName()); prop = config.get(CATEGORY_GENERAL,"testbool",false); prop.comment = "for testing purposes"; prop.setLanguageKey("mod.conf.testbool"); propOrder.add(prop.getName()); prop = reConf.get(CATEGORY_GENERAL,"testvar","can you see this?"); prop.comment = "for testing purposes only"; prop.setLanguageKey("mod.conf.teststring"); propOrder.add(prop.getName()); config.setCategoryPropertyOrder(CATEGORY_GENERAL, propOrder); if (config.hasChanged()) { config.save(); } } public static void syncConf(boolean load1) { //public configuration sync method syncConfig(load1); } @SubscribeEvent public void onConfigChangedEvent(OnConfigChangedEvent event) { if (event.modID.equals(MODID)) { if (Configuration.CATEGORY_GENERAL.equals(event.configID)) { syncConfig(false); } } } //much of this was taken from or inspired by forge's source code, and adapted to work with this mod. If anyone can help, please do. If this post is breaking a forum rule, DEFINITELY tell me, since I need to know. Thanks ahead of time, -MiSt_Rocky
-
How to Add Color to Item Name
Last time I was modding in 1.18 I just had to add \u00a7 and the color code to my string. Example: "\u00a7eHello, world!" should display as yellow. (This assumes you are inputting the item name as a string) Someone correct me if this doesn't work, or has a better answer.
IPS spam blocked by CleanTalk.