Datageneration/Tags

Revision as of 17:45, 4 November 2020 by Unbekannt (talk | contribs) (Inital write up still needs work in the Custom Type Section)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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 BlockTagsProvider

Items/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 the NamedTag you can start with the actual creation of the Tag, you would first call TagsProvider#getOrCreateBuilder which takes the NamedTag as an Argument, this returns a TagsProvider.Builder. Now you can with TagsProvider.Builder#add add 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