Package net.commoble.databuddy.datagen

# Record Class BlockStateBuilder.Variants

java.lang.Object
java.lang.Record
net.commoble.databuddy.datagen.BlockStateBuilder.Variants

Record Components:
  `variants` - Map of blockstate property predicates to models

Enclosing class:
  `BlockStateBuilder`

public static record BlockStateBuilder.Variants(Map<List<net.commoble.databuddy.datagen.BlockStateBuilder.PropertyValue<?>>,net.minecraft.client.renderer.block.model.BlockStateModel.Unbaked> variants) extends Record
Represents a "variants" block in a blockstate json. Can be used as a builder like so:

    BlockStateBuilder.variants(variants -> variants
      .addVariant(BlockStateProperties.POWERED, false, BlockStateBuilder.model(ResourceLocation.fromNamespaceAndPath("foo, "bar")))
      .addVariant(propertyValues -> propertyValues
        .addPropertyValue(BlockStateProperties.POWERED, true)
        .addPropertyValue(BlockStateProperties.LIT, false),
        BlockStateBuilder.model(ResourceLocation.fromNamespaceAndPath("foo, "bar_powered"))));

Which results in the blockstate json

    {
      "variants": {
        "powered=false": {"model": "foo:bar"},
        "powered=true,lit=false": {"model": "foo:bar_powered"}
      }
    }

## Constructor Summary

Constructors
Constructor
Description
`Variants(Map<List<net.commoble.databuddy.datagen.BlockStateBuilder.PropertyValue<?>>,net.minecraft.client.renderer.block.model.BlockStateModel.Unbaked> variants)`
Creates an instance of a `Variants` record class.

## Method Summary

Modifier and Type
Method
Description
`BlockStateBuilder.Variants`
`addMultiPropertyVariant(Consumer<BlockStateBuilder.PropertyValueList> propertyValuesBuilder, net.minecraft.client.renderer.block.model.BlockStateModel.Unbaked model)`
Adds a multi-property variant to your blockstate json, e.g.
`<T extends Comparable<T>>
BlockStateBuilder.Variants`
`addVariant(net.minecraft.world.level.block.state.properties.Property<T> property, T value, net.minecraft.client.renderer.block.model.BlockStateModel.Unbaked model)`
Adds a single-property variant to your blockstate json., e.g.
`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.
`final String`
`toString()`
Returns a string representation of this record class.
`Map<List<net.commoble.databuddy.datagen.BlockStateBuilder.PropertyValue<?>>,net.minecraft.client.renderer.block.model.BlockStateModel.Unbaked>`
`variants()`
Returns the value of the `variants` record component.

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

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

## Constructor Details

### Variants

public Variants(Map<List<net.commoble.databuddy.datagen.BlockStateBuilder.PropertyValue<?>>,net.minecraft.client.renderer.block.model.BlockStateModel.Unbaked> variants)
Creates an instance of a `Variants` record class.

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

## Method Details

### addVariant

public <T extends Comparable<T>> BlockStateBuilder.Variants addVariant(net.minecraft.world.level.block.state.properties.Property<T> property, T value, net.minecraft.client.renderer.block.model.BlockStateModel.Unbaked model)
Adds a single-property variant to your blockstate json., e.g. "powered=true": {"model": "foo:bar"}

Type Parameters:
  `T` - type of the blockstate property to filter blockstates by
Parameters:
  `property` - blockstate Property to filter blockstates by, e.g. `BlockStateProperties.POWERED`
  `value` - value of the blockstate Property to filter blockstates by, e.g. true
  `model` - BlockStateModel.Unbaked to assign to blockstates which have that property value, see `BlockStateBuilder.model(net.minecraft.resources.ResourceLocation)` or its overloads to help create the model
Returns:
  this

### addMultiPropertyVariant

public BlockStateBuilder.Variants addMultiPropertyVariant(Consumer<BlockStateBuilder.PropertyValueList> propertyValuesBuilder, net.minecraft.client.renderer.block.model.BlockStateModel.Unbaked model)
Adds a multi-property variant to your blockstate json, e.g. "powered=true,lit=false": {"model": "foo:bar"}

Parameters:
  `propertyValuesBuilder` - PropertyValueList builder to add property values to, see its javadoc for details
  `model` - BlockStateModel.Unbaked to assign to blockstates which have all specified property values, see `BlockStateBuilder.model(net.minecraft.resources.ResourceLocation)` or its overloads to help create the model
Returns:
  this

### 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 Map<List<net.commoble.databuddy.datagen.BlockStateBuilder.PropertyValue<?>>,net.minecraft.client.renderer.block.model.BlockStateModel.Unbaked> variants()
Returns the value of the `variants` record component.

Returns:
  the value of the `variants` record component