User Tools

Site Tools


tutorial:datagen_tags

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
tutorial:datagen_tags [2022/08/08 20:06] mineblock11tutorial:datagen_tags [2023/06/05 18:13] – Update to new constructor mcrafterzz
Line 1: Line 1:
 ====== Tag Generation ====== ====== Tag Generation ======
  
-The ''FabricTagProvider<T>'' class allows you to generate tag json files.+The ''[[https://github.com/FabricMC/fabric/blob/1.19.2/fabric-data-generation-api-v1/src/main/java/net/fabricmc/fabric/api/datagen/v1/provider/FabricTagProvider.java|FabricTagProvider<T>]]'' class allows you to generate tag json files.
  
 This page will follow you through all aspects of this provider. This page will follow you through all aspects of this provider.
  
-To create a ''FabricTagProvider<T>'' create a class that extends it and register it at your entrypoint like so:+To create a tag generator, create a class that extends ''FabricTagProvider<T>'', where ''T'' is the type of tag you want to generate, and register it at your datagen entrypoint like so:
  
 <code java> <code java>
-private static class MyTagGenerator extends FabricTagProvider<Item> +private static class MyTagGenerator extends ItemTagProvider 
-   public MyTagGenerator(FabricDataGenerator dataGenerator) { +   public MyTagGenerator(FabricDataOutput output, CompletableFuture<WrapperLookup> completableFuture) { 
-       super(dataGeneratorRegistry.ITEM);+        super(outputcompletableFuture);
    }    }
  
Line 49: Line 49:
 </code> </code>
  
-Output from above example:+Output from the example above:
  
 <file javascript smelly_items.json> <file javascript smelly_items.json>
tutorial/datagen_tags.txt · Last modified: 2023/06/05 18:22 by mcrafterzz