Macros are shortcut names for existing blocks, items, and entities with specific tags or block states. The data/(namespace)/macros/ folder in a data pack contains three subfolders: blocks/, items/, and entities/, each of which contains text files with the .mcmacro extension. In a command, (namespace):foo will be replaced with the contents of foo.mcmacro (as long as it's appropriate for that command, for example you can summon my:newmob only if newmob.mcmacro is in the entities/ folder.)
Example: a golden sword with Unbreaking III and Fire Aspect II could be defined in a macro in a swords datapack so that swords:blazing_sword can be used instead of minecraft:golden_sword followed by a long string of data tags.
.mcmacro files contain a single line of text, beginning with the ID of a legit Minecraft block, item, or entity (minecraft:golden_sword) followed by the block states or data tags, in the proper format used in commands.
Option: If it seems like a better approach, the subfolder/individual macro file could be replaced with three JSON files blocks.json, items.json, and entities.json, each of which would include multiple macro definitions. This might be better for Bedrock edition. Since Bedrock doesn't support data tags, it might be nice if macros could be used to define entities with specific component groups as defined in the behavior files. That way, Bedrock players could easily summon mobs with specific features.
- Improves readability in functions
- Saves typing, especially for things that need to be typed out repeatedly
- Pseudo-modding new mobs, blocks, and items
- Add custom items in recipes without having to change recipe file format
- Add custom items in Bedrock loot tables
- (Bedrock) Allow something similar to NBT data tags without actually adding NBT data tags
Please sign in to leave a comment.