Skip to content

feat: add extensible registry interface and integrate into config and meta-config registries#560

Open
Bloeckchengrafik wants to merge 1 commit into
PolyhedralDev:dev/1.21.11from
everbuild-org:feat/extend-search-path
Open

feat: add extensible registry interface and integrate into config and meta-config registries#560
Bloeckchengrafik wants to merge 1 commit into
PolyhedralDev:dev/1.21.11from
everbuild-org:feat/extend-search-path

Conversation

@Bloeckchengrafik
Copy link
Copy Markdown
Member

@Bloeckchengrafik Bloeckchengrafik commented May 12, 2026

Pull Request

Description

As discussed via discord: Provides a way to extend the "search radius" of the pack and metapack registres using 4 system properties documented in the code below

Changelog

  • Allow specifying extra search paths for packs and metapacks

Checklist

Mandatory checks

  • The base branch of this PR is an unreleased version branch (that has a ver/ prefix)
    or is a branch that is intended to be merged into a version branch.
  • There are no already existing PRs that provide the same changes.
  • The PR is within the scope of Terra (i.e. is something a configurable terrain generator should be doing).
  • Changes follow the code style for this project.
  • I have read the CONTRIBUTING.md
    document in the root of the git repository.
  • LLM-based tools were not used to create this PR. (ChatGPT, Claude, etc)

Types of changes

  • Bug Fix
  • Build system
  • Documentation
  • New Feature
  • Performance
  • Refactoring
  • Repository
  • Revert
  • Style
  • Tests
  • Translation

Compatibility

  • Introduces a breaking change
  • Introduces new functionality in a backwards compatible way.
  • Introduces bug fixes

Documentation

  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
    • TODO

Testing

  • I have added tests to cover my changes.
  • All new and existing tests passed.

Licensing

  • I am the original author of this code, and I am willing to
    release it under GPLv3.
  • I am not the original author of this code, but it is in public domain or
    released under GPLv3 or a compatible license.

This does not build

This does not build due to missing stuff in the 1.21.11 branch.
Minestom part published
https://mvn.everbuild.org/#/public/com/dfsek/terra/minestom/7.0.0-BETA+b49b38f24

Copy link
Copy Markdown
Member

@solonovamax solonovamax left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should the concept of extending a registry maybe be abstracted a bit, so it can be extended both via system properties, but also by different providers? (config file, env variable, cli param, etc.)

Comment on lines +71 to +72
var file = path.toFile();
return file.isDirectory() || file.getName().endsWith(".zip");
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use the NIO Files api
with the files api, it allows it to easy be able to handle, for example, paths inside zip files (if we ever do support that) or something

Comment on lines +57 to +61
parseValidPaths(System.getProperty(basePropertyName + ".searchPath")),
Stream.of(baseSearchPath)
);

Stream<Path> extraPath = parseValidPaths(System.getProperty(basePropertyName + ".extraPath"));
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need both extra path & search path, or would only one be sufficient?

* <br>
* These system properties are formatted like UNIX-style paths, with each path separated by a colon (':') character.
*/
public interface CliExtensibleRegistry {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like the name "cli extensible registry" could definitely be workshopped a bit, but that's a personal nitpick

Comment on lines +71 to +72
var file = path.toFile();
return file.isDirectory() || file.getName().endsWith(".zip");
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NIO Files api

String basePropertyName = "terra.registry." + getRegistryName();

Stream<Path> searchPath = Stream.concat(
parseValidPaths(System.getProperty(basePropertyName + ".searchPath")),
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

personally I am partial to using kebab case for something like this rather than camel case, but this is a personal nitpick and it's honestly fine either way

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants