mirror of
https://gitlab.bixilon.de/bixilon/minosoft.git
synced 2025-09-14 09:56:37 -04:00
fluid models: fix texture path fixing
This commit is contained in:
parent
704eca3c00
commit
767d69e41b
@ -47,7 +47,9 @@ open class PixLyzerItem(resourceLocation: ResourceLocation, registries: Registri
|
|||||||
val className = data["class"]?.toString()
|
val className = data["class"]?.toString()
|
||||||
var factory = PixLyzerItemFactories[className]
|
var factory = PixLyzerItemFactories[className]
|
||||||
if (factory == null) {
|
if (factory == null) {
|
||||||
Log.log(LogMessageType.LOADING, LogLevels.VERBOSE) { "Item for class $className not found, defaulting..." }
|
if (className != null) {
|
||||||
|
Log.log(LogMessageType.LOADING, LogLevels.VERBOSE) { "Item for class $className not found, defaulting..." }
|
||||||
|
}
|
||||||
// ToDo: This item class got renamed or is not yet implemented
|
// ToDo: This item class got renamed or is not yet implemented
|
||||||
factory = if (data["food_properties"] != null) {
|
factory = if (data["food_properties"] != null) {
|
||||||
PixLyzerFoodItem // ToDo: Remove this edge case
|
PixLyzerFoodItem // ToDo: Remove this edge case
|
||||||
|
@ -27,12 +27,12 @@ class LavaFluidModel : FluidModel {
|
|||||||
override val transparency = TextureTransparencies.OPAQUE// TODO: from texture
|
override val transparency = TextureTransparencies.OPAQUE// TODO: from texture
|
||||||
|
|
||||||
override fun load(context: RenderContext) {
|
override fun load(context: RenderContext) {
|
||||||
still = context.textures.staticTextures.createTexture(context.models.block.fixPath(STILL).texture())
|
still = context.textures.staticTextures.createTexture(context.models.block.fixTexturePath(STILL).texture())
|
||||||
flowing = context.textures.staticTextures.createTexture(context.models.block.fixPath(FLOWING).texture())
|
flowing = context.textures.staticTextures.createTexture(context.models.block.fixTexturePath(FLOWING).texture())
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
private val STILL = minecraft("block/lava_still").texture()
|
private val STILL = minecraft("block/lava_still")
|
||||||
private val FLOWING = minecraft("block/lava_flow").texture()
|
private val FLOWING = minecraft("block/lava_flow")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -31,8 +31,8 @@ class WaterFluidModel : FluidModel {
|
|||||||
override val transparency = TextureTransparencies.TRANSLUCENT// TODO: from texture
|
override val transparency = TextureTransparencies.TRANSLUCENT// TODO: from texture
|
||||||
|
|
||||||
override fun load(context: RenderContext) {
|
override fun load(context: RenderContext) {
|
||||||
still = context.textures.staticTextures.createTexture(context.models.block.fixPath(STILL).texture())
|
still = context.textures.staticTextures.createTexture(context.models.block.fixTexturePath(STILL).texture())
|
||||||
flowing = context.textures.staticTextures.createTexture(context.models.block.fixPath(FLOWING).texture())
|
flowing = context.textures.staticTextures.createTexture(context.models.block.fixTexturePath(FLOWING).texture())
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
@ -74,12 +74,12 @@ class BlockLoader(private val loader: ModelLoader) {
|
|||||||
this.cache.clear()
|
this.cache.clear()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun fixPath(name: ResourceLocation): ResourceLocation {
|
fun fixTexturePath(name: ResourceLocation): ResourceLocation {
|
||||||
return ResourceLocation(name.namespace, name.path.fixPrefix(loader.packFormat, 4, "block/", "blocks/"))
|
return ResourceLocation(name.namespace, name.path.fixPrefix(loader.packFormat, 4, "blocks/", "block/"))
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun ResourceLocation.blockModel(): ResourceLocation {
|
private fun ResourceLocation.blockModel(): ResourceLocation {
|
||||||
return fixPath(this).model()
|
return this.prefix("block/").model()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -73,11 +73,11 @@ class ItemLoader(private val loader: ModelLoader) {
|
|||||||
this.cache.clear()
|
this.cache.clear()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun fixPath(name: ResourceLocation): ResourceLocation {
|
fun fixTexturePath(name: ResourceLocation): ResourceLocation {
|
||||||
return ResourceLocation(name.namespace, name.path.fixPrefix(loader.packFormat, 4, "item/", "items/"))
|
return ResourceLocation(name.namespace, name.path.fixPrefix(loader.packFormat, 4, "items/", "item/"))
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun ResourceLocation.itemModel(): ResourceLocation {
|
private fun ResourceLocation.itemModel(): ResourceLocation {
|
||||||
return fixPath(this).model()
|
return this.prefix("item/").model()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user