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:39] – Fix good conventional tag examples list haykamtutorial:tags [2026/02/10 22:24] (current) cassiancc
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.
  
 ===== Creating tags ===== ===== Creating tags =====
Line 7: Line 7:
 ==== Defining through JSON ==== ==== Defining through JSON ====
  
-File Location: ''src/main/resources/data/tutorial/tags/blocks/example_ores.json''+File Location:  
 +  * ''src/main/resources/data/tutorial/tags/**block**/example_ores.json'' (since 1.21) 
 +  * ''src/main/resources/data/tutorial/tags/**blocks**/example_ores.json'' (before 1.21)
  
 <code javascript> <code javascript>
Line 26: Line 28:
 Vanilla tag objects can be found in class ''<yarn class_3481>'' and ''<yarn class_3489>''. To register tag objects in your mod, see the following. Vanilla tag objects can be found in class ''<yarn class_3481>'' and ''<yarn class_3489>''. To register tag objects in your mod, see the following.
  
-=== Minecraft 1.19.and above ===+=== Minecraft 1.21.11 and above (Mojang Mappings) 
 + 
 +public class ModBlockTags { 
 +  public static final TagKey<Block> EXAMPLE_ORES = TagKey.create(Registries.BLOCK, Identifier.fromNamespaceAndPath("tutorial", "example_ores")); 
 +
 + 
 +=== Minecraft 1.21.1 and above (Mojang Mappings) 
 + 
 +public class ModBlockTags { 
 +  public static final TagKey<Block> EXAMPLE_ORES = TagKey.create(Registries.BLOCK, ResourceLocation.fromNamespaceAndPath("tutorial", "example_ores")); 
 +
 + 
 +=== Minecraft 1.21.1 through 1.21.10 (Mojang Mappings) 
 + 
 +public class ModBlockTags { 
 +  public static final TagKey<Block> EXAMPLE_ORES = TagKey.create(Registries.BLOCK, ResourceLocation.fromNamespaceAndPath("tutorial", "example_ores")); 
 +
 + 
 +=== Minecraft 1.21 and above (Yarn Mappings) === 
 + 
 +<yarncode java> 
 +public class ModBlockTags { 
 +  public static final TagKey<class_2248> EXAMPLE_ORES = class_6862.method_40092(class_7924.field_41254, class_2960.of("tutorial", "example_ores")); 
 +
 +</yarncode> 
 + 
 +=== Minecraft 1.19.3 through 1.20.6 (Yarn Mappings) ===
  
 <yarncode java> <yarncode java>
Line 34: Line 62:
 </yarncode> </yarncode>
  
-=== Minecraft 1.18.2 through 1.19.2 ===+=== Minecraft 1.18.2 through 1.19.2 (Yarn Mappings) ===
  
 <yarncode java> <yarncode java>
Line 42: Line 70:
 </yarncode> </yarncode>
  
-=== Minecraft 1.17.1 through 1.18.1 ===+=== Minecraft 1.17.1 through 1.18.1 (Yarn Mappings) ===
  
 In Minecraft 1.17.1 through 1.18.1, Fabric API provides a helper method for creating a tag: In Minecraft 1.17.1 through 1.18.1, Fabric API provides a helper method for creating a tag:
Line 52: Line 80:
 </yarncode> </yarncode>
  
-=== Minecraft 1.17 and below ===+=== Minecraft 1.17 and below (Yarn Mappings) ===
  
 In Minecraft 1.17 (not including Minecraft 1.17.1) and earlier versions, Fabric API provides a different API for creating a tag: In Minecraft 1.17 (not including Minecraft 1.17.1) and earlier versions, Fabric API provides a different API for creating a tag:
Line 78: Line 106:
   * ''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:is_end'' biome tag
  
-flat structure is used rather than a hierarchal structure. For example, ''c:iron_ores'' is preferred over ''c:ores/iron''.+Since 1.21, hierarchal structure is used rather than a flat structure. For example, ''c:ores/iron'' is preferred over ''c:iron_ores''.
  
 ==== 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-v2'' module. The provided tags can be viewed [[https://github.com/FabricMC/fabric/tree/HEAD/fabric-convention-tags-v2/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.1694619592.txt.gz · Last modified: 2023/09/13 15:39 by haykam