Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/main/kotlin/cc/hyperium/Hyperium.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package cc.hyperium
import cc.hyperium.network.NetworkManager
import cc.hyperium.processes.services.AbstractService
import cc.hyperium.processes.services.ServiceRegistry
import cc.hyperium.utils.ResourceManager
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.launch
import kotlinx.coroutines.runBlocking
Expand Down Expand Up @@ -35,6 +36,7 @@ object Hyperium {
)
private val logger: Logger = LogManager.getLogger()
private val runningServices = ServiceRegistry()
private val resourceManager = ResourceManager()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't really want to just have a bunch of fields in our Hyperium object, that gets weird and unruly very fast. I would prefer to make this provided through kodein as a singleton. Or, if you are going to make ResourceManager a service as I suggested below, it will automatically be accessible through Kodein.

private val config = ConfigFactory.createFileConfig("config-test.json", "json")
private lateinit var network: NetworkManager

Expand Down
9 changes: 9 additions & 0 deletions src/main/kotlin/cc/hyperium/utils/ResourceManager.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package cc.hyperium.utils

import cc.hyperium.processes.services.AbstractService
import cc.hyperium.processes.services.Service
import net.minecraft.util.ResourceLocation
import org.kodein.di.Kodein

@Service
class ResourceManager(override val kodein: Kodein) : AbstractService(), MutableMap<String, ResourceLocation> by HashMap()