mirror of
https://gitlab.bixilon.de/bixilon/minosoft.git
synced 2025-09-17 03:15:35 -04:00
pixlyzer: don't crash when block entity is not implemented
This commit is contained in:
parent
93a5c3a48d
commit
ec8dbbdcb4
@ -25,14 +25,14 @@ import de.bixilon.minosoft.protocol.network.connection.play.PlayConnection
|
||||
import kotlin.reflect.jvm.javaField
|
||||
|
||||
abstract class PixLyzerBlockWithEntity<T : BlockEntity>(resourceLocation: ResourceLocation, registries: Registries, data: Map<String, Any>) : PixLyzerBlock(resourceLocation, registries, data), BlockWithEntity<BlockEntity> {
|
||||
private val blockEntity: BlockEntityType<BlockEntity> = unsafeNull()
|
||||
private val blockEntity: BlockEntityType<BlockEntity>? = unsafeNull()
|
||||
|
||||
init {
|
||||
FACTORY_FIELD.inject<RegistryItem>(this)
|
||||
}
|
||||
|
||||
|
||||
override fun createBlockEntity(connection: PlayConnection) = blockEntity.factory.build(connection)
|
||||
override fun createBlockEntity(connection: PlayConnection) = blockEntity?.factory?.build(connection)
|
||||
|
||||
private companion object {
|
||||
val FACTORY_FIELD = PixLyzerBlockWithEntity<*>::blockEntity.javaField!!
|
||||
|
Loading…
x
Reference in New Issue
Block a user