Cardinal Components API

Cardinal Components API

21M Downloads

[1.18] Ticking block component isn't ticking

slava110 opened this issue ยท 2 comments

commented

I'm not sure why but ticking block component isn't ticking. At least on vanilla blocks

Registration

override fun registerBlockComponentFactories(registry: BlockComponentFactoryRegistry) {
    registry.beginRegistration(BaseContainerBlockEntity::class.java, MANUFACTORY_ENVIRONMENT)
        .filter { cl -> Container::class.java.isAssignableFrom(cl) }
        .end { blockEntity ->
            if(blockEntity is Container) {
                println("Adding environment to: ${ blockEntity::class }")
                BlockEntityInventoryEnvironment(blockEntity)
            }
            else
                throw IllegalArgumentException("Expected Container BlockEntity!")
        }
}

Component interface

interface InventoryEnvironment: ComponentV3, ClientTickingComponent, ServerTickingComponent {
    val size: Int

    fun getItem(index: Int): ItemStack

    fun setItem(index: Int, stack: ItemStack)
}

Tried adding impl but doesn't work too

commented

Apologies for the delay - may I get a link to your repository in order to better understand the context ?

commented

Update: nevermind, there was a bug ! Thanks for the report.