Skip to content

Commit 3b30f99

Browse files
committed
add onRender callback for mod initialization
1 parent eb32f78 commit 3b30f99

File tree

3 files changed

+10
-7
lines changed

3 files changed

+10
-7
lines changed

common/src/main/kotlin/com/lambda/Lambda.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import net.minecraft.util.math.BlockPos
1919
import org.apache.logging.log4j.LogManager
2020
import org.apache.logging.log4j.Logger
2121
import java.awt.Color
22+
import java.lang.Thread.sleep
2223
import java.util.*
2324

2425

@@ -46,9 +47,10 @@ object Lambda {
4647
.registerTypeAdapter(Optional::class.java, OptionalSerializer)
4748
.create()
4849

49-
fun initialize() {
50+
fun initialize(onRender: () -> Unit = {}) {
5051
recordRenderCall {
5152
Loader.initialize()
53+
onRender()
5254
}
5355
}
5456
}

fabric/src/main/kotlin/com/lambda/fabric/LambdaFabric.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ import net.minecraft.registry.Registries
1010

1111
object LambdaFabric : ClientModInitializer {
1212
override fun onInitializeClient() {
13-
Lambda.initialize()
14-
LOG.info("$MOD_NAME Fabric $VERSION initialized.")
15-
16-
Registries.REGISTRIES.forEach(AgnosticRegistries::dump)
13+
Lambda.initialize {
14+
Registries.REGISTRIES.forEach(AgnosticRegistries::dump)
15+
LOG.info("$MOD_NAME Fabric $VERSION initialized.")
16+
}
1717
}
1818
}

forge/src/main/kotlin/com/lambda/forge/LambdaForge.kt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,9 @@ import thedarkcolour.kotlinforforge.forge.MOD_BUS
2222
object LambdaForge {
2323
@SubscribeEvent
2424
fun onClient(event: FMLClientSetupEvent) {
25-
Lambda.initialize()
26-
LOG.info("$MOD_NAME Forge $VERSION initialized.")
25+
Lambda.initialize {
26+
LOG.info("$MOD_NAME Forge $VERSION initialized.")
27+
}
2728
}
2829

2930
// Forge forces the user to user their event in order to interact with registries.

0 commit comments

Comments
 (0)