Jump to content

[1.16.4]Providing a pre populated config file


Cratthorax

Recommended Posts

So I got my "modname-common.toml" file created, and know how to populate the file with variables. The problem is, I've got a lot of them...really a lot. I'd need about 4 times as much code if I'd try to pre populate by default, so I'm looking for a way to just easily provide a preset config file, and copy it to the config folder. 

Can someone tell me if that is even possible?

Link to comment
Share on other sites

Sure I can, but the default value is this, I'm just trying to save time:

	[["Custom Ore"]]
    "Ore Name" = "matlib:blockantimony"
    "Filler Name" = "minecraft:stone"
    "Max Vein Size" = 2
    "Min Vein Level" = 1
    "Max Vein Level" = 128
    "Spawn Rate" = 3
	[["Custom Ore"]]
    "Ore Name" = "matlib:blockstibnite"
    "Filler Name" = "minecraft:stone"
    "Max Vein Size" = 8
    "Min Vein Level" = 1
    "Max Vein Level" = 128
    "Spawn Rate" = 7
	[["Custom Ore"]]
    "Ore Name" = "matlib:blockblackcoal"
    "Filler Name" = "minecraft:stone"
    "Max Vein Size" = 12
    "Min Vein Level" = 1
    "Max Vein Level" = 128
    "Spawn Rate" = 9
	[["Custom Ore"]]
    "Ore Name" = "matlib:blockbrowncoal"
    "Filler Name" = "minecraft:stone"
    "Max Vein Size" = 10
    "Min Vein Level" = 1
    "Max Vein Level" = 128
    "Spawn Rate" = 7
	[["Custom Ore"]]
    "Ore Name" = "matlib:blockazuriteore"
    "Filler Name" = "minecraft:stone"
    "Max Vein Size" = 3
    "Min Vein Level" = 1
    "Max Vein Level" = 128
    "Spawn Rate" = 5
	[["Custom Ore"]]
    "Ore Name" = "matlib:blockchalcopyrite"
    "Filler Name" = "minecraft:stone"
    "Max Vein Size" = 12
    "Min Vein Level" = 1
    "Max Vein Level" = 128
    "Spawn Rate" = 8
	[["Custom Ore"]]
    "Ore Name" = "matlib:blockcopper"
    "Filler Name" = "minecraft:stone"
    "Max Vein Size" = 3
    "Min Vein Level" = 1
    "Max Vein Level" = 128
    "Spawn Rate" = 3
	[["Custom Ore"]]
    "Ore Name" = "matlib:blockmalachiteore"
    "Filler Name" = "minecraft:stone"
    "Max Vein Size" = 3
    "Min Vein Level" = 1
    "Max Vein Level" = 128
    "Spawn Rate" = 3
	[["Custom Ore"]]
    "Ore Name" = "matlib:blockcalaverite"
    "Filler Name" = "minecraft:stone"
    "Max Vein Size" = 3
    "Min Vein Level" = 1
    "Max Vein Level" = 128
    "Spawn Rate" = 3
	[["Custom Ore"]]
    "Ore Name" = "matlib:blockgold"
    "Filler Name" = "minecraft:stone"
    "Max Vein Size" = 2
    "Min Vein Level" = 1
    "Max Vein Level" = 128
    "Spawn Rate" = 1
	[["Custom Ore"]]
    "Ore Name" = "matlib:blockhaematite"
    "Filler Name" = "minecraft:stone"
    "Max Vein Size" = 10
    "Min Vein Level" = 1
    "Max Vein Level" = 128
    "Spawn Rate" = 8
	[["Custom Ore"]]
    "Ore Name" = "matlib:blockmagnetite"
    "Filler Name" = "minecraft:stone"
    "Max Vein Size" = 3
    "Min Vein Level" = 1
    "Max Vein Level" = 128
    "Spawn Rate" = 2
	[["Custom Ore"]]
    "Ore Name" = "matlib:blockbogiron"
    "Filler Name" = "minecraft:stone"
    "Max Vein Size" = 9
    "Min Vein Level" = 1
    "Max Vein Level" = 128
    "Spawn Rate" = 8
	[["Custom Ore"]]
    "Ore Name" = "matlib:blockbraunstein"
    "Filler Name" = "minecraft:stone"
    "Max Vein Size" = 9
    "Min Vein Level" = 1
    "Max Vein Level" = 128
    "Spawn Rate" = 8
	[["Custom Ore"]]
    "Ore Name" = "matlib:blockpyrite"
    "Filler Name" = "minecraft:stone"
    "Max Vein Size" = 9
    "Min Vein Level" = 1
    "Max Vein Level" = 128
    "Spawn Rate" = 8
	[["Custom Ore"]]
    "Ore Name" = "matlib:blockilmenite"
    "Filler Name" = "minecraft:stone"
    "Max Vein Size" = 6
    "Min Vein Level" = 1
    "Max Vein Level" = 128
    "Spawn Rate" = 5
	[["Custom Ore"]]
    "Ore Name" = "matlib:blockgalena"
    "Filler Name" = "minecraft:stone"
    "Max Vein Size" = 9
    "Min Vein Level" = 1
    "Max Vein Level" = 128
    "Spawn Rate" = 7
	[["Custom Ore"]]
    "Ore Name" = "matlib:blocklead"
    "Filler Name" = "minecraft:stone"
    "Max Vein Size" = 4
    "Min Vein Level" = 1
    "Max Vein Level" = 128
    "Spawn Rate" = 3
	[["Custom Ore"]]
    "Ore Name" = "matlib:blockcinnabar"
    "Filler Name" = "minecraft:stone"
    "Max Vein Size" = 6
    "Min Vein Level" = 1
    "Max Vein Level" = 128
    "Spawn Rate" = 5
	[["Custom Ore"]]
    "Ore Name" = "matlib:blockgarnierite"
    "Filler Name" = "minecraft:stone"
    "Max Vein Size" = 3
    "Min Vein Level" = 1
    "Max Vein Level" = 128
    "Spawn Rate" = 4
	[["Custom Ore"]]
    "Ore Name" = "matlib:blocknickel"
    "Filler Name" = "minecraft:stone"
    "Max Vein Size" = 2
    "Min Vein Level" = 1
    "Max Vein Level" = 128
    "Spawn Rate" = 2
	[["Custom Ore"]]
    "Ore Name" = "matlib:blocknickeline"
    "Filler Name" = "minecraft:stone"
    "Max Vein Size" = 5
    "Min Vein Level" = 1
    "Max Vein Level" = 128
    "Spawn Rate" = 6
	[["Custom Ore"]]
    "Ore Name" = "matlib:blockplatinum"
    "Filler Name" = "minecraft:stone"
    "Max Vein Size" = 2
    "Min Vein Level" = 1
    "Max Vein Level" = 128
    "Spawn Rate" = 1
	[["Custom Ore"]]
    "Ore Name" = "matlib:blockakanthite"
    "Filler Name" = "minecraft:stone"
    "Max Vein Size" = 2
    "Min Vein Level" = 1
    "Max Vein Level" = 128
    "Spawn Rate" = 2
	[["Custom Ore"]]
    "Ore Name" = "matlib:blocksilver"
    "Filler Name" = "minecraft:stone"
    "Max Vein Size" = 4
    "Min Vein Level" = 1
    "Max Vein Level" = 128
    "Spawn Rate" = 3
	[["Custom Ore"]]
    "Ore Name" = "matlib:blockstromeyerite"
    "Filler Name" = "minecraft:stone"
    "Max Vein Size" = 4
    "Min Vein Level" = 1
    "Max Vein Level" = 128
    "Spawn Rate" = 3
	[["Custom Ore"]]
    "Ore Name" = "matlib:blockcassiterite"
    "Filler Name" = "minecraft:stone"
    "Max Vein Size" = 6
    "Min Vein Level" = 1
    "Max Vein Level" = 128
    "Spawn Rate" = 5
	[["Custom Ore"]]
    "Ore Name" = "matlib:blockstannite"
    "Filler Name" = "minecraft:stone"
    "Max Vein Size" = 4
    "Min Vein Level" = 1
    "Max Vein Level" = 128
    "Spawn Rate" = 3
	[["Custom Ore"]]
    "Ore Name" = "matlib:blocksphalerite"
    "Filler Name" = "minecraft:stone"
    "Max Vein Size" = 6
    "Min Vein Level" = 1
    "Max Vein Level" = 128
    "Spawn Rate" = 5
	[["Custom Ore"]]
    "Ore Name" = "matlib:blockzincite"
    "Filler Name" = "minecraft:stone"
    "Max Vein Size" = 4
    "Min Vein Level" = 1
    "Max Vein Level" = 128
    "Spawn Rate" = 3
	[["Custom Ore"]]
    "Ore Name" = "matlib:blockagate"
    "Filler Name" = "minecraft:stone"
    "Max Vein Size" = 2
    "Min Vein Level" = 1
    "Max Vein Level" = 128
    "Spawn Rate" = 1
	[["Custom Ore"]]
    "Ore Name" = "matlib:blockamethyst"
    "Filler Name" = "minecraft:stone"
    "Max Vein Size" = 3
    "Min Vein Level" = 1
    "Max Vein Level" = 128
    "Spawn Rate" = 1
	[["Custom Ore"]]
    "Ore Name" = "matlib:blockaquamarine"
    "Filler Name" = "minecraft:stone"
    "Max Vein Size" = 2
    "Min Vein Level" = 1
    "Max Vein Level" = 128
    "Spawn Rate" = 1
	[["Custom Ore"]]
    "Ore Name" = "matlib:blockazurite"
    "Filler Name" = "minecraft:stone"
    "Max Vein Size" = 3
    "Min Vein Level" = 1
    "Max Vein Level" = 128
    "Spawn Rate" = 1
	[["Custom Ore"]]
    "Ore Name" = "matlib:blockcitrine"
    "Filler Name" = "minecraft:stone"
    "Max Vein Size" = 4
    "Min Vein Level" = 1
    "Max Vein Level" = 128
    "Spawn Rate" = 1
	[["Custom Ore"]]
    "Ore Name" = "matlib:blockdiamond"
    "Filler Name" = "minecraft:stone"
    "Max Vein Size" = 1
    "Min Vein Level" = 1
    "Max Vein Level" = 128
    "Spawn Rate" = 1
	[["Custom Ore"]]
    "Ore Name" = "matlib:blockemerald"
    "Filler Name" = "minecraft:stone"
    "Max Vein Size" = 2
    "Min Vein Level" = 1
    "Max Vein Level" = 128
    "Spawn Rate" = 1
	[["Custom Ore"]]
    "Ore Name" = "matlib:blockgarnet"
    "Filler Name" = "minecraft:stone"
    "Max Vein Size" = 2
    "Min Vein Level" = 1
    "Max Vein Level" = 128
    "Spawn Rate" = 1
	[["Custom Ore"]]
    "Ore Name" = "matlib:blockjade"
    "Filler Name" = "minecraft:stone"
    "Max Vein Size" = 5
    "Min Vein Level" = 1
    "Max Vein Level" = 128
    "Spawn Rate" = 1
	[["Custom Ore"]]
    "Ore Name" = "matlib:blockmalachite"
    "Filler Name" = "minecraft:stone"
    "Max Vein Size" = 3
    "Min Vein Level" = 1
    "Max Vein Level" = 128
    "Spawn Rate" = 1
	[["Custom Ore"]]
    "Ore Name" = "matlib:blockmorion"
    "Filler Name" = "minecraft:stone"
    "Max Vein Size" = 4
    "Min Vein Level" = 1
    "Max Vein Level" = 128
    "Spawn Rate" = 1
	[["Custom Ore"]]
    "Ore Name" = "matlib:blockonyx"
    "Filler Name" = "minecraft:stone"
    "Max Vein Size" = 4
    "Min Vein Level" = 1
    "Max Vein Level" = 128
    "Spawn Rate" = 1
	[["Custom Ore"]]
    "Ore Name" = "matlib:blockruby"
    "Filler Name" = "minecraft:stone"
    "Max Vein Size" = 2
    "Min Vein Level" = 1
    "Max Vein Level" = 128
    "Spawn Rate" = 1
	[["Custom Ore"]]
    "Ore Name" = "matlib:blocksaphire"
    "Filler Name" = "minecraft:stone"
    "Max Vein Size" = 3
    "Min Vein Level" = 1
    "Max Vein Level" = 128
    "Spawn Rate" = 1
	[["Custom Ore"]]
    "Ore Name" = "matlib:blocktopaz"
    "Filler Name" = "minecraft:stone"
    "Max Vein Size" = 3
    "Min Vein Level" = 1
    "Max Vein Level" = 128
    "Spawn Rate" = 1
	[["Custom Ore"]]
    "Ore Name" = "matlib:blockslate"
    "Filler Name" = "minecraft:stone"
    "Max Vein Size" = 15
    "Min Vein Level" = 1
    "Max Vein Level" = 128
    "Spawn Rate" = 8
	[["Custom Ore"]]
    "Ore Name" = "matlib:blockbasalt"
    "Filler Name" = "minecraft:stone"
    "Max Vein Size" = 10
    "Min Vein Level" = 1
    "Max Vein Level" = 128
    "Spawn Rate" = 5
	[["Custom Ore"]]
    "Ore Name" = "matlib:blockgranite"
    "Filler Name" = "minecraft:stone"
    "Max Vein Size" = 12
    "Min Vein Level" = 1
    "Max Vein Level" = 128
    "Spawn Rate" = 7
	[["Custom Ore"]]
    "Ore Name" = "matlib:blocklimestone"
    "Filler Name" = "minecraft:stone"
    "Max Vein Size" = 15
    "Min Vein Level" = 1
    "Max Vein Level" = 128
    "Spawn Rate" = 4
	[["Custom Ore"]]
    "Ore Name" = "matlib:blockquartzite"
    "Filler Name" = "minecraft:stone"
    "Max Vein Size" = 14
    "Min Vein Level" = 1
    "Max Vein Level" = 128
    "Spawn Rate" = 10
	[["Custom Ore"]]
    "Ore Name" = "matlib:blockgraphite"
    "Filler Name" = "minecraft:stone"
    "Max Vein Size" = 6
    "Min Vein Level" = 1
    "Max Vein Level" = 128
    "Spawn Rate" = 10
	[["Custom Ore"]]
    "Ore Name" = "matlib:blockbonestone"
    "Filler Name" = "minecraft:stone"
    "Max Vein Size" = 4
    "Min Vein Level" = 1
    "Max Vein Level" = 128
    "Spawn Rate" = 4
	[["Custom Ore"]]
    "Ore Name" = "matlib:blocklapis"
    "Filler Name" = "minecraft:stone"
    "Max Vein Size" = 4
    "Min Vein Level" = 1
    "Max Vein Level" = 128
    "Spawn Rate" = 3
	[["Custom Ore"]]
    "Ore Name" = "matlib:blockbitumen"
    "Filler Name" = "minecraft:stone"
    "Max Vein Size" = 3
    "Min Vein Level" = 1
    "Max Vein Level" = 128
    "Spawn Rate" = 5
	[["Custom Ore"]]
    "Ore Name" = "matlib:blockbluestone"
    "Filler Name" = "minecraft:stone"
    "Max Vein Size" = 6
    "Min Vein Level" = 1
    "Max Vein Level" = 128
    "Spawn Rate" = 8
	[["Custom Ore"]]
    "Ore Name" = "matlib:blockdiabase"
    "Filler Name" = "minecraft:stone"
    "Max Vein Size" = 4
    "Min Vein Level" = 1
    "Max Vein Level" = 128
    "Spawn Rate" = 4
	[["Custom Ore"]]
    "Ore Name" = "matlib:blockmarble"
    "Filler Name" = "minecraft:stone"
    "Max Vein Size" = 4
    "Min Vein Level" = 1
    "Max Vein Level" = 128
    "Spawn Rate" = 4
	[["Custom Ore"]]
    "Ore Name" = "matlib:blocksandstone"
    "Filler Name" = "minecraft:stone"
    "Max Vein Size" = 8
    "Min Vein Level" = 1
    "Max Vein Level" = 128
    "Spawn Rate" = 9
	[["Custom Ore"]]
    "Ore Name" = "matlib:blocktuff"
    "Filler Name" = "minecraft:stone"
    "Max Vein Size" = 4
    "Min Vein Level" = 1
    "Max Vein Level" = 128
    "Spawn Rate" = 4
	[["Custom Ore"]]
    "Ore Name" = "matlib:blockbromellite"
    "Filler Name" = "minecraft:stone"
    "Max Vein Size" = 2
    "Min Vein Level" = 1
    "Max Vein Level" = 128
    "Spawn Rate" = 2
	[["Custom Ore"]]
    "Ore Name" = "matlib:blockbismutite"
    "Filler Name" = "minecraft:stone"
    "Max Vein Size" = 5
    "Min Vein Level" = 1
    "Max Vein Level" = 128
    "Spawn Rate" = 4
	[["Custom Ore"]]
    "Ore Name" = "matlib:blockcobaltite"
    "Filler Name" = "minecraft:stone"
    "Max Vein Size" = 6
    "Min Vein Level" = 1
    "Max Vein Level" = 128
    "Spawn Rate" = 5
	[["Custom Ore"]]
    "Ore Name" = "matlib:blockwolframite"
    "Filler Name" = "minecraft:stone"
    "Max Vein Size" = 7
    "Min Vein Level" = 1
    "Max Vein Level" = 128
    "Spawn Rate" = 6
	[["Custom Ore"]]
    "Ore Name" = "matlib:blockcoppergloss"
    "Filler Name" = "minecraft:stone"
    "Max Vein Size" = 7
    "Min Vein Level" = 1
    "Max Vein Level" = 128
    "Spawn Rate" = 7
	[["Custom Ore"]]
    "Ore Name" = "matlib:blockirongloss"
    "Filler Name" = "minecraft:stone"
    "Max Vein Size" = 7
    "Min Vein Level" = 1
    "Max Vein Level" = 128
    "Spawn Rate" = 7
	[["Custom Ore"]]
    "Ore Name" = "matlib:blocksilvergloss"
    "Filler Name" = "minecraft:stone"
    "Max Vein Size" = 7
    "Min Vein Level" = 1
    "Max Vein Level" = 128
    "Spawn Rate" = 7
	[["Custom Ore"]]
    "Ore Name" = "matlib:blocksulfur"
    "Filler Name" = "minecraft:stone"
    "Max Vein Size" = 7
    "Min Vein Level" = 1
    "Max Vein Level" = 128
    "Spawn Rate" = 7
	[["Custom Ore"]]
    "Ore Name" = "matlib:blocksaltpeter"
    "Filler Name" = "minecraft:stone"
    "Max Vein Size" = 7
    "Min Vein Level" = 1
    "Max Vein Level" = 128
    "Spawn Rate" = 7

Edited by Cratthorax
Link to comment
Share on other sites

I'm sure I can do more. And I'm sure I didn't expressed myself comprehensible enough, for you to provide information, that you have already provided in the past...:D

Just make sure it happens way preInit:

 

    private static void initDefault() {
        
        @SuppressWarnings("resource")
        File configPath = new File(Minecraft.getInstance().gameDir + "/config", "matlib-common.toml");
        InputStream inputStream = MatLibMain.class.getResourceAsStream("/assets/matlib/matlib-common.toml");
        
        try {
            Files.asByteSink(configPath).writeFrom(inputStream);
            inputStream.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
        
    } 
Edited by Cratthorax
Link to comment
Share on other sites

Well, the system put in place asks me to build configs code for more than 70 blocks, and at least the double amount of itemBlocks spawned on BiomeGeneration as EntityDrops. I simply don't do that. That would sum up for more than 70% of my already existing code.

I initialize the method on FMLClientSetupEvent, check if a file is present, and if present, it doesn't do anything. I suppose users installing new mods on their servers will at least start them once, to create config files if present? At least that's what I'd do.

I checked this on LAN game, and it is working flawlessly, at least the last 4 hours with multiple bug track points in. I'll come back complaining about the wheel if something dramatically is happening...:)

Link to comment
Share on other sites

How does iterating over massive amounts of code, in comparison to a one time, client side, boolean check, make modding efforts more "beauty"?

The config file will be created as usual, in your scope of "beauties" with regular code, anyways. So how does it matter if I write to this already existing file clientside?

You did not provide a more professionell solution, nor did you share your massive inside into Java/Minecraft coding, to why this is so risky, what I'm doing.

I really fail to see the lesson if you just connect it to saying how ugly things are, and rebuke me for hacking the grace of Forge methods. Which I probably don't even know they exist, given there are so many ways to skin the cat.

Edited by Cratthorax
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
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
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.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Yeah idk how to shut this down but it had something to do with parchment. It works now, I think I may have had the wrong version or something?
    • Recently while playing offline due to internet outages Malwarebytes identified Javaw.exe as malware, not thinking too much of it i deleted the file causing this error.  Unable to start Java. Error details: The requested operation requires elevation. Filename on disk: javaw.exe Path: C:\Users\---\curseforge\minecraft\Install\runtime\java-runtime-gamma\windows-x64\java-runtime-gamma\bin\javaw.exe Exists: File I reinstalled the file, same error occurred. I deleted CurseForge, over wolf and Minecraft and reinstalled them. Same error occurring. I have read starting Minecraft in administrator mode will help. I attempted to launch Minecraft through CurseForge in administrative mode this did not help.  I updated and downloaded the newest version of java, again receiving the same error. I updated Malwarebytes authorizing settings to allow for Javaw.exe through the pathway C:\Users\jacob\curseforge\minecraft\Install\runtime\java-runtime-gamma\windows-x64\java-runtime-gamma\bin\javaw.exe this did not assist either.  I am unsure of what to try next or what i am missing, i am not an expert with the complexities of these systems but any help to teach me or assist in problem solving would help. I also cannot find any debug logs or crash logs based on this specific circumstance.  The only thing that pops up when I search debug through the files is https://pastebin.com/WqMEvEn6.    
    • I have been trying my hardest to find the method to detect if the player is on the ground. I looked it up and people just say it like onGround always works, or isOnGround always works. Nothing shows up for me and the wording is red. I tried looking up an import but it doesn't seem to exist. I had to same issue with hasGlint, which turned out to be in the Item class and was isFoil instead. I even found the checkfalldamage method in the Living Entity class (I found this through looking at isFallFlying method and looking at usages) but it  uses its own variable to see if the player is on the ground, and I have NO idea where it gets that from! (It is called pOnGround) I am using Intellij, SDk 21, Language level 17, and the Forge version is 1.20.1-47.1.0. I Don't know where to look anymore and I feel like im going crazy.
    • I have been trying my hardest to find the method to detect if the player is on the ground. I looked it up and people just say it like onGround always works, or isOnGround always works. Nothing shows up for me and the wording is red. I tried looking up an import but it doesn't seem to exist. I had to same issue with hasGlint, which turned out to be in the Item class and was isFoil instead. I even found the checkfalldamage method in the Living Entity class (I found this through looking at isFallFlying method and looking at usages) but it  uses its own variable to see if the player is on the ground, and I have NO idea where it gets that from! (It is called pOnGround) I am using Intellij, SDk 21, Language level 17, and the Forge version is 1.20.1-47.1.0. I Don't know where to look anymore and I feel like im going crazy.
  • Topics

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.