Part Selections and Filters

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();

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

Filtering Parts

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 MultiPartSelection

Apply a PartFilter

Unfilter

Last updated