Class NoTeam

java.lang.Object
com.petrolpark.core.team.NoTeam
All Implemented Interfaces:
ITeam, ITeam.Provider, net.minecraft.core.component.DataComponentHolder, net.neoforged.neoforge.common.extensions.IDataComponentHolderExtension, net.neoforged.neoforge.common.MutableDataComponentHolder

@ParametersAreNonnullByDefault public final class NoTeam extends Object implements ITeam, ITeam.Provider
  • Nested Class Summary

    Nested classes/interfaces inherited from interface com.petrolpark.core.team.ITeam

    ITeam.Provider, ITeam.ProviderType
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final NoTeam
     

    Fields inherited from interface com.petrolpark.core.team.ITeam.Provider

    CODEC, STREAM_CODEC, TYPED_CODEC
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    applyComponents(net.minecraft.core.component.DataComponentMap components)
     
    void
    applyComponents(net.minecraft.core.component.DataComponentPatch patch)
     
    net.minecraft.core.component.DataComponentMap
     
    net.minecraft.network.chat.Component
    The name of this Team, without necessarily referring to any members.
    The ITeam.Provider that provides this exact Team instance.
     
    net.minecraft.network.chat.Component
    getRenderedMemberList(int maxTextWidth)
    Get the names of some members of this Team, formatted nicely.
    boolean
    isAdmin(net.minecraft.world.entity.player.Player player)
    What this means will be different for every system that uses Teams.
    boolean
    isMember(net.minecraft.world.entity.player.Player player)
    Whether the given Player is in this Team, meaning they have access client-side to the Team's Data Components, and have any non-admin abilities.
    boolean
    Whether this Team can never have any members or Data Components.
    int
    The number of members of this Team.
    provideTeam(net.minecraft.world.level.Level level)
     
    <T> T
    remove(net.minecraft.core.component.DataComponentType<? extends T> componentType)
     
    void
    renderIcon(net.minecraft.client.gui.GuiGraphics graphics)
    Render an icon for this ITeam.
    <T> T
    set(net.minecraft.core.component.DataComponentType<? super T> componentType, T value)
     
    Stream<net.minecraft.world.entity.player.Player>
    Every member of this Team, with no guarantee of order.
    The unique username of every member of this Team, in no particular order.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface net.minecraft.core.component.DataComponentHolder

    get, getOrDefault, has

    Methods inherited from interface net.neoforged.neoforge.common.extensions.IDataComponentHolderExtension

    addToTooltip, addToTooltip, get, getOrDefault, has

    Methods inherited from interface com.petrolpark.core.team.ITeam

    sendToAllMembers, streamServerMembers

    Methods inherited from interface net.neoforged.neoforge.common.MutableDataComponentHolder

    copyFrom, copyFrom, remove, set, update, update, update, update
  • Field Details

    • INSTANCE

      public static final NoTeam INSTANCE
  • Constructor Details

    • NoTeam

      public NoTeam()
  • Method Details

    • getProvider

      public ITeam.Provider getProvider()
      Description copied from interface: ITeam
      The ITeam.Provider that provides this exact Team instance.
      Specified by:
      getProvider in interface ITeam
    • getProviderType

      public ITeam.ProviderType getProviderType()
      Specified by:
      getProviderType in interface ITeam.Provider
    • provideTeam

      public ITeam provideTeam(net.minecraft.world.level.Level level)
      Specified by:
      provideTeam in interface ITeam.Provider
    • isNone

      public boolean isNone()
      Description copied from interface: ITeam
      Whether this Team can never have any members or Data Components.
      Specified by:
      isNone in interface ITeam
      See Also:
    • isMember

      public boolean isMember(net.minecraft.world.entity.player.Player player)
      Description copied from interface: ITeam
      Whether the given Player is in this Team, meaning they have access client-side to the Team's Data Components, and have any non-admin abilities.
      Specified by:
      isMember in interface ITeam
      Parameters:
      player -
    • memberCount

      public int memberCount()
      Description copied from interface: ITeam
      The number of members of this Team.
      Specified by:
      memberCount in interface ITeam
      Returns:
      Positive integer almost always greater than 0.
    • streamMemberUsernames

      public Stream<String> streamMemberUsernames()
      Description copied from interface: ITeam
      The unique username of every member of this Team, in no particular order. For ScoreboardTeams in particular, this method is faster than ITeam.streamMembers() and should be used in preference to calling that method and then getting the usernames.
      Specified by:
      streamMemberUsernames in interface ITeam
    • streamMembers

      public Stream<net.minecraft.world.entity.player.Player> streamMembers()
      Description copied from interface: ITeam
      Every member of this Team, with no guarantee of order. It is faster to use ITeam.streamMemberUsernames() unless having the Player itself is vital. On the client side, that is the only way to know the members of the Team.
      Specified by:
      streamMembers in interface ITeam
      See Also:
    • isAdmin

      public boolean isAdmin(net.minecraft.world.entity.player.Player player)
      Description copied from interface: ITeam
      What this means will be different for every system that uses Teams. It could mean the ability to change the name of a Shop, for example. It has nothing to do with operator permissions. If called, it is assumed that ITeam.isMember(Player) has already passed.
      Specified by:
      isAdmin in interface ITeam
      Parameters:
      player -
    • getName

      public net.minecraft.network.chat.Component getName()
      Description copied from interface: ITeam
      The name of this Team, without necessarily referring to any members.
      Specified by:
      getName in interface ITeam
      See Also:
    • renderIcon

      public void renderIcon(net.minecraft.client.gui.GuiGraphics graphics)
      Description copied from interface: ITeam
      Render an icon for this ITeam. The icon should occupy (0, 0) -> (16, 16) of the given PoseStack.
      Specified by:
      renderIcon in interface ITeam
      Parameters:
      graphics -
    • getRenderedMemberList

      public net.minecraft.network.chat.Component getRenderedMemberList(int maxTextWidth)
      Description copied from interface: ITeam
      Get the names of some members of this Team, formatted nicely. This does not need to list every member exhaustively. This list in no particular order, but should be the same every time to prevent weird rendering.
      Specified by:
      getRenderedMemberList in interface ITeam
      Parameters:
      maxTextWidth -
      See Also:
    • set

      @Nullable public <T> T set(@Nonnull net.minecraft.core.component.DataComponentType<? super T> componentType, @Nonnull T value)
      Specified by:
      set in interface net.neoforged.neoforge.common.MutableDataComponentHolder
    • remove

      @Nullable public <T> T remove(@Nonnull net.minecraft.core.component.DataComponentType<? extends T> componentType)
      Specified by:
      remove in interface net.neoforged.neoforge.common.MutableDataComponentHolder
    • applyComponents

      public void applyComponents(@Nonnull net.minecraft.core.component.DataComponentPatch patch)
      Specified by:
      applyComponents in interface net.neoforged.neoforge.common.MutableDataComponentHolder
    • applyComponents

      public void applyComponents(@Nonnull net.minecraft.core.component.DataComponentMap components)
      Specified by:
      applyComponents in interface net.neoforged.neoforge.common.MutableDataComponentHolder
    • getComponents

      public net.minecraft.core.component.DataComponentMap getComponents()
      Specified by:
      getComponents in interface net.minecraft.core.component.DataComponentHolder