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