Conversation
FalseHonesty
left a comment
There was a problem hiding this comment.
I have suggested a few changes to make this line up more with the goal and design of the project currently. However, I must ask, what is the goal of this ResourceManager? What is its use case?
| ) | ||
| private val logger: Logger = LogManager.getLogger() | ||
| private val runningServices = ServiceRegistry() | ||
| private val resourceManager = ResourceManager() |
There was a problem hiding this comment.
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.
|
|
||
| class ResourceManager : HashMap<String, ResourceLocation>() { | ||
| fun get(k: String, def: ResourceLocation?) : ResourceLocation { | ||
| return computeIfAbsent(k){ def!! } |
There was a problem hiding this comment.
What is the point of this function? Why would the user not just call computeIfAbsent directly if thats what the situation calls for?
|
|
||
| import net.minecraft.util.ResourceLocation | ||
|
|
||
| class ResourceManager : HashMap<String, ResourceLocation>() { |
There was a problem hiding this comment.
Rather than make this extend HashMap, you could make this a service that is backed by a hashmap and has proxy methods to access the backing map.
There was a problem hiding this comment.
In fact, you could also make it implement just the base Map interface which would make it compatible with some Kotlin extension functions as well as outline what methods you should have.
Description
Added resource manager
Type of change
Please delete options that are not relevant.
Checklist: