Package net.minecraft.commands
Class CommandSourceStack
java.lang.Object
net.minecraft.commands.CommandSourceStack
- All Implemented Interfaces:
ExecutionCommandSource<CommandSourceStack>
,SharedSuggestionProvider
,ICommandSourceStackExtension
- Direct Known Subclasses:
ClientCommandSourceStack
public class CommandSourceStack
extends Object
implements ExecutionCommandSource<CommandSourceStack>, SharedSuggestionProvider, ICommandSourceStackExtension
-
Nested Class Summary
Nested classes/interfaces inherited from interface net.minecraft.commands.SharedSuggestionProvider
SharedSuggestionProvider.ElementSuggestionType, SharedSuggestionProvider.TextCoordinates
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final EntityAnchorArgument.Anchor
private final TaskChainer
private final Component
private final Entity
static final com.mojang.brigadier.exceptions.SimpleCommandExceptionType
static final com.mojang.brigadier.exceptions.SimpleCommandExceptionType
private final ServerLevel
private final int
private final CommandResultCallback
private final Vec2
private final MinecraftServer
private final CommandSigningContext
private final boolean
final CommandSource
private final String
private final Vec3
-
Constructor Summary
ConstructorsModifierConstructorDescriptionCommandSourceStack
(CommandSource source, Vec3 worldPosition, Vec2 rotation, ServerLevel level, int permissionLevel, String textName, Component displayName, MinecraftServer server, Entity entity) protected
CommandSourceStack
(CommandSource source, Vec3 worldPosition, Vec2 rotation, ServerLevel level, int permissionLevel, String textName, Component displayName, MinecraftServer server, Entity entity, boolean silent, CommandResultCallback resultCallback, EntityAnchorArgument.Anchor anchor, CommandSigningContext signingContext, TaskChainer chatMessageChainer) -
Method Summary
Modifier and TypeMethodDescriptionprivate void
broadcastToAdmins
(Component message) callback()
CompletableFuture
<com.mojang.brigadier.suggestion.Suggestions> customSuggestion
(com.mojang.brigadier.context.CommandContext<?> context) com.mojang.brigadier.CommandDispatcher
<CommandSourceStack> facing
(Entity entity, EntityAnchorArgument.Anchor anchor) getLevel()
void
handleError
(com.mojang.brigadier.exceptions.CommandExceptionType exceptionType, com.mojang.brigadier.Message message, boolean success, TraceCallbacks traceCallbacks) boolean
hasPermission
(int level) boolean
isPlayer()
boolean
isSilent()
levels()
void
sendChatMessage
(OutgoingChatMessage message, boolean shouldFilter, ChatType.Bound boundChatType) void
sendFailure
(Component message) void
sendSuccess
(Supplier<Component> messageSupplier, boolean allowLogging) void
sendSystemMessage
(Component message) boolean
shouldFilterMessageTo
(ServerPlayer receiver) CompletableFuture
<com.mojang.brigadier.suggestion.Suggestions> suggestRegistryElements
(ResourceKey<? extends Registry<?>> resourceKey, SharedSuggestionProvider.ElementSuggestionType registryKey, com.mojang.brigadier.suggestion.SuggestionsBuilder builder, com.mojang.brigadier.context.CommandContext<?> context) withCallback
(CommandResultCallback callback) withCallback
(CommandResultCallback callback, BinaryOperator<CommandResultCallback> operator) withEntity
(Entity entity) withLevel
(ServerLevel level) withMaximumPermission
(int permissionLevel) withPermission
(int permissionLevel) withPosition
(Vec3 pos) withRotation
(Vec2 rotation) withSigningContext
(CommandSigningContext signingContext, TaskChainer chatMessageChainer) withSource
(CommandSource source) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface net.minecraft.commands.ExecutionCommandSource
clearCallbacks, handleError
Methods inherited from interface net.neoforged.neoforge.common.extensions.ICommandSourceStackExtension
getAdvancement, getRecipeManager, getScoreboard, getUnsidedLevel
Methods inherited from interface net.minecraft.commands.SharedSuggestionProvider
getAbsoluteCoordinates, getCustomTabSugggestions, getRelevantCoordinates, getSelectedEntities, suggestRegistryElements
-
Field Details
-
ERROR_NOT_PLAYER
public static final com.mojang.brigadier.exceptions.SimpleCommandExceptionType ERROR_NOT_PLAYER -
ERROR_NOT_ENTITY
public static final com.mojang.brigadier.exceptions.SimpleCommandExceptionType ERROR_NOT_ENTITY -
source
-
worldPosition
-
level
-
permissionLevel
private final int permissionLevel -
textName
-
displayName
-
server
-
silent
private final boolean silent -
entity
-
resultCallback
-
anchor
-
rotation
-
signingContext
-
chatMessageChainer
-
-
Constructor Details
-
CommandSourceStack
public CommandSourceStack(CommandSource source, Vec3 worldPosition, Vec2 rotation, ServerLevel level, int permissionLevel, String textName, Component displayName, MinecraftServer server, @Nullable Entity entity) -
CommandSourceStack
protected CommandSourceStack(CommandSource source, Vec3 worldPosition, Vec2 rotation, ServerLevel level, int permissionLevel, String textName, Component displayName, MinecraftServer server, @Nullable Entity entity, boolean silent, CommandResultCallback resultCallback, EntityAnchorArgument.Anchor anchor, CommandSigningContext signingContext, TaskChainer chatMessageChainer)
-
-
Method Details
-
withSource
-
withEntity
-
withPosition
-
withRotation
-
withCallback
- Specified by:
withCallback
in interfaceExecutionCommandSource<CommandSourceStack>
-
withCallback
public CommandSourceStack withCallback(CommandResultCallback callback, BinaryOperator<CommandResultCallback> operator) -
withSuppressedOutput
-
withPermission
-
withMaximumPermission
-
withAnchor
-
withLevel
-
facing
-
facing
-
withSigningContext
public CommandSourceStack withSigningContext(CommandSigningContext signingContext, TaskChainer chatMessageChainer) -
getDisplayName
-
getTextName
-
hasPermission
public boolean hasPermission(int level) - Specified by:
hasPermission
in interfaceExecutionCommandSource<CommandSourceStack>
- Specified by:
hasPermission
in interfaceSharedSuggestionProvider
-
getPosition
-
getLevel
-
getEntity
-
getEntityOrException
- Throws:
com.mojang.brigadier.exceptions.CommandSyntaxException
-
getPlayerOrException
public ServerPlayer getPlayerOrException() throws com.mojang.brigadier.exceptions.CommandSyntaxException- Throws:
com.mojang.brigadier.exceptions.CommandSyntaxException
-
getPlayer
-
isPlayer
public boolean isPlayer() -
getRotation
-
getServer
-
getAnchor
-
getSigningContext
-
getChatMessageChainer
-
shouldFilterMessageTo
-
sendChatMessage
public void sendChatMessage(OutgoingChatMessage message, boolean shouldFilter, ChatType.Bound boundChatType) -
sendSystemMessage
-
sendSuccess
-
broadcastToAdmins
-
sendFailure
-
callback
- Specified by:
callback
in interfaceExecutionCommandSource<CommandSourceStack>
-
getOnlinePlayerNames
- Specified by:
getOnlinePlayerNames
in interfaceSharedSuggestionProvider
-
getAllTeams
- Specified by:
getAllTeams
in interfaceSharedSuggestionProvider
-
getAvailableSounds
- Specified by:
getAvailableSounds
in interfaceSharedSuggestionProvider
-
getRecipeNames
- Specified by:
getRecipeNames
in interfaceSharedSuggestionProvider
-
customSuggestion
public CompletableFuture<com.mojang.brigadier.suggestion.Suggestions> customSuggestion(com.mojang.brigadier.context.CommandContext<?> context) - Specified by:
customSuggestion
in interfaceSharedSuggestionProvider
-
levels
- Specified by:
levels
in interfaceSharedSuggestionProvider
-
registryAccess
- Specified by:
registryAccess
in interfaceSharedSuggestionProvider
-
enabledFeatures
- Specified by:
enabledFeatures
in interfaceSharedSuggestionProvider
-
dispatcher
- Specified by:
dispatcher
in interfaceExecutionCommandSource<CommandSourceStack>
-
handleError
public void handleError(com.mojang.brigadier.exceptions.CommandExceptionType exceptionType, com.mojang.brigadier.Message message, boolean success, @Nullable TraceCallbacks traceCallbacks) - Specified by:
handleError
in interfaceExecutionCommandSource<CommandSourceStack>
-
isSilent
public boolean isSilent()- Specified by:
isSilent
in interfaceExecutionCommandSource<CommandSourceStack>
-