Class ClientCommandSourceStack

java.lang.Object
net.minecraft.commands.CommandSourceStack
net.neoforged.neoforge.client.ClientCommandSourceStack
All Implemented Interfaces:
net.minecraft.commands.ExecutionCommandSource<net.minecraft.commands.CommandSourceStack>, net.minecraft.commands.SharedSuggestionProvider, ICommandSourceStackExtension

public class ClientCommandSourceStack extends net.minecraft.commands.CommandSourceStack
overrides for CommandSourceStack so that the methods will run successfully client side
  • Nested Class Summary

    Nested classes/interfaces inherited from interface net.minecraft.commands.SharedSuggestionProvider

    net.minecraft.commands.SharedSuggestionProvider.ElementSuggestionType, net.minecraft.commands.SharedSuggestionProvider.TextCoordinates
  • Field Summary

    Fields inherited from class net.minecraft.commands.CommandSourceStack

    ERROR_NOT_ENTITY, ERROR_NOT_PLAYER, source

    Fields inherited from interface net.minecraft.commands.SharedSuggestionProvider

    MATCH_SPLITTER
  • Constructor Summary

    Constructors
    Constructor
    Description
    ClientCommandSourceStack(net.minecraft.commands.CommandSource source, net.minecraft.world.phys.Vec3 position, net.minecraft.world.phys.Vec2 rotation, int permission, String plainTextName, net.minecraft.network.chat.Component displayName, net.minecraft.world.entity.Entity executing)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    private net.minecraft.client.multiplayer.ClientPacketListener
    Returns the current connection, used to shorten method calls and hide the nullability warnings.
    net.minecraft.world.flag.FeatureFlagSet
    Returns the FeatureFlagSet from the client side.
    @Nullable net.minecraft.advancements.AdvancementHolder
    getAdvancement(net.minecraft.resources.ResourceLocation id)
    Returns the advancement from the id from the client side where the advancement needs to be visible to the player.
    Returns the list of teams from the client side.
    net.minecraft.server.level.ServerLevel
     
    Returns the list of online player names from the client side.
    net.minecraft.world.scores.Scoreboard
    Returns the scoreboard from the client side.
    net.minecraft.server.MinecraftServer
     
    net.minecraft.world.level.Level
    Returns the level from the client side.
    Set<net.minecraft.resources.ResourceKey<net.minecraft.world.level.Level>>
    Returns a set of ResourceKey for levels from the client side.
    net.minecraft.core.RegistryAccess
    Returns the RegistryAccess from the client side.
    void
    sendSuccess(Supplier<net.minecraft.network.chat.Component> message, boolean sendToAdmins)
    Sends a success message without attempting to get the server side list of admins
    CompletableFuture<com.mojang.brigadier.suggestion.Suggestions>
    suggestRegistryElements(net.minecraft.resources.ResourceKey<? extends net.minecraft.core.Registry<?>> registry, net.minecraft.commands.SharedSuggestionProvider.ElementSuggestionType suggestionType, com.mojang.brigadier.suggestion.SuggestionsBuilder suggestionsBuilder, com.mojang.brigadier.context.CommandContext<?> context)
     

    Methods inherited from class net.minecraft.commands.CommandSourceStack

    callback, customSuggestion, dispatcher, facing, facing, getAnchor, getAvailableSounds, getChatMessageChainer, getDisplayName, getEntity, getEntityOrException, getPlayer, getPlayerOrException, getPosition, getRotation, getSigningContext, getTextName, handleError, hasPermission, isPlayer, isSilent, sendChatMessage, sendFailure, sendSystemMessage, shouldFilterMessageTo, withAnchor, withCallback, withCallback, withEntity, withLevel, withMaximumPermission, withPermission, withPosition, withRotation, withSigningContext, withSource, withSuppressedOutput

    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.minecraft.commands.SharedSuggestionProvider

    getAbsoluteCoordinates, getCustomTabSugggestions, getRelevantCoordinates, getSelectedEntities, suggestRegistryElements
  • Constructor Details

    • ClientCommandSourceStack

      public ClientCommandSourceStack(net.minecraft.commands.CommandSource source, net.minecraft.world.phys.Vec3 position, net.minecraft.world.phys.Vec2 rotation, int permission, String plainTextName, net.minecraft.network.chat.Component displayName, net.minecraft.world.entity.Entity executing)
  • Method Details

    • connection

      private net.minecraft.client.multiplayer.ClientPacketListener connection()
      Returns the current connection, used to shorten method calls and hide the nullability warnings.
      Returns:
      the current connection, used to shorten method calls and hide the nullability warnings
    • sendSuccess

      public void sendSuccess(Supplier<net.minecraft.network.chat.Component> message, boolean sendToAdmins)
      Sends a success message without attempting to get the server side list of admins
      Overrides:
      sendSuccess in class net.minecraft.commands.CommandSourceStack
    • getAllTeams

      public Collection<String> getAllTeams()
      Returns the list of teams from the client side.
      Specified by:
      getAllTeams in interface net.minecraft.commands.SharedSuggestionProvider
      Overrides:
      getAllTeams in class net.minecraft.commands.CommandSourceStack
      Returns:
      the list of teams from the client side
    • getOnlinePlayerNames

      public Collection<String> getOnlinePlayerNames()
      Returns the list of online player names from the client side.
      Specified by:
      getOnlinePlayerNames in interface net.minecraft.commands.SharedSuggestionProvider
      Overrides:
      getOnlinePlayerNames in class net.minecraft.commands.CommandSourceStack
      Returns:
      the list of online player names from the client side
    • suggestRegistryElements

      public CompletableFuture<com.mojang.brigadier.suggestion.Suggestions> suggestRegistryElements(net.minecraft.resources.ResourceKey<? extends net.minecraft.core.Registry<?>> registry, net.minecraft.commands.SharedSuggestionProvider.ElementSuggestionType suggestionType, com.mojang.brigadier.suggestion.SuggestionsBuilder suggestionsBuilder, com.mojang.brigadier.context.CommandContext<?> context)
      Specified by:
      suggestRegistryElements in interface net.minecraft.commands.SharedSuggestionProvider
      Overrides:
      suggestRegistryElements in class net.minecraft.commands.CommandSourceStack
    • levels

      public Set<net.minecraft.resources.ResourceKey<net.minecraft.world.level.Level>> levels()
      Returns a set of ResourceKey for levels from the client side.
      Specified by:
      levels in interface net.minecraft.commands.SharedSuggestionProvider
      Overrides:
      levels in class net.minecraft.commands.CommandSourceStack
      Returns:
      a set of ResourceKey for levels from the client side
    • registryAccess

      public net.minecraft.core.RegistryAccess registryAccess()
      Returns the RegistryAccess from the client side.
      Specified by:
      registryAccess in interface net.minecraft.commands.SharedSuggestionProvider
      Overrides:
      registryAccess in class net.minecraft.commands.CommandSourceStack
      Returns:
      the RegistryAccess from the client side
    • enabledFeatures

      public net.minecraft.world.flag.FeatureFlagSet enabledFeatures()
      Returns the FeatureFlagSet from the client side.
      Specified by:
      enabledFeatures in interface net.minecraft.commands.SharedSuggestionProvider
      Overrides:
      enabledFeatures in class net.minecraft.commands.CommandSourceStack
      Returns:
      the FeatureFlagSet from the client side
    • getScoreboard

      public net.minecraft.world.scores.Scoreboard getScoreboard()
      Returns the scoreboard from the client side.
      Returns:
      the scoreboard from the client side
    • getAdvancement

      @Nullable public @Nullable net.minecraft.advancements.AdvancementHolder getAdvancement(net.minecraft.resources.ResourceLocation id)
      Returns the advancement from the id from the client side where the advancement needs to be visible to the player.
      Returns:
      the advancement from the id from the client side where the advancement needs to be visible to the player
    • getUnsidedLevel

      public net.minecraft.world.level.Level getUnsidedLevel()
      Returns the level from the client side.
      Returns:
      the level from the client side
    • getServer

      public net.minecraft.server.MinecraftServer getServer()
      Overrides:
      getServer in class net.minecraft.commands.CommandSourceStack
      Throws:
      UnsupportedOperationException - because the server isn't available on the client
    • getLevel

      public net.minecraft.server.level.ServerLevel getLevel()
      Overrides:
      getLevel in class net.minecraft.commands.CommandSourceStack
      Throws:
      UnsupportedOperationException - because the server side level isn't available on the client side