mirror of
https://gitlab.bixilon.de/bixilon/minosoft.git
synced 2025-09-12 17:07:55 -04:00
fix legacy shulker box model loading
This commit is contained in:
parent
f5e3d29826
commit
7ced54d5dd
@ -42,7 +42,7 @@ enum class DyeColors {
|
|||||||
|
|
||||||
|
|
||||||
fun DyeColors.name(packFormat: Int) = when {
|
fun DyeColors.name(packFormat: Int) = when {
|
||||||
packFormat >= FLATTENING && this == LIGHT_GRAY -> "silver"
|
packFormat < FLATTENING && this == LIGHT_GRAY -> "silver"
|
||||||
else -> name.lowercase()
|
else -> name.lowercase()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,6 +15,7 @@ package de.bixilon.minosoft.gui.rendering.chunk.entities.renderer.storage.shulke
|
|||||||
|
|
||||||
import de.bixilon.kotlinglm.vec3.Vec3
|
import de.bixilon.kotlinglm.vec3.Vec3
|
||||||
import de.bixilon.kotlinglm.vec3.Vec3i
|
import de.bixilon.kotlinglm.vec3.Vec3i
|
||||||
|
import de.bixilon.minosoft.assets.minecraft.MinecraftPackFormat.FLATTENING
|
||||||
import de.bixilon.minosoft.data.colors.DyeColors
|
import de.bixilon.minosoft.data.colors.DyeColors
|
||||||
import de.bixilon.minosoft.data.colors.DyeColors.Companion.name
|
import de.bixilon.minosoft.data.colors.DyeColors.Companion.name
|
||||||
import de.bixilon.minosoft.data.entities.block.container.storage.ShulkerBoxBlockEntity
|
import de.bixilon.minosoft.data.entities.block.container.storage.ShulkerBoxBlockEntity
|
||||||
@ -79,14 +80,20 @@ class ShulkerBoxRenderer(
|
|||||||
)
|
)
|
||||||
|
|
||||||
override fun register(loader: ModelLoader) {
|
override fun register(loader: ModelLoader) {
|
||||||
load(NAME, texture, loader)
|
if (loader.packFormat > FLATTENING) {
|
||||||
|
load(NAME, texture, loader) // was purple color instead
|
||||||
|
}
|
||||||
|
|
||||||
for (color in DyeColors) {
|
for (color in DyeColors) {
|
||||||
val texture = minecraft("entity/shulker/shulker_${color.name(loader.packFormat)}").texture()
|
val texture = color.texture(loader.packFormat)
|
||||||
load(NAME_COLOR[color.ordinal], texture, loader)
|
load(NAME_COLOR[color.ordinal], texture, loader)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun DyeColors.texture(packFormat: Int): ResourceLocation {
|
||||||
|
return minecraft("entity/shulker/shulker_${name(packFormat)}").texture()
|
||||||
|
}
|
||||||
|
|
||||||
private fun load(name: ResourceLocation, texture: ResourceLocation, loader: ModelLoader) {
|
private fun load(name: ResourceLocation, texture: ResourceLocation, loader: ModelLoader) {
|
||||||
val texture = loader.context.textures.staticTextures.createTexture(texture)
|
val texture = loader.context.textures.staticTextures.createTexture(texture)
|
||||||
loader.skeletal.register(name, TEMPLATE, override = mapOf(this.named to texture))
|
loader.skeletal.register(name, TEMPLATE, override = mapOf(this.named to texture))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user