User Tools

Site Tools


tutorial:tags

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
tutorial:tags [2023/09/13 15:33] – Improve conventional tag documentation haykamtutorial:tags [2024/01/05 13:53] (current) – Switch minecraft wiki link to indie site cph101
Line 1: Line 1:
 ====== Tags ====== ====== Tags ======
  
-Tags are groups of blocks, items, fluids, biomes or other registry objects which share similar properties. They can be used in recipes to allow for multiple items to be used in the same recipe interchangeably. Read more on what tags are on the [[https://minecraft.gamepedia.com/Tag|Minecraft Wiki]]. Tags can also be used to group similar items or other pieces of content from different mods, to allow them to be compatible with each other. These are called conventional tags.+Tags are groups of blocks, items, fluids, biomes or other registry objects which share similar properties. They can be used in recipes to allow for multiple items to be used in the same recipe interchangeably. Read more on what tags are on the [[https://minecraft.wiki/w/Tag|Minecraft Wiki]]. Tags can also be used to group similar items or other pieces of content from different mods, to allow them to be compatible with each other. These are called conventional tags.
  
-===== Tag Example =====+===== Creating tags ===== 
 + 
 +==== Defining through JSON ====
  
 File Location: ''src/main/resources/data/tutorial/tags/blocks/example_ores.json'' File Location: ''src/main/resources/data/tutorial/tags/blocks/example_ores.json''
Line 18: Line 20:
 The ''"replace"'' tag determines whether the mod will remove all other items in the tag that are not mentioned in this file. It is not recommended to set this to true, as it may break compatibility with other mods. ''blocks'' in the file path can also be ''items'' or ''fluids''. You should separate words with underscores, and tags should be plural. The ''"replace"'' tag determines whether the mod will remove all other items in the tag that are not mentioned in this file. It is not recommended to set this to true, as it may break compatibility with other mods. ''blocks'' in the file path can also be ''items'' or ''fluids''. You should separate words with underscores, and tags should be plural.
  
-===== Using tags in code =====+==== Accessing tags in code =====
  
 For some cases, you might want to have tags as registered objects on code. For example, methods like ''Block#isIn'' require these tag parameters. Besides, the Fabric registries like ''FlammableBlockRegistry'', ''FuelRegistry'' and ''CompostingChanceRegistry'' also accept block tags or item tags. For some cases, you might want to have tags as registered objects on code. For example, methods like ''Block#isIn'' require these tag parameters. Besides, the Fabric registries like ''FlammableBlockRegistry'', ''FuelRegistry'' and ''CompostingChanceRegistry'' also accept block tags or item tags.
Line 62: Line 64:
 Note that ''TagRegistry'' is deprecated since Fabric API 0.46.0, as ''TagFactory'' replaces it. ''TagRegistry'' is used in Minecraft 1.17 and below because Fabric API for these versions did not receive the ''TagFactory'' changes. Note that ''TagRegistry'' is deprecated since Fabric API 0.46.0, as ''TagFactory'' replaces it. ''TagRegistry'' is used in Minecraft 1.17 and below because Fabric API for these versions did not receive the ''TagFactory'' changes.
  
-===== Conventional Tags =====+===== Conventional tags =====
  
 Conventional tags are a standardized tag naming scheme that aims to reduce guesswork and inconsistency for mod developers, data pack authors, and mod pack authors. These tags share the ''c'' namespace and have explicit rules for naming. Conventional tags are a standardized tag naming scheme that aims to reduce guesswork and inconsistency for mod developers, data pack authors, and mod pack authors. These tags share the ''c'' namespace and have explicit rules for naming.
Line 70: Line 72:
 On the other hand, pieces of content that are unique enough to not be interchangable should not use conventional tags. For example, if a mod adds a unique set of machines that must be grouped within a tag, it should place these machines in a tag in its own namespace, such as ''yourmodid:custom_machines''. On the other hand, pieces of content that are unique enough to not be interchangable should not use conventional tags. For example, if a mod adds a unique set of machines that must be grouped within a tag, it should place these machines in a tag in its own namespace, such as ''yourmodid:custom_machines''.
  
-======= Creating New Conventional Tags =======+==== Creating new conventional tags =====
  
 Conventional tags are simply tags in the ''c'' namespace. These tags are expected to be used by multiple mods, so the name scheme for conventional tags should be consistent between mods. The general format for conventional tags is plural, with words separated with underscores. The following tags are good examples of this convention: Conventional tags are simply tags in the ''c'' namespace. These tags are expected to be used by multiple mods, so the name scheme for conventional tags should be consistent between mods. The general format for conventional tags is plural, with words separated with underscores. The following tags are good examples of this convention:
  
-''c:chests'' block tag +  * ''c:chests'' block tag 
-''c:water_buckets'' item tag +  ''c:water_buckets'' item tag 
-''c:in_the_end'' biome tag+  ''c:in_the_end'' biome tag
  
 A flat structure is used rather than a hierarchal structure. For example, ''c:iron_ores'' is preferred over ''c:ores/iron''. A flat structure is used rather than a hierarchal structure. For example, ''c:iron_ores'' is preferred over ''c:ores/iron''.
  
-====== Existing Conventional Tags ======+==== Existing conventional tags =====
  
-Fabric API ships definitions for conventional tags in its ''fabric-conventional-tags-v1'' module. The provided tags can be viewed [[https://github.com/FabricMC/fabric/tree/1.20.2/fabric-convention-tags-v1/src/generated/resources/data/c/tags|here].+Fabric API ships definitions for conventional tags in its ''fabric-conventional-tags-v1'' module. The provided tags can be viewed [[https://github.com/FabricMC/fabric/tree/HEAD/fabric-convention-tags-v1/src/generated/resources/data/c/tags|here]].
  
-A (possibly outdated) directory of general known conventional tags is available on [[known_tags|a separate page]].+A (possibly outdated) directory of general known conventional tags is available on [[community:common_tags|a separate page]].
  
tutorial/tags.1694619213.txt.gz · Last modified: 2023/09/13 15:33 by haykam