fix config crash when accessing isOpaqueCube() before postInit
This commit is contained in:
@@ -29,6 +29,7 @@ object BetterFoliageMod {
|
|||||||
|
|
||||||
lateinit var log: Logger
|
lateinit var log: Logger
|
||||||
var config: Configuration? = null
|
var config: Configuration? = null
|
||||||
|
var isAfterPostInit = false
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
@Mod.InstanceFactory
|
@Mod.InstanceFactory
|
||||||
@@ -47,6 +48,7 @@ object BetterFoliageMod {
|
|||||||
if (FMLCommonHandler.instance().effectiveSide == Side.CLIENT) {
|
if (FMLCommonHandler.instance().effectiveSide == Side.CLIENT) {
|
||||||
Config.attach(config!!)
|
Config.attach(config!!)
|
||||||
Client.log(INFO, "BetterFoliage initialized")
|
Client.log(INFO, "BetterFoliage initialized")
|
||||||
|
isAfterPostInit = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -32,8 +32,8 @@ fun doesSideBlockRenderingOverride(original: Boolean, blockAccess: IBlockAccess,
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun isOpaqueCubeOverride(original: Boolean, state: IBlockState): Boolean {
|
fun isOpaqueCubeOverride(original: Boolean, state: IBlockState): Boolean {
|
||||||
// caution: blocks are initialized and the method called before any mods are loaded
|
// caution: blocks are initialized and the method called during startup
|
||||||
if (BetterFoliageMod.config == null) return original
|
if (!BetterFoliageMod.isAfterPostInit) return original
|
||||||
return original && !(Config.enabled && Config.roundLogs.enabled && Config.blocks.logs.matchesID(state.block))
|
return original && !(Config.enabled && Config.roundLogs.enabled && Config.blocks.logs.matchesID(state.block))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user