Tags
Tags are JSON structures used in data packs to group related game elements together. They allow you to reference multiple items, blocks, entities, or other resources as a single unit. Tags are extensively used in commands, loot tables, advancements, recipes, and other data-driven features.
Basic Usage
Kore provides a generic tag function as well as specialized helper functions for each tag type:
This creates a tag file at data/<namespace>/tags/block/my_blocks.json.
Adding Values
There are several ways to add values to a tag:
Simple Addition
Adding Other Tags
You can include other tags within a tag by prefixing with #:
Optional Entries
Mark entries as optional with the required parameter. Optional entries won't cause errors if they don't exist:
Replace Mode
By default, tags merge with existing tags of the same name. Set replace = true to completely override:
Tag Types
Kore provides specialized helper functions for all tag types. Here are the most commonly used ones:
Block Tags
Item Tags
Entity Type Tags
Function Tags
Function tags are special - they define groups of functions that can be called together or triggered by game events:
The minecraft:load and minecraft:tick function tags are special:
minecraft:load- Functions run once when the datapack loadsminecraft:tick- Functions run every game tick
Biome Tags
Damage Type Tags
Enchantment Tags
Fluid Tags
Complete List of Tag Helpers
Kore provides helpers for all vanilla tag types:
| Function | Tag Type | Path |
|---|---|---|
bannerPatternTag |
Banner patterns | tags/banner_pattern |
biomeTag |
Biomes | tags/worldgen/biome |
blockTag |
Blocks | tags/block |
catVariantTag |
Cat variants | tags/cat_variant |
configuredCarverTag |
World carvers | tags/worldgen/configured_carver |
configuredFeatureTag |
World features | tags/worldgen/configured_feature |
configuredStructureTag |
Structures | tags/worldgen/structure |
damageTypeTag |
Damage types | tags/damage_type |
enchantmentTag |
Enchantments | tags/enchantment |
entityTypeTag |
Entity types | tags/entity_type |
flatLevelGeneratorPresetTag |
Flat world presets | tags/worldgen/flat_level_generator_preset |
fluidTag |
Fluids | tags/fluid |
frogVariantTag |
Frog variants | tags/frog_variant |
functionTag |
Functions | tags/function |
gameEventTag |
Game events | tags/game_event |
instrumentTag |
Goat horns | tags/instrument |
itemTag |
Items | tags/item |
noiseSettingsTag |
Noise settings | tags/worldgen/noise_settings |
noiseTag |
Noise | tags/worldgen/noise |
paintingVariantTag |
Paintings | tags/painting_variant |
pigVariantTag |
Pig variants | tags/pig_variant |
placedFeatureTag |
Placed features | tags/worldgen/placed_feature |
pointOfInterestTypeTag |
POI types | tags/point_of_interest_type |
processorListTag |
Structure processors | tags/worldgen/processor_list |
structureTag |
Structures | tags/worldgen/structure |
templatePoolTag |
Jigsaw pools | tags/worldgen/template_pool |
trimMaterialTag |
Trim materials | tags/trim_material |
trimPatternTag |
Trim patterns | tags/trim_pattern |
wolfVariantTag |
Wolf variants | tags/wolf_variant |
worldPresetTag |
World presets | tags/worldgen/world_preset |
Modifying Existing Tags
Use addToTag to append to an existing tag without creating duplicates:
Using Tags in Commands
Tags can be referenced in commands with the # prefix:
Using Tags in Predicates
Tags work seamlessly with Predicates:
Using Tags in Recipes
Tags are commonly used in Recipes for flexible ingredient matching:
Generated JSON
A basic tag generates JSON like this:
With optional entries:
With tag references:
Best Practices
- Use meaningful names: Name tags based on their purpose (e.g.,
mineable/pickaxenotpickaxe_blocks) - Leverage existing tags: Reference vanilla tags when appropriate instead of duplicating entries
- Keep tags focused: Each tag should serve a single, clear purpose
- Use optional entries: Mark modded content as
required = falsefor cross-mod compatibility - Avoid replace when possible: Merging with existing tags maintains compatibility with other datapacks
See Also
- Predicates - Use tags in predicate conditions
- Recipes - Use tags for flexible recipe ingredients
- Loot Tables - Use tags in loot conditions
- Functions - Creating functions to use with function tags
- Trims - Trim material and pattern tags
External Resources
- Minecraft Wiki: Tag (Java Edition) - Complete reference for all tag types and vanilla tags
