Terra (Fabric/Forge/Paper)

Terra (Fabric/Forge/Paper)

74.2k Downloads

Long-term TODO: Per-world config pack instances

dfsek opened this issue ยท 0 comments

commented

To avoid all maps of world -> things, add a toWorldConfig method to ConfigPack which accepts a World as a parameter and creates a WorldConfig instance.

WorldConfig would build all world-dependent objects independently from the parent ConfigPack instance, and would be attached to a TerraWorld instead of a ConfigPack.

Advantages of this over old approach:

  • No more world -> thing maps. This allows for
    • Better concurrency. No more needing to synchronize on these maps.
    • Better performance. This completely removes the need to get items from the several world maps in the config.
  • Easier to understand code flow. Now, each world gets its own config instance, with a parent ConfigPack instead of all worlds on a particular pack sharing a pack instance.

Maps to eliminate:

  • SamplerCache world -> Container map
  • GeneratorBuilder world -> WorldGenerator map (this has the potential to significantly boost perf, this map is accessed a ton, this would completely remove the need to have it)
  • UserDefinedCarver world -> CarverCache map