Package commoble.exmachina.engine.internal.circuit

# Class CircuitImpl

java.lang.Object
commoble.exmachina.engine.internal.circuit.CircuitImpl

All Implemented Interfaces:
  `Circuit`

public class CircuitImpl extends Object implements Circuit

## Constructor Summary

Constructors
Constructor
Description
`CircuitImpl(net.minecraft.world.level.LevelAccessor level, double staticLoad, double staticSource, Map<net.minecraft.core.BlockPos,org.apache.commons.lang3.tuple.Pair<net.minecraft.world.level.block.state.BlockState,StateComponent>> components, List<DoubleSupplier> dynamicLoads, List<DoubleSupplier> dynamicSources)`

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

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

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### CircuitImpl

public CircuitImpl(net.minecraft.world.level.LevelAccessor level, double staticLoad, double staticSource, Map<net.minecraft.core.BlockPos,org.apache.commons.lang3.tuple.Pair<net.minecraft.world.level.block.state.BlockState,StateComponent>> components, List<DoubleSupplier> dynamicLoads, List<DoubleSupplier> dynamicSources)

## Method Details

### getPowerSuppliedTo

public double getPowerSuppliedTo(net.minecraft.core.BlockPos pos)
Description copied from interface: `Circuit`
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.

Specified by:
  `getPowerSuppliedTo` in interface `Circuit`
Returns:
  The power supplied to a position, or 0 if the circuit is invalid or does not exist at the given position

### getCurrent

public double getCurrent()
Description copied from interface: `Circuit`
Returns the current running through the circuit (in charge/second). Voltage across a block can be determined via voltage = power / current

Specified by:
  `getCurrent` in interface `Circuit`
Returns:
  The current through the circuit, or 0 if the circuit is invalid.

### markNeedingDynamicUpdate

public void markNeedingDynamicUpdate()
Description copied from interface: `Circuit`
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.

Specified by:
  `markNeedingDynamicUpdate` in interface `Circuit`

### components

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

Specified by:
  `components` in interface `Circuit`
Returns:
  the immutable map of blockpositions this circuit occupies and the states that existed there when the circuit was built

### isPresent

public boolean isPresent()
Description copied from interface: `Circuit`
Returns Whether this circuit has any valid components..

Specified by:
  `isPresent` in interface `Circuit`
Returns:
  Whether this circuit has any valid components.