Package commoble.exmachina.engine.api.content

# Record Class DirectionsConnector

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

All Implemented Interfaces:
  `Connector`

public record DirectionsConnector(EnumSet<net.minecraft.core.Direction> directions) extends Record implements Connector
Connector type for a block that connects to a subset of its six neighbors.

    {
            "type": "exmachina:directions",
            "directions": ["north", "south", "east", "west"] // list of Directions
    }

## 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<DirectionsConnector>`
`CODEC`
`static final net.minecraft.resources.ResourceKey<com.mojang.serialization.Codec<? extends Connector>>`
`KEY`

## Constructor Summary

Constructors
Constructor
Description
`DirectionsConnector(EnumSet<net.minecraft.core.Direction> directions)`
Creates an instance of a `DirectionsConnector` 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`.
`Set<net.minecraft.core.BlockPos>`
`connect(net.minecraft.world.level.LevelReader level, net.minecraft.core.BlockPos pos)`
`EnumSet<net.minecraft.core.Direction>`
`directions()`
Returns the value of the `directions` 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`

### Methods inherited from interface commoble.exmachina.engine.api.Connector

`isPresent`

## 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<DirectionsConnector> CODEC

## Constructor Details

### DirectionsConnector

public DirectionsConnector(EnumSet<net.minecraft.core.Direction> directions)
Creates an instance of a `DirectionsConnector` record class.

Parameters:
  `directions` - the value for the `directions` 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

### connect

public Set<net.minecraft.core.BlockPos> connect(net.minecraft.world.level.LevelReader level, net.minecraft.core.BlockPos pos)

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

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

### directions

public EnumSet<net.minecraft.core.Direction> directions()
Returns the value of the `directions` record component.

Returns:
  the value of the `directions` record component