Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Add categories and default values to new config system


Choonster
 Share

Recommended Posts

I just tried to port my old configuration to the new annotation-based system and noticed two missing features: default values and categories.

 

I understand the new system is still a WIP, so these may already be on the roadmap.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Link to comment
Share on other sites

Default values are the values from the static initializes of your fields.

As for categories, you can make sub-objects. See here: https://github.com/MinecraftForge/Mercurius/blob/master/src/main/java/net/minecraftforge/mercurius/Config.java

I'm not sure i want to move things into TOP level categories. I'd more rather change the top level from "general" to "ModID" or something. But I havent decided yet.

I do Forge for free, however the servers to run it arn't free, so anything is appreciated.
Patreon: http://www.patreon.com/lexmanos
Paypal: http://paypal.me/LexManos

BitCoin: 1Q8rWvUNMM2T1ZfDaFeeYQyVXtYoeT6tTn

Link to comment
Share on other sites

Default values are the values from the static initializes of your fields.

As for categories, you can make sub-objects. See here: https://github.com/MinecraftForge/Mercurius/blob/master/src/main/java/net/minecraftforge/mercurius/Config.java

I'm not sure i want to move things into TOP level categories. I'd more rather change the top level from "general" to "ModID" or something. But I havent decided yet.

 

Thanks, that makes sense.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Link to comment
Share on other sites

Just a note, this is my test suit for this. Not the best but shows all the different data types and sub-categories:

https://gist.github.com/LexManos/ca57c1f29365bf492f207e4aa1a7865c

I do Forge for free, however the servers to run it arn't free, so anything is appreciated.
Patreon: http://www.patreon.com/lexmanos
Paypal: http://paypal.me/LexManos

BitCoin: 1Q8rWvUNMM2T1ZfDaFeeYQyVXtYoeT6tTn

Link to comment
Share on other sites

Yes, but you have to use the internal config object that is created by the manager.

The GUI is part that I haven't gotten around to doing quite yet.

Using the GUI system is really easy it just needs to be glued together.

https://github.com/MinecraftForge/Mercurius/blob/master/1.9.4/src/main/java/net/minecraftforge/mercurius/binding/ModConfigGui.java#L40 being the example of how to use it in this style setup.

I do Forge for free, however the servers to run it arn't free, so anything is appreciated.
Patreon: http://www.patreon.com/lexmanos
Paypal: http://paypal.me/LexManos

BitCoin: 1Q8rWvUNMM2T1ZfDaFeeYQyVXtYoeT6tTn

Link to comment
Share on other sites

Yes, but you have to use the internal config object that is created by the manager.

The GUI is part that I haven't gotten around to doing quite yet.

Using the GUI system is really easy it just needs to be glued together.

https://github.com/MinecraftForge/Mercurius/blob/master/1.9.4/src/main/java/net/minecraftforge/mercurius/binding/ModConfigGui.java#L40 being the example of how to use it in this style setup.

 

Thanks, I ended up with this. Is there a way to do this without using reflection to access

ConfigManager#CONFIGS

?

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Link to comment
Share on other sites

