IdentifierArgument .java

net.minecraft.commands.arguments.IdentifierArgument (class): members: getExamples, EXAMPLES, getId, parse. strings: "foo:bar". imports: ArgumentType.

net.minecraft.commands.argumentsclass32 linescommon1004 B

Implements

API Surface (4)

IdentifierArgument id()
Identifier getId(final CommandContext<CommandSourceStack> context, final String name)
Identifier parse(final StringReader reader)
Collection<String> getExamples()

Fields & Constants (1)

EXAMPLES

String literals (1)

"foo:bar"

Code Graph: Dependencies (2)

Edges (calls / imports / inherits / references) resolved by graphify from the AST. Every chip opens the class source.

Full Source

IdentifierArgument.java32 lines · Minecraft 26.3 · verbatim
1
package net.minecraft.commands.arguments;
2
3
import com.mojang.brigadier.StringReader;
4
import com.mojang.brigadier.arguments.ArgumentType;
5
import com.mojang.brigadier.context.CommandContext;
6
import com.mojang.brigadier.exceptions.CommandSyntaxException;
7
import java.util.Arrays;
8
import java.util.Collection;
9
import net.minecraft.commands.CommandSourceStack;
10
import net.minecraft.resources.Identifier;
11
12
public class IdentifierArgument implements ArgumentType<Identifier> {
13
	private static final Collection<String> EXAMPLES = Arrays.asList("foo", "foo:bar", "012");
14
15
	public static IdentifierArgument id() {
16
		return new IdentifierArgument();
17
	}
18
19
	public static Identifier getId(final CommandContext<CommandSourceStack> context, final String name) {
20
		return context.getArgument(name, Identifier.class);
21
	}
22
23
	public Identifier parse(final StringReader reader) throws CommandSyntaxException {
24
		return Identifier.read(reader);
25
	}
26
27
	@Override
28
	public Collection<String> getExamples() {
29
		return EXAMPLES;
30
	}
31
}
32

Decompiled Minecraft 26.3 source of IdentifierArgument (net/minecraft/commands/arguments/IdentifierArgument.java) with Mojang official mappings, stored verbatim on the site.