30 lines
507 B
Kotlin
30 lines
507 B
Kotlin
package net.shadowfacts.asmr.program
|
|
|
|
import net.minecraft.util.Identifier
|
|
|
|
/**
|
|
* @author shadowfacts
|
|
*/
|
|
class ProgramBlockInput<Type: Any>(
|
|
val identifier: Identifier,
|
|
val type: ProgramType<Type>,
|
|
val block: ProgramBlock,
|
|
source: ProgramBlockOutput<Type>? = null
|
|
) {
|
|
|
|
var source: ProgramBlockOutput<Type>? = source
|
|
internal set
|
|
|
|
val value: Type?
|
|
get() = source?.value
|
|
|
|
fun link(from: ProgramBlockOutput<Type>) {
|
|
from.link(to = this)
|
|
}
|
|
|
|
fun unlink() {
|
|
source?.unlink(to = this)
|
|
}
|
|
|
|
}
|