34 lines
758 B
Kotlin
34 lines
758 B
Kotlin
package net.shadowfacts.asmr.program
|
|
|
|
import net.minecraft.util.Identifier
|
|
import net.minecraft.util.Language
|
|
|
|
/**
|
|
* @author shadowfacts
|
|
*/
|
|
class ProgramBlockOutput<Type: Any>(
|
|
val identifier: Identifier,
|
|
val type: ProgramType<Type>,
|
|
val block: ProgramBlock
|
|
) {
|
|
|
|
lateinit var value: Type
|
|
|
|
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)
|
|
}
|
|
|
|
fun translateName(): String {
|
|
return Language.getInstance().translate("programblock.param.${identifier.namespace}.${identifier.path}")
|
|
}
|
|
|
|
} |