Btw, have you thought about giving modders the option to separate "global" and "user" configs? That would be especially helpful for modpacks, since users could still change some settings (like the tooltip position for Waila/OneProbe) without getting them overwritten every time the modpack gets updated.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share



  • Recently Browsing

    No registered users viewing this page.

  • Posts

    • in you item class add code: @Override public ItemStack getContainerItem(ItemStack itemStack) { return itemStack.copy(); } @Override public boolean hasContainerItem(ItemStack stack) { return true; }  
    • I only made a custom sword, but it is too small, I want to make it a little bigger    
    • Hello, Whenever I try to start forge 1.16.5, I get an error saying MVI couldn't load because there's not enough data available. Can anyone help with this? This is the crash text:   ---- Minecraft Crash Report ---- // You should try our sister game, Minceraft! Time: 12/2/21 5:27 PM Description: Mod loading error has occurred java.lang.Exception: Mod Loading has failed     at net.minecraftforge.fml.CrashReportExtender.dumpModLoadingCrashReport(CrashReportExtender.java:85) [?:?] {re:classloading}     at net.minecraftforge.fml.client.ClientModLoader.completeModLoading(ClientModLoader.java:188) [?:?] {re:classloading,pl:runtimedistcleaner:A}     at net.minecraft.client.Minecraft.lambda$null$1(Minecraft.java:508) [?:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A,re:mixin,pl:accesstransformer:B,pl:runtimedistcleaner:A}     at net.minecraft.client.Minecraft$$Lambda$4660/1471145035.run(Unknown Source) [?:?] {}     at net.minecraft.util.Util.func_215077_a(Util.java:430) [?:?] {re:classloading,xf:OptiFine:default,re:mixin}     at net.minecraft.client.Minecraft.lambda$new$2(Minecraft.java:504) [?:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A,re:mixin,pl:accesstransformer:B,pl:runtimedistcleaner:A}     at net.minecraft.client.Minecraft$$Lambda$4409/1341785997.accept(Unknown Source) [?:?] {}     at net.minecraft.client.gui.ResourceLoadProgressGui.func_230430_a_(ResourceLoadProgressGui.java:172) [?:?] {re:classloading,xf:OptiFine:default}     at net.minecraft.client.renderer.GameRenderer.func_195458_a(GameRenderer.java:802) [?:?] {re:mixin,pl:accesstransformer:B,re:classloading,pl:accesstransformer:B,xf:OptiFine:default,pl:mixin:APP:mvw.mixins.json:GameRendererMixin,pl:mixin:A}     at net.minecraft.client.Minecraft.func_195542_b(Minecraft.java:976) [?:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A,re:mixin,pl:accesstransformer:B,pl:runtimedistcleaner:A}     at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:607) [?:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A,re:mixin,pl:accesstransformer:B,pl:runtimedistcleaner:A}     at net.minecraft.client.main.Main.main(Main.java:184) [?:?] {re:classloading,pl:runtimedistcleaner:A}     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_51] {}     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_51] {}     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_51] {}     at java.lang.reflect.Method.invoke(Method.java:497) ~[?:1.8.0_51] {}     at net.minecraftforge.fml.loading.FMLClientLaunchProvider.lambda$launchService$0(FMLClientLaunchProvider.java:51) [forge-1.16.5-36.2.0.jar:36.2] {}     at net.minecraftforge.fml.loading.FMLClientLaunchProvider$$Lambda$461/27818833.call(Unknown Source) [forge-1.16.5-36.2.0.jar:36.2] {}     at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:37) [modlauncher-8.0.9.jar:?] {}     at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:54) [modlauncher-8.0.9.jar:?] {}     at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:72) [modlauncher-8.0.9.jar:?] {}     at cpw.mods.modlauncher.Launcher.run(Launcher.java:82) [modlauncher-8.0.9.jar:?] {}     at cpw.mods.modlauncher.Launcher.main(Launcher.java:66) [modlauncher-8.0.9.jar:?] {} A detailed walkthrough of the error, its code path and all known details is as follows: --------------------------------------------------------------------------------------- -- Head -- Thread: Render thread Stacktrace:     at com.electronwill.nightconfig.core.io.ParsingException.notEnoughData(ParsingException.java:22) ~[core-3.6.3.jar:?] {} -- MOD mvw -- Details:     Mod File: mvw-1.7.2.jar     Failure message: MoreVanillaWeapons (mvw) has failed to load correctly         com.electronwill.nightconfig.core.io.ParsingException: Not enough data available     Mod Version: 1.16.X-1.7.2     Mod Issue URL: NOT PROVIDED     Exception message: com.electronwill.nightconfig.core.io.ParsingException: Not enough data available Stacktrace:     at com.electronwill.nightconfig.core.io.ParsingException.notEnoughData(ParsingException.java:22) ~[core-3.6.3.jar:?] {}     at com.electronwill.nightconfig.core.io.ReaderInput.directReadChar(ReaderInput.java:36) ~[core-3.6.3.jar:?] {}     at com.electronwill.nightconfig.core.io.AbstractInput.readChar(AbstractInput.java:49) ~[core-3.6.3.jar:?] {}     at com.electronwill.nightconfig.core.io.AbstractInput.readCharsUntil(AbstractInput.java:123) ~[core-3.6.3.jar:?] {}     at com.electronwill.nightconfig.toml.TableParser.parseKey(TableParser.java:166) ~[toml-3.6.3.jar:?] {}     at com.electronwill.nightconfig.toml.TableParser.parseDottedKey(TableParser.java:145) ~[toml-3.6.3.jar:?] {}     at com.electronwill.nightconfig.toml.TableParser.parseNormal(TableParser.java:55) ~[toml-3.6.3.jar:?] {}     at com.electronwill.nightconfig.toml.TomlParser.parse(TomlParser.java:44) ~[toml-3.6.3.jar:?] {}     at com.electronwill.nightconfig.toml.TomlParser.parse(TomlParser.java:37) ~[toml-3.6.3.jar:?] {}     at com.electronwill.nightconfig.core.io.ConfigParser.parse(ConfigParser.java:113) ~[core-3.6.3.jar:?] {}     at com.electronwill.nightconfig.core.io.ConfigParser.parse(ConfigParser.java:219) ~[core-3.6.3.jar:?] {}     at com.electronwill.nightconfig.core.io.ConfigParser.parse(ConfigParser.java:202) ~[core-3.6.3.jar:?] {}     at com.electronwill.nightconfig.core.file.WriteSyncFileConfig.load(WriteSyncFileConfig.java:73) ~[core-3.6.3.jar:?] {}     at com.electronwill.nightconfig.core.file.AutosaveCommentedFileConfig.load(AutosaveCommentedFileConfig.java:85) ~[core-3.6.3.jar:?] {}     at com.mrbelieve.mvw.ModConfig.<init>(ModConfig.java:21) ~[?:1.7.2] {re:classloading}     at com.mrbelieve.Mvw.<init>(Mvw.java:48) ~[?:1.7.2] {re:classloading}     at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[?:1.8.0_51] {}     at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[?:1.8.0_51] {}     at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[?:1.8.0_51] {}     at java.lang.reflect.Constructor.newInstance(Constructor.java:422) ~[?:1.8.0_51] {}     at java.lang.Class.newInstance(Class.java:442) ~[?:1.8.0_51] {}     at net.minecraftforge.fml.javafmlmod.FMLModContainer.constructMod(FMLModContainer.java:81) ~[?:36.2] {re:classloading}     at net.minecraftforge.fml.javafmlmod.FMLModContainer$$Lambda$3105/1982468278.run(Unknown Source) ~[?:?] {}     at net.minecraftforge.fml.ModContainer.lambda$buildTransitionHandler$4(ModContainer.java:120) ~[?:?] {re:classloading}     at net.minecraftforge.fml.ModContainer$$Lambda$3189/76306072.run(Unknown Source) ~[?:?] {}     at java.util.concurrent.CompletableFuture$AsyncRun.run(CompletableFuture.java:1618) ~[?:1.8.0_51] {}     at java.util.concurrent.CompletableFuture$AsyncRun.exec(CompletableFuture.java:1610) ~[?:1.8.0_51] {}     at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289) ~[?:1.8.0_51] {}     at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056) ~[?:1.8.0_51] {}     at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1689) ~[?:1.8.0_51] {re:computing_frames}     at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157) ~[?:1.8.0_51] {} -- System Details -- Details:     Minecraft Version: 1.16.5     Minecraft Version ID: 1.16.5     Operating System: Windows 10 (amd64) version 10.0     Java Version: 1.8.0_51, Oracle Corporation     Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation     Memory: 1351327720 bytes (1288 MB) / 2147483648 bytes (2048 MB) up to 2147483648 bytes (2048 MB)     CPUs: 8     JVM Flags: 10 total; -XX:HeapDumpPath=MojangTricksIntelDriversForPerformance_javaw.exe_minecraft.exe.heapdump -Xss1M -XX:+IgnoreUnrecognizedVMOptions -Xmx2G -XX:+UnlockExperimentalVMOptions -XX:+UseG1GC -XX:G1NewSizePercent=20 -XX:G1ReservePercent=20 -XX:MaxGCPauseMillis=50 -XX:G1HeapRegionSize=32M     ModLauncher: 8.0.9+86+master.3cf110c     ModLauncher launch target: fmlclient     ModLauncher naming: srg     ModLauncher services:          /mixin-0.8.2.jar mixin PLUGINSERVICE          /eventbus-4.0.0.jar eventbus PLUGINSERVICE          /forge-1.16.5-36.2.0.jar object_holder_definalize PLUGINSERVICE          /forge-1.16.5-36.2.0.jar runtime_enum_extender PLUGINSERVICE          /accesstransformers-3.0.1.jar accesstransformer PLUGINSERVICE          /forge-1.16.5-36.2.0.jar capability_inject_definalize PLUGINSERVICE          /forge-1.16.5-36.2.0.jar runtimedistcleaner PLUGINSERVICE          /mixin-0.8.2.jar mixin TRANSFORMATIONSERVICE          /OptiFine_1.16.5_HD_U_G7.jar OptiFine TRANSFORMATIONSERVICE          /forge-1.16.5-36.2.0.jar fml TRANSFORMATIONSERVICE      FML: 36.2     Forge: net.minecraftforge:36.2.0     FML Language Providers:          javafml@36.2         minecraft@1     Mod List:          forge-1.16.5-36.2.0-client.jar                    |Minecraft                     |minecraft                     |1.16.5              |CREATE_REG|Manifest: NOSIGNATURE         BetterDungeons-1.16.4-1.2.1.jar                   |YUNG's Better Dungeons        |betterdungeons                |1.16.4-1.2.1        |CREATE_REG|Manifest: NOSIGNATURE         BiomesOPlenty-1.16.5-13.1.0.481-universal.jar     |Biomes O' Plenty              |biomesoplenty                 |1.16.5-13.1.0.481   |CREATE_REG|Manifest: NOSIGNATURE         1.16.5-enchantedgoldenapplecrafting-1.0.jar       |Enchanted Golden Apple Craftin|enchantedgoldenapplecrafting  |1.0                 |CREATE_REG|Manifest: NOSIGNATURE         Weeping-Angels-1.16.x-2.1.6.jar                   |Weeping Angels                |weeping_angels                |2.1.6               |CREATE_REG|Manifest: NOSIGNATURE         dungeons_plus-1.16.5-1.1.5.jar                    |Dungeons Plus                 |dungeons_plus                 |1.1.5               |CREATE_REG|Manifest: NOSIGNATURE         Creative Core.jar                                 |CreativeCore                  |creativecore                  |2.0.0               |CREATE_REG|Manifest: NOSIGNATURE         Tree Harvester.jar                                |Tree Harvester                |treeharvester                 |2.4                 |CREATE_REG|Manifest: NOSIGNATURE         Just Enough Items.jar                             |Just Enough Items             |jei                           |7.7.0.106           |CREATE_REG|Manifest: NOSIGNATURE         villagespawnpoint_1.16.5-1.8.jar                  |Village Spawn Point           |villagespawnpoint             |1.8                 |CREATE_REG|Manifest: NOSIGNATURE         Toro Health Bar.jar                               |ToroHealth                    |torohealth                    |NONE                |CREATE_REG|Manifest: NOSIGNATURE         SpartanShields-1.16.5-2.1.2.jar                   |Spartan Shields               |spartanshields                |2.1.2               |CREATE_REG|Manifest: NOSIGNATURE         Waystones.jar                                     |Waystones                     |waystones                     |7.4.0               |CREATE_REG|Manifest: NOSIGNATURE         collective-1.16.5-3.0.jar                         |Collective                    |collective                    |3.0                 |CREATE_REG|Manifest: NOSIGNATURE         journeymap-1.16.5-5.7.3.jar                       |Journeymap                    |journeymap                    |5.7.3               |CREATE_REG|Manifest: NOSIGNATURE         citadel-1.8.1-1.16.5.jar                          |Citadel                       |citadel                       |1.8.1               |CREATE_REG|Manifest: NOSIGNATURE         alexsmobs-1.12.1.jar                              |Alex's Mobs                   |alexsmobs                     |1.12.1              |CREATE_REG|Manifest: NOSIGNATURE         TravelersBackpack-1.16.5-5.4.2.jar                |Traveler's Backpack           |travelersbackpack             |5.4.2               |CREATE_REG|Manifest: NOSIGNATURE         YungsApi-1.16.4-Forge-13.jar                      |YUNG's API                    |yungsapi                      |1.16.4-Forge-13     |CREATE_REG|Manifest: NOSIGNATURE         InventoryHud_[1.16.2-1.16.5].forge-3.4.1.jar      |Inventory HUD+(Forge edition) |inventoryhud                  |3.4.1               |CREATE_REG|Manifest: NOSIGNATURE         DungeonCrawl-1.16.5-2.3.2.jar                     |Dungeon Crawl                 |dungeoncrawl                  |2.3.2               |CREATE_REG|Manifest: NOSIGNATURE         iceandfire-2.1.9-1.16.5.jar                       |Ice and Fire                  |iceandfire                    |2.1.9-1.16.5        |CREATE_REG|Manifest: NOSIGNATURE         mvw-1.7.2.jar                                     |MoreVanillaWeapons            |mvw                           |1.16.X-1.7.2        |ERROR     |Manifest: NOSIGNATURE         Item Physic.jar                                   |ItemPhysic                    |itemphysic                    |1.6.0               |CREATE_REG|Manifest: NOSIGNATURE         forge-1.16.5-36.2.0-universal.jar                 |Forge                         |forge                         |36.2.0              |CREATE_REG|Manifest: 22:af:21:d8:19:82:7f:93:94:fe:2b:ac:b7:e4:41:57:68:39:87:b1:a7:5c:c6:44:f9:25:74:21:14:f5:0d:90         Disenchanting-forge-1.16.5-1.7.2.jar              |Disenchanting                 |disenchanting                 |1.6.0               |CREATE_REG|Manifest: NOSIGNATURE         BetterMineshafts-Forge-1.16.4-2.0.4.jar           |YUNG's Better Mineshafts      |bettermineshafts              |1.16.4-2.0.4        |CREATE_REG|Manifest: NOSIGNATURE         DynamicSurroundings-1.16.4-4.0.4.2 (1).jar        |§3Dynamic Surroundings        |dsurround                     |1.16.4-4.0.4.2      |CREATE_REG|Manifest: b4:98:14:b9:76:55:25:4f:e5:5f:4d:71:90:87:43:5b:f9:d5:3a:02:60:42:5e:da:1f:15:9c:ff:be:a9:7c:77         structure_gel-1.16.5-1.7.8.jar                    |Structure Gel API             |structure_gel                 |1.7.8               |CREATE_REG|Manifest: NOSIGNATURE         corpse-1.16.5-1.0.5.jar                           |Corpse                        |corpse                        |1.16.5-1.0.5        |CREATE_REG|Manifest: NOSIGNATURE     Crash Report UUID: cdcb879d-5dae-4e29-88ad-a4ace45db323     OptiFine Version: OptiFine_1.16.5_HD_U_G7     OptiFine Build: 20210305-003221     Render Distance Chunks: 12     Mipmaps: 4     Anisotropic Filtering: 1     Antialiasing: 0     Multitexture: false     Shaders: null     OpenGlVersion: 4.6.0 - Build 30.0.100.9955     OpenGlRenderer: Intel(R) Iris(R) Xe Graphics     OpenGlVendor: Intel     CpuCount: 8
    • Yeah its a question sorry for phrasing it weird, currently everytime I restart the server the mobs .mobLevel is being reset because it isn't saving. Im trying to decipher why this is happening and how to make it so that the .mobLevel for all the mobs in the server persists after a server restart
    • Yeah sorry I installed Java 17 I just checked a minut ago :D.   So, I deleted everything about Forge in my .minecraft folder, then I executed the jarfix.exe that I downloaded previously and THEN I installed the 1.18 Forge Client and now it works !
  • Topics

  • Who's Online (See full list)

×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.