wall sign model, render wall signs

This commit is contained in:
Bixilon 2022-04-20 14:12:24 +02:00
parent d3a0ff5745
commit a208d7a926
No known key found for this signature in database
GPG Key ID: 5CAD791931B09AC4
35 changed files with 274 additions and 303 deletions

View File

@ -23,7 +23,7 @@ import java.nio.charset.StandardCharsets
object ResourcesAssetsUtil { object ResourcesAssetsUtil {
fun create(clazz: Class<*>, canUnload: Boolean = true, prefix: String = AssetsManager.DEFAULT_ASSETS_PREFIX): AssetsManager { fun create(clazz: Class<*>, canUnload: Boolean = true, prefix: String = AssetsManager.DEFAULT_ASSETS_PREFIX): AssetsManager {
val rootResources = clazz.classLoader.getResource("assets") ?: throw FileNotFoundException("Can not find assets folder in $clazz") val rootResources = clazz.classLoader.getResource(prefix) ?: throw FileNotFoundException("Can not find assets folder in $clazz")
return when (rootResources.protocol) { return when (rootResources.protocol) {
"file" -> DirectoryAssetsManager(rootResources.path, canUnload, prefix) // Read them directly from the folder "file" -> DirectoryAssetsManager(rootResources.path, canUnload, prefix) // Read them directly from the folder

View File

@ -13,12 +13,12 @@
package de.bixilon.minosoft.data.entities.block package de.bixilon.minosoft.data.entities.block
import de.bixilon.kotlinglm.vec3.Vec3i
import de.bixilon.minosoft.data.registries.blocks.BlockState import de.bixilon.minosoft.data.registries.blocks.BlockState
import de.bixilon.minosoft.gui.rendering.RenderWindow import de.bixilon.minosoft.gui.rendering.RenderWindow
import de.bixilon.minosoft.gui.rendering.world.entities.BlockEntityRenderer import de.bixilon.minosoft.gui.rendering.world.entities.BlockEntityRenderer
import de.bixilon.minosoft.gui.rendering.world.entities.MeshedBlockEntityRenderer import de.bixilon.minosoft.gui.rendering.world.entities.MeshedBlockEntityRenderer
import de.bixilon.minosoft.protocol.network.connection.play.PlayConnection import de.bixilon.minosoft.protocol.network.connection.play.PlayConnection
import glm_.vec3.Vec3i
abstract class MeshedBlockEntity(connection: PlayConnection) : BlockEntity(connection) { abstract class MeshedBlockEntity(connection: PlayConnection) : BlockEntity(connection) {

View File

@ -13,6 +13,7 @@
package de.bixilon.minosoft.data.entities.block package de.bixilon.minosoft.data.entities.block
import de.bixilon.kotlinglm.vec3.Vec3i
import de.bixilon.kutil.cast.CastUtil.nullCast import de.bixilon.kutil.cast.CastUtil.nullCast
import de.bixilon.minosoft.data.registries.ResourceLocation import de.bixilon.minosoft.data.registries.ResourceLocation
import de.bixilon.minosoft.data.registries.blocks.BlockState import de.bixilon.minosoft.data.registries.blocks.BlockState
@ -21,7 +22,6 @@ import de.bixilon.minosoft.gui.rendering.RenderWindow
import de.bixilon.minosoft.gui.rendering.world.entities.renderer.sign.SignBlockEntityRenderer import de.bixilon.minosoft.gui.rendering.world.entities.renderer.sign.SignBlockEntityRenderer
import de.bixilon.minosoft.protocol.network.connection.play.PlayConnection import de.bixilon.minosoft.protocol.network.connection.play.PlayConnection
import de.bixilon.minosoft.protocol.protocol.ProtocolDefinition import de.bixilon.minosoft.protocol.protocol.ProtocolDefinition
import glm_.vec3.Vec3i
class SignBlockEntity(connection: PlayConnection) : MeshedBlockEntity(connection) { class SignBlockEntity(connection: PlayConnection) : MeshedBlockEntity(connection) {
var lines: Array<ChatComponent> = Array(ProtocolDefinition.SIGN_LINES) { ChatComponent.of("") } var lines: Array<ChatComponent> = Array(ProtocolDefinition.SIGN_LINES) { ChatComponent.of("") }

View File

@ -1,6 +1,6 @@
/* /*
* Minosoft * 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. * 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.
* *
@ -189,7 +189,7 @@ object MinecraftBlocks {
val LADDER = "minecraft:ladder".toResourceLocation() val LADDER = "minecraft:ladder".toResourceLocation()
val RAIL = "minecraft:rail".toResourceLocation() val RAIL = "minecraft:rail".toResourceLocation()
val COBBLESTONE_STAIRS = "minecraft:cobblestone_stairs".toResourceLocation() val COBBLESTONE_STAIRS = "minecraft:cobblestone_stairs".toResourceLocation()
val OAK_WALL_SIGN = "minecraft:oak_wall_sign".toResourceLocation() val OAK_WALL_SIGN = "minecraft:oak_wall_sign.json".toResourceLocation()
val SPRUCE_WALL_SIGN = "minecraft:spruce_wall_sign".toResourceLocation() val SPRUCE_WALL_SIGN = "minecraft:spruce_wall_sign".toResourceLocation()
val BIRCH_WALL_SIGN = "minecraft:birch_wall_sign".toResourceLocation() val BIRCH_WALL_SIGN = "minecraft:birch_wall_sign".toResourceLocation()
val ACACIA_WALL_SIGN = "minecraft:acacia_wall_sign".toResourceLocation() val ACACIA_WALL_SIGN = "minecraft:acacia_wall_sign".toResourceLocation()

View File

@ -17,9 +17,6 @@ import de.bixilon.minosoft.data.entities.block.SignBlockEntity
import de.bixilon.minosoft.data.registries.ResourceLocation import de.bixilon.minosoft.data.registries.ResourceLocation
import de.bixilon.minosoft.data.registries.blocks.types.entity.BlockWithEntity import de.bixilon.minosoft.data.registries.blocks.types.entity.BlockWithEntity
import de.bixilon.minosoft.data.registries.registries.Registries import de.bixilon.minosoft.data.registries.registries.Registries
import de.bixilon.minosoft.gui.rendering.world.entities.renderer.sign.SignModel
abstract class SignBlock(resourceLocation: ResourceLocation, registries: Registries, data: Map<String, Any>) : BlockWithEntity<SignBlockEntity>(resourceLocation, registries, data) { abstract class SignBlock(resourceLocation: ResourceLocation, registries: Registries, data: Map<String, Any>) : BlockWithEntity<SignBlockEntity>(resourceLocation, registries, data)
abstract val model: SignModel?
}

View File

@ -17,10 +17,8 @@ import de.bixilon.minosoft.data.registries.ResourceLocation
import de.bixilon.minosoft.data.registries.blocks.BlockFactory import de.bixilon.minosoft.data.registries.blocks.BlockFactory
import de.bixilon.minosoft.data.registries.factory.clazz.MultiClassFactory import de.bixilon.minosoft.data.registries.factory.clazz.MultiClassFactory
import de.bixilon.minosoft.data.registries.registries.Registries import de.bixilon.minosoft.data.registries.registries.Registries
import de.bixilon.minosoft.gui.rendering.world.entities.renderer.sign.standing.StandingSignModel
open class StandingSignBlock(resourceLocation: ResourceLocation, registries: Registries, data: Map<String, Any>) : SignBlock(resourceLocation, registries, data) { open class StandingSignBlock(resourceLocation: ResourceLocation, registries: Registries, data: Map<String, Any>) : SignBlock(resourceLocation, registries, data) {
override var model: StandingSignModel? = null
companion object : BlockFactory<StandingSignBlock>, MultiClassFactory<StandingSignBlock> { companion object : BlockFactory<StandingSignBlock>, MultiClassFactory<StandingSignBlock> {
override val ALIASES: Set<String> = setOf("SignBlock") override val ALIASES: Set<String> = setOf("SignBlock")

View File

@ -16,10 +16,8 @@ package de.bixilon.minosoft.data.registries.blocks.types.entity.sign
import de.bixilon.minosoft.data.registries.ResourceLocation import de.bixilon.minosoft.data.registries.ResourceLocation
import de.bixilon.minosoft.data.registries.blocks.BlockFactory import de.bixilon.minosoft.data.registries.blocks.BlockFactory
import de.bixilon.minosoft.data.registries.registries.Registries import de.bixilon.minosoft.data.registries.registries.Registries
import de.bixilon.minosoft.gui.rendering.world.entities.renderer.sign.wall.WallSignModel
open class WallSignBlock(resourceLocation: ResourceLocation, registries: Registries, data: Map<String, Any>) : SignBlock(resourceLocation, registries, data) { open class WallSignBlock(resourceLocation: ResourceLocation, registries: Registries, data: Map<String, Any>) : SignBlock(resourceLocation, registries, data) {
override var model: WallSignModel? = null
companion object : BlockFactory<WallSignBlock> { companion object : BlockFactory<WallSignBlock> {

View File

@ -51,6 +51,9 @@ class ModelLoader(
} }
private fun loadBlockStates(block: Block) { private fun loadBlockStates(block: Block) {
if (block.resourceLocation.toString() == "minecraft:oak_wall_sign.json") {
println("Test")
}
val blockStateJson = assetsManager[block.resourceLocation.blockState()].readJsonObject() val blockStateJson = assetsManager[block.resourceLocation.blockState()].readJsonObject()
val model = RootModel(this, blockStateJson) ?: return val model = RootModel(this, blockStateJson) ?: return

View File

@ -13,9 +13,9 @@
package de.bixilon.minosoft.gui.rendering.models package de.bixilon.minosoft.gui.rendering.models
import de.bixilon.kotlinglm.vec3.Vec3i
import de.bixilon.minosoft.data.registries.blocks.BlockState import de.bixilon.minosoft.data.registries.blocks.BlockState
import de.bixilon.minosoft.gui.rendering.world.mesh.WorldMesh import de.bixilon.minosoft.gui.rendering.world.mesh.WorldMesh
import glm_.vec3.Vec3i
import java.util.* import java.util.*
interface SingleBlockRenderable { interface SingleBlockRenderable {

View File

@ -63,7 +63,7 @@ data class UnbakedBlockStateModel(
for (element in model.elements) { for (element in model.elements) {
for (face in element.faces) { for (face in element.faces) {
val texture = textures[face.texture.removePrefix("#")]!! // ToDo: Allow direct texture names? val texture = textures[face.texture.removePrefix("#")] ?: throw IllegalArgumentException("Can not find texture variable ${face.texture}")// ToDo: Allow direct texture names?
val positions = face.direction.getPositions(element.from, element.to) val positions = face.direction.getPositions(element.from, element.to)
element.rotation?.let { element.rotation?.let {

View File

@ -13,8 +13,6 @@
package de.bixilon.minosoft.gui.rendering.world.entities package de.bixilon.minosoft.gui.rendering.world.entities
import de.bixilon.minosoft.gui.rendering.world.entities.renderer.sign.standing.StandingSignModels
import de.bixilon.minosoft.gui.rendering.world.entities.renderer.sign.wall.WallSignModels
import de.bixilon.minosoft.gui.rendering.world.entities.renderer.storage.DoubleChestRenderer import de.bixilon.minosoft.gui.rendering.world.entities.renderer.storage.DoubleChestRenderer
import de.bixilon.minosoft.gui.rendering.world.entities.renderer.storage.SingleChestRenderer import de.bixilon.minosoft.gui.rendering.world.entities.renderer.storage.SingleChestRenderer
@ -26,24 +24,5 @@ object DefaultEntityModels {
DoubleChestRenderer.NormalChest, DoubleChestRenderer.NormalChest,
DoubleChestRenderer.TrappedChest, DoubleChestRenderer.TrappedChest,
StandingSignModels.Acacia,
StandingSignModels.Birch,
StandingSignModels.Crimson,
StandingSignModels.DarkOak,
StandingSignModels.Jungle,
StandingSignModels.Oak,
StandingSignModels.Spruce,
StandingSignModels.WarpedSign,
WallSignModels.Acacia,
WallSignModels.Birch,
WallSignModels.Crimson,
WallSignModels.DarkOak,
WallSignModels.Jungle,
WallSignModels.Oak,
WallSignModels.Spruce,
WallSignModels.WarpedSign,
) )
} }

View File

@ -13,13 +13,13 @@
package de.bixilon.minosoft.gui.rendering.world.entities.renderer.sign package de.bixilon.minosoft.gui.rendering.world.entities.renderer.sign
import de.bixilon.kutil.cast.CastUtil.nullCast import de.bixilon.kotlinglm.vec3.Vec3i
import de.bixilon.minosoft.data.entities.block.SignBlockEntity import de.bixilon.minosoft.data.entities.block.SignBlockEntity
import de.bixilon.minosoft.data.registries.blocks.BlockState import de.bixilon.minosoft.data.registries.blocks.BlockState
import de.bixilon.minosoft.data.registries.blocks.types.entity.sign.SignBlock import de.bixilon.minosoft.data.registries.blocks.types.entity.sign.StandingSignBlock
import de.bixilon.minosoft.data.registries.blocks.types.entity.sign.WallSignBlock
import de.bixilon.minosoft.gui.rendering.world.entities.MeshedBlockEntityRenderer import de.bixilon.minosoft.gui.rendering.world.entities.MeshedBlockEntityRenderer
import de.bixilon.minosoft.gui.rendering.world.mesh.WorldMesh import de.bixilon.minosoft.gui.rendering.world.mesh.WorldMesh
import glm_.vec3.Vec3i
import java.util.* import java.util.*
class SignBlockEntityRenderer( class SignBlockEntityRenderer(
@ -28,9 +28,12 @@ class SignBlockEntityRenderer(
) : MeshedBlockEntityRenderer<SignBlockEntity> { ) : MeshedBlockEntityRenderer<SignBlockEntity> {
override fun singleRender(position: Vec3i, mesh: WorldMesh, random: Random, blockState: BlockState, neighbours: Array<BlockState?>, light: ByteArray, ambientLight: FloatArray, tints: IntArray?): Boolean { override fun singleRender(position: Vec3i, mesh: WorldMesh, random: Random, blockState: BlockState, neighbours: Array<BlockState?>, light: ByteArray, ambientLight: FloatArray, tints: IntArray?): Boolean {
val model = this.blockState.block.nullCast<SignBlock>()?.model ?: return false val block = this.blockState.block
println("Rendering sign at $position") if (block is StandingSignBlock) {
println("Rendering standing sign at $position (${block.resourceLocation})")
} else if (block is WallSignBlock) {
println("Rendering wall sign at $position (${block.resourceLocation})")
}
// ToDo // ToDo

View File

@ -1,20 +0,0 @@
/*
* Minosoft
* 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.
*
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
*
* This software is not affiliated with Mojang AB, the original developer of Minecraft.
*/
package de.bixilon.minosoft.gui.rendering.world.entities.renderer.sign
import de.bixilon.minosoft.gui.rendering.system.base.texture.texture.AbstractTexture
abstract class SignModel(
val texture: AbstractTexture,
)

View File

@ -1,21 +0,0 @@
/*
* Minosoft
* 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.
*
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
*
* This software is not affiliated with Mojang AB, the original developer of Minecraft.
*/
package de.bixilon.minosoft.gui.rendering.world.entities.renderer.sign.standing
import de.bixilon.minosoft.gui.rendering.system.base.texture.texture.AbstractTexture
import de.bixilon.minosoft.gui.rendering.world.entities.renderer.sign.SignModel
class StandingSignModel(
texture: AbstractTexture,
) : SignModel(texture)

View File

@ -1,98 +0,0 @@
/*
* Minosoft
* 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.
*
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
*
* This software is not affiliated with Mojang AB, the original developer of Minecraft.
*/
package de.bixilon.minosoft.gui.rendering.world.entities.renderer.sign.standing
import de.bixilon.kutil.cast.CastUtil.nullCast
import de.bixilon.minosoft.data.registries.ResourceLocation
import de.bixilon.minosoft.data.registries.blocks.MinecraftBlocks
import de.bixilon.minosoft.data.registries.blocks.types.entity.sign.StandingSignBlock
import de.bixilon.minosoft.gui.rendering.RenderWindow
import de.bixilon.minosoft.gui.rendering.models.ModelLoader
import de.bixilon.minosoft.gui.rendering.textures.TextureUtil.texture
import de.bixilon.minosoft.gui.rendering.world.entities.EntityRendererRegister
import de.bixilon.minosoft.util.KUtil.toResourceLocation
object StandingSignModels {
fun register(renderWindow: RenderWindow, modelLoader: ModelLoader, textureName: ResourceLocation, block: ResourceLocation) {
val block = renderWindow.connection.registries.blockRegistry[block].nullCast<StandingSignBlock>() ?: return
val texture = renderWindow.textureManager.staticTextures.createTexture(textureName)
val signModel = StandingSignModel(texture)
block.model = signModel
}
object Acacia : EntityRendererRegister {
val TEXTURE = "minecraft:entity/signs/acacia".toResourceLocation().texture()
override fun register(renderWindow: RenderWindow, modelLoader: ModelLoader) {
register(renderWindow, modelLoader, TEXTURE, MinecraftBlocks.ACACIA_SIGN)
}
}
object Birch : EntityRendererRegister {
val TEXTURE = "minecraft:entity/signs/birch".toResourceLocation().texture()
override fun register(renderWindow: RenderWindow, modelLoader: ModelLoader) {
register(renderWindow, modelLoader, TEXTURE, MinecraftBlocks.BIRCH_SIGN)
}
}
object Crimson : EntityRendererRegister {
val TEXTURE = "minecraft:entity/signs/crimson".toResourceLocation().texture()
override fun register(renderWindow: RenderWindow, modelLoader: ModelLoader) {
register(renderWindow, modelLoader, TEXTURE, MinecraftBlocks.CRIMSON_SIGN)
}
}
object DarkOak : EntityRendererRegister {
val TEXTURE = "minecraft:entity/signs/dark_oak".toResourceLocation().texture()
override fun register(renderWindow: RenderWindow, modelLoader: ModelLoader) {
register(renderWindow, modelLoader, TEXTURE, MinecraftBlocks.DARK_OAK_SIGN)
}
}
object Jungle : EntityRendererRegister {
val TEXTURE = "minecraft:entity/signs/jungle".toResourceLocation().texture()
override fun register(renderWindow: RenderWindow, modelLoader: ModelLoader) {
register(renderWindow, modelLoader, TEXTURE, MinecraftBlocks.JUNGLE_SIGN)
}
}
object Oak : EntityRendererRegister {
val TEXTURE = "minecraft:entity/signs/oak".toResourceLocation().texture()
override fun register(renderWindow: RenderWindow, modelLoader: ModelLoader) {
register(renderWindow, modelLoader, TEXTURE, MinecraftBlocks.OAK_SIGN)
}
}
object Spruce : EntityRendererRegister {
val TEXTURE = "minecraft:entity/signs/spruce".toResourceLocation().texture()
override fun register(renderWindow: RenderWindow, modelLoader: ModelLoader) {
register(renderWindow, modelLoader, TEXTURE, MinecraftBlocks.SPRUCE_SIGN)
}
}
object WarpedSign : EntityRendererRegister {
val TEXTURE = "minecraft:entity/signs/warped".toResourceLocation().texture()
override fun register(renderWindow: RenderWindow, modelLoader: ModelLoader) {
register(renderWindow, modelLoader, TEXTURE, MinecraftBlocks.WARPED_SIGN)
}
}
}

View File

@ -1,21 +0,0 @@
/*
* Minosoft
* 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.
*
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
*
* This software is not affiliated with Mojang AB, the original developer of Minecraft.
*/
package de.bixilon.minosoft.gui.rendering.world.entities.renderer.sign.wall
import de.bixilon.minosoft.gui.rendering.system.base.texture.texture.AbstractTexture
import de.bixilon.minosoft.gui.rendering.world.entities.renderer.sign.SignModel
class WallSignModel(
texture: AbstractTexture,
) : SignModel(texture)

View File

@ -1,98 +0,0 @@
/*
* Minosoft
* 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.
*
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
*
* This software is not affiliated with Mojang AB, the original developer of Minecraft.
*/
package de.bixilon.minosoft.gui.rendering.world.entities.renderer.sign.wall
import de.bixilon.kutil.cast.CastUtil.nullCast
import de.bixilon.minosoft.data.registries.ResourceLocation
import de.bixilon.minosoft.data.registries.blocks.MinecraftBlocks
import de.bixilon.minosoft.data.registries.blocks.types.entity.sign.WallSignBlock
import de.bixilon.minosoft.gui.rendering.RenderWindow
import de.bixilon.minosoft.gui.rendering.models.ModelLoader
import de.bixilon.minosoft.gui.rendering.textures.TextureUtil.texture
import de.bixilon.minosoft.gui.rendering.world.entities.EntityRendererRegister
import de.bixilon.minosoft.util.KUtil.toResourceLocation
object WallSignModels {
fun register(renderWindow: RenderWindow, modelLoader: ModelLoader, textureName: ResourceLocation, block: ResourceLocation) {
val block = renderWindow.connection.registries.blockRegistry[block].nullCast<WallSignBlock>() ?: return
val texture = renderWindow.textureManager.staticTextures.createTexture(textureName)
val signModel = WallSignModel(texture)
block.model = signModel
}
object Acacia : EntityRendererRegister {
val TEXTURE = "minecraft:entity/signs/acacia".toResourceLocation().texture()
override fun register(renderWindow: RenderWindow, modelLoader: ModelLoader) {
register(renderWindow, modelLoader, TEXTURE, MinecraftBlocks.ACACIA_WALL_SIGN)
}
}
object Birch : EntityRendererRegister {
val TEXTURE = "minecraft:entity/signs/birch".toResourceLocation().texture()
override fun register(renderWindow: RenderWindow, modelLoader: ModelLoader) {
register(renderWindow, modelLoader, TEXTURE, MinecraftBlocks.BIRCH_WALL_SIGN)
}
}
object Crimson : EntityRendererRegister {
val TEXTURE = "minecraft:entity/signs/crimson".toResourceLocation().texture()
override fun register(renderWindow: RenderWindow, modelLoader: ModelLoader) {
register(renderWindow, modelLoader, TEXTURE, MinecraftBlocks.CRIMSON_WALL_SIGN)
}
}
object DarkOak : EntityRendererRegister {
val TEXTURE = "minecraft:entity/signs/dark_oak".toResourceLocation().texture()
override fun register(renderWindow: RenderWindow, modelLoader: ModelLoader) {
register(renderWindow, modelLoader, TEXTURE, MinecraftBlocks.DARK_OAK_WALL_SIGN)
}
}
object Jungle : EntityRendererRegister {
val TEXTURE = "minecraft:entity/signs/jungle".toResourceLocation().texture()
override fun register(renderWindow: RenderWindow, modelLoader: ModelLoader) {
register(renderWindow, modelLoader, TEXTURE, MinecraftBlocks.JUNGLE_WALL_SIGN)
}
}
object Oak : EntityRendererRegister {
val TEXTURE = "minecraft:entity/signs/oak".toResourceLocation().texture()
override fun register(renderWindow: RenderWindow, modelLoader: ModelLoader) {
register(renderWindow, modelLoader, TEXTURE, MinecraftBlocks.OAK_WALL_SIGN)
}
}
object Spruce : EntityRendererRegister {
val TEXTURE = "minecraft:entity/signs/spruce".toResourceLocation().texture()
override fun register(renderWindow: RenderWindow, modelLoader: ModelLoader) {
register(renderWindow, modelLoader, TEXTURE, MinecraftBlocks.SPRUCE_WALL_SIGN)
}
}
object WarpedSign : EntityRendererRegister {
val TEXTURE = "minecraft:entity/signs/warped".toResourceLocation().texture()
override fun register(renderWindow: RenderWindow, modelLoader: ModelLoader) {
register(renderWindow, modelLoader, TEXTURE, MinecraftBlocks.WARPED_WALL_SIGN)
}
}
}

View File

@ -92,14 +92,14 @@ class SolidCullSectionPreparer(
position = Vec3i(offsetX + x, offsetY + y, offsetZ + z) position = Vec3i(offsetX + x, offsetY + y, offsetZ + z)
blockEntity = section.blockEntities.unsafeGet(x, y, z) blockEntity = section.blockEntities.unsafeGet(x, y, z)
val blockEntityModel = blockEntity?.getRenderer(renderWindow, blockState, position, light[6].toInt()) val blockEntityModel = blockEntity?.getRenderer(renderWindow, blockState, position, light[6].toInt())
if (blockEntityModel != null) { // ToDo: ignore if is MeshedBlockEntityRenderer? if (blockEntityModel != null) {
blockEntities += blockEntityModel blockEntities += blockEntityModel
mesh.addBlock(x, y, z) mesh.addBlock(x, y, z)
} }
model = if (blockEntityModel is MeshedBlockEntityRenderer) { model = blockState.blockModel ?: if (blockEntityModel is MeshedBlockEntityRenderer) {
blockEntityModel blockEntityModel
} else { } else {
blockState.blockModel ?: continue continue
} }
@ -168,6 +168,10 @@ class SolidCullSectionPreparer(
tints = tintColorCalculator.getAverageTint(chunk, neighbourChunks, blockState, x, y, z) tints = tintColorCalculator.getAverageTint(chunk, neighbourChunks, blockState, x, y, z)
rendered = model.singleRender(position, mesh, random, blockState, neighbourBlocks, light, ambientLight, tints) rendered = model.singleRender(position, mesh, random, blockState, neighbourBlocks, light, ambientLight, tints)
if (blockEntityModel is MeshedBlockEntityRenderer<*>) {
rendered = rendered || blockEntityModel.singleRender(position, mesh, random, blockState, neighbourBlocks, light, ambientLight, tints)
}
if (rendered) { if (rendered) {
mesh.addBlock(x, y, z) mesh.addBlock(x, y, z)
} }

View File

@ -0,0 +1,19 @@
{
"variants": {
"facing=north": {
"model": "minecraft:block/acacia_wall_sign"
},
"facing=east": {
"model": "minecraft:block/acacia_wall_sign",
"y": 90
},
"facing=south": {
"model": "minecraft:block/acacia_wall_sign",
"y": 180
},
"facing=west": {
"model": "minecraft:block/acacia_wall_sign",
"y": 270
}
}
}

View File

@ -0,0 +1,19 @@
{
"variants": {
"facing=north": {
"model": "minecraft:block/birch_wall_sign"
},
"facing=east": {
"model": "minecraft:block/birch_wall_sign",
"y": 90
},
"facing=south": {
"model": "minecraft:block/birch_wall_sign",
"y": 180
},
"facing=west": {
"model": "minecraft:block/birch_wall_sign",
"y": 270
}
}
}

View File

@ -0,0 +1,19 @@
{
"variants": {
"facing=north": {
"model": "minecraft:block/crimson_wall_sign"
},
"facing=east": {
"model": "minecraft:block/crimson_wall_sign",
"y": 90
},
"facing=south": {
"model": "minecraft:block/crimson_wall_sign",
"y": 180
},
"facing=west": {
"model": "minecraft:block/crimson_wall_sign",
"y": 270
}
}
}

View File

@ -0,0 +1,19 @@
{
"variants": {
"facing=north": {
"model": "minecraft:block/dark_oak_wall_sign"
},
"facing=east": {
"model": "minecraft:block/dark_oak_wall_sign",
"y": 90
},
"facing=south": {
"model": "minecraft:block/dark_oak_wall_sign",
"y": 180
},
"facing=west": {
"model": "minecraft:block/dark_oak_wall_sign",
"y": 270
}
}
}

View File

@ -0,0 +1,19 @@
{
"variants": {
"facing=north": {
"model": "minecraft:block/jungle_wall_sign"
},
"facing=east": {
"model": "minecraft:block/jungle_wall_sign",
"y": 90
},
"facing=south": {
"model": "minecraft:block/jungle_wall_sign",
"y": 180
},
"facing=west": {
"model": "minecraft:block/jungle_wall_sign",
"y": 270
}
}
}

View File

@ -0,0 +1,19 @@
{
"variants": {
"facing=north": {
"model": "minecraft:block/oak_wall_sign"
},
"facing=east": {
"model": "minecraft:block/oak_wall_sign",
"y": 90
},
"facing=south": {
"model": "minecraft:block/oak_wall_sign",
"y": 180
},
"facing=west": {
"model": "minecraft:block/oak_wall_sign",
"y": 270
}
}
}

View File

@ -0,0 +1,19 @@
{
"variants": {
"facing=north": {
"model": "minecraft:block/spruce_wall_sign"
},
"facing=east": {
"model": "minecraft:block/spruce_wall_sign",
"y": 90
},
"facing=south": {
"model": "minecraft:block/spruce_wall_sign",
"y": 180
},
"facing=west": {
"model": "minecraft:block/spruce_wall_sign",
"y": 270
}
}
}

View File

@ -0,0 +1,19 @@
{
"variants": {
"facing=north": {
"model": "minecraft:block/warped_wall_sign"
},
"facing=east": {
"model": "minecraft:block/warped_wall_sign",
"y": 90
},
"facing=south": {
"model": "minecraft:block/warped_wall_sign",
"y": 180
},
"facing=west": {
"model": "minecraft:block/warped_wall_sign",
"y": 270
}
}
}

View File

@ -0,0 +1,7 @@
{
"parent": "minecraft:block/template_wall_sign",
"textures": {
"particle": "minecraft:block/acacia_planks",
"sign": "minecraft:entity/signs/acacia"
}
}

View File

@ -0,0 +1,7 @@
{
"parent": "minecraft:block/template_wall_sign",
"textures": {
"particle": "minecraft:block/birch_planks",
"sign": "minecraft:entity/signs/birch"
}
}

View File

@ -0,0 +1,7 @@
{
"parent": "minecraft:block/template_wall_sign",
"textures": {
"particle": "minecraft:block/crimson_planks",
"sign": "minecraft:entity/signs/crimson"
}
}

View File

@ -0,0 +1,7 @@
{
"parent": "minecraft:block/template_wall_sign",
"textures": {
"particle": "minecraft:block/dark_oak_planks",
"sign": "minecraft:entity/signs/dark_oak"
}
}

View File

@ -0,0 +1,7 @@
{
"parent": "minecraft:block/template_wall_sign",
"textures": {
"particle": "minecraft:block/jungle_planks",
"sign": "minecraft:entity/signs/jungle"
}
}

View File

@ -0,0 +1,7 @@
{
"parent": "minecraft:block/template_wall_sign",
"textures": {
"particle": "minecraft:block/oak_planks",
"sign": "minecraft:entity/signs/oak"
}
}

View File

@ -0,0 +1,7 @@
{
"parent": "minecraft:block/template_wall_sign",
"textures": {
"particle": "minecraft:block/spruce_planks",
"sign": "minecraft:entity/signs/spruce"
}
}

View File

@ -0,0 +1,39 @@
{
"elements": [
{
"from": [0, 4.5, 14],
"to": [16, 12.5, 16],
"faces": {
"down": {
"uv": [0.5, 0, 4.5, 1],
"texture": "#sign"
},
"up": {
"uv": [4.5, 0, 8.5, 1],
"rotation": 180,
"texture": "#sign"
},
"east": {
"uv": [0.0, 1, 0.5, 7],
"texture": "#sign",
"cullface": "east"
},
"north": {
"uv": [0.5, 1, 4.5, 7],
"texture": "#sign",
"cullface": "north"
},
"south": {
"uv": [4.5, 1, 8.0, 7],
"texture": "#sign",
"cullface": "south"
},
"west": {
"uv": [8.0, 1, 8.5, 7],
"texture": "#sign",
"cullface": "west"
}
}
}
]
}

View File

@ -0,0 +1,7 @@
{
"parent": "minecraft:block/template_wall_sign",
"textures": {
"particle": "minecraft:block/warped_planks",
"sign": "minecraft:entity/signs/warped"
}
}