MaterialSet
An immutable set of materials that remembers which of them were given as single materials and which through tags, so that tags stay tags when the set is written to a config file.
The set contains the materials and the values of all tags. The tags are resolved when the set is created: a set created again later, e.g. when the config is reloaded, includes the blocks that new Minecraft versions or datapacks add to a tag.
Equality follows the Set contract: a MaterialSet equals every set with the same materials. Tags are not part of equality, so a set with the tag #minecraft:logs equals a set that lists all logs as single materials.
The + and - operators return a new MaterialSet and keep its tags:
+adds materials to materials and tags to tags. Adding another MaterialSet adds its materials and tags.-removes materials from materials and tags (matched by key) from tags. A material that is not part of the set is ignored. Removing a material that one of the tags includes throws an IllegalArgumentException, because the result could not keep the tag; remove the tag instead. Removing another MaterialSet removes its tags first, then its materials.
Parameters
The single materials of this set
The tags of this set. Of several tags with the same key, only the first is kept.
Throws
if materials contains legacy materials
Constructors
Functions
A set without elements. Elements that are not part of this set are ignored.
A set without elements. Elements that are not part of this set are ignored. If elements is a MaterialSet, its tags are removed from the tags of this set first, then its materials.
A set without the tag with the key of tag. Nothing changes if no such tag is part of this set.