Fix soft deadlock in storage interfaces
This commit is contained in:
parent
a36e47c629
commit
59689011a1
@ -36,6 +36,7 @@ import ru.dbotthepony.mc.otm.graph.storage.BasicStorageGraphNode
|
||||
import ru.dbotthepony.mc.otm.graph.storage.StorageNetworkGraph
|
||||
import ru.dbotthepony.mc.otm.menu.storage.StorageExporterMenu
|
||||
import ru.dbotthepony.mc.otm.menu.storage.StorageImporterMenu
|
||||
import ru.dbotthepony.mc.otm.once
|
||||
import ru.dbotthepony.mc.otm.registry.MBlockEntities
|
||||
import ru.dbotthepony.mc.otm.registry.MNames
|
||||
import ru.dbotthepony.mc.otm.storage.IStorageEventConsumer
|
||||
@ -63,17 +64,25 @@ abstract class AbstractStorageImportExport<T>(
|
||||
|
||||
val cell: BasicStorageGraphNode = object : BasicStorageGraphNode(energy), GraphNodeListener {
|
||||
override fun onNeighbour(node: Graph6Node<*>, direction: Direction) {
|
||||
val newState = this@AbstractStorageImportExport.blockState.setValue(CableBlock.MAPPING_CONNECTION_PROP[direction]!!, true)
|
||||
level?.once {
|
||||
if (!isRemoved) {
|
||||
val newState = this@AbstractStorageImportExport.blockState.setValue(CableBlock.MAPPING_CONNECTION_PROP[direction]!!, true)
|
||||
|
||||
if (newState !== this@AbstractStorageImportExport.blockState && SERVER_IS_LIVE)
|
||||
level?.setBlock(blockPos, newState, Block.UPDATE_CLIENTS)
|
||||
if (newState !== this@AbstractStorageImportExport.blockState && SERVER_IS_LIVE)
|
||||
level?.setBlock(blockPos, newState, Block.UPDATE_CLIENTS)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onUnNeighbour(node: Graph6Node<*>, direction: Direction) {
|
||||
val newState = this@AbstractStorageImportExport.blockState.setValue(CableBlock.MAPPING_CONNECTION_PROP[direction]!!, false)
|
||||
level?.once {
|
||||
if (!isRemoved) {
|
||||
val newState = this@AbstractStorageImportExport.blockState.setValue(CableBlock.MAPPING_CONNECTION_PROP[direction]!!, false)
|
||||
|
||||
if (newState !== this@AbstractStorageImportExport.blockState && SERVER_IS_LIVE)
|
||||
level?.setBlock(blockPos, newState, Block.UPDATE_CLIENTS)
|
||||
if (newState !== this@AbstractStorageImportExport.blockState && SERVER_IS_LIVE)
|
||||
level?.setBlock(blockPos, newState, Block.UPDATE_CLIENTS)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user