Why aren’t my events running?
Initializer is the main Mod singleton object that should instantiate everything.
Event Bussin is the object that runs a quick test to ensure that the function
onBlockPlaced works, within onBlockPlaced it should run getNBTForPlacedBlock. But when we place blocks nothing shows up in the logs on curseforge. Whether or not the block has NBT data or is just like a dirt block.
Any ideas?
@Mod(Initializer.MOD_ID)
object Initializer {
const val MOD_ID = "nbt_to_vs"
private val bus = EventBussin
private val LOGGER: Logger = LoggerFactory.getLogger(MOD_ID)
init {
LOGGER.info("The Mod Works Tim")
LOGGER.info("The rest of the tests will follow")
bus
}
}
@Mod.EventBusSubscriber(modid = Initializer.MOD_ID, bus = Mod.EventBusSubscriber.Bus.FORGE)
object EventBussin {
private val dataExtract = DataExtract()
private val LOGGER: Logger = LoggerFactory.getLogger("nbt_to_vs")
@SubscribeEvent
@JvmStatic
fun onBlockPlaced(event: BlockEvent.EntityPlaceEvent) {
val world = event.level as Level
val pos = event.pos
val nbtData = dataExtract.getNBTForPlacedBlock(world, pos)
if (nbtData != null) {
LOGGER.info("NBT Data at $pos: $nbtData")
} else {
LOGGER.info("No NBT data found at $pos")
}
}
}