Package com.petrolpark.core.team
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
FieldsFields inherited from interface com.petrolpark.core.team.ITeam.Provider
CODEC, STREAM_CODEC, TYPED_CODEC -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidapplyComponents(net.minecraft.core.component.DataComponentMap components) voidapplyComponents(net.minecraft.core.component.DataComponentPatch patch) net.minecraft.core.component.DataComponentMapnet.minecraft.network.chat.ComponentgetName()The name of this Team, without necessarily referring to anymembers.TheITeam.Providerthat provides this exact Team instance.net.minecraft.network.chat.ComponentgetRenderedMemberList(int maxTextWidth) Get thenamesof somemembersof this Team, formatted nicely.booleanisAdmin(net.minecraft.world.entity.player.Player player) What this means will be different for every system that uses Teams.booleanisMember(net.minecraft.world.entity.player.Player player) Whether the given Player is in this Team, meaning they have access client-side to the Team'sData Components, and have any non-adminabilities.booleanisNone()Whether this Team can never haveany membersorData Components.intThe number ofmembersof this Team.provideTeam(net.minecraft.world.level.Level level) <T> Tremove(net.minecraft.core.component.DataComponentType<? extends T> componentType) voidrenderIcon(net.minecraft.client.gui.GuiGraphics graphics) Render an icon for thisITeam.<T> Tset(net.minecraft.core.component.DataComponentType<? super T> componentType, T value) Stream<net.minecraft.world.entity.player.Player> Everymemberof this Team, with no guarantee of order.The uniqueusernameof everymemberof this Team, in no particular order.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.minecraft.core.component.DataComponentHolder
get, getOrDefault, hasMethods inherited from interface net.neoforged.neoforge.common.extensions.IDataComponentHolderExtension
addToTooltip, addToTooltip, get, getOrDefault, hasMethods inherited from interface com.petrolpark.core.team.ITeam
sendToAllMembers, streamServerMembersMethods inherited from interface net.neoforged.neoforge.common.MutableDataComponentHolder
copyFrom, copyFrom, remove, set, update, update, update, update
-
Field Details
-
INSTANCE
-
-
Constructor Details
-
NoTeam
public NoTeam()
-
-
Method Details
-
getProvider
Description copied from interface:ITeamTheITeam.Providerthat provides this exact Team instance.- Specified by:
getProviderin interfaceITeam
-
getProviderType
- Specified by:
getProviderTypein interfaceITeam.Provider
-
provideTeam
- Specified by:
provideTeamin interfaceITeam.Provider
-
isNone
public boolean isNone()Description copied from interface:ITeamWhether this Team can never haveany membersorData Components. -
isMember
public boolean isMember(net.minecraft.world.entity.player.Player player) Description copied from interface:ITeamWhether the given Player is in this Team, meaning they have access client-side to the Team'sData Components, and have any non-adminabilities. -
memberCount
public int memberCount()Description copied from interface:ITeamThe number ofmembersof this Team.- Specified by:
memberCountin interfaceITeam- Returns:
- Positive integer
almost alwaysgreater than0.
-
streamMemberUsernames
Description copied from interface:ITeamThe uniqueusernameof everymemberof this Team, in no particular order. ForScoreboardTeams in particular, this method is faster thanITeam.streamMembers()and should be used in preference to calling that method and then getting the usernames.- Specified by:
streamMemberUsernamesin interfaceITeam
-
streamMembers
Description copied from interface:ITeamEverymemberof this Team, with no guarantee of order. It is faster to useITeam.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:
streamMembersin interfaceITeam- See Also:
-
isAdmin
public boolean isAdmin(net.minecraft.world.entity.player.Player player) Description copied from interface:ITeamWhat this means will be different for every system that uses Teams. It could mean the ability to change the name of aShop, for example. It has nothing to do with operator permissions. If called, it is assumed thatITeam.isMember(Player)has already passed. -
getName
public net.minecraft.network.chat.Component getName()Description copied from interface:ITeamThe name of this Team, without necessarily referring to anymembers. -
renderIcon
public void renderIcon(net.minecraft.client.gui.GuiGraphics graphics) Description copied from interface:ITeamRender an icon for thisITeam. The icon should occupy(0, 0) -> (16, 16)of the given PoseStack.- Specified by:
renderIconin interfaceITeam- Parameters:
graphics-
-
getRenderedMemberList
public net.minecraft.network.chat.Component getRenderedMemberList(int maxTextWidth) Description copied from interface:ITeamGet thenamesof somemembersof 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:
getRenderedMemberListin interfaceITeam- Parameters:
maxTextWidth-- See Also:
-
set
@Nullable public <T> T set(@Nonnull net.minecraft.core.component.DataComponentType<? super T> componentType, @Nonnull T value) - Specified by:
setin interfacenet.neoforged.neoforge.common.MutableDataComponentHolder
-
remove
@Nullable public <T> T remove(@Nonnull net.minecraft.core.component.DataComponentType<? extends T> componentType) - Specified by:
removein interfacenet.neoforged.neoforge.common.MutableDataComponentHolder
-
applyComponents
public void applyComponents(@Nonnull net.minecraft.core.component.DataComponentPatch patch) - Specified by:
applyComponentsin interfacenet.neoforged.neoforge.common.MutableDataComponentHolder
-
applyComponents
public void applyComponents(@Nonnull net.minecraft.core.component.DataComponentMap components) - Specified by:
applyComponentsin interfacenet.neoforged.neoforge.common.MutableDataComponentHolder
-
getComponents
public net.minecraft.core.component.DataComponentMap getComponents()- Specified by:
getComponentsin interfacenet.minecraft.core.component.DataComponentHolder
-