Package commoble.exmachina.engine.api

# Record Class CircuitComponent

java.lang.Object
java.lang.Record
commoble.exmachina.engine.api.CircuitComponent

Record Components:
  `connector` - Connector interface to determine which blocks a block in the world can connect to
  `staticLoad` - StaticProperty designating the load for each of the block's blockstates
  `staticSource` - StaticProperty designating the power source quantity of each of the block's blockstates
  `dynamicLoad` - DynamicProperty designating the dynamic (worldpos-sensitive) load of the block
  `dynamicSource` - DynamicProperty designating the dynamic (worldpos-sensitive) source from the block

public record CircuitComponent(@NotNull Connector connector, @NotNull StaticProperty staticLoad, @NotNull StaticProperty staticSource, @NotNull DynamicProperty dynamicLoad, @NotNull DynamicProperty dynamicSource) extends Record
CircuitComponents represent the circuit properties associated with particular Blocks. Each block has at most one CircuitComponent loaded for it, from the exmachina/circuit_components data folder. A circuit component can be loaded for a block by having a circuit component json with the same id as an existing block.

    {
            "connector": {}, // connector object, defaults to an invalid component if not present
            "static_load": 1.0, // double or static property object, defaults to 0 if not present
            "static_source": 1.0, // double or static property object, defaults to 0 if not present
            "dynamic_load": {}, // dynamic property object, optional
            "dynamic_source": {}, // dynamic property object, optional
    }

Datapacks can "disable" components by overriding a component json with an empty root object {}.

## Field Summary

Fields
Modifier and Type
Field
Description
`static final com.mojang.serialization.Codec<CircuitComponent>`
`CODEC`

## Constructor Summary

Constructors
Constructor
Description
`CircuitComponent(@NotNull Connector connector, @NotNull StaticProperty staticLoad, @NotNull StaticProperty staticSource, @NotNull DynamicProperty dynamicLoad, @NotNull DynamicProperty dynamicSource)`
Creates an instance of a `CircuitComponent` record class.

## Method Summary

Modifier and Type
Method
Description
`@NotNull Connector`
`connector()`
Returns the value of the `connector` record component.
`@NotNull DynamicProperty`
`dynamicLoad()`
Returns the value of the `dynamicLoad` record component.
`@NotNull DynamicProperty`
`dynamicSource()`
Returns the value of the `dynamicSource` record component.
`CircuitComponent`
`empty()`
Returns CircuitComponent representing empty/invalid components (equivalent to air blocks/items).
`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 component..
`@NotNull StaticProperty`
`staticLoad()`
Returns the value of the `staticLoad` record component.
`@NotNull StaticProperty`
`staticSource()`
Returns the value of the `staticSource` record component.
`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`

## Field Details

### CODEC

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

## Constructor Details

### CircuitComponent

public CircuitComponent(@NotNull @NotNull Connector connector, @NotNull @NotNull StaticProperty staticLoad, @NotNull @NotNull StaticProperty staticSource, @NotNull @NotNull DynamicProperty dynamicLoad, @NotNull @NotNull DynamicProperty dynamicSource)
Creates an instance of a `CircuitComponent` record class.

Parameters:
  `connector` - the value for the `connector` record component
  `staticLoad` - the value for the `staticLoad` record component
  `staticSource` - the value for the `staticSource` record component
  `dynamicLoad` - the value for the `dynamicLoad` record component
  `dynamicSource` - the value for the `dynamicSource` record component

## Method Details

### empty

public CircuitComponent empty()
Returns CircuitComponent representing empty/invalid components (equivalent to air blocks/items).

Returns:
  CircuitComponent representing empty/invalid components (equivalent to air blocks/items)

### isPresent

public boolean isPresent()
Returns Whether this is a valid component..

Returns:
  Whether this is a valid component.

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

### connector

@NotNull public @NotNull Connector connector()
Returns the value of the `connector` record component.

Returns:
  the value of the `connector` record component

### staticLoad

@NotNull public @NotNull StaticProperty staticLoad()
Returns the value of the `staticLoad` record component.

Returns:
  the value of the `staticLoad` record component

### staticSource

@NotNull public @NotNull StaticProperty staticSource()
Returns the value of the `staticSource` record component.

Returns:
  the value of the `staticSource` record component

### dynamicLoad

@NotNull public @NotNull DynamicProperty dynamicLoad()
Returns the value of the `dynamicLoad` record component.

Returns:
  the value of the `dynamicLoad` record component

### dynamicSource

@NotNull public @NotNull DynamicProperty dynamicSource()
Returns the value of the `dynamicSource` record component.

Returns:
  the value of the `dynamicSource` record component