Package net.minecraft.commands
Class CommandSourceStack
java.lang.Object
net.minecraft.commands.CommandSourceStack
- All Implemented Interfaces:
ExecutionCommandSource<CommandSourceStack>
,SharedSuggestionProvider
,ICommandSourceStackExtension
- Direct Known Subclasses:
ClientCommandSourceStack
,CommandTests.ErrorCatchingStack
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 pSource, Vec3 pWorldPosition, Vec2 pRotation, ServerLevel pLevel, int pPermissionLevel, String pTextName, Component pDisplayName, MinecraftServer pServer, Entity pEntity) protected
CommandSourceStack
(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 void
broadcastToAdmins
(Component pMessage) callback()
CompletableFuture
<com.mojang.brigadier.suggestion.Suggestions> customSuggestion
(com.mojang.brigadier.context.CommandContext<?> p_212324_) com.mojang.brigadier.CommandDispatcher
<CommandSourceStack> facing
(Entity pEntity, EntityAnchorArgument.Anchor pAnchor) getLevel()
void
handleError
(com.mojang.brigadier.exceptions.CommandExceptionType p_307548_, com.mojang.brigadier.Message p_307613_, boolean p_307560_, TraceCallbacks p_307654_) boolean
hasPermission
(int pLevel) boolean
isPlayer()
boolean
isSilent()
levels()
void
sendChatMessage
(OutgoingChatMessage pMessage, boolean pShouldFilter, ChatType.Bound pBoundChatType) void
sendFailure
(Component pMessage) void
sendSuccess
(Supplier<Component> pMessageSupplier, boolean pAllowLogging) void
sendSystemMessage
(Component pMessage) boolean
shouldFilterMessageTo
(ServerPlayer pReceiver) CompletableFuture
<com.mojang.brigadier.suggestion.Suggestions> suggestRegistryElements
(ResourceKey<? extends Registry<?>> p_212330_, SharedSuggestionProvider.ElementSuggestionType p_212331_, com.mojang.brigadier.suggestion.SuggestionsBuilder p_212332_, com.mojang.brigadier.context.CommandContext<?> p_212333_) 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, 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 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:
withCallback
in 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:
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 pMessage, boolean pShouldFilter, ChatType.Bound pBoundChatType) -
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<?> p_212324_) - 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 p_307548_, com.mojang.brigadier.Message p_307613_, boolean p_307560_, @Nullable TraceCallbacks p_307654_) - Specified by:
handleError
in interfaceExecutionCommandSource<CommandSourceStack>
-
isSilent
public boolean isSilent()- Specified by:
isSilent
in interfaceExecutionCommandSource<CommandSourceStack>
-