Class GroupHelper
java.lang.Object
com.mrbysco.armorposer.client.GroupHelper
Manages groups of armor stands for the Armor Poser mod.
Each group is identified by a unique name and contains a list of armor stand UUIDs.
-
Field Summary
FieldsModifier and TypeFieldDescription -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidaddToGroup(String groupName, net.minecraft.world.entity.decoration.ArmorStand armorStand) Adds an armor stand to a specified group.static voidaddToGroupLocal(String groupName, UUID armorStandId) Adds an armor stand to a specified group without sending an update packet.static voidclearGroup(String groupName, net.minecraft.world.level.Level level) Clears all armor stands from a specified group and updates the entities in the provided level accordingly.static net.minecraft.ChatFormattinggetFormatForGroup(String groupName) Retrieves the chat formatting color associated with a specified group name.Retrieves the list of armor stand UUIDs associated with a specified group.getGroupsForArmorStand(UUID armorStandId) Retrieves a list of group names that a specified armor stand belongs to.static booleanChecks if a specified group is empty, meaning it has no armor stands associated with it.static booleanChecks if a specified armor stand is part of a specified group.static voidloadGroups(net.minecraft.world.entity.decoration.ArmorStand armorStand) Loads the group information for a specified armor stand from its custom data and updates the group map accordingly.static voidpruneInvalid(Set<UUID> valid) Removes any armor stands from all groups that are not present in the provided set of valid UUIDs.static voidremoveFromGroup(String groupName, net.minecraft.world.entity.decoration.ArmorStand armorStand) Removes an armor stand from a specified group.static voidsaveGroups(net.minecraft.world.entity.decoration.ArmorStand armorStand, List<String> groups) Saves the group information for a specified armor stand to its custom data.static voidsyncGroups(Map<UUID, List<String>> serverGroups) Synchronizes the group information for all armor stands with the provided server group data.
-
Field Details
-
DEFAULT_GROUP_MAP
-
DEFAULT_GROUP_NAMES
-
-
Constructor Details
-
GroupHelper
public GroupHelper()
-
-
Method Details
-
addToGroup
public static void addToGroup(String groupName, net.minecraft.world.entity.decoration.ArmorStand armorStand) Adds an armor stand to a specified group. If the group does not exist, it will be created.- Parameters:
groupName- the name of the group to add the armor stand toarmorStand- the armor stand to add to the group
-
addToGroupLocal
Adds an armor stand to a specified group without sending an update packet. This is used for local updates when loading group information from an armor stand's custom data.- Parameters:
groupName- the name of the group to add the armor stand toarmorStandId- the UUID of the armor stand to add to the group
-
removeFromGroup
public static void removeFromGroup(String groupName, net.minecraft.world.entity.decoration.ArmorStand armorStand) Removes an armor stand from a specified group. If the group becomes empty after removal, it will be deleted.- Parameters:
groupName- the name of the group to remove the armor stand fromarmorStand- the armor stand to remove from the group
-
getGroupsForArmorStand
Retrieves a list of group names that a specified armor stand belongs to.- Parameters:
armorStandId- the UUID of the armor stand to check for group membership- Returns:
- a list of group names that the armor stand belongs to, or an empty list if the armor stand does not belong to any groups
-
getFormatForGroup
Retrieves the chat formatting color associated with a specified group name.- Parameters:
groupName- the name of the group to retrieve the chat formatting color for- Returns:
- the chat formatting color associated with the group name, or WHITE if the group name is not found in the default group map
-
getGroup
-
clearGroup
Clears all armor stands from a specified group and updates the entities in the provided level accordingly.- Parameters:
groupName- the name of the group to clearlevel- the level containing the entities to update after clearing the group
-
isInGroup
Checks if a specified armor stand is part of a specified group.- Parameters:
group- the name of the group to checkuuid- the UUID of the armor stand to check for membership in the group- Returns:
- true if the armor stand is part of the group, false otherwise
-
pruneInvalid
-
isEmpty
Checks if a specified group is empty, meaning it has no armor stands associated with it.- Parameters:
group- the name of the group to check for emptiness- Returns:
- true if the group is empty or does not exist, false if the group has one or more armor stands associated with it
-
loadGroups
public static void loadGroups(net.minecraft.world.entity.decoration.ArmorStand armorStand) Loads the group information for a specified armor stand from its custom data and updates the group map accordingly.- Parameters:
armorStand- the armor stand to load the group information for
-
saveGroups
public static void saveGroups(net.minecraft.world.entity.decoration.ArmorStand armorStand, List<String> groups) Saves the group information for a specified armor stand to its custom data. If the group information has not changed, it will not update the custom data.- Parameters:
armorStand- the armor stand to save the group information forgroups- the list of group names that the armor stand belongs to
-
syncGroups
Synchronizes the group information for all armor stands with the provided server group data. This will clear the existing group map and repopulate it based on the server data.- Parameters:
serverGroups- a map of armor stand UUIDs to lists of group names that they belong to, representing the current group information from the server
-