Package net.commoble.exmachina.api.content

# Record Class BlockStateConnector

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

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

All Implemented Interfaces:
  `Connector`

public record BlockStateConnector(Map<String,EnumSet<net.minecraft.core.Direction>> variants) extends Record implements Connector
Connector for a block whose connections depend on blockstate properties. Blockstates are designated similarly to variant blockstate jsons. e.g. for a furnace block that only connects on one side:

    {
            "type": "exmachina:blockstate",
            "variants": {
                    "facing=north": ["north", "up"],
                    "facing=south": ["south", "up"],
                    "facing=west": ["west", "up"],
                    "facing=east": ["east", "up"]
            }
    }

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

## Nested Class Summary

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

`Connector.BlockConnector, Connector.StateConnector`

## Field Summary

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

## Constructor Summary

Constructors
Constructor
Description
`BlockStateConnector(Map<String,EnumSet<net.minecraft.core.Direction>> variants)`
Creates an instance of a `BlockStateConnector` record class.

## Method Summary

Modifier and Type
Method
Description
`com.mojang.serialization.DataResult<Connector.BlockConnector>`
`bake(net.minecraft.world.level.block.Block block)`
Bakes a BakedConnector function for the associated block.
`com.mojang.serialization.MapCodec<? extends Connector>`
`codec()`
Returns Codec registered to `ExMachinaRegistries.CONNECTOR_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,EnumSet<net.minecraft.core.Direction>>`
`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.Connector

`isPresent`

## Field Details

### KEY

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

### CODEC

public static final com.mojang.serialization.MapCodec<BlockStateConnector> CODEC
e.g. for a furnace block that only connects on one side:

    {
            "type": "exmachina:blockstate",
            "variants": {
                    "facing=north": ["north", "up"],
                    "facing=south": ["south", "up"],
                    "facing=west": ["west", "up"],
                    "facing=east": ["east", "up"]
            }
    }

## Constructor Details

### BlockStateConnector

public BlockStateConnector(Map<String,EnumSet<net.minecraft.core.Direction>> variants)
Creates an instance of a `BlockStateConnector` record class.

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

## Method Details

### bake

public com.mojang.serialization.DataResult<Connector.BlockConnector> bake(net.minecraft.world.level.block.Block block)
Description copied from interface: `Connector`
Bakes a BakedConnector function for the associated block. Caching and validation can be done.

Specified by:
  `bake` in interface `Connector`
Parameters:
  `block` - Block this connector is associated with
Returns:
  DataResult with success holding a BakedConnector if block is valid, error result otherwise

### codec

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

Specified by:
  `codec` in interface `Connector`
Returns:
  Codec registered to `ExMachinaRegistries.CONNECTOR_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,EnumSet<net.minecraft.core.Direction>> variants()
Returns the value of the `variants` record component.

Returns:
  the value of the `variants` record component