tutorial:tags
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | Next revisionBoth sides next revision | ||
tutorial:tags [2022/04/29 09:35] – [1.18.1 and below (Requires Fabric API)] solidblock | tutorial:tags [2022/04/29 09:47] – solidblock | ||
---|---|---|---|
Line 14: | Line 14: | ||
The ''" | The ''" | ||
- | For some cases, you might want to have tags checked on code, which will require you to register them: | + | ===== Using tags in code ===== |
- | ==== 1.18.2 and above ==== | + | For some cases, you might want to have tags as registered objects on code. For example, methods like '' |
+ | |||
+ | Vanilla tag objects can be found in class '' | ||
+ | |||
+ | === 1.18.2 and above === | ||
<code java> | <code java> | ||
Line 24: | Line 28: | ||
import net.minecraft.util.registry.Registry; | import net.minecraft.util.registry.Registry; | ||
- | public class BlockTags | + | public class ModBlockTags |
public static final TagKey< | public static final TagKey< | ||
} | } | ||
Line 37: | Line 41: | ||
import net.minecraft.util.Identifier; | import net.minecraft.util.Identifier; | ||
- | public class BlockTags | + | public class ModBlockTags |
public static final Tag< | public static final Tag< | ||
} | } | ||
Line 45: | Line 49: | ||
<code java> | <code java> | ||
- | public class BlockTags | + | public class ModBlockTags |
public static final Tag< | public static final Tag< | ||
} | } | ||
Line 51: | Line 55: | ||
===== 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 '' | + | 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 '' |
======= Creating New Common Tags ======= | ======= Creating New Common Tags ======= | ||
Common tags should be named with the syntax '' | Common tags should be named with the syntax '' | ||
- | ======= Existing Common Tags ======= | + | ====== Existing Common Tags ====== |
This section was [[https:// | This section was [[https:// | ||
tutorial/tags.txt · Last modified: 2024/01/05 13:53 by cph101