Pattern panel now properly react to removed replication tasks
This commit is contained in:
parent
c6ded6b134
commit
d1978d7e04
@ -191,7 +191,7 @@ class MatterPanelBlockEntity(p_155229_: BlockPos, p_155230_: BlockState) :
|
||||
val task = _tasks[id] ?: return
|
||||
_tasks.remove(id)
|
||||
|
||||
(matterNode.graph as MatterGraph?)?.onMatterTaskRemoved(task)
|
||||
matterNode.graph.onMatterTaskRemoved(task)
|
||||
|
||||
listeners.forEach { it.taskRemoved(task) }
|
||||
setChanged()
|
||||
@ -201,7 +201,7 @@ class MatterPanelBlockEntity(p_155229_: BlockPos, p_155230_: BlockState) :
|
||||
val task = ReplicationTask(UUID.randomUUID(), state.id, state.item, 0, 0, count)
|
||||
_tasks[task.id] = task
|
||||
|
||||
(matterNode.graph as MatterGraph?)?.onMatterTaskCreated(task)
|
||||
matterNode.graph.onMatterTaskCreated(task)
|
||||
|
||||
listeners.forEach { it.taskUpdated(task) }
|
||||
setChanged()
|
||||
|
@ -266,7 +266,19 @@ class MatterPanelMenu @JvmOverloads constructor(
|
||||
|
||||
fun networkTasksRemoved(tasks: Collection<IReplicationTask<*>>) {
|
||||
for (task in tasks) {
|
||||
this.tasks.remove(task)
|
||||
val index = this.tasks.indexOfFirst(task::matchId)
|
||||
|
||||
if (index != -1) {
|
||||
this.tasks.removeAt(index)
|
||||
|
||||
if (filter.test(task.item)) {
|
||||
val index = this.tasksFiltered.indexOfFirst(task::matchId)
|
||||
|
||||
if (index != -1) {
|
||||
this.tasksFiltered.removeAt(index)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user