Package net.commoble.databuddy.datagen

# Record Class BlockStateFile

java.lang.Object
java.lang.Record
net.commoble.databuddy.datagen.BlockStateFile

public record BlockStateFile(Optional<BlockStateFile.Variants> variants, Optional<BlockStateFile.Multipart> multipart) extends Record
Alternative datageneration for blockstate jsons. Usable with `JsonCodecProvider`.

## Nested Class Summary

Nested Classes
Modifier and Type
Class
Description
`static final record`
`BlockStateFile.Case`
Component of Multipart definitions representing a blockstate predicate.
`static final record`
`BlockStateFile.Model`
Component representing a rotated model object in variant and multipart definitions.
`static final record`
`BlockStateFile.Multipart`
Multipart format for blockstate jsons.
`static final record`
`BlockStateFile.OrCase`
Component of Multipart definitions' 'when' blocks.
`static final record`
`BlockStateFile.PropertyValue<T extends Comparable<T>>`
Component of Variants definitions, representing a property-value entry.
`static final record`
`BlockStateFile.Variants`
Represents a "variants" block in a blockstate json.
`static final record`
`BlockStateFile.WhenApply`
Component of Multipart definitions, representing the "when" and "apply" blocks in a blockstate json.

## Field Summary

Fields
Modifier and Type
Field
Description
`static final com.mojang.serialization.Codec<BlockStateFile>`
`CODEC`
codec

## Constructor Summary

Constructors
Constructor
Description
`BlockStateFile(Optional<BlockStateFile.Variants> variants, Optional<BlockStateFile.Multipart> multipart)`
Creates an instance of a `BlockStateFile` record class.

## Method Summary

Modifier and Type
Method
Description
`static void`
`addDataProvider(net.neoforged.neoforge.data.event.GatherDataEvent event, String modid, com.mojang.serialization.DynamicOps<com.google.gson.JsonElement> dynamicOps, Map<net.minecraft.resources.ResourceLocation,BlockStateFile> entries)`
Creates a DataProvider and adds it to the provided GatherDataEvent's datagenerator, generating in the assets/namespace/blockstates/ folder
`final boolean`
`equals(Object o)`
Indicates whether some other object is "equal to" this one.
`final int`
`hashCode()`
Returns a hash code value for this object.
`Optional<BlockStateFile.Multipart>`
`multipart()`
Returns the value of the `multipart` record component.
`static BlockStateFile`
`multipart(BlockStateFile.Multipart multipart)`
Specifies a blockstate file with a multipart definition.
`final String`
`toString()`
Returns a string representation of this record class.
`Optional<BlockStateFile.Variants>`
`variants()`
Returns the value of the `variants` record component.
`static BlockStateFile`
`variants(BlockStateFile.Variants variants)`
Specifies a blockstate file with a variants definition.
`static BlockStateFile`
`variantsAndMultipart(BlockStateFile.Variants variants, BlockStateFile.Multipart multipart)`
Specifies a blockstate file with both variants and multipart definitions.

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

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

## Field Details

### CODEC

public static final com.mojang.serialization.Codec<BlockStateFile> CODEC
codec

## Constructor Details

### BlockStateFile

public BlockStateFile(Optional<BlockStateFile.Variants> variants, Optional<BlockStateFile.Multipart> multipart)
Creates an instance of a `BlockStateFile` record class.

Parameters:
  `variants` - the value for the `variants` record component
  `multipart` - the value for the `multipart` record component

## Method Details

### addDataProvider

public static void addDataProvider(net.neoforged.neoforge.data.event.GatherDataEvent event, String modid, com.mojang.serialization.DynamicOps<com.google.gson.JsonElement> dynamicOps, Map<net.minecraft.resources.ResourceLocation,BlockStateFile> entries)
Creates a DataProvider and adds it to the provided GatherDataEvent's datagenerator, generating in the assets/namespace/blockstates/ folder

Parameters:
  `event` - GatherDataEvent with datagen context
  `modid` - String modid for logging purposes
  `dynamicOps` - DynamicOps to serialize data to json with, e.g. JsonOps.INSTANCE
  `entries` - Map of ResourceLocation ids to BlockStateDefinitions to serialize

### variants

public static BlockStateFile variants(BlockStateFile.Variants variants)
Specifies a blockstate file with a variants definition. See `BlockStateFile.Variants.builder()`.

Parameters:
  `variants` - Variants mapping sets of blockstates to individual models.
Returns:
  BlockStateDefinition for datageneration.

### multipart

public static BlockStateFile multipart(BlockStateFile.Multipart multipart)
Specifies a blockstate file with a multipart definition. See `BlockStateFile.Multipart.builder()`.

Parameters:
  `multipart` - Multipart definition assigning (possibly multiple) models to states.
Returns:
  BlockStateDefinition for datageneration.

### variantsAndMultipart

public static BlockStateFile variantsAndMultipart(BlockStateFile.Variants variants, BlockStateFile.Multipart multipart)
Specifies a blockstate file with both variants and multipart definitions. Variants override multiparts.

Parameters:
  `variants` - Variants mapping sets of blockstates to individual models.
  `multipart` - Multipart definition assigning (possibly multiple) models to states.
Returns:
  BlockStateDefinition for datageneration

### 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.

### variants

public Optional<BlockStateFile.Variants> variants()
Returns the value of the `variants` record component.

Returns:
  the value of the `variants` record component

### multipart

public Optional<BlockStateFile.Multipart> multipart()
Returns the value of the `multipart` record component.

Returns:
  the value of the `multipart` record component