Package commoble.exmachina.engine.api.content

# Record Class UnionConnector

java.lang.Object
java.lang.Record
commoble.exmachina.engine.api.content.UnionConnector

All Implemented Interfaces:
  `Connector`

public record UnionConnector(List<Connector> values) extends Record implements Connector
Connector providing the union of the position sets of a list of subconnectors.

    {
            "type": "exmachina:union",
            "values":
            [
                    {
                            // another connector object
                    },
                    {
                            // another connector object
                    },
            // etc
            ]
    }

"values" must have at least one non-empty connector or baking will fail. Use exmachina:none to represent an empty connector instead.

## Nested Class Summary

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

`Connector.BlockConnector, Connector.StateConnector`

## Field Summary

Fields
Modifier and Type
Field
Description
`static final com.mojang.serialization.Codec<UnionConnector>`
`CODEC`
`static final net.minecraft.resources.ResourceKey<com.mojang.serialization.Codec<? extends Connector>>`
`KEY`

## Constructor Summary

Constructors
Constructor
Description
`UnionConnector(List<Connector> values)`
Creates an instance of a `UnionConnector` 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.Codec<? 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.
`boolean`
`isPresent()`
Returns whether this is a valid Connector.
`final String`
`toString()`
Returns a string representation of this record class.
`List<Connector>`
`values()`
Returns the value of the `values` record component.

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

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

## Field Details

### KEY

public static final net.minecraft.resources.ResourceKey<com.mojang.serialization.Codec<? extends Connector>> KEY

### CODEC

public static final com.mojang.serialization.Codec<UnionConnector> CODEC

## Constructor Details

### UnionConnector

public UnionConnector(List<Connector> values)
Creates an instance of a `UnionConnector` record class.

Parameters:
  `values` - the value for the `values` 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.Codec<? 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`

### isPresent

public boolean isPresent()
Description copied from interface: `Connector`
Returns whether this is a valid Connector. If false, will be ignored by the graph builder. Consider using `CircuitComponent.empty()` instead of overriding.

Specified by:
  `isPresent` in interface `Connector`
Returns:
  Whether the component can be part of a circuit.

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

### values

public List<Connector> values()
Returns the value of the `values` record component.

Returns:
  the value of the `values` record component