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 revisionBoth sides next revision
tutorial:tags [2021/02/27 17:56] shnupbupstutorial:tags [2021/07/27 06:42] justinhuprime
Line 13: Line 13:
 </code> </code>
 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.
 +
 +To register this tag and use it in your code, you will need to do the following (using the Fabric API):
 +<code java>
 +import net.fabricmc.fabric.api.tag.TagRegistry;
 +import net.minecraft.block.Block;
 +import net.minecraft.tag.Tag;
 +import net.minecraft.util.Identifier;
 +
 +public class BlockTags {
 +  public static final Tag<Block> EXAMPLE_ORES = TagRegistry.block(new Identifier("examplemod", "example_ores"));
 +}
 +</code>
  
 ===== Common Tags vs Mod Tags ===== ===== Common Tags vs Mod Tags =====
tutorial/tags.txt · Last modified: 2024/01/05 13:53 by cph101