Package net.commoble.databuddy.datagen

# Record Class BlockStateBuilder.OrWhen

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

Record Components:
  `cases` - List of Whens and/or OrWhens to predicate blockstates with

Enclosing class:
  `BlockStateBuilder`

public static record BlockStateBuilder.OrWhen(List<com.mojang.datafixers.util.Either<BlockStateBuilder.OrWhen,BlockStateBuilder.When>> cases) extends Record
Component of Multipart definitions' 'when' blocks. Represents a union of blockstate predicates, where if any of the cases are true for a given state, then the models specified in the corresponding 'apply' block will be used for that blockstate.

## Constructor Summary

Constructors
Constructor
Description
`OrWhen(List<com.mojang.datafixers.util.Either<BlockStateBuilder.OrWhen,BlockStateBuilder.When>> cases)`
Creates an instance of a `OrWhen` record class.

## Method Summary

Modifier and Type
Method
Description
`BlockStateBuilder.OrWhen`
`addAllPropertiesSubWhen(Consumer<BlockStateBuilder.When> caseBuilder)`
Adds a multi-property subcase to this OrWhen; all properties added must match for the subcase to be true
`BlockStateBuilder.OrWhen`
`addOrSubWhen(Consumer<BlockStateBuilder.OrWhen> orBuilder)`
Adds an OrWhen sub-case to this OrWhen
`final <T extends Comparable<T>>
BlockStateBuilder.OrWhen`
`addSinglePropertySubWhen(net.minecraft.world.level.block.state.properties.Property<T> property, T value, T... additionalValues)`
Adds a single-property subcase to this OrWhen
`List<com.mojang.datafixers.util.Either<BlockStateBuilder.OrWhen,BlockStateBuilder.When>>`
`cases()`
Returns the value of the `cases` 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.
`final String`
`toString()`
Returns a string representation of this record class.

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

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

## Constructor Details

### OrWhen

public OrWhen(List<com.mojang.datafixers.util.Either<BlockStateBuilder.OrWhen,BlockStateBuilder.When>> cases)
Creates an instance of a `OrWhen` record class.

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

## Method Details

### addSinglePropertySubWhen

@SafeVarargs public final <T extends Comparable<T>> BlockStateBuilder.OrWhen addSinglePropertySubWhen(net.minecraft.world.level.block.state.properties.Property<T> property, T value, T... additionalValues)
Adds a single-property subcase to this OrWhen

Type Parameters:
  `T` - type of the property's values, e.g. Boolean
Parameters:
  `property` - blockstate Property to filter by, e.g. BlockStateProperties.POWERED
  `value` - value of the blockstate Property to filter by, e.g. true
  `additionalValues` - additional values blockstates can have
Returns:
  this

### addAllPropertiesSubWhen

public BlockStateBuilder.OrWhen addAllPropertiesSubWhen(Consumer<BlockStateBuilder.When> caseBuilder)
Adds a multi-property subcase to this OrWhen; all properties added must match for the subcase to be true

Parameters:
  `caseBuilder` - When builder
Returns:
  this

### addOrSubWhen

public BlockStateBuilder.OrWhen addOrSubWhen(Consumer<BlockStateBuilder.OrWhen> orBuilder)
Adds an OrWhen sub-case to this OrWhen

Parameters:
  `orBuilder` - OrWhen builder
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.

### cases

public List<com.mojang.datafixers.util.Either<BlockStateBuilder.OrWhen,BlockStateBuilder.When>> cases()
Returns the value of the `cases` record component.

Returns:
  the value of the `cases` record component