Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions mappings/net/minecraft/resources/Identifier.mapping
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
CLASS net/minecraft/resources/Identifier
COMMENT `Identifier`s are used in Minecraft's code to identify a resource's location.

@its-miroma its-miroma Nov 7, 2026 •

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.

The Docs' refreshed guidelines say: "Avoid specifying that the [modded] game is Minecraft"

Should we apply that rule to Annotater too?

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.

IMO, we should not apply that to the annotator, since the code is not modified yet.

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.

That's even more of a reason why mentioning "Minecraft" is redundant.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Annotater's guidelines don't specify this, I think the clarification is fine.

COMMENT To avoid ambiguity, they consist of a namespace representing the creator of the resource and the path to the resource.
COMMENT When converted to a string, the namespace and path are combined becoming `namespace:path`.
METHOD assertValidPath (Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
COMMENT @throws IdentifierException if the path contains a non `[a-z0-9/._-]` character.
METHOD fromNamespaceAndPath (Ljava/lang/String;Ljava/lang/String;)Lnet/minecraft/resources/Identifier;
COMMENT Creates an identifier from a namespace and a path.
COMMENT @param namespace the namespace, restricted to `[a-z0-9_.-]`.
COMMENT @param path the path, restricted to `[a-z0-9/._-]`
COMMENT @return an `Identifier` created from the namespace and path.
COMMENT @throws IdentifierException if either string contains an invalid character.
METHOD toLanguageKey ()Ljava/lang/String;
COMMENT @return A translation key in the format `namespace.path`.
METHOD toLanguageKey (Ljava/lang/String;)Ljava/lang/String;
COMMENT @return A translation key in the format `prefix.namespace.path`.
METHOD toLanguageKey (Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
COMMENT @return A translation key in the format `prefix.namespace.path.suffix`.
METHOD toShortLanguageKey ()Ljava/lang/String;
COMMENT @return A translation key in the format `namespace.path`. If the namespace is `minecraft`, the translation key is shortened to `path`.

@its-miroma its-miroma Nov 7, 2026 •

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.

Should we reference other methods? For example:

Similar to [toLanguageKey], but drops the default [namespace] `minecraft`.

Question: can multiple @return clauses be used in the same comment?

@return A translation key in the format `namespace.path`.
@return A translation key in the format `path`, if the [namespace] is {@value #DEFAULT_NAMESPACE}.

@NotNightSky NotNightSky Nov 7, 2026 •

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.

yes, multiple @return clauses can be used in the same comment and will be formatted like multiple @param clauses.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I think referencing other methods makes sense. Multiple @return declarations doesn't though, this isn't allowed per the javadoc spec.

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 think referencing other methods makes sense. Multiple @return declarations doesn't though, this isn't allowed per the javadoc spec.

It isn't?

METHOD tryBuild (Ljava/lang/String;Ljava/lang/String;)Lnet/minecraft/resources/Identifier;
COMMENT Creates an `Identifier` from a namespace and a path.
COMMENT @param namespace the namespace, restricted to `[a-z0-9_.-]`.
COMMENT @param path the path, restricted to `[a-z0-9/._-]`
COMMENT @return an `Identifier` created from the namespace and path, or `null` if either string contains an invalid character.
METHOD withDefaultNamespace (Ljava/lang/String;)Lnet/minecraft/resources/Identifier;
COMMENT Creates an `Identifier` with the namespace set to [DEFAULT_NAMESPACE].

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggested change
COMMENT Creates an `Identifier` with the namespace set to [DEFAULT_NAMESPACE].
COMMENT Creates an [Identifier] with the [default namespace][#DEFAULT_NAMESPACE].

Renders like this, which reads more like a sentence:

Creates an Identifier with the default namespace.

COMMENT @param path the path, restricted to `[a-z0-9/._-]`
METHOD withPath (Ljava/lang/String;)Lnet/minecraft/resources/Identifier;
COMMENT @param newPath the path, restricted to `[a-z0-9/._-]`
COMMENT @return a new `Identifier` with the same namespace and a different path.
METHOD withPath (Ljava/util/function/UnaryOperator;)Lnet/minecraft/resources/Identifier;
COMMENT @param modifier a modifier to prepend to the existing path, with the result restricted to `[a-z0-9/._-]`
COMMENT @return creates a new `Identifier` with the same namespace and a different path.
METHOD withPrefix (Ljava/lang/String;)Lnet/minecraft/resources/Identifier;
COMMENT @param prefix a string to prepend to the existing path, restricted to `[a-z0-9/._-]`
COMMENT @return a new `Identifier` with the same namespace and a different path.
METHOD withSuffix (Ljava/lang/String;)Lnet/minecraft/resources/Identifier;
COMMENT @param suffix a string to append to the existing path, restricted to `[a-z0-9/._-]`
COMMENT @return a new `Identifier` with the same namespace and a different path.