Tag Replace vs Add Behavior Reference
One of the most frequent headaches for Minecraft behavior pack developers stems from a single, often overlooked boolean: the replace field within tag definitions. Understanding whether to use “Tag Replace” or rely on the default “Add Behavior” is paramount for creating stable, compatible, and effective modifications.
![]()
In the intricate world of Minecraft modding, tags serve as powerful organizational tools, allowing creators to group related in-game elements and modify their behavior without directly altering core game files. However, the seemingly simple act of defining a tag can have profound implications depending on how you instruct the game to handle its entries. This guide will demystify the crucial difference between completely replacing existing tag data and merely appending to it, empowering you to make informed decisions in your behavior pack development.
Understanding Minecraft Tags: The Foundation
At their core, tags are JSON files that function as dynamic lists, grouping together various game assets such as blocks, items, fluids, entity types, and even functions. Instead of hardcoding every instance where a specific type of block or item is needed, you can simply reference a tag. For example, vanilla Minecraft uses tags extensively for purposes like mob pathfinding (determining which blocks mobs can walk on) or identifying climbable blocks. This abstraction offers immense flexibility, allowing you to influence game mechanics across multiple areas by simply modifying a single tag.
When you create a behavior pack, you’re essentially layering your definitions on top of the game’s existing data, including its vanilla tags. How your tags interact with these existing definitions (and those from other behavior packs) is determined by the `replace` field, or its absence.
The Power of replace: true: Tag Replace
When you explicitly set the replace field to true within your tag’s JSON file, you are making a definitive statement: “My tag definition should entirely overwrite any previous definitions for this specific tag.” This means that if another data pack (or even vanilla Minecraft itself) has entries for the same tag, your version will completely supersede them. Only the values you list in your tag file will be active for that tag.
Consider this a declaration of absolute control. Using replace: true is ideal when:
- You need to enforce a very specific set of elements for a tag, overriding any potential additions from other packs or vanilla behavior.
- You want to “clean up” or remove unwanted entries that might be present in a vanilla tag or another pack’s tag.
- You are creating a highly specialized behavior pack where compatibility with other packs’ tag modifications is not a priority, or where you explicitly want to dictate the tag’s contents.
Example of Tag Replace:
Imagine you want a specific tag, my_pack:special_blocks, to *only* contain stone and dirt, regardless of what other packs might try to add to it. Your tag file (e.g., data/my_pack/tags/blocks/special_blocks.json) would look like this:
{
"replace": true,
"values": [
"minecraft:stone",
"minecraft:dirt"
]}
With this configuration, if another pack defined my_pack:special_blocks to include “minecraft:cobblestone” or “minecraft:sand,” your pack, if loaded at a higher priority, would ensure that only stone and dirt are recognized as “special blocks.”
Embracing Compatibility: The Default “Add” Behavior (Append/Merge)
The default behavior for tags, when the replace field is either omitted or explicitly set to false, is to “add” or “append” to existing tag definitions. Instead of overwriting, your tag’s contents will be merged with those from higher priority data packs. This creates a cumulative list of values for that tag.
This “Add” behavior is generally the recommended approach for maximizing compatibility and creating modular content. It allows your additions to coexist peacefully with other packs and vanilla definitions without causing unexpected conflicts. You are essentially extending an existing list rather than redefining it entirely.
The “Add” behavior is perfect when:
- You want to add your custom blocks or items to existing vanilla tags (e.g., making your custom wood blocks usable in vanilla crafting recipes by adding them to
minecraft:planks). - You are creating a general-purpose behavior pack that should work well alongside many other mods or packs.
- Your intention is to extend game functionality without completely altering its foundational definitions.
Example of Default “Add” Behavior:
Suppose you’ve created a new custom block, my_pack:polished_deepslate, and you want it to be mineable with a pickaxe, just like vanilla stone blocks. You would add it to the vanilla minecraft:mineable/pickaxe tag. Your tag file (e.g., data/my_pack/tags/blocks/mineable/pickaxe.json) would look like this:
{
"values": [
"my_pack:polished_deepslate"
]}
Or, explicitly setting replace to false:
{
"replace": false,
"values": [
"my_pack:polished_deepslate"
]}
In both cases, your polished_deepslate block will be added to the existing list of blocks that can be mined with a pickaxe, without removing any vanilla blocks or blocks added by other packs.
Crafting Your Tags: A Step-by-Step Guide
Defining tags in your behavior pack follows a clear, structured process:
- Locate or Create Tag Folder: Inside your behavior pack’s root directory, navigate to or create the path
data//tags/. Replacewith your pack’s unique identifier (e.g.,my_pack). - Categorize Your Tags: Within the
tags/directory, create subfolders corresponding to the type of element you are tagging. Common examples includeblocks,items,entity_types,functions, andworldgen/biome. For instance, if you’re tagging blocks, you’d go todata/my_pack/tags/blocks/. - Create Tag JSON File: Inside the appropriate subfolder, create a
.jsonfile for your tag. The filename will become part of the tag’s resource location. For example,data/my_pack/tags/blocks/my_custom_tag.jsonwould define the tagmy_pack:my_custom_tag. - Define Tag Content: Open the JSON file and define the
replacefield (if desired) and thevaluesarray. Thevaluesarray lists all the elements that belong to this tag. You can reference specific items/blocks (e.g.,"minecraft:stone") or even other tags (e.g.,"#my_pack:another_tag").Example for “Add Behavior” (default): Adding custom logs to the vanilla
logstag.data/my_pack/tags/blocks/logs.json{
"values": [
"my_pack:ancient_log",
"my_pack:ancient_wood"
]}Example for “Tag Replace”: Completely redefining a custom tag for specific tools.
data/my_pack/tags/items/special_tools.json{
"replace": true,
"values": [
"minecraft:netherite_pickaxe",
"my_pack:diamond_hammer"
]}
Strategic Choices: When to Replace, When to Add
The decision to replace or add is a critical one with significant implications for your behavior pack’s behavior and compatibility:
- Choose
replace: true(Tag Replace) when:- You require absolute, uncompromised control over a tag’s contents.
- You need to counteract or remove unwanted elements introduced by vanilla or other packs.
- The tag defines a fundamental game mechanic that your pack is designed to completely redefine.
- You are building a standalone experience where broad compatibility is less of a concern than strict adherence to your design.
- Choose Default “Add” Behavior (
replace: falseor omitted) when:- You aim for maximum compatibility with other behavior packs and vanilla Minecraft.
- Your goal is to extend existing functionality (e.g., adding new items to crafting categories, new blocks to mineable lists).
- You want your content to integrate seamlessly into a broader modding ecosystem.
- This is the general recommendation for most behavior pack development, unless a specific need for replacement arises.
Avoiding Pitfalls: Common Mistakes and Best Practices
Even seasoned developers can stumble over tag management. Here are common mistakes and best practices to keep in mind:
- Unintended Overwrites: Accidentally setting
replace: truewhen you meant to add can wipe out crucial tag entries from other packs or vanilla. Conversely, omittingreplace: truewhen you *intended* to completely redefine a tag can lead to unexpected merging. Always be explicit about your intent. - Ignoring Data Pack Load Order: Minecraft loads data packs based on their priority. If two packs define the same tag, the one with higher priority will have the final say. If the higher priority pack uses
replace: true, it wins. If it uses “add” behavior, its entries will be appended after those from lower priority packs. Understanding this hierarchy is key to predicting tag behavior. - Invalid JSON Syntax: Tags are JSON files, and any syntax errors (missing commas, misplaced brackets, incorrect string formatting) will prevent them from loading correctly, often silently failing or causing unexpected game behavior. Use a JSON validator if you’re unsure.
- Best Practice: Default to “Add”: When in doubt, always default to the “Add” behavior (omit
replaceor set it tofalse). This is the safest approach for compatibility. Only usereplace: truewhen you have a clear and specific reason to override. - Best Practice: Test Thoroughly: Always test your behavior pack, especially its tags, in various scenarios, ideally with other common behavior packs, to ensure your tags behave as expected and don’t introduce unforeseen conflicts.
- Best Practice: Use Namespaces Wisely: When defining new tags, always use your pack’s unique namespace (e.g.,
my_pack:my_custom_tag). This helps prevent conflicts with tags from other packs that might use generic names.
Mastering Tag Management
The choice between “Tag Replace” and “Add Behavior Reference” is more than just a boolean setting; it’s a fundamental design decision that shapes how your behavior pack interacts with the vast Minecraft ecosystem. By understanding the distinct implications of replace: true versus the default append behavior, you gain precise control over your modifications, ensuring either absolute authority or seamless integration. Embrace these mechanics, and you’ll build more robust, compatible, and enjoyable Minecraft experiences.