Views
Actions
Difference between revisions of "Datageneration/Tags"
From Forge Community Wiki
(added {{Under construction}}) |
(some style fixes) |
||
Line 1: | Line 1: | ||
− | + | {{Under construction}} | |
− | |||
− | |||
− | |||
− | |||
− | |||
Tags can be generated by extending the <code>ItemTagsProvider</code> for Items or <code>BlockTagsProvider</code> for Blocks. For Custom Objects you would need to expand <code>TagsProvider</code> and give it the Object you want tags for. For the registration of you Tags you need to override the <code>TagsProvider#registerTags</code> method. | Tags can be generated by extending the <code>ItemTagsProvider</code> for Items or <code>BlockTagsProvider</code> for Blocks. For Custom Objects you would need to expand <code>TagsProvider</code> and give it the Object you want tags for. For the registration of you Tags you need to override the <code>TagsProvider#registerTags</code> method. | ||
Line 10: | Line 5: | ||
{{Colored box|title=Information|content=You can still use <code>TagsProvider</code> for Items and Blocks but you would need to implement a lot of stuff that is already done in <code>ItemTagsProvider</code> and <code>BlockTagsProvider</code>}} | {{Colored box|title=Information|content=You can still use <code>TagsProvider</code> for Items and Blocks but you would need to implement a lot of stuff that is already done in <code>ItemTagsProvider</code> and <code>BlockTagsProvider</code>}} | ||
− | |||
− | |||
− | |||
− | |||
− | |||
==Items/Blocks== | ==Items/Blocks== |
Revision as of 14:39, 5 November 2020
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 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 theNamedTag
you can start with the actual creation of the Tag, you would first callTagsProvider#getOrCreateBuilder
which takes the NamedTag as an Argument, this returns aTagsProvider.Builder
. Now you can withTagsProvider.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