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
Next revisionBoth sides next revision
tutorial:tags [2022/05/25 08:11] – [1.16.5 and below (Requires Fabric API)] 1.17 uses TagRegistry solidblocktutorial:tags [2022/12/16 02:39] solidblock
Line 20: Line 20:
 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.
  
-=== 1.18.and above ===+=== 1.19.and above ===
 <yarncode java> <yarncode java>
 public class ModBlockTags { public class ModBlockTags {
-  public static final TagKey<class_2248> EXAMPLE_ORES = TagKey.of(class_2378.field_25105, new class_2960("tutorial", "example_ores"));+  public static final TagKey<class_2248> EXAMPLE_ORES = class_6862.method_40092(class_7924.field_41254, new class_2960("tutorial", "example_ores"));
 } }
 </yarncode> </yarncode>
  
 +=== 1.19.2 and below ===
 +<yarncode java>
 +public class ModBlockTags {
 +  public static final TagKey<class_2248> EXAMPLE_ORES = class_6862.method_40092(class_2378.BLOCK_KEY, new class_2960("tutorial", "example_ores"));
 +}
 +</yarncode>
  
 ==== 1.18.1 and below (Requires Fabric API) ==== ==== 1.18.1 and below (Requires Fabric API) ====
Line 42: Line 48:
 </yarncode> </yarncode>
  
 +Note that ''TagRegistry'' is deprecated since Fabric API 0.46.0 where ''TagFactory'' is added, and which does not support 1.17.
 ===== Common Tags vs Mod Tags ===== ===== Common Tags vs Mod Tags =====
 If your tag applies ONLY to items in your mod, and no other mod is likely to have similar items, or you specifically want to only include your mod's items in that tag, then use ''yourmodid:yourtaghere'', with the example above. However, if your mod adds items which other mods also add, you can: If your tag applies ONLY to items in your mod, and no other mod is likely to have similar items, or you specifically want to only include your mod's items in that tag, then use ''yourmodid:yourtaghere'', with the example above. However, if your mod adds items which other mods also add, you can:
Line 50: Line 57:
 ====== Existing Common Tags ====== ====== Existing Common Tags ======
 This section was [[https://github.com/fabric-community/fabric-convention-tags|automatically generated using a script]]. See the end of this page for the list of mods used. If your item fits into one of these tags, then you should add it to that tag instead of defining your own. If you want your mod's recipes to be compatible with other mods, replace the item in the recipe with ''#c:tagname''. This section was [[https://github.com/fabric-community/fabric-convention-tags|automatically generated using a script]]. See the end of this page for the list of mods used. If your item fits into one of these tags, then you should add it to that tag instead of defining your own. If you want your mod's recipes to be compatible with other mods, replace the item in the recipe with ''#c:tagname''.
- 
  
 ===== Item Tags ===== ===== Item Tags =====
tutorial/tags.txt · Last modified: 2024/01/05 13:53 by cph101