Package net.commoble.exmachina.api

# Interface CircuitManager

All Known Implementing Classes:
  `LevelCircuitManager`

public interface CircuitManager
API for handling power graphs

## Method Summary

Modifier and Type
Method
Description
`static CircuitManager`
`get(net.minecraft.server.level.ServerLevel level)`
Gets the CircuitManager for a given ServerLevel
`Circuit`
`getCircuit(net.minecraft.core.BlockPos pos)`
Get a circuit at a position.
`void`
`invalidateCircuit(net.minecraft.core.BlockPos pos)`
Forcibly invalidate a circuit.
`void`
`onBlockUpdate(net.minecraft.world.level.block.state.BlockState newState, net.minecraft.core.BlockPos pos)`
Notifies the circuit manager that a block at this position has updated.

## Method Details

### get

static CircuitManager get(net.minecraft.server.level.ServerLevel level)
Gets the CircuitManager for a given ServerLevel

Parameters:
  `level` - ServerLevel to get the CircuitManager for
Returns:
  CircuitManager for that ServerLevel

### getCircuit

Circuit getCircuit(net.minecraft.core.BlockPos pos)
Get a circuit at a position.

Parameters:
  `pos` - A position in global world coordinates
Returns:
  Circuit at the position. Circuit#isPresent will return false if the block at that position is not part of a circuit. Circuits are not cacheable and should be requeried when needed.

### onBlockUpdate

void onBlockUpdate(net.minecraft.world.level.block.state.BlockState newState, net.minecraft.core.BlockPos pos)
Notifies the circuit manager that a block at this position has updated. Normal blockstate updates are handled by internal processes and mods generally shouldn't need to call this for those.

Parameters:
  `newState` - BlockState which is now at the given position
  `pos` - BlockPos where the update occurred

### invalidateCircuit

void invalidateCircuit(net.minecraft.core.BlockPos pos)
Forcibly invalidate a circuit. Use this when standard block updates are insufficient to cause a circuit revalidation. Call this when you have a circuit component block whose connectable positions change but the blockstate does not change (due to the positions being stored in a TileEntity or elsewhere). Failing to do so may cause circuits to not properly update. This will crash if you call it while iterating over the circuit's component map.

Parameters:
  `pos` - A position contained by the circuit that should be invalidated.