Package net.minecraft.command
Class CommandSource
- java.lang.Object
-
- net.minecraft.command.CommandSource
-
- All Implemented Interfaces:
ISuggestionProvider
public class CommandSource extends java.lang.Object implements ISuggestionProvider
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface net.minecraft.command.ISuggestionProvider
ISuggestionProvider.Coordinates
-
-
Field Summary
Fields Modifier and Type Field Description private EntityAnchorArgument.Typeanchorprivate com.mojang.brigadier.ResultConsumer<CommandSource>consumerprivate ITextComponentdisplayNameprivate Entityentitystatic com.mojang.brigadier.exceptions.SimpleCommandExceptionTypeERROR_NOT_ENTITYstatic com.mojang.brigadier.exceptions.SimpleCommandExceptionTypeERROR_NOT_PLAYERprivate ServerWorldlevelprivate intpermissionLevelprivate Vector2frotationprivate MinecraftServerserverprivate booleansilentprivate ICommandSourcesourceprivate java.lang.StringtextNameprivate Vector3dworldPosition
-
Constructor Summary
Constructors Modifier Constructor Description CommandSource(ICommandSource p_i49552_1_, Vector3d p_i49552_2_, Vector2f p_i49552_3_, ServerWorld p_i49552_4_, int p_i49552_5_, java.lang.String p_i49552_6_, ITextComponent p_i49552_7_, MinecraftServer p_i49552_8_, Entity p_i49552_9_)protectedCommandSource(ICommandSource p_i49553_1_, Vector3d p_i49553_2_, Vector2f p_i49553_3_, ServerWorld p_i49553_4_, int p_i49553_5_, java.lang.String p_i49553_6_, ITextComponent p_i49553_7_, MinecraftServer p_i49553_8_, Entity p_i49553_9_, boolean p_i49553_10_, com.mojang.brigadier.ResultConsumer<CommandSource> p_i49553_11_, EntityAnchorArgument.Type p_i49553_12_)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private voidbroadcastToAdmins(ITextComponent p_197020_1_)java.util.concurrent.CompletableFuture<com.mojang.brigadier.suggestion.Suggestions>customSuggestion(com.mojang.brigadier.context.CommandContext<ISuggestionProvider> p_197009_1_, com.mojang.brigadier.suggestion.SuggestionsBuilder p_197009_2_)CommandSourcefacing(Entity p_201006_1_, EntityAnchorArgument.Type p_201006_2_)CommandSourcefacing(Vector3d p_201005_1_)java.util.Collection<java.lang.String>getAllTeams()EntityAnchorArgument.TypegetAnchor()java.util.Collection<ResourceLocation>getAvailableSoundEvents()ITextComponentgetDisplayName()EntitygetEntity()EntitygetEntityOrException()ServerWorldgetLevel()java.util.Collection<java.lang.String>getOnlinePlayerNames()ServerPlayerEntitygetPlayerOrException()Vector3dgetPosition()java.util.stream.Stream<ResourceLocation>getRecipeNames()Vector2fgetRotation()MinecraftServergetServer()java.lang.StringgetTextName()booleanhasPermission(int p_197034_1_)java.util.Set<RegistryKey<World>>levels()voidonCommandComplete(com.mojang.brigadier.context.CommandContext<CommandSource> p_197038_1_, boolean p_197038_2_, int p_197038_3_)DynamicRegistriesregistryAccess()voidsendFailure(ITextComponent p_197021_1_)voidsendSuccess(ITextComponent p_197030_1_, boolean p_197030_2_)CommandSourcewithAnchor(EntityAnchorArgument.Type p_201010_1_)CommandSourcewithCallback(com.mojang.brigadier.ResultConsumer<CommandSource> p_197029_1_)CommandSourcewithCallback(com.mojang.brigadier.ResultConsumer<CommandSource> p_209550_1_, java.util.function.BinaryOperator<com.mojang.brigadier.ResultConsumer<CommandSource>> p_209550_2_)CommandSourcewithEntity(Entity p_197024_1_)CommandSourcewithLevel(ServerWorld p_201003_1_)CommandSourcewithMaximumPermission(int p_197026_1_)CommandSourcewithPermission(int p_197033_1_)CommandSourcewithPosition(Vector3d p_201009_1_)CommandSourcewithRotation(Vector2f p_201007_1_)CommandSourcewithSuppressedOutput()-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface net.minecraft.command.ISuggestionProvider
getAbsoluteCoordinates, getRelevantCoordinates, getSelectedEntities
-
-
-
-
Field Detail
-
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
private final ICommandSource source
-
worldPosition
private final Vector3d worldPosition
-
level
private final ServerWorld level
-
permissionLevel
private final int permissionLevel
-
textName
private final java.lang.String textName
-
displayName
private final ITextComponent displayName
-
server
private final MinecraftServer server
-
silent
private final boolean silent
-
entity
@Nullable private final Entity entity
-
consumer
private final com.mojang.brigadier.ResultConsumer<CommandSource> consumer
-
anchor
private final EntityAnchorArgument.Type anchor
-
rotation
private final Vector2f rotation
-
-
Constructor Detail
-
CommandSource
public CommandSource(ICommandSource p_i49552_1_, Vector3d p_i49552_2_, Vector2f p_i49552_3_, ServerWorld p_i49552_4_, int p_i49552_5_, java.lang.String p_i49552_6_, ITextComponent p_i49552_7_, MinecraftServer p_i49552_8_, @Nullable Entity p_i49552_9_)
-
CommandSource
protected CommandSource(ICommandSource p_i49553_1_, Vector3d p_i49553_2_, Vector2f p_i49553_3_, ServerWorld p_i49553_4_, int p_i49553_5_, java.lang.String p_i49553_6_, ITextComponent p_i49553_7_, MinecraftServer p_i49553_8_, @Nullable Entity p_i49553_9_, boolean p_i49553_10_, com.mojang.brigadier.ResultConsumer<CommandSource> p_i49553_11_, EntityAnchorArgument.Type p_i49553_12_)
-
-
Method Detail
-
withEntity
public CommandSource withEntity(Entity p_197024_1_)
-
withPosition
public CommandSource withPosition(Vector3d p_201009_1_)
-
withRotation
public CommandSource withRotation(Vector2f p_201007_1_)
-
withCallback
public CommandSource withCallback(com.mojang.brigadier.ResultConsumer<CommandSource> p_197029_1_)
-
withCallback
public CommandSource withCallback(com.mojang.brigadier.ResultConsumer<CommandSource> p_209550_1_, java.util.function.BinaryOperator<com.mojang.brigadier.ResultConsumer<CommandSource>> p_209550_2_)
-
withSuppressedOutput
public CommandSource withSuppressedOutput()
-
withPermission
public CommandSource withPermission(int p_197033_1_)
-
withMaximumPermission
public CommandSource withMaximumPermission(int p_197026_1_)
-
withAnchor
public CommandSource withAnchor(EntityAnchorArgument.Type p_201010_1_)
-
withLevel
public CommandSource withLevel(ServerWorld p_201003_1_)
-
facing
public CommandSource facing(Entity p_201006_1_, EntityAnchorArgument.Type p_201006_2_) throws com.mojang.brigadier.exceptions.CommandSyntaxException
- Throws:
com.mojang.brigadier.exceptions.CommandSyntaxException
-
facing
public CommandSource facing(Vector3d p_201005_1_) throws com.mojang.brigadier.exceptions.CommandSyntaxException
- Throws:
com.mojang.brigadier.exceptions.CommandSyntaxException
-
getDisplayName
public ITextComponent getDisplayName()
-
getTextName
public java.lang.String getTextName()
-
hasPermission
public boolean hasPermission(int p_197034_1_)
- Specified by:
hasPermissionin interfaceISuggestionProvider
-
getPosition
public Vector3d getPosition()
-
getLevel
public ServerWorld getLevel()
-
getEntity
@Nullable public Entity getEntity()
-
getEntityOrException
public Entity getEntityOrException() throws com.mojang.brigadier.exceptions.CommandSyntaxException
- Throws:
com.mojang.brigadier.exceptions.CommandSyntaxException
-
getPlayerOrException
public ServerPlayerEntity getPlayerOrException() throws com.mojang.brigadier.exceptions.CommandSyntaxException
- Throws:
com.mojang.brigadier.exceptions.CommandSyntaxException
-
getRotation
public Vector2f getRotation()
-
getServer
public MinecraftServer getServer()
-
getAnchor
public EntityAnchorArgument.Type getAnchor()
-
sendSuccess
public void sendSuccess(ITextComponent p_197030_1_, boolean p_197030_2_)
-
broadcastToAdmins
private void broadcastToAdmins(ITextComponent p_197020_1_)
-
sendFailure
public void sendFailure(ITextComponent p_197021_1_)
-
onCommandComplete
public void onCommandComplete(com.mojang.brigadier.context.CommandContext<CommandSource> p_197038_1_, boolean p_197038_2_, int p_197038_3_)
-
getOnlinePlayerNames
public java.util.Collection<java.lang.String> getOnlinePlayerNames()
- Specified by:
getOnlinePlayerNamesin interfaceISuggestionProvider
-
getAllTeams
public java.util.Collection<java.lang.String> getAllTeams()
- Specified by:
getAllTeamsin interfaceISuggestionProvider
-
getAvailableSoundEvents
public java.util.Collection<ResourceLocation> getAvailableSoundEvents()
- Specified by:
getAvailableSoundEventsin interfaceISuggestionProvider
-
getRecipeNames
public java.util.stream.Stream<ResourceLocation> getRecipeNames()
- Specified by:
getRecipeNamesin interfaceISuggestionProvider
-
customSuggestion
public java.util.concurrent.CompletableFuture<com.mojang.brigadier.suggestion.Suggestions> customSuggestion(com.mojang.brigadier.context.CommandContext<ISuggestionProvider> p_197009_1_, com.mojang.brigadier.suggestion.SuggestionsBuilder p_197009_2_)
- Specified by:
customSuggestionin interfaceISuggestionProvider
-
levels
public java.util.Set<RegistryKey<World>> levels()
- Specified by:
levelsin interfaceISuggestionProvider
-
registryAccess
public DynamicRegistries registryAccess()
- Specified by:
registryAccessin interfaceISuggestionProvider
-
-