Package net.commoble.exmachina.api

# Interface Circuit

All Known Implementing Classes:
  `CircuitImpl`, `EmptyCircuit`

public interface Circuit
a Circuit represents a power graph of blocks. Power in the circuit is divided between its component blocks based on their voltage and resistance relative to the total voltage and resistance in the circuit (as if it were one big single resistive loop). Circuits can be retrieved via `CircuitManager.getCircuit(net.minecraft.core.BlockPos)`.

## Method Summary

Modifier and Type
Method
Description
`Map<net.minecraft.core.BlockPos,org.apache.commons.lang3.tuple.Pair<net.minecraft.world.level.block.state.BlockState,StateComponent>>`
`components()`
Returns the immutable map of blockpositions this circuit occupies and the states that existed there when the circuit was built.
`static Circuit`
`empty()`
Returns Empty/invalid circuit.
`double`
`getCurrent()`
Returns the current running through the circuit (in charge/second).
`double`
`getPowerSuppliedTo(net.minecraft.core.BlockPos pos)`
Returns the power in energy/second this Circuit is supplying to a given position.
`boolean`
`isPresent()`
Returns Whether this circuit has any valid components..
`void`
`markNeedingDynamicUpdate()`
Mark a circuit as needing to read data from its dynamic components.

## Method Details

### empty

static Circuit empty()
Returns Empty/invalid circuit.

Returns:
  Empty/invalid circuit

### getPowerSuppliedTo

double getPowerSuppliedTo(net.minecraft.core.BlockPos pos)
Returns the power in energy/second this Circuit is supplying to a given position. This is positive for power consumers and negative for power sources. If a position is both consuming and supplying power, the returned value is positive if it is consuming more power than it is supplying.

Parameters:
  `pos` - BlockPos to get the power supply at
Returns:
  The power supplied to a position, or 0 if the circuit is invalid or does not exist at the given position

### getCurrent

double getCurrent()
Returns the current running through the circuit (in charge/second). Voltage across a block can be determined via voltage = power / current

Returns:
  The current through the circuit, or 0 if the circuit is invalid.

### markNeedingDynamicUpdate

void markNeedingDynamicUpdate()
Mark a circuit as needing to read data from its dynamic components. If your component block has a dynamic source or load, this should be called when the value updates to notify the circuit that it has to redo some math.

### isPresent

boolean isPresent()
Returns Whether this circuit has any valid components..

Returns:
  Whether this circuit has any valid components.

### components

Map<net.minecraft.core.BlockPos,org.apache.commons.lang3.tuple.Pair<net.minecraft.world.level.block.state.BlockState,StateComponent>> components()
Returns the immutable map of blockpositions this circuit occupies and the states that existed there when the circuit was built.

Returns:
  the immutable map of blockpositions this circuit occupies and the states that existed there when the circuit was built