mirror of
https://gitlab.bixilon.de/bixilon/minosoft.git
synced 2025-09-18 03:44:54 -04:00
registries: fix block entity type mappings
This commit is contained in:
parent
6ab96cfcd6
commit
2ae7c2575c
@ -30,6 +30,13 @@ class BlockEntityTypeRegistry(
|
||||
return blockTypeMap[block] ?: parentRegistry?.get(block)
|
||||
}
|
||||
|
||||
override fun get(any: Any?): BlockEntityType<*>? {
|
||||
if (any is Block) {
|
||||
return get(any)
|
||||
}
|
||||
return super.get(any)
|
||||
}
|
||||
|
||||
override fun initialize(data: Map<ResourceLocation, Any>?, registries: Registries?, deserializer: ResourceLocationDeserializer<BlockEntityType<*>>?, flattened: Boolean, metaType: MetaTypes, alternative: AbstractRegistry<BlockEntityType<*>>?): Registry<BlockEntityType<*>> {
|
||||
super.initialize(data, registries, deserializer, flattened, metaType, alternative)
|
||||
|
||||
|
@ -179,6 +179,7 @@ class Registries {
|
||||
field.get(this).unsafeCast<Registry<*>>().postInit(this)
|
||||
}
|
||||
isFullyLoaded = true
|
||||
shapes.clear()
|
||||
}
|
||||
|
||||
private fun loadShapes(pixlyzerData: Map<String, Any>?) {
|
||||
|
@ -78,18 +78,14 @@ open class Registry<T : RegistryItem>(
|
||||
idValueMap[any] = value
|
||||
valueIdMap[value] = any
|
||||
}
|
||||
is ResourceLocation -> {
|
||||
resourceLocationMap[any] = value
|
||||
}
|
||||
is ResourceLocationAble -> {
|
||||
resourceLocationMap[any.resourceLocation] = value
|
||||
}
|
||||
is ResourceLocation -> resourceLocationMap[any] = value
|
||||
is ResourceLocationAble -> resourceLocationMap[any.resourceLocation] = value
|
||||
is MultiResourceLocationAble -> {
|
||||
for (resourceLocation in any.ALIASES) {
|
||||
resourceLocationMap[resourceLocation] = value
|
||||
}
|
||||
}
|
||||
else -> TODO()
|
||||
else -> TODO("Can not set $any, value=$value")
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Minosoft
|
||||
* Copyright (C) 2021 Moritz Zwerger
|
||||
* Copyright (C) 2020-2022 Moritz Zwerger
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
@ -39,8 +39,7 @@ abstract class RegistryItem : ResourceLocationAble {
|
||||
val javaField = field.javaField ?: continue
|
||||
var value: Any? = null
|
||||
for (key in keys) {
|
||||
val currentValue = registries[javaField.type as Class<out RegistryItem>]?.get(key) ?: continue
|
||||
value = currentValue
|
||||
value = registries[javaField.type as Class<out RegistryItem>]?.get(key) ?: continue
|
||||
break
|
||||
}
|
||||
value ?: continue
|
||||
|
Loading…
x
Reference in New Issue
Block a user