Changes

28 bytes removed ,  23:04, 31 July 2021
Update to 1.17
Line 1: Line 1: −
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.
+
{{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#addTags</code> method.
       
{{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==
First you should make a <code>ITag.INamedTag</code>(NamedTag) with <code>ItemTags#makeWrapperTag</code> for Items or <code>BlockTags#makeWrapperTag</code> for blocks, this will take the name of you Tag, see [[Tags#Conventions]] for more info. After you have the <code>NamedTag</code> you can start with the actual creation of the Tag, you would first call <code>TagsProvider#getOrCreateBuilder</code> which takes the NamedTag as an Argument, this returns a <code>TagsProvider.Builder</code>. Now you can with <code>TagsProvider.Builder#add</code> add one or more Items/Blocks or other Tags to your own Tags.  
+
First you should make a <code>Tag$Named</code> with <code>ItemTags#bind</code> for Items or <code>BlockTags#bind</code> for blocks, this will take the name of you Tag, see [[Tags#Conventions]]
 +
for more info. After you have the <code>Tag$Named</code> you can start with the actual creation of the Tag, you would first call <code>TagsProvider#tag</code> which takes the tag as an argument, this returns a <code>TagsProvider$TagAppender</code>. Now you can with <code>TagsProvider$TagAppender#add</code> add one or more Items/Blocks or other Tags to your own Tags.  
    
Example for an Item Tag:
 
Example for an Item Tag:
 
<syntaxhighlight lang="java">
 
<syntaxhighlight lang="java">
ITag.INamedTag<Item> copperTag = ItemTags.makeWrapperTag("forge:ore/copper");
+
Tag.Named<Item> copperTag = ItemTags.bind("forge:ore/copper");
getOrCreateBuilder(copperTag).add(Init.COPPER_ORE_ITEM.get());
+
tag(copperTag).add(Init.COPPER_ORE_ITEM.get());
 
</syntaxhighlight>
 
</syntaxhighlight>
   −
== Custom Type for Tags ==
+
 
 +
 
 +
==Custom Type for Tags==
 
TBD
 
TBD
 +
 +
 +
[[Category:Data Generation]]