Class XTag<T extends XBase<?,?> >
The main usage of this class is simply done by choosing your category and using isTagged(XBase) or getValues():
boolean isTagged = XTag.CATEGORY.isTagged(element);
Set<T> values = XTag.CATEGORY.getValues();
You may also want to make this easier as a configurable value for users to change using stringMatcher(Collection, Collection):
List<Matcher<E>> compiledMatchers = XTag.stringMatcher(elements); // for compiled matchers
boolean anyMatched = XTag.anyMatchString(element, compiledMatchers); // or pass the elements directly
You can also use some kind of registry-based system for tags using getTag(String).
However, not all methods here follow the common XTag system, and there are a few tags that
are only available as a static boolean method, such as isInteractable(XMaterial) and isItem(XMaterial).
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionTag representing all acacia log and bark variantsTag representing all dead coral non-walled fansTag representing all non-dead coral plantsTag representing all possible blocks available for animals to spawn onTag representing all variants of anvilstatic final @NotNull XTag<XEnchantment> Tag representing all possible enchants that can be applied to all armor pieces (excluding elytras)Tag representing all armor pieces that add armor bars upon wearingstatic final @NotNull XTag<XEnchantment> Tag representing all possible enchants that can be applied to axesTag representing all possible types of axeTag representing all items that can tempt axolotlTag representing all possible blocks for axolotls to spawn onTag representing all possible blocks for azalea to grow onTag representing all possible blocks that can be replaced by azaleaTag representing all bamboo wood variantsTag representing all possible blocks bamboo may be planted onTag representing all banner blocksTag representing the nether base materialsTag representing the overworld base materialsTag representing all possible blocks that can be used as beacon baseTag representing all possible variants of bedTag representing all possible blocks/crops that be grown by beesTag representing all possible blocks big dripleaf may be planted onTag representing all birch log and bark variantsstatic final @NotNull XTag<XEnchantment> Tag representing all possible enchants that can be applied to bootsstatic final @NotNull XTag<XEnchantment> Tag representing all possible enchants that can be applied to bowsTag representing all possible variants of buttonsTag representing all possible variants of campfiresTag representing all possible variants of candle cakesTag representing all possible variants of candlesTag representing all possible variants of carpetsTag representing all possible variants of cauldronsTag representing all possible variants of cave vinesTag representing all armor pieces made of chainsTag representing all cherry log and bark variantsstatic final @NotNull XTag<XEnchantment> Tag representing all possible enchants that can be applied to chestplatesTag representing all climbable blocksTag representing all preferred items for harvesting clusters{unused as of 1.18}Tag representing all possible variants of coal oresTag representing all possible variants of concreteTag representing all possible variants of concrete_powderTag representing all possible variants of copper oresTag representing all coralsTag representing all crimson log and bark variantsTag representing all cropsstatic final @NotNull XTag<XEnchantment> Tag representing all possible enchants that can be applied to crossbowsTag representing all possible blocks that can make crystal soundsTag representing all blocks that could harm a player.Tag representing all dark oak log and bark variantsAn unmodifiable set of "bad" potion effects.Tag representing all possible blocks that may be replaced by deepslate oresTag representing all armor pieces made of diamondTag representing all possible variants of diamond oresTag representing all diamond tools and swordsTag representing all dirtTag representing all possible types of doorsTag representing all blocks that can't be destroyed by dragonsTag representing all possible blocks that can be replaced by dripstonestatic final @NotNull XTag<XEntityType> Entity types thatXEnchantment.BANE_OF_ARTHROPODSenchantment is effective against.static final @NotNull XTag<XEntityType> Entity types thatXEnchantment.SMITEenchantment is effective against.static final @NotNull XTag<XEnchantment> Tag representing all possible enchants that can be applied to elytrasTag representing all variants of emerald oresTag representing all possible blocks that can be picked up by endermenTag representing all blocks that cant be replaced by world generation featuresTag representing all possible variants of fence gatesTag representing all possible variants of fencesTag representing all possible variants of filled cauldronTag representing all possible variants fireTag representing all possible variants of flower potsTag representing all possible types of flowersThis doesn't refer to all materials that contain fluids, but pure fluids.Tag representing all items can be used as food for foxTag representing all possible blocks foxes may spawn onTag representing all possible items can be used to avoid freezingTag representing all blocks that geodes will not spawn inTag representing all variants of glassTag representing all possible variants of glazed terracottaTag representing all possible blocks goats may spawn onTag representing all possible variants of gold oresTag representing all armor pieces made of goldTag representing all block types that are guarded by piglinsTag representing all possible types of hanging signsstatic final @NotNull XTag<XEnchantment> Tag representing all possible enchants that can be applied to helmets/turtle shellsstatic final @NotNull XTag<XEnchantment> Tag representing all possible enchants that can be applied to hoesTag representing all possible types of hoeTag representing all block types that repel hoglinsTag representing all possible variants of iceTag representing all items ignored by baby piglinsTag representing all possible block types that do not drip water/lavaTag representing all block types that can burn for infinitely long in the endTag representing all block types that can burn for infinitely long in the netherTag representing all block types that can burn for infinitely long in the overworldTag representing all block types that play muffled step soundsTag representing all armor pieces made of ironTag representing all possible variants of iron oresTag representing all iron tools and swordsTag representing all possible variants of arrowsTag representing all items that can be used as bannersTag representing all items that can be used to fuel beaconTag representing all possible variants of boatsTag representing all possible variants of coalTag representing all possible music discs that can be dropped by creeperTag representing all possible types of fishTag representing all furnace materials {empty in spigot as of 1.18}Tag representing all possible book types that can be placed on lecternsTag representing all types of music discsTag representing all items loved by piglinsTag representing all stone tool materialsTag representing all jungle log and bark variantsTag representing all possible variants of lapis oresTag representing all blocks that can't be replaced by lava poolsTag representing all armor pieces made of leatherTag representing all types of leavesstatic final @NotNull XTag<XEnchantment> Tag representing all possible enchants that can be applied to leggingsTag representing all wood and bark variantsTag representing all wood and bark variants that can catch fireTag representing all possible blocks that can be replaced by lush groundTag representing all mangrove log and bark variantsstatic final Map<XMaterial, XEntityType> What entity spawns when a material is placed down?Tag representing all block types mineable with axeTag representing all block types mineable with hoeTag representing all block types mineable with pickaxeTag representing all block types mineable with shovelTag representing all possible block types mooshrooms can spawn onTag representing all block types that can be replaced by mossTag representing all block types that need minimum of diamond tool to drop itemsTag representing all block types that need minimum of iron tool to drop itemsTag representing all block types that need minimum of stone tool to drop itemsTag representing all armor pieces made of netheriteTag representing all netherite tools and swordsTag representing all non-flammable wood and bark variantsTag representing all non-wooden slabsTag representing all non-wooden stairsTag representing all nylium blocksTag representing all oak wood and bark variantsTag representing all possible blocks that can block vibration signalsTag representing all oresTag representing all pale oak log and bark variantsTag representing all possible block types parrots may spawn onstatic final @NotNull XTag<XEnchantment> Tag representing all possible enchants that can be applied to pickaxesTag representing all possible types of pickaxeTag representing all items that can be used as piglin foodTag representing all block types that repel piglinsTag representing all types of planksTag representing all possible blocks polar bears may spawn onTag representing all possible block types that be used as portalsTag representing all possible pottery sherdsTag representing all possible variants of pressure platesTag representing all block types that prevent inside mob spawningTag representing all possible block types that rabbits may spawn onTag representing all possible types of railsTag representing all possible variants of redstone oresTag representing all plant blocks that may be replacedTag representing all possible types of sandTag representing all possible types of saplingsstatic final @NotNull XTag<XEnchantment> Tag representing all possible enchants that can be applied to shearsstatic final @NotNull XTag<XEnchantment> Tag representing all possible enchants that can be applied to shovelsTag representing all possible types of shovelTag representing all possible variants of shulker boxesTag representing all possible variants of signsTag representing all possible block types small dripleaf may be placed uponTag representing all flowers small in size {1 block tall}Tag representing all possible smithing templatesTag representing all possible variants of snowTag representing all possible blocks that can be lit up with sould fireTag representing all possible blocks that activate soul speed enchantmentTag representing all spruce wood and log variantsTag representing all possible types of stairsTag representing all possible types of standing signsTag representing all possible variants of stone bricksTag representing all possible blocks that can be replaced by regular stone oresTag representing all pressure plates made of some type of stoneTag representing all stone tools and swordsTag representing all block types that make strider warmstatic final @NotNull XTag<XEnchantment> Tag representing all possible enchants that can be applied to swordsTag representing all possible types of swordTag representing all flowers that are tall {2 blocks}Tag representing all possible variants of non-glazed terracottaTag representing all possible types of trapdoorsTag representing all block types that can be bonemealed underwaterTag representing all blocks that have unstable bottom when placed in centre of 2 blocksTag representing all valid mob spawn positionsTag representing all possible types of wall bannersTag representing all possible variants of wall hanging signTag representing all possible block types that can override a wall post creationTag representing all wall signsTag representing all possible types of wall torchesTag representing all different types of wallsTag representing all warped stemsTag representing all block types that can't be destroyed by withersTag representing all possible block types that may be used as wither summon baseTag representing all possible block types that wolves may spawn onTag representing all possible types of wooden buttonsTag representing all possible types of wooden doorsTag representing all possible types of wooden fence gatesTag representing all possible types of wooden fencesTag representing all possible types of wooden pressure platesTag representing all possible types of wooden slabsTag representing all possible types of wooden stairsTag representing all wooden tools and swordsTag representing all possible types of wooden trapdoorsTag representing all possible types of wool -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> booleananyMatch(T target, Collection<XTag.Matcher<T>> matchers) static <T> booleananyMatchString(T target, Collection<String> matchers) static booleanisInteractable(XMaterial material) Checks if this Material can be interacted with.static booleanChecks if this Material is an obtainable item.booleanstatic <E> List<XTag.Matcher<E>> stringMatcher(@Nullable Collection<String> elements) static <E> List<XTag.Matcher<E>> stringMatcher(@Nullable Collection<String> elements, @Nullable Collection<XTag.Matcher.Error> errors)
-
Field Details
-
AIR
-
INVENTORY_NOT_DISPLAYABLE
-
ACACIA_LOGS
-
CORAL_FANS
-
ALIVE_CORAL_BLOCKS
-
ALIVE_CORAL_FANS
-
ALIVE_CORAL_PLANTS
-
ALIVE_CORAL_WALL_FANS
-
SPAWN_EGGS
-
ANIMALS_SPAWNABLE_ON
-
ANVIL
-
AXOLOTL_TEMPT_ITEMS
-
AXOLOTLS_SPAWNABLE_ON
-
AZALEA_GROWS_ON
-
AZALEA_ROOT_REPLACEABLE
-
BAMBOO_LOGS
-
BAMBOO_PLANTABLE_ON
-
BANNERS
-
BASE_STONE_NETHER
-
BASE_STONE_OVERWORLD
-
BEACON_BASE_BLOCKS
-
BEDS
-
BEE_GROWABLES
-
BIG_DRIPLEAF_PLACEABLE
-
BIRCH_LOGS
-
BUTTONS
-
CAMPFIRES
-
CANDLE_CAKES
-
CANDLES
-
CARPETS
-
CAULDRONS
-
CAVE_VINES
-
CHERRY_LOGS
-
CLIMBABLE
-
CLUSTER_MAX_HARVESTABLES
-
COAL_ORES
-
CONCRETE
-
CONCRETE_POWDER
-
COPPER_ORES
-
CORALS
-
CRIMSON_STEMS
-
CROPS
-
CRYSTAL_SOUND_BLOCKS
-
DARK_OAK_LOGS
-
DEAD_CORAL_BLOCKS
-
DEAD_CORAL_FANS
-
DEAD_CORAL_PLANTS
-
DEAD_CORAL_WALL_FANS
-
DEEPSLATE_ORE_REPLACEABLES
-
DIAMOND_ORES
-
DIRT
-
DOORS
-
DRAGON_IMMUNE
-
DRIPSTONE_REPLACEABLE
-
WALL_HEADS
-
EMERALD_ORES
-
ENDERMAN_HOLDABLE
-
FEATURES_CANNOT_REPLACE
-
FENCE_GATES
-
FENCES
-
FILLED_CAULDRONS
-
FIRE
-
FLOWER_POTS
-
FLOWERS
-
FOX_FOOD
-
FOXES_SPAWNABLE_ON
-
FREEZE_IMMUNE_WEARABLES
-
GEODE_INVALID_BLOCKS
-
GLASS
-
GLAZED_TERRACOTTA
-
GOATS_SPAWNABLE_ON
-
GOLD_ORES
-
GUARDED_BY_PIGLINS
-
HANGING_SIGNS
-
HOGLIN_REPELLENTS
-
ICE
-
IGNORED_BY_PIGLIN_BABIES
-
IMPERMEABLE
-
INFINIBURN_END
-
INFINIBURN_NETHER
-
INFINIBURN_OVERWORLD
-
INSIDE_STEP_SOUND_BLOCKS
-
IRON_ORES
-
ITEMS_ARROWS
-
ITEMS_BANNERS
-
ITEMS_BEACON_PAYMENT_ITEMS
-
ITEMS_BOATS
-
ITEMS_COALS
-
ITEMS_CREEPER_DROP_MUSIC_DISCS
-
ITEMS_FISHES
-
ITEMS_FURNACE_MATERIALS
-
ITEMS_LECTERN_BOOKS
-
ITEMS_MUSIC_DISCS
-
ITEMS_PIGLIN_LOVED
-
ITEMS_STONE_TOOL_MATERIALS
-
WALL_BANNERS
-
JUNGLE_LOGS
-
LAPIS_ORES
-
LAVA_POOL_STONE_CANNOT_REPLACE
-
LEAVES
-
LOGS
-
LOGS_THAT_BURN
-
LUSH_GROUND_REPLACEABLE
-
MANGROVE_LOGS
-
MINEABLE_AXE
-
MINEABLE_HOE
-
MINEABLE_PICKAXE
-
MINEABLE_SHOVEL
-
MOOSHROOMS_SPAWNABLE_ON
-
MOSS_REPLACEABLE
-
MUSHROOM_GROW_BLOCK
-
NEEDS_DIAMOND_TOOL
-
NEEDS_IRON_TOOL
-
NEEDS_STONE_TOOL
-
NON_FLAMMABLE_WOOD
-
NON_WOODEN_STAIRS
-
NON_WOODEN_SLABS
-
NYLIUM
-
OAK_LOGS
-
OCCLUDES_VIBRATION_SIGNALS
-
ORES
-
PALE_OAK_LOGS
-
PARROTS_SPAWNABLE_ON
-
PIGLIN_FOOD
-
PIGLIN_REPELLENTS
-
PLANKS
-
POLAR_BEARS_SPAWNABLE_ON_IN_FROZEN_OCEAN
-
PORTALS
-
POTTERY_SHERDS
-
PRESSURE_PLATES
-
PREVENT_MOB_SPAWNING_INSIDE
-
RABBITS_SPAWNABLE_ON
-
RAILS
-
REDSTONE_ORES
-
REPLACEABLE_PLANTS
-
SAND
-
SAPLINGS
-
SHULKER_BOXES
-
SIGNS
-
SMALL_DRIPLEAF_PLACEABLE
-
SMALL_FLOWERS
-
SMITHING_TEMPLATES
-
SNOW
-
SOUL_FIRE_BASE_BLOCKS
-
SOUL_SPEED_BLOCKS
-
SPRUCE_LOGS
-
STAIRS
-
STANDING_SIGNS
-
STONE_BRICKS
-
STONE_ORE_REPLACEABLES
-
STONE_PRESSURE_PLATES
-
STRIDER_WARM_BLOCKS
-
TALL_FLOWERS
-
TERRACOTTA
-
TRAPDOORS
-
UNDERWATER_BONEMEALS
-
UNSTABLE_BOTTOM_CENTER
-
VALID_SPAWN
-
WALL_HANGING_SIGNS
-
WALL_POST_OVERRIDE
-
WALL_SIGNS
-
WALL_TORCHES
-
WALLS
-
WARPED_STEMS
-
WITHER_IMMUNE
-
WITHER_SUMMON_BASE_BLOCKS
-
WOLVES_SPAWNABLE_ON
-
WOODEN_BUTTONS
-
WOODEN_DOORS
-
WOODEN_FENCE_GATES
-
WOODEN_FENCES
-
WOODEN_PRESSURE_PLATES
-
WOODEN_SLABS
-
WOODEN_STAIRS
-
WOODEN_TRAPDOORS
-
WOOL
-
LEATHER_ARMOR_PIECES
-
IRON_ARMOR_PIECES
-
CHAINMAIL_ARMOR_PIECES
-
GOLDEN_ARMOR_PIECES
-
DIAMOND_ARMOR_PIECES
-
NETHERITE_ARMOR_PIECES
-
ARMOR_PIECES
-
WOODEN_TOOLS
-
FLUID
-
STONE_TOOLS
-
IRON_TOOLS
-
DIAMOND_TOOLS
-
NETHERITE_TOOLS
-
SWORDS
-
PICKAXES
-
AXES
-
SHOVELS
-
HOES
-
DANGEROUS_BLOCKS
-
ARMOR_ENCHANTS
Tag representing all possible enchants that can be applied to all armor pieces (excluding elytras) -
HELEMT_ENCHANTS
Tag representing all possible enchants that can be applied to helmets/turtle shells -
CHESTPLATE_ENCHANTS
Tag representing all possible enchants that can be applied to chestplates -
LEGGINGS_ENCHANTS
Tag representing all possible enchants that can be applied to leggings -
BOOTS_ENCHANTS
Tag representing all possible enchants that can be applied to boots -
ELYTRA_ENCHANTS
Tag representing all possible enchants that can be applied to elytras -
SWORD_ENCHANTS
Tag representing all possible enchants that can be applied to swords -
AXE_ENCHANTS
Tag representing all possible enchants that can be applied to axes -
HOE_ENCHANTS
Tag representing all possible enchants that can be applied to hoes -
PICKAXE_ENCHANTS
Tag representing all possible enchants that can be applied to pickaxes -
SHOVEL_ENCHANTS
Tag representing all possible enchants that can be applied to shovels -
SHEARS_ENCHANTS
Tag representing all possible enchants that can be applied to shears -
BOW_ENCHANTS
Tag representing all possible enchants that can be applied to bows -
CROSSBOW_ENCHANTS
Tag representing all possible enchants that can be applied to crossbows -
EFFECTIVE_SMITE_ENTITIES
Entity types thatXEnchantment.SMITEenchantment is effective against. This set is unmodifiable.- Since:
- 1.2.0
-
EFFECTIVE_BANE_OF_ARTHROPODS_ENTITIES
Entity types thatXEnchantment.BANE_OF_ARTHROPODSenchantment is effective against. This set is unmodifiable.- Since:
- 1.2.0
-
DEBUFFS
-
MATERIAL_TO_ENTITY
What entity spawns when a material is placed down? Mostly for things that spawn instantly after a single right-click whether it requires a block or free air.It doesn't work for bows and arrows, TNT, fishing bobs or EXP bottles.
-
-
Method Details
-
stringMatcher
public static <E> List<XTag.Matcher<E>> stringMatcher(@Nullable @Nullable Collection<String> elements) -
stringMatcher
public static <E> List<XTag.Matcher<E>> stringMatcher(@Nullable @Nullable Collection<String> elements, @Nullable @Nullable Collection<XTag.Matcher.Error> errors) Compiles a list of string checkers for various classes likeXMaterial,XSound, etc. Mostly used for configs.Supports
String.contains(CharSequence)CONTAINS:NAMEand Regular ExpressionREGEX:PATTERNformats.Example:
XMaterial material =XMaterial.matchXMaterial(ItemStack); if (XTag.anyMatch(XTag.stringMatcher(plugin.getConfig().getStringList("disabled-items"), null)) return;
CONTAINSExamples:"CONTAINS:CHEST" -> CHEST, ENDERCHEST, TRAPPED_CHEST -> true"cOnTaINS:dYe" -> GREEN_DYE, YELLOW_DYE, BLUE_DYE, INK_SACK -> trueREGEXExamples"REGEX:^.+_.+_.+$" -> Every Material with 3 underlines or more: SHULKER_SPAWN_EGG, SILVERFISH_SPAWN_EGG, SKELETON_HORSE_SPAWN_EGG"REGEX:^.{1,3}$" -> Material names that have 3 letters only: BED, MAP, AIRThe reason that there are tags for
CONTAINSandREGEXis for the performance. Server owners should be advised to avoid usingREGEXtag if they can use theCONTAINStag instead.Want to learn RegEx? You can mess around in RegExr website.
- Parameters:
elements- the material names to check base material on.- Returns:
- a compiled list of enum matchers.
-
anyMatchString
-
anyMatch
-
isItem
Checks if this Material is an obtainable item. "Obtainable items" are simply materials that can be displayed in your GUI. This method is mainly designed to support pre-1.13, servers using 1.13 and above will directly have their materials checked withMaterial.isItem()- Returns:
- true if this material is an item, otherwise false if it's not an item or the item is not supported.
- Since:
- 1.13
-
isInteractable
Checks if this Material can be interacted with.Interactable materials include those with functionality when they are interacted with by a player such as chests, furnaces, etc.
Some blocks such as piston heads and stairs are considered interactable though may not perform any additional functionality.
Note that the interactability of some materials may be dependent on their state as well. This method will return true if there is at least one state in which additional interact handling is performed for the material.
- Returns:
- true if this material can be interacted with.
- Since:
- 1.13
-
getValues
-
isTagged
-
getTag
-