Skip to content

API PartSelection And PartFilterting

Jay edited this page Jan 2, 2026 · 1 revision

Part Selections are a collection of parts from an ActiveGroup. These parts can be filtered down to their tag, part type, block type, or item type.

Getting a Part Selection

ActiveGroup<?> group = yourMethodToGetAGroup();
SpawnedDisplayEntityGroup spawnedGroup; //subclass of ActiveGroup
PacketDisplayEntityGroup packetGroup; //subclass of ActiveGroup

//Create a selection that contains ALL of the parts from an ActiveGroup
MultiPartSelection<?> selection = group.createPartSelection();

//Get a selection from a SpawnedDisplayEntityGroup
SpawnedPartSelection spawnedSelection = spawnedGroup.createPartSelection();
PacketPartSelection packetSelection = packetGroup.createPartSelection();

//Create a selection using a PartFilter (explained further in next section)
PartFilter partFilter = new PartFilter();
MultiPartSelection<?> filteredSelection = group.createPartSelection(group, partFilter);

Filtering Parts

To filter parts, we want to use a PartFilter

PartFilter partFilter = new PartFilter()

//Include a part tag to be filtered
partFilter.includePartTag("includeThisTag");

//Exclude a part tag to be filtered
//If no tag has been included in the filter, then all parts will be selected except for ones with the tag "excludeThisTag"
partFilter.excludePartTag("excludeThisTag");

//Set the part types that will be filtered (included)
partFilter.setPartTypes(PartType.BLOCK, PartType.ITEM);

//Filter Blocks
Collection<BlockType> blocks = yourMethodToGetYourBlockTypes();
boolean includeBlocksInFilter = true;
partFilter.setBlockTypes(blocks, includeBlocksInFilter);

//Filter Items
Collection<ItemType> itmes = yourMethodToGetYourItemTypes();
boolean includeItemsInFilter = false;
partFilter.setItemTypes(blocks, includeItemsInFilter);

//Now, only parts with the tag "includeThisTag", without "excludeThisTag", with the part types of BLOCK and ITEM, and with the specified blocks and
//items, will be filtered in a SpawnedPartSelection

Apply a PartFilter

//Apply to a selection
boolean reset = false; //Reset the filters already applied to the selection, instead of adding to it
selection.applyFilter(filter, reset)

Unfilter

Unfiltering removes a filter type from a selection

boolean refresh = true; //Whether the parts in the selection should be updated after the filter change
selection.unfilter(FilterType.PART_TYPE, refresh);

DisplayEntityUtils Wiki

Overview

General Help / Examples

Display Groups/Models

Interactions & Mannequins

Animations

Animation Effects

DisplayControllers (Mounting, Custom Entities & Equipment)

Skript Help / Examples

API Help / Examples

Old Help / Examples

Clone this wiki locally