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-10 23:21:26 +00:00
|
|
|
import net.minecraft.util.Language
|
2019-08-10 02:39:01 +00:00
|
|
|
|
2019-08-09 01:44:59 +00:00
|
|
|
/**
|
|
|
|
* @author shadowfacts
|
|
|
|
*/
|
|
|
|
class ProgramBlockInput<Type: Any>(
|
2019-08-10 02:39:01 +00:00
|
|
|
val identifier: Identifier,
|
2019-08-09 01:44:59 +00:00
|
|
|
val type: ProgramType<Type>,
|
2019-08-09 19:23:48 +00:00
|
|
|
val block: ProgramBlock,
|
2019-08-10 04:03:25 +00:00
|
|
|
source: ProgramBlockOutput<Type>? = null
|
2019-08-09 01:44:59 +00:00
|
|
|
) {
|
|
|
|
|
2019-08-10 04:03:25 +00:00
|
|
|
var source: ProgramBlockOutput<Type>? = source
|
|
|
|
internal set
|
|
|
|
|
2019-08-09 01:44:59 +00:00
|
|
|
val value: Type?
|
|
|
|
get() = source?.value
|
|
|
|
|
2019-08-10 04:03:25 +00:00
|
|
|
fun link(from: ProgramBlockOutput<Type>) {
|
|
|
|
from.link(to = this)
|
|
|
|
}
|
|
|
|
|
|
|
|
fun unlink() {
|
|
|
|
source?.unlink(to = this)
|
|
|
|
}
|
|
|
|
|
2019-08-10 23:21:26 +00:00
|
|
|
fun translateName(): String {
|
|
|
|
return Language.getInstance().translate("programblock.param.${identifier.namespace}.${identifier.path}")
|
|
|
|
}
|
|
|
|
|
2019-08-09 01:44:59 +00:00
|
|
|
}
|