Datageneration/Tags
Revision as of 00:59, 19 May 2021 by ShrimpBot (talk | contribs) (Categorize with Category:Data Generation by SizableShrimp#0755)
This page is under construction.
This page is incomplete, and needs more work. Feel free to edit and improve this page!
Tags can be generated by extending the ItemTagsProvider for Items or BlockTagsProvider for Blocks. For Custom Objects you would need to expand TagsProvider and give it the Object you want tags for. For the registration of you Tags you need to override the TagsProvider#registerTags method.
Information
You can still use
TagsProvider for Items and Blocks but you would need to implement a lot of stuff that is already done in ItemTagsProvider and BlockTagsProviderItems/Blocks
First you should make a ITag.INamedTag(NamedTag) with ItemTags#makeWrapperTag for Items or BlockTags#makeWrapperTag for blocks, this will take the name of you Tag, see Tags#Conventions
for more info. After you have theNamedTagyou can start with the actual creation of the Tag, you would first callTagsProvider#getOrCreateBuilderwhich takes the NamedTag as an Argument, this returns aTagsProvider.Builder. Now you can withTagsProvider.Builder#addadd one or more Items/Blocks or other Tags to your own Tags.
Example for an Item Tag:
ITag.INamedTag<Item> copperTag = ItemTags.makeWrapperTag("forge:ore/copper");
getOrCreateBuilder(copperTag).add(Init.COPPER_ORE_ITEM.get());
Custom Type for Tags
TBD