Package net.minecraft.commands
Class CommandSourceStack
java.lang.Object
net.minecraft.commands.CommandSourceStack
- All Implemented Interfaces:
ExecutionCommandSource<CommandSourceStack>,PermissionSource,SharedSuggestionProvider,ICommandSourceStackExtension
- Direct Known Subclasses:
ClientCommandSourceStack
public class CommandSourceStack
extends Object
implements ExecutionCommandSource<CommandSourceStack>, PermissionSource, SharedSuggestionProvider, ICommandSourceStackExtension
-
Nested Class Summary
Nested classes/interfaces inherited from interface net.minecraft.commands.PermissionSource
PermissionSource.Check<T extends PermissionSource>Nested classes/interfaces inherited from interface net.minecraft.commands.SharedSuggestionProvider
SharedSuggestionProvider.ElementSuggestionType, SharedSuggestionProvider.TextCoordinates -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final EntityAnchorArgument.Anchorprivate final TaskChainerprivate final Componentprivate final Entitystatic final com.mojang.brigadier.exceptions.SimpleCommandExceptionTypestatic final com.mojang.brigadier.exceptions.SimpleCommandExceptionTypeprivate final ServerLevelprivate final intprivate final CommandResultCallbackprivate final Vec2private final MinecraftServerprivate final CommandSigningContextprivate final booleanfinal CommandSourceprivate final Stringprivate final Vec3Fields inherited from interface net.minecraft.commands.SharedSuggestionProvider
MATCH_SPLITTER -
Constructor Summary
ConstructorsModifierConstructorDescriptionCommandSourceStack(CommandSource pSource, Vec3 pWorldPosition, Vec2 pRotation, ServerLevel pLevel, int pPermissionLevel, String pTextName, Component pDisplayName, MinecraftServer pServer, Entity pEntity) protectedCommandSourceStack(CommandSource pSource, Vec3 pWorldPosition, Vec2 pRotation, ServerLevel pLevel, int pPermissionLevel, String pTextName, Component pDisplayName, MinecraftServer pServer, Entity pEntity, boolean pSilent, CommandResultCallback pResultCallback, EntityAnchorArgument.Anchor pAnchor, CommandSigningContext pSigningContext, TaskChainer pChatMessageChainer) -
Method Summary
Modifier and TypeMethodDescriptionprivate voidbroadcastToAdmins(Component pMessage) callback()CompletableFuture<com.mojang.brigadier.suggestion.Suggestions> customSuggestion(com.mojang.brigadier.context.CommandContext<?> pContext) com.mojang.brigadier.CommandDispatcher<CommandSourceStack> facing(Entity pEntity, EntityAnchorArgument.Anchor pAnchor) getLevel()private Optional<? extends HolderLookup<?>> getLookup(ResourceKey<? extends Registry<?>> pRegistryKey) voidhandleError(com.mojang.brigadier.exceptions.CommandExceptionType pExceptionType, com.mojang.brigadier.Message pMessage, boolean pSuccess, TraceCallbacks pTraceCallbacks) booleanhasPermission(int pLevel) booleanisPlayer()booleanisSilent()levels()voidsendChatMessage(OutgoingChatMessage pMessage, boolean pShouldFilter, ChatType.Bound pBoundChatType) voidsendFailure(Component pMessage) voidsendSuccess(Supplier<Component> pMessageSupplier, boolean pAllowLogging) voidsendSystemMessage(Component pMessage) booleanshouldFilterMessageTo(ServerPlayer pReceiver) CompletableFuture<com.mojang.brigadier.suggestion.Suggestions> suggestRegistryElements(ResourceKey<? extends Registry<?>> pRegistryKey, SharedSuggestionProvider.ElementSuggestionType pType, com.mojang.brigadier.suggestion.SuggestionsBuilder pBuilder, com.mojang.brigadier.context.CommandContext<?> pContext) withAnchor(EntityAnchorArgument.Anchor pAnchor) withCallback(CommandResultCallback pCallback) withCallback(CommandResultCallback pCallback, BinaryOperator<CommandResultCallback> pOperator) withEntity(Entity pEntity) withLevel(ServerLevel pLevel) withMaximumPermission(int pPermissionLevel) withPermission(int pPermissionLevel) withPosition(Vec3 pPos) withRotation(Vec2 pRotation) withSigningContext(CommandSigningContext pSigningContext, TaskChainer pChatMessageChainer) withSource(CommandSource pSource) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.minecraft.commands.ExecutionCommandSource
clearCallbacks, handleErrorMethods inherited from interface net.neoforged.neoforge.common.extensions.ICommandSourceStackExtension
getAdvancement, getScoreboard, getUnsidedLevelMethods inherited from interface net.minecraft.commands.PermissionSource
allowsSelectorsMethods 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 pSource, Vec3 pWorldPosition, Vec2 pRotation, ServerLevel pLevel, int pPermissionLevel, String pTextName, Component pDisplayName, MinecraftServer pServer, @Nullable Entity pEntity) -
CommandSourceStack
protected CommandSourceStack(CommandSource pSource, Vec3 pWorldPosition, Vec2 pRotation, ServerLevel pLevel, int pPermissionLevel, String pTextName, Component pDisplayName, MinecraftServer pServer, @Nullable Entity pEntity, boolean pSilent, CommandResultCallback pResultCallback, EntityAnchorArgument.Anchor pAnchor, CommandSigningContext pSigningContext, TaskChainer pChatMessageChainer)
-
-
Method Details
-
withSource
-
withEntity
-
withPosition
-
withRotation
-
withCallback
- Specified by:
withCallbackin interfaceExecutionCommandSource<CommandSourceStack>
-
withCallback
public CommandSourceStack withCallback(CommandResultCallback pCallback, BinaryOperator<CommandResultCallback> pOperator) -
withSuppressedOutput
-
withPermission
-
withMaximumPermission
-
withAnchor
-
withLevel
-
facing
-
facing
-
withSigningContext
public CommandSourceStack withSigningContext(CommandSigningContext pSigningContext, TaskChainer pChatMessageChainer) -
getDisplayName
-
getTextName
-
hasPermission
public boolean hasPermission(int pLevel) - Specified by:
hasPermissionin interfacePermissionSource
-
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 pMessage, boolean pShouldFilter, ChatType.Bound pBoundChatType) -
sendSystemMessage
-
sendSuccess
-
broadcastToAdmins
-
sendFailure
-
callback
- Specified by:
callbackin interfaceExecutionCommandSource<CommandSourceStack>
-
getOnlinePlayerNames
- Specified by:
getOnlinePlayerNamesin interfaceSharedSuggestionProvider
-
getAllTeams
- Specified by:
getAllTeamsin interfaceSharedSuggestionProvider
-
getAvailableSounds
- Specified by:
getAvailableSoundsin interfaceSharedSuggestionProvider
-
customSuggestion
public CompletableFuture<com.mojang.brigadier.suggestion.Suggestions> customSuggestion(com.mojang.brigadier.context.CommandContext<?> pContext) - Specified by:
customSuggestionin interfaceSharedSuggestionProvider
-
getLookup
private Optional<? extends HolderLookup<?>> getLookup(ResourceKey<? extends Registry<?>> pRegistryKey) -
levels
- Specified by:
levelsin interfaceSharedSuggestionProvider
-
registryAccess
- Specified by:
registryAccessin interfaceSharedSuggestionProvider
-
enabledFeatures
- Specified by:
enabledFeaturesin interfaceSharedSuggestionProvider
-
dispatcher
- Specified by:
dispatcherin interfaceExecutionCommandSource<CommandSourceStack>
-
handleError
public void handleError(com.mojang.brigadier.exceptions.CommandExceptionType pExceptionType, com.mojang.brigadier.Message pMessage, boolean pSuccess, @Nullable TraceCallbacks pTraceCallbacks) - Specified by:
handleErrorin interfaceExecutionCommandSource<CommandSourceStack>
-
isSilent
public boolean isSilent()- Specified by:
isSilentin interfaceExecutionCommandSource<CommandSourceStack>
-