fix parent bug in ResourceLocationRegistry

This commit is contained in:
Bixilon 2021-11-28 15:59:15 +01:00
parent 4c94ae5ffb
commit 6ab220d2a6
No known key found for this signature in database
GPG Key ID: 5CAD791931B09AC4

View File

@ -26,17 +26,17 @@ class ResourceLocationRegistry(
valueIdMap.clear()
}
override fun get(any: Any?): ResourceLocation? {
override operator fun get(any: Any?): ResourceLocation? {
check(any is Int) { "Don't know how to get $any" }
return idValueMap[any]
return this[any]
}
override fun get(id: Int): ResourceLocation? {
return idValueMap[id]
override operator fun get(id: Int): ResourceLocation? {
return idValueMap[id] ?: parent?.get(id)
}
override fun getId(value: ResourceLocation): Int {
return valueIdMap[value] ?: -1
return valueIdMap[value] ?: parent?.getId(value) ?: -1
}
fun initialize(data: Map<ResourceLocation, Any>?, alternative: ResourceLocationRegistry? = null): ResourceLocationRegistry {