Package net.commoble.exmachina.api.content

# Record Class BlockStateProperty

java.lang.Object
java.lang.Record
net.commoble.exmachina.api.content.BlockStateProperty

Record Components:
  `variants` - Map of blockstate predicate string to double value for the blockstate(s)

All Implemented Interfaces:
  `StaticProperty`

public record BlockStateProperty(Map<String,Double> variants) extends Record implements StaticProperty
StaticProperty for a block which has different property values for different blockstates. Blockstates are designated similarly to variant blockstate jsons. e.g. for a furnace block:

    {
            "type": "exmachina:blockstate",
            "variants": {
                    "lit=false": 0,
                    "lit=true,facing=north": 1,
                    "lit=true,facing=west": 2
            }
    }

Not all states are required to be specified (unspecified states default to 0), but a state cannot be specified by more than one variant.

## Nested Class Summary

## Nested classes/interfaces inherited from interface net.commoble.exmachina.api.StaticProperty

`StaticProperty.BakedStaticProperty`

## Field Summary

Fields
Modifier and Type
Field
Description
`static final com.mojang.serialization.MapCodec<BlockStateProperty>`
`CODEC`
e.g.
`static final net.minecraft.resources.ResourceKey<com.mojang.serialization.MapCodec<? extends StaticProperty>>`
`KEY`
exmachina:static_property_type / exmachina:blockstate

## Constructor Summary

Constructors
Constructor
Description
`BlockStateProperty(Map<String,Double> variants)`
Creates an instance of a `BlockStateProperty` record class.

## Method Summary

Modifier and Type
Method
Description
`com.mojang.serialization.DataResult<StaticProperty.BakedStaticProperty>`
`bake(net.minecraft.world.level.block.Block block)`
Returns DataResult success holding a state-to-double function if block is valid, error result otherwise.
`com.mojang.serialization.MapCodec<? extends StaticProperty>`
`codec()`
Returns Codec registered to `ExMachinaRegistries.STATIC_PROPERTY_TYPE`..
`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<String,Double>`
`variants()`
Returns the value of the `variants` record component.

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

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

### Methods inherited from interface net.commoble.exmachina.api.StaticProperty

`isPresent`

## Field Details

### KEY

public static final net.minecraft.resources.ResourceKey<com.mojang.serialization.MapCodec<? extends StaticProperty>> KEY
exmachina:static_property_type / exmachina:blockstate

### CODEC

public static final com.mojang.serialization.MapCodec<BlockStateProperty> CODEC
e.g. for a furnace block:

    {
            "type": "exmachina:blockstate",
            "variants": {
                    "lit=false": 0,
                    "lit=true,facing=north": 1,
                    "lit=true,facing=west": 2
            }
    }

## Constructor Details

### BlockStateProperty

public BlockStateProperty(Map<String,Double> variants)
Creates an instance of a `BlockStateProperty` record class.

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

## Method Details

### bake

public com.mojang.serialization.DataResult<StaticProperty.BakedStaticProperty> bake(net.minecraft.world.level.block.Block block)
Description copied from interface: `StaticProperty`
Returns DataResult success holding a state-to-double function if block is valid, error result otherwise.

Specified by:
  `bake` in interface `StaticProperty`
Parameters:
  `block` - Block this StaticProperty is associated with.
Returns:
  DataResult success holding a state-to-double function if block is valid, error result otherwise

### codec

public com.mojang.serialization.MapCodec<? extends StaticProperty> codec()
Description copied from interface: `StaticProperty`
Returns Codec registered to `ExMachinaRegistries.STATIC_PROPERTY_TYPE`..

Specified by:
  `codec` in interface `StaticProperty`
Returns:
  Codec registered to `ExMachinaRegistries.STATIC_PROPERTY_TYPE`.

### 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<String,Double> variants()
Returns the value of the `variants` record component.

Returns:
  the value of the `variants` record component