2019-08-09 01:44:59 +00:00
|
|
|
package net.shadowfacts.asmr.program
|
|
|
|
|
2019-08-10 02:39:01 +00:00
|
|
|
import net.minecraft.util.Identifier
|
|
|
|
|
2019-08-09 01:44:59 +00:00
|
|
|
/**
|
|
|
|
* @author shadowfacts
|
|
|
|
*/
|
|
|
|
class ProgramBlockOutput<Type: Any>(
|
2019-08-10 02:39:01 +00:00
|
|
|
val identifier: Identifier,
|
2019-08-09 19:23:48 +00:00
|
|
|
val type: ProgramType<Type>,
|
|
|
|
val block: ProgramBlock
|
2019-08-09 01:44:59 +00:00
|
|
|
) {
|
|
|
|
|
|
|
|
lateinit var value: Type
|
|
|
|
|
2019-08-10 04:03:25 +00:00
|
|
|
private val _destinations = mutableListOf<ProgramBlockInput<Type>>()
|
|
|
|
val destinations: List<ProgramBlockInput<Type>> = _destinations
|
|
|
|
|
|
|
|
fun link(to: ProgramBlockInput<Type>) {
|
|
|
|
to.source = this
|
|
|
|
_destinations.add(to)
|
|
|
|
}
|
|
|
|
|
|
|
|
fun unlink(to: ProgramBlockInput<Type>) {
|
|
|
|
to.source = null
|
|
|
|
_destinations.remove(to)
|
|
|
|
}
|
|
|
|
|
2019-08-09 01:44:59 +00:00
|
|
|
}
|