I am trying to create a class AbstractMachineBlock that extends HorizontalFacingBlock and implements BlockEntityProvider. I have based my code off of a Kotlin port of the Fabric tutorial on directional blocks, and the code compiles, but on runtime crashes with this crash report. The full code for AbstractMachineBlock.kt is located here.
That’s a very sneaky crash report!
This is happening because you’re copying the block settings of a blast furnace for your blocks extending this block. This is an issue because said block settings define a luminance function, which takes as input a block state and as output an integer between
The issue is this method here, for the blast furnace, uses the
lit property from its block state.
When you instanciate a new block it will create various caches of values, which it does for the luminance: it generates every value of luminance possible for every block states. Except the function being defined as
state.get(Properties.LIT) ? 15 : 0 causes an issue: it request the
lit property which does not exist on any of your blocks: thus it crashes.
Oh, huh, I chose that randomly because I thought “a blast furnace is kinda like a machine, right?” And yeah, I can confirm that replacing
QuiltBlockSettings.of(Material.METAL) did fix the problem.