don't prefix item model parents with item/

This fixes some issues with loading models
This commit is contained in:
Moritz Zwerger 2023-10-08 21:40:16 +02:00
parent ad4fd8b37f
commit 92892c9de8
No known key found for this signature in database
GPG Key ID: 5CAD791931B09AC4
2 changed files with 3 additions and 3 deletions

View File

@ -133,7 +133,7 @@ class HotbarHungerElement(guiRenderer: GUIRenderer) : Element(guiRenderer), Poll
return true return true
} }
private class HungerAtlas(val atlas: Atlas?) { private class HungerAtlas(atlas: Atlas?) {
private val container = arrayOf(atlas["container"], atlas["container_hunger"]) private val container = arrayOf(atlas["container"], atlas["container_hunger"])
private val saturation = arrayOf(atlas["container_saturation_half"], atlas["container_saturation_full"]) private val saturation = arrayOf(atlas["container_saturation_half"], atlas["container_saturation_full"])
private val hunger = arrayOf(arrayOf(atlas["full"], atlas["half"]), arrayOf(atlas["full_hunger"], atlas["half_hunger"])) private val hunger = arrayOf(arrayOf(atlas["full"], atlas["half"]), arrayOf(atlas["full_hunger"], atlas["half_hunger"]))

View File

@ -36,7 +36,7 @@ class ItemLoader(private val loader: ModelLoader) {
val version = loader.context.connection.version val version = loader.context.connection.version
fun loadItem(name: ResourceLocation): ItemModel? { fun loadItem(name: ResourceLocation): ItemModel? {
val file = name.itemModel() val file = name.model()
cache[file]?.let { return it } cache[file]?.let { return it }
val data = assets.getOrNull(file)?.readJsonObject() val data = assets.getOrNull(file)?.readJsonObject()
if (data == null) { if (data == null) {
@ -52,7 +52,7 @@ class ItemLoader(private val loader: ModelLoader) {
} }
private fun loadItem(item: Item): ItemModel? { private fun loadItem(item: Item): ItemModel? {
val file = (if (item is CustomModel) item.getModelName(version) else item.identifier) ?: return null val file = (if (item is CustomModel) item.getModelName(version) else item.identifier.itemModel()) ?: return null
return loadItem(file) return loadItem(file)
} }