lateinit property value has not been initialized when registering item
joshop opened this issue ยท 2 comments
I have very little experience with Kotlin for Forge or Forge in general, but I'm currently attempting to make an item with custom behavior by creating an object which inherits from Item(Properties())
or whatever properties I want and then declaring, for instance, onitemRightClick
. The file containing the item:
package rous.roustestmod.item
import net.minecraft.item.Item
object TestItem : Item(Properties()) {
// implementing methods here
}
but when I try to register it (in the same way done in the modding skeleton):
val TESTITEM by REGISTRY.registerObject("test_item") {
TestItem
}
it gives me lateinit property value has not been initialized
. What am I doing wrong - is this even the intended way to register new items?
You're using an object, which cannot be initialized. You need to use a normal class.