Package net.commoble.databuddy.datagen

# Record Class JsonDataProvider<T>

java.lang.Object
java.lang.Record
net.commoble.databuddy.datagen.JsonDataProvider<T>

Record Components:
  `registries` - CompletableFuture providing registries from GatherDataEvent
  `packOutput` - PackOutput from DataGenerator#addProvider
  `generator` - The generator instance from the GatherDataEvent
  `target` - Whether to generate data in the assets or data folder
  `folder` - The root folder of this data type in a given data domain e.g. to generate data in resources/data/modid/foods/cheeses/, use DATA for the resource type, and "foods/cheeses" for the folder name.
  `codec` - The codec that will be used to convert objects to jsons
  `objects` - An ID-to-object map that defines the objects to generate jsons from and where the jsons will be generated.
  `uniqueName` - String uniquely identifying this dataprovider (local to your mod)

All Implemented Interfaces:
  `net.minecraft.data.DataProvider`

public record JsonDataProvider<T>(CompletableFuture<net.minecraft.core.HolderLookup.Provider> registries, net.minecraft.data.PackOutput packOutput, net.minecraft.data.DataGenerator generator, net.minecraft.data.PackOutput.Target target, String folder, com.mojang.serialization.Codec<T> codec, Map<net.minecraft.resources.ResourceLocation,T> objects, String uniqueName) extends Record implements net.minecraft.data.DataProvider
Generic data provider that uses DataFixerUpper Codecs to generate jsons from java objects.

## Nested Class Summary

## Nested classes/interfaces inherited from interface net.minecraft.data.DataProvider

`net.minecraft.data.DataProvider.Factory<T extends net.minecraft.data.DataProvider>`

## Field Summary

### Fields inherited from interface net.minecraft.data.DataProvider

`FIXED_ORDER_FIELDS, INDENT_WIDTH, KEY_COMPARATOR`

## Constructor Summary

Constructors
Constructor
Description
`JsonDataProvider(CompletableFuture<net.minecraft.core.HolderLookup.Provider> registries, net.minecraft.data.PackOutput packOutput, net.minecraft.data.DataGenerator generator, net.minecraft.data.PackOutput.Target target, String folder, com.mojang.serialization.Codec<T> codec, Map<net.minecraft.resources.ResourceLocation,T> objects, String uniqueName)`
Creates an instance of a `JsonDataProvider` record class.

## Method Summary

Modifier and Type
Method
Description
`static <T> void`
`addNamedProvider(net.neoforged.neoforge.data.event.GatherDataEvent event, net.minecraft.data.PackOutput.Target target, String folder, com.mojang.serialization.Codec<T> codec, Map<net.minecraft.resources.ResourceLocation,T> objects, String name)`
Registers a JsonDataProvider to the datagenerator using the provided GatherDataEvent
`static <T> void`
`addProvider(net.neoforged.neoforge.data.event.GatherDataEvent event, net.minecraft.data.PackOutput.Target target, String folder, com.mojang.serialization.Codec<T> codec, Map<net.minecraft.resources.ResourceLocation,T> objects)`
Registers a JsonDataProvider to the datagenerator using the provided GatherDataEvent, using the folder name as the unique name of this provider.
`com.mojang.serialization.Codec<T>`
`codec()`
Returns the value of the `codec` record component.
`final boolean`
`equals(Object o)`
Indicates whether some other object is "equal to" this one.
`String`
`folder()`
Returns the value of the `folder` record component.
`net.minecraft.data.DataGenerator`
`generator()`
Returns the value of the `generator` record component.
`String`
`getName()`
Gets the name of this data provider.
`final int`
`hashCode()`
Returns a hash code value for this object.
`Map<net.minecraft.resources.ResourceLocation,T>`
`objects()`
Returns the value of the `objects` record component.
`net.minecraft.data.PackOutput`
`packOutput()`
Returns the value of the `packOutput` record component.
`CompletableFuture<net.minecraft.core.HolderLookup.Provider>`
`registries()`
Returns the value of the `registries` record component.
`CompletableFuture<?>`
`run(net.minecraft.data.CachedOutput cache)`
`net.minecraft.data.PackOutput.Target`
`target()`
Returns the value of the `target` record component.
`final String`
`toString()`
Returns a string representation of this record class.
`String`
`uniqueName()`
Returns the value of the `uniqueName` record component.

### Methods inherited from class java.lang.Object

`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

## Constructor Details

### JsonDataProvider

public JsonDataProvider(CompletableFuture<net.minecraft.core.HolderLookup.Provider> registries, net.minecraft.data.PackOutput packOutput, net.minecraft.data.DataGenerator generator, net.minecraft.data.PackOutput.Target target, String folder, com.mojang.serialization.Codec<T> codec, Map<net.minecraft.resources.ResourceLocation,T> objects, String uniqueName)
Creates an instance of a `JsonDataProvider` record class.

Parameters:
  `registries` - the value for the `registries` record component
  `packOutput` - the value for the `packOutput` record component
  `generator` - the value for the `generator` record component
  `target` - the value for the `target` record component
  `folder` - the value for the `folder` record component
  `codec` - the value for the `codec` record component
  `objects` - the value for the `objects` record component
  `uniqueName` - the value for the `uniqueName` record component

## Method Details

### addProvider

public static <T> void addProvider(net.neoforged.neoforge.data.event.GatherDataEvent event, net.minecraft.data.PackOutput.Target target, String folder, com.mojang.serialization.Codec<T> codec, Map<net.minecraft.resources.ResourceLocation,T> objects)
Registers a JsonDataProvider to the datagenerator using the provided GatherDataEvent, using the folder name as the unique name of this provider. If you have multiple providers for the same folder, use `addNamedProvider(net.neoforged.neoforge.data.event.GatherDataEvent, net.minecraft.data.PackOutput.Target, java.lang.String, com.mojang.serialization.Codec<T>, java.util.Map<net.minecraft.resources.ResourceLocation, T>, java.lang.String)` instead

Type Parameters:
  `T` - type of things to generate files for
Parameters:
  `event` - GatherDataEvent
  `target` - DATA_PACK for server data, RESOURCE_PACK for client assets
  `folder` - name of the data type folder to write objects to
  `codec` - Codec to serialize objects with
  `objects` - Objects to write

### addNamedProvider

public static <T> void addNamedProvider(net.neoforged.neoforge.data.event.GatherDataEvent event, net.minecraft.data.PackOutput.Target target, String folder, com.mojang.serialization.Codec<T> codec, Map<net.minecraft.resources.ResourceLocation,T> objects, String name)
Registers a JsonDataProvider to the datagenerator using the provided GatherDataEvent

Type Parameters:
  `T` - type of things to generate files for
Parameters:
  `event` - GatherDataEvent
  `target` - DATA_PACK for server data, RESOURCE_PACK for client assets
  `folder` - name of the data type folder to write objects to
  `codec` - Codec to serialize objects with
  `objects` - Objects to write
  `name` - Unique name (within your mod), required by the datagen system.

### run

public CompletableFuture<?> run(net.minecraft.data.CachedOutput cache)

Specified by:
  `run` in interface `net.minecraft.data.DataProvider`

### getName

public String getName()
Gets the name of this data provider. Used by the data generator to log its root data providers.

Specified by:
  `getName` in interface `net.minecraft.data.DataProvider`

### toString

public final String toString()
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.

Specified by:
  `toString` in class `Record`
Returns:
  a string representation of this object

### hashCode

public final int hashCode()
Returns a hash code value for this object. The value is derived from the hash code of each of the record components.

Specified by:
  `hashCode` in class `Record`
Returns:
  a hash code value for this object

### equals

public final boolean equals(Object o)
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with `Objects::equals(Object,Object)`.

Specified by:
  `equals` in class `Record`
Parameters:
  `o` - the object with which to compare
Returns:
  `true` if this object is the same as the `o` argument; `false` otherwise.

### registries

public CompletableFuture<net.minecraft.core.HolderLookup.Provider> registries()
Returns the value of the `registries` record component.

Returns:
  the value of the `registries` record component

### packOutput

public net.minecraft.data.PackOutput packOutput()
Returns the value of the `packOutput` record component.

Returns:
  the value of the `packOutput` record component

### generator

public net.minecraft.data.DataGenerator generator()
Returns the value of the `generator` record component.

Returns:
  the value of the `generator` record component

### target

public net.minecraft.data.PackOutput.Target target()
Returns the value of the `target` record component.

Returns:
  the value of the `target` record component

### folder

public String folder()
Returns the value of the `folder` record component.

Returns:
  the value of the `folder` record component

### codec

public com.mojang.serialization.Codec<T> codec()
Returns the value of the `codec` record component.

Returns:
  the value of the `codec` record component

### objects

public Map<net.minecraft.resources.ResourceLocation,T> objects()
Returns the value of the `objects` record component.

Returns:
  the value of the `objects` record component

### uniqueName

public String uniqueName()
Returns the value of the `uniqueName` record component.

Returns:
  the value of the `uniqueName` record component