WaypointArgument .java

net.minecraft.commands.arguments.WaypointArgument (class, 22 lines): members: ERROR_NOT_A_WAYPOINT, getWaypoint. strings: "argument.waypoint.invalid".

net.minecraft.commands.argumentsclass22 linescommon1018 B

API Surface (1)

WaypointTransmitter getWaypoint(final CommandContext<CommandSourceStack> context, final String name)

Fields & Constants (1)

ERROR_NOT_A_WAYPOINT

String literals (1)

"argument.waypoint.invalid"

Code Graph: Dependencies (4)

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

Full Source

WaypointArgument.java22 lines · Minecraft 26.3 · verbatim
1
package net.minecraft.commands.arguments;
2
3
import com.mojang.brigadier.context.CommandContext;
4
import com.mojang.brigadier.exceptions.CommandSyntaxException;
5
import com.mojang.brigadier.exceptions.SimpleCommandExceptionType;
6
import net.minecraft.commands.CommandSourceStack;
7
import net.minecraft.commands.arguments.selector.EntitySelector;
8
import net.minecraft.network.chat.Component;
9
import net.minecraft.world.waypoints.WaypointTransmitter;
10
11
public class WaypointArgument {
12
	public static final SimpleCommandExceptionType ERROR_NOT_A_WAYPOINT = new SimpleCommandExceptionType(Component.translatable("argument.waypoint.invalid"));
13
14
	public static WaypointTransmitter getWaypoint(final CommandContext<CommandSourceStack> context, final String name) throws CommandSyntaxException {
15
		if (context.getArgument(name, EntitySelector.class).findSingleEntity(context.getSource()) instanceof WaypointTransmitter waypointTransmitter) {
16
			return waypointTransmitter;
17
		} else {
18
			throw ERROR_NOT_A_WAYPOINT.create();
19
		}
20
	}
21
}
22

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