thedarkcolour / KotlinForForge

Makes Kotlin forge-friendly.
GNU Lesser General Public License v2.1
193 stars 26 forks source link

Exception registering block with KDeferredRegister #4

Closed michele-grifa closed 4 years ago

michele-grifa commented 4 years ago

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)) }
thedarkcolour commented 4 years ago

I'll look into it

thedarkcolour commented 4 years ago

Found the issue, I was using the wrong Map

michele-grifa commented 4 years ago

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

thedarkcolour commented 4 years ago

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

thedarkcolour commented 4 years ago

CurseForge is still approving it

michele-grifa commented 4 years ago

Thanks