fix missing postInit call in WorldRenderer

* Fixes cullfacing and optimizer in <1.13
This commit is contained in:
Bixilon 2021-04-20 14:59:59 +02:00
parent 1490896a85
commit ddfad202fa
No known key found for this signature in database
GPG Key ID: 5CAD791931B09AC4
3 changed files with 7 additions and 4 deletions

View File

@ -111,7 +111,7 @@ data class BlockState(
if (renderers.isEmpty()) {
throw IllegalArgumentException("$this has not renderer!")
}
if (renderers.size == 1 || Minosoft.getConfig().config.game.other.antiMoirePattern) {
if (renderers.size == 1 || !Minosoft.getConfig().config.game.other.antiMoirePattern) {
return renderers[0]
}
// ToDo: Support weight attribute

View File

@ -55,6 +55,8 @@ class WorldRenderer(
val visibleChunks: MutableMap<Vec2i, MutableMap<Int, ChunkMeshCollection>> = Collections.synchronizedMap(ConcurrentHashMap())
val queuedChunks: MutableSet<Vec2i> = Collections.synchronizedSet(mutableSetOf())
private var allBlocks: Collection<BlockState>? = null
var meshes = 0
private set
var triangles = 0
@ -106,7 +108,8 @@ class WorldRenderer(
}
override fun init() {
renderWindow.textures.allTextures.addAll(resolveBlockTextureIds(getAllBlocks(connection.version.mapping)))
allBlocks = getAllBlocks(connection.version.mapping)
renderWindow.textures.allTextures.addAll(resolveBlockTextureIds(allBlocks!!))
// register keybindings
@ -129,11 +132,12 @@ class WorldRenderer(
renderWindow.textures.use(chunkShader, "textureArray")
renderWindow.textures.animator.use(chunkShader, "AnimatedDataBuffer")
for (block in connection.version.mapping.blockStateIdMap.values) {
for (block in allBlocks!!) {
for (model in block.renderers) {
model.postInit()
}
}
allBlocks = null
}
override fun draw() {

View File

@ -26,7 +26,6 @@ import glm_.vec3.Vec3i
class MultipartRenderer(
val models: List<BlockLikeRenderer>,
) : BlockLikeRenderer {
override val faceBorderSizes: Array<Array<FaceSize>?>
override val transparentFaces: BooleanArray = BooleanArray(Directions.DIRECTIONS.size)