Terra (Fabric/Forge/Paper)

Terra (Fabric/Forge/Paper)

74.2k Downloads

Config loading rewrite

dfsek opened this issue ยท 5 comments

commented

Config loading should be improved. Things to do:

  • Abstaction improvements
    • Multiple Inheritance
    • Allow extension of non-abstract configs
    • Allow abstraction/extension of all configs
    • Ditch the abstract directory. Replace with abstract key in config.
  • Multi-phase loading.
    • Phase 1: Load metadata (ID and abstraction data), and build/validate inheritance tree (make sure super configs exist, check for circular dependency)
    • Phase 2: Load config data. Load all config options into memory, build all non-abstract configs fully. Check that non-abstract configs have/inherit all required keys.
    • Phase 3: Generate terrain objects from all configs.
  • More checks?
    • Better duplicate checks. Make duplicates error rather than warn.
    • Check for unused configs and warn.
    • Save errors and make a stack trace-style system to make tracing the source of config errors easier.
commented

Specific things to add:

  • "Sub-Palettes" - Allow palettes to specify other palettes to include (this would solve the issue of using Simplex and Random palettes)
commented

since you never added this, I'll add it here:

  • Loading from zip files.
    • Can load configs from either the normal folder structure, or a .zip which is renamed to something like .terra so we can be fancy.
    • it does computer magic and loads it in memory.
commented

Another thing:

  • Stage changes and only load if there aren't errors.
    • In the latest commit I removed FailType, mainly because it's a dumb workaround to the problem at hand, which is errored configs being reloaded at runtime. This can be solved more elegantly by staging config changes, and only loading them if no errors are found.
    • Probably another phase for multi phase loading.
commented

image

commented

Implemented in #31