CompoundTagArgument .java

net.minecraft.commands.arguments.CompoundTagArgument (class): members: getCompoundTag, compoundTag, getExamples, EXAMPLES, parse. strings: "{foo=bar}".

net.minecraft.commands.argumentsclass35 linescommon1.0 KB

Implements

API Surface (4)

CompoundTagArgument compoundTag()
<S> CompoundTag getCompoundTag(final CommandContext<S> context, final String name)
CompoundTag 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

CompoundTagArgument.java35 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.nbt.CompoundTag;
10
import net.minecraft.nbt.TagParser;
11
12
public class CompoundTagArgument implements ArgumentType<CompoundTag> {
13
	private static final Collection<String> EXAMPLES = Arrays.asList("{}", "{foo=bar}");
14
15
	private CompoundTagArgument() {
16
	}
17
18
	public static CompoundTagArgument compoundTag() {
19
		return new CompoundTagArgument();
20
	}
21
22
	public static <S> CompoundTag getCompoundTag(final CommandContext<S> context, final String name) {
23
		return context.getArgument(name, CompoundTag.class);
24
	}
25
26
	public CompoundTag parse(final StringReader reader) throws CommandSyntaxException {
27
		return TagParser.parseCompoundAsArgument(reader);
28
	}
29
30
	@Override
31
	public Collection<String> getExamples() {
32
		return EXAMPLES;
33
	}
34
}
35

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