Package commoble.databuddy.datagen

# Record Class BlockStateFile.WhenApply

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

Record Components:
  `when` - Optional field specifying one or more case predicates to apply to each blockstate. If a Case is provided, the model list will be used for blockstates that match that case. If an OrCase is provided, the model list will be used for blockstates that match any of the sub-cases. If no case is provided, the model list will be used for all blockstates.
  `apply` - List of models to randomly apply to a blockstate at a position if the 'when' case applies to that blockstate. Must contain at least one model. If the list contains more than one model, one model will randomly be applied at each position containing the relevant blockstates.

Enclosing class:
  BlockStateFile

public static record BlockStateFile.WhenApply(Optional<com.mojang.datafixers.util.Either<BlockStateFile.OrCase,BlockStateFile.Case>> when, List<BlockStateFile.Model> apply) extends Record
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.WhenApply>`
`CODEC`
codec

## Constructor Summary

Constructors
Constructor
Description
`WhenApply(Optional<com.mojang.datafixers.util.Either<BlockStateFile.OrCase,BlockStateFile.Case>> when, List<BlockStateFile.Model> apply)`
Creates an instance of a `WhenApply` record class.

## Method Summary

Modifier and Type
Method
Description
`static BlockStateFile.WhenApply`
`always(BlockStateFile.Model apply, BlockStateFile.Model... additionalRandomModels)`
Builder-like factory for datageneration, applying a Part to all blockstates.
`List<BlockStateFile.Model>`
`apply()`
Returns the value of the `apply` record component.
`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.
`static BlockStateFile.WhenApply`
`or(BlockStateFile.OrCase when, BlockStateFile.Model apply, BlockStateFile.Model... additionalRandomModels)`
Builder-like factory for datageneration, using an OR-case when.
`final String`
`toString()`
Returns a string representation of this record class.
`Optional<com.mojang.datafixers.util.Either<BlockStateFile.OrCase,BlockStateFile.Case>>`
`when()`
Returns the value of the `when` record component.
`static BlockStateFile.WhenApply`
`when(BlockStateFile.Case when, BlockStateFile.Model apply, BlockStateFile.Model... additionalRandomModels)`
Builder-like factory for datageneration, using a single-case when.

### 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.WhenApply> CODEC
codec

## Constructor Details

### WhenApply

public WhenApply(Optional<com.mojang.datafixers.util.Either<BlockStateFile.OrCase,BlockStateFile.Case>> when, List<BlockStateFile.Model> apply)
Creates an instance of a `WhenApply` record class.

Parameters:
  `when` - the value for the `when` record component
  `apply` - the value for the `apply` record component

## Method Details

### when

public static BlockStateFile.WhenApply when(BlockStateFile.Case when, BlockStateFile.Model apply, BlockStateFile.Model... additionalRandomModels)
Builder-like factory for datageneration, using a single-case when.

Parameters:
  `when` - CaseDefinition, all of whose cases must be true to apply the model part.
  `apply` - Model to apply when the 'when' is true for a given blockstate.
  `additionalRandomModels` - optional additional Model(s) to include. One model from all models will be randomly chosen per block position.
Returns:
  ModelSet builder

### or

public static BlockStateFile.WhenApply or(BlockStateFile.OrCase when, BlockStateFile.Model apply, BlockStateFile.Model... additionalRandomModels)
Builder-like factory for datageneration, using an OR-case when.

Parameters:
  `when` - OrCase, any of whose cases must be true to apply the model part.
  `apply` - Model to apply when the 'when' is true for a given blockstate.
  `additionalRandomModels` - optional additional Model(s) to include. One model from all models will be randomly chosen per block position.
Returns:
  WhenApply builder

### always

public static BlockStateFile.WhenApply always(BlockStateFile.Model apply, BlockStateFile.Model... additionalRandomModels)
Builder-like factory for datageneration, applying a Part to all blockstates.

Parameters:
  `apply` - Model to apply to all blockstates.
  `additionalRandomModels` - optional additional Model(s) to include. One model from all models will be randomly chosen per block position.
Returns:
  WhenAPply builder

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

### when

public Optional<com.mojang.datafixers.util.Either<BlockStateFile.OrCase,BlockStateFile.Case>> when()
Returns the value of the `when` record component.

Returns:
  the value of the `when` record component

### apply

public List<BlockStateFile.Model> apply()
Returns the value of the `apply` record component.

Returns:
  the value of the `apply` record component