Kotlin for Forge

Kotlin for Forge

73M Downloads

Exception registering block with KDeferredRegister

michele-grifa opened this issue ยท 6 comments

commented

Hi,
i downloaded the new 1.4.0 version of the library and in the SkeletonRepository i noticed the KDeferredRegister use, but when i try to convert my existing blocks to delegates, it show me the error:

kotlin.UninitializedPropertyAccessException: lateinit property value has not been initialized

From what I understand, the slab that refers to the planks, is initialized before the planks themselves.
The library don't register automatically the planks blocks the first time i request it?

Thanks

val blocks = KDeferredRegister(ForgeRegistries.BLOCKS, MoreStuffMod.MODID)

    val japCherryPlanks by blocks.register("jap_cherry_planks") {
        Block(AbstractBlock.Properties.create(Material.WOOD, MaterialColor.WOOD).hardnessAndResistance(2.0f, 3.0f).sound(SoundType.WOOD))
    }

val japCherrySlab by blocks.register("jap_cherry_slab") { SlabBlock(AbstractBlock.Properties.from(japCherryPlanks)) }
commented

I'll look into it

commented

Found the issue, I was using the wrong Map

commented

When I can get the new version? Or I have to compile myself?

commented

I just put it out. It should show up in the maven repo.

commented

CurseForge is still approving it

commented

Thanks