Jump to content

[1.19.2] Config sometimes correcting itself with no reason


aut1sto

Recommended Posts

After changing value in config it reloads and works fine, but sometimes it spams "List on key X is deemed to need correction. It is null, not a list, or an empty list. Modders, consider defineListAllowEmpty?" about every key and recreating config. 
Here's files: https://gist.github.com/Aaur1s/4c9fee20fff6463f68c6bff62e634050
Using defineListAllowEmpty didn't resolve the problem.
I checked with debug mode and seems like all of the keys are null. Am I doing something wrong?

Edited by aut1sto
Link to comment
Share on other sites

Basically, you are adding a reload listener that can have its data repopulated using the `/reload` command. Since it looks like your data is all server related, you would need to listen to `AddReloadListenerEvent` on the Forge event bus and register a `PreparableReloadListener`. The reload listener will be responsible for reading your data into the game whenever the world is opened or the `/reload` command is called.

I would recommend using `SimpleJsonResourceReloadListener` instead of implementing your own, as then you just need to implement the storage system and relevant access points from your mod.

However, I must ask, what is the point of your configurations? Looking at it even more closely, it looks more related to feature spawn rates in biomes.

Link to comment
Share on other sites

It's config for quarry, basically list of ores/resources for biomes and height of it. Every tick quarry picks random rarity and random ore from list from config, however if resources didn't exist (for ex. ore from thermal, but no thermal mod installed) it rerolls resource. I tried to recieve random resource from chunk generator, but failed and wrote all of ores in config. Maybe you know the way of getting resource from generator?

Link to comment
Share on other sites

6 hours ago, aut1sto said:

I tried to recieve random resource from chunk generator, but failed and wrote all of ores in config. Maybe you know the way of getting resource from generator?

Is the ore or resource a specific block? Additionally, when you mean chunk generator in this context, do you mean you are trying to generate a list of these ores and resources within the positions inside the chunk itself? Are you trying to grab all the ore features that are generated within a chunk?

Link to comment
Share on other sites

1 hour ago, aut1sto said:

I need go get block that will be generated at random X, specific Y, random Z and specific biome (but not generate it in world or e.t.c.)

So, if you wanted to do the true implementation, you would probably need to use a BiomeModifier to read the placed features for each biome, execute the PlacementModifier list for each placed feature to get the block positions the feature would spawn in, and then group it by feature. The main issue there is that you have no context what feature is which. You could attempt to use the registry key to find similar naming schemes (e.g., name contains ore or something like that). You would also need to invalidate the data every time the biome modifier is reloaded.

 

Of course, as this is highly complicated to properly implement, it's probably just better to use a config with optional entries to handle your logic.

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



×
×
  • Create New...

Important Information

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