Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minecraft 1.13 - Datapacks #53

Open
wants to merge 1 commit into
base: 1.12
Choose a base branch
from
Open

Minecraft 1.13 - Datapacks #53

wants to merge 1 commit into from

Conversation

Cybermaxke
Copy link
Member

@Cybermaxke Cybermaxke commented Jan 6, 2018

Implementing the WIP datapacks API
SpongePowered/SpongeAPI#1706

Different kind of paths:
path/to/file.txt The namespace is unknown and will default to minecraft:path/to/file.txt
path/to/directory The namespace is unknown and will default to minecraft:path/to/directory
:path/to/file.txt (*:path/to/file.txt) The namespace is a wildcard, alternatively use * as namespace. Matches the first/all the files with the given path for every available namespace.
:path/to/directory (*:path/to/directory) The namespace is a wildcard, alternatively use * as namespace. Matches the all the files within the given directory for every available namespace.
namespace:path/to/file.txt A regular namespaced file path.
namespace:path/to/directory A regular namespaced directory path.

Stream<LanternResource> stream = null;
try {
// If a wildcard is used, there is some special handling required
if (path1.getNamespace().isEmpty()) {

Choose a reason for hiding this comment

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

This will never be empty. If the namespace is omitted from vanilla, minecraft is used in its place.

e.g. :. will become minecraft:.

Copy link
Member Author

Choose a reason for hiding this comment

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

We could modify that behavior? Or use a wildcard like * instead.

final Matcher matcher = NAMESPACE_PATH_PATTERN.matcher(path);
checkState(matcher.matches(),
"%s doesn't match the namespaced path pattern: %s", path, NAMESPACE_PATH_PATTERN.pattern());
this.namespace = matcher.group(1);
Copy link

@mattmess1221 mattmess1221 Jan 6, 2018

Choose a reason for hiding this comment

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

How does this handle a non-existent namespace? By non-existent, I mean missing, which should default to minecraft.

Copy link
Member Author

Choose a reason for hiding this comment

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

Non existent would be path/to/file, wildcard namespace :path/to/file

Copy link
Member Author

Choose a reason for hiding this comment

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

I haven't currently implemented path/to/file support

@Cybermaxke Cybermaxke changed the base branch from master to 1.12 April 24, 2020 13:51
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