Package commoble.exmachina.engine.internal.circuit

# Class LevelCircuitManager

java.lang.Object
net.minecraft.world.level.saveddata.SavedData
commoble.exmachina.engine.internal.circuit.LevelCircuitManager

All Implemented Interfaces:
  `CircuitManager`

public class LevelCircuitManager extends net.minecraft.world.level.saveddata.SavedData implements CircuitManager

## Field Summary

Fields
Modifier and Type
Field
Description
`static final String`
`ID`

## Constructor Summary

Constructors
Constructor
Description
`LevelCircuitManager(net.minecraft.server.level.ServerLevel level)`

## Method Summary

Modifier and Type
Method
Description
`Circuit`
`getCircuit(net.minecraft.core.BlockPos pos)`
Get a circuit at a position.
`static LevelCircuitManager`
`getOrCreate(net.minecraft.server.level.ServerLevel level)`
`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 updatedPos)`
Notifies the circuit manager that a block at this position has updated.
`net.minecraft.nbt.CompoundTag`
`save(net.minecraft.nbt.CompoundTag tag)`

### Methods inherited from class net.minecraft.world.level.saveddata.SavedData

`isDirty, save, setDirty, setDirty`

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

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

## Field Details

### ID

public static final String ID

See Also:
  - Constant Field Values

## Constructor Details

### LevelCircuitManager

public LevelCircuitManager(net.minecraft.server.level.ServerLevel level)

## Method Details

### getOrCreate

public static LevelCircuitManager getOrCreate(net.minecraft.server.level.ServerLevel level)

### getCircuit

public Circuit getCircuit(net.minecraft.core.BlockPos pos)
Description copied from interface: `CircuitManager`
Get a circuit at a position.

Specified by:
  `getCircuit` in interface `CircuitManager`
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

public void onBlockUpdate(net.minecraft.world.level.block.state.BlockState newState, net.minecraft.core.BlockPos updatedPos)
Description copied from interface: `CircuitManager`
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.

Specified by:
  `onBlockUpdate` in interface `CircuitManager`

### invalidateCircuit

public void invalidateCircuit(net.minecraft.core.BlockPos pos)
Description copied from interface: `CircuitManager`
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.

Specified by:
  `invalidateCircuit` in interface `CircuitManager`
Parameters:
  `pos` - A position contained by the circuit that should be invalidated.

### save

public net.minecraft.nbt.CompoundTag save(net.minecraft.nbt.CompoundTag tag)

Specified by:
  `save` in class `net.minecraft.world.level.saveddata.SavedData`