diff options
author | Linnea Gräf <nea@nea.moe> | 2024-11-03 01:24:24 +0100 |
---|---|---|
committer | Linnea Gräf <nea@nea.moe> | 2024-11-03 01:24:24 +0100 |
commit | e2677d6ee5c3f74d5f547ca48bf6641f047a2a1e (patch) | |
tree | fecc0322e48a399df7697da11adfb022d5641a6c /src/main/kotlin/events/FinalizeResourceManagerEvent.kt | |
parent | 646843ba3b960ac48f9866b3640438d3cc1dafc4 (diff) | |
download | Firmament-e2677d6ee5c3f74d5f547ca48bf6641f047a2a1e.tar.gz Firmament-e2677d6ee5c3f74d5f547ca48bf6641f047a2a1e.tar.bz2 Firmament-e2677d6ee5c3f74d5f547ca48bf6641f047a2a1e.zip |
1.21.3 WIP
Diffstat (limited to 'src/main/kotlin/events/FinalizeResourceManagerEvent.kt')
-rw-r--r-- | src/main/kotlin/events/FinalizeResourceManagerEvent.kt | 41 |
1 files changed, 19 insertions, 22 deletions
diff --git a/src/main/kotlin/events/FinalizeResourceManagerEvent.kt b/src/main/kotlin/events/FinalizeResourceManagerEvent.kt index 0d411f1..12167f8 100644 --- a/src/main/kotlin/events/FinalizeResourceManagerEvent.kt +++ b/src/main/kotlin/events/FinalizeResourceManagerEvent.kt @@ -5,31 +5,28 @@ import java.util.concurrent.Executor import net.minecraft.resource.ReloadableResourceManagerImpl import net.minecraft.resource.ResourceManager import net.minecraft.resource.ResourceReloader -import net.minecraft.util.profiler.Profiler data class FinalizeResourceManagerEvent( - val resourceManager: ReloadableResourceManagerImpl, + val resourceManager: ReloadableResourceManagerImpl, ) : FirmamentEvent() { - companion object : FirmamentEventBus<FinalizeResourceManagerEvent>() + companion object : FirmamentEventBus<FinalizeResourceManagerEvent>() - inline fun registerOnApply(name: String, crossinline function: () -> Unit) { - resourceManager.registerReloader(object : ResourceReloader { - override fun reload( - synchronizer: ResourceReloader.Synchronizer, - manager: ResourceManager?, - prepareProfiler: Profiler?, - applyProfiler: Profiler?, - prepareExecutor: Executor?, - applyExecutor: Executor - ): CompletableFuture<Void> { - return CompletableFuture.completedFuture(Unit) - .thenCompose(synchronizer::whenPrepared) - .thenAcceptAsync({ function() }, applyExecutor) - } + inline fun registerOnApply(name: String, crossinline function: () -> Unit) { + resourceManager.registerReloader(object : ResourceReloader { + override fun reload( + synchronizer: ResourceReloader.Synchronizer, + manager: ResourceManager, + prepareExecutor: Executor, + applyExecutor: Executor + ): CompletableFuture<Void> { + return CompletableFuture.completedFuture(Unit) + .thenCompose(synchronizer::whenPrepared) + .thenAcceptAsync({ function() }, applyExecutor) + } - override fun getName(): String { - return name - } - }) - } + override fun getName(): String { + return name + } + }) + } } |