aut1sto Posted May 19, 2023 Share Posted May 19, 2023 (edited) 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 May 19, 2023 by aut1sto Quote Link to comment Share on other sites More sharing options...
aut1sto Posted May 20, 2023 Author Share Posted May 20, 2023 Do config values must be final? Quote Link to comment Share on other sites More sharing options...
aut1sto Posted May 20, 2023 Author Share Posted May 20, 2023 Did them final, still same issue Quote Link to comment Share on other sites More sharing options...
ChampionAsh5357 Posted May 20, 2023 Share Posted May 20, 2023 I assume it has to do with this open Forge issue that relies on an upstream change. However, I would recommend making a serializer for a datapack instead rather than using a config. Quote Link to comment Share on other sites More sharing options...
aut1sto Posted May 22, 2023 Author Share Posted May 22, 2023 What is serializer for a datapack and how can I use it as config that reloads? Quote Link to comment Share on other sites More sharing options...
ChampionAsh5357 Posted May 22, 2023 Share Posted May 22, 2023 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. Quote Link to comment Share on other sites More sharing options...
aut1sto Posted May 22, 2023 Author Share Posted May 22, 2023 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? Quote Link to comment Share on other sites More sharing options...
ChampionAsh5357 Posted May 22, 2023 Share Posted May 22, 2023 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? Quote Link to comment Share on other sites More sharing options...
aut1sto Posted May 22, 2023 Author Share Posted May 22, 2023 (edited) 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.) Edited May 22, 2023 by aut1sto Quote Link to comment Share on other sites More sharing options...
ChampionAsh5357 Posted May 22, 2023 Share Posted May 22, 2023 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. Quote Link to comment Share on other sites More sharing options...
aut1sto Posted May 22, 2023 Author Share Posted May 22, 2023 I looked at placed features, but couldn't properly implement it. I will try to use datapack serialization, thx for help! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.