diff --git a/src/integration-test/kotlin/de/bixilon/minosoft/MinosoftSIT.kt b/src/integration-test/kotlin/de/bixilon/minosoft/MinosoftSIT.kt index 9aa3d268d..b79864aff 100644 --- a/src/integration-test/kotlin/de/bixilon/minosoft/MinosoftSIT.kt +++ b/src/integration-test/kotlin/de/bixilon/minosoft/MinosoftSIT.kt @@ -66,10 +66,10 @@ internal object MinosoftSIT { val worker = TaskWorker() MinosoftBoot.register(worker) - worker.minusAssign(BootTasks.PROFILES) - worker.minusAssign(BootTasks.LAN_SERVERS) - worker.minusAssign(BootTasks.MODS) - worker.minusAssign(BootTasks.CLI) + worker -= BootTasks.PROFILES + worker -= BootTasks.LAN_SERVERS + worker -= BootTasks.MODS + worker -= BootTasks.CLI worker.work(MinosoftBoot.LATCH) MinosoftBoot.LATCH.dec() MinosoftBoot.LATCH.await() diff --git a/src/main/java/de/bixilon/minosoft/gui/rendering/chunk/border/WorldBorderRenderer.kt b/src/main/java/de/bixilon/minosoft/gui/rendering/chunk/border/WorldBorderRenderer.kt index 694927024..d2292d965 100644 --- a/src/main/java/de/bixilon/minosoft/gui/rendering/chunk/border/WorldBorderRenderer.kt +++ b/src/main/java/de/bixilon/minosoft/gui/rendering/chunk/border/WorldBorderRenderer.kt @@ -57,13 +57,13 @@ class WorldBorderRenderer( override fun init(latch: AbstractLatch) { shader.native.defines["MAX_DISTANCE"] = MAX_DISTANCE - shader.load() texture = context.textures.static.create(TEXTURE) context.camera.offset::offset.observe(this) { reload = true } } override fun postInit(latch: AbstractLatch) { + shader.load() context.textures.static.use(shader) shader.textureIndexLayer = texture.renderData.shaderTextureId } diff --git a/src/main/java/de/bixilon/minosoft/gui/rendering/framebuffer/FramebufferManager.kt b/src/main/java/de/bixilon/minosoft/gui/rendering/framebuffer/FramebufferManager.kt index 2db9953da..105d00f09 100644 --- a/src/main/java/de/bixilon/minosoft/gui/rendering/framebuffer/FramebufferManager.kt +++ b/src/main/java/de/bixilon/minosoft/gui/rendering/framebuffer/FramebufferManager.kt @@ -31,6 +31,9 @@ class FramebufferManager( fun init() { world.init() gui.init() + for (error in context.system.getErrors()) { + println() + } context.connection.events.listen { world.framebuffer.resize(it.size) @@ -39,6 +42,9 @@ class FramebufferManager( } fun postInit() { + for (error in context.system.getErrors()) { + println() + } world.postInit() gui.postInit() } diff --git a/src/main/java/de/bixilon/minosoft/gui/rendering/framebuffer/world/overlay/overlays/weather/WeatherOverlay.kt b/src/main/java/de/bixilon/minosoft/gui/rendering/framebuffer/world/overlay/overlays/weather/WeatherOverlay.kt index eccef77ef..c903cf3df 100644 --- a/src/main/java/de/bixilon/minosoft/gui/rendering/framebuffer/world/overlay/overlays/weather/WeatherOverlay.kt +++ b/src/main/java/de/bixilon/minosoft/gui/rendering/framebuffer/world/overlay/overlays/weather/WeatherOverlay.kt @@ -86,11 +86,8 @@ class WeatherOverlay(private val context: RenderContext) : Overlay { mesh.load() } - override fun init() { - shader.load() - } - override fun postInit() { + shader.load() shader.use() context.textures.static.use(shader) } diff --git a/src/main/java/de/bixilon/minosoft/gui/rendering/system/opengl/texture/OpenGLFontTextureArray.kt b/src/main/java/de/bixilon/minosoft/gui/rendering/system/opengl/texture/OpenGLFontTextureArray.kt index 90116a9be..d0ac45728 100644 --- a/src/main/java/de/bixilon/minosoft/gui/rendering/system/opengl/texture/OpenGLFontTextureArray.kt +++ b/src/main/java/de/bixilon/minosoft/gui/rendering/system/opengl/texture/OpenGLFontTextureArray.kt @@ -43,6 +43,8 @@ class OpenGLFontTextureArray( override fun upload(latch: AbstractLatch?) { this.handle = OpenGLTextureUtil.createTextureArray(0) + // glTexParameteriv(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_SWIZZLE_RGBA, intArrayOf(GL_LUMINANCE, GL_LUMINANCE, GL_LUMINANCE, GL_LUMINANCE)) // TODO: not working? + glTexImage3D(GL_TEXTURE_2D_ARRAY, 0, GL_COMPRESSED_LUMINANCE_ALPHA, RESOLUTION, RESOLUTION, textures.size, 0, GL_RGBA, GL_UNSIGNED_BYTE, null as ByteBuffer?) for (texture in textures) { @@ -62,6 +64,7 @@ class OpenGLFontTextureArray( } override fun use(shader: NativeShader, name: String) { + if (state != TextureArrayStates.UPLOADED) throw IllegalStateException("Texture array is not uploaded yet! Are you trying to load a shader in the init phase?") shader.use() activate() diff --git a/src/main/java/de/bixilon/minosoft/gui/rendering/system/opengl/texture/OpenGLTextureArray.kt b/src/main/java/de/bixilon/minosoft/gui/rendering/system/opengl/texture/OpenGLTextureArray.kt index 83afb751c..1d7fece6a 100644 --- a/src/main/java/de/bixilon/minosoft/gui/rendering/system/opengl/texture/OpenGLTextureArray.kt +++ b/src/main/java/de/bixilon/minosoft/gui/rendering/system/opengl/texture/OpenGLTextureArray.kt @@ -53,7 +53,7 @@ class OpenGLTextureArray( private fun upload(resolution: Int, textures: List): Int { - val textureId = OpenGLTextureUtil.createTextureArray(mipmaps) + val handle = OpenGLTextureUtil.createTextureArray(mipmaps) for (level in 0..mipmaps) { glTexImage3D(GL_TEXTURE_2D_ARRAY, level, GL_RGBA8, resolution shr level, resolution shr level, textures.size, 0, GL_RGBA, GL_UNSIGNED_BYTE, null as ByteBuffer?) @@ -70,7 +70,7 @@ class OpenGLTextureArray( texture.data = TextureData.NULL } - return textureId + return handle } @@ -98,6 +98,7 @@ class OpenGLTextureArray( } override fun use(shader: NativeShader, name: String) { + if (state != TextureArrayStates.UPLOADED) throw IllegalStateException("Texture array is not uploaded yet! Are you trying to load a shader in the init phase?") shader.use() activate() diff --git a/src/main/java/de/bixilon/minosoft/gui/rendering/system/opengl/texture/dynamic/OpenGLDynamicTextureArray.kt b/src/main/java/de/bixilon/minosoft/gui/rendering/system/opengl/texture/dynamic/OpenGLDynamicTextureArray.kt index 233f2b4e3..2ed7446b7 100644 --- a/src/main/java/de/bixilon/minosoft/gui/rendering/system/opengl/texture/dynamic/OpenGLDynamicTextureArray.kt +++ b/src/main/java/de/bixilon/minosoft/gui/rendering/system/opengl/texture/dynamic/OpenGLDynamicTextureArray.kt @@ -96,6 +96,7 @@ class OpenGLDynamicTextureArray( } override fun unsafeUse(shader: NativeShader, name: String) { + if (handle <= 0) throw IllegalStateException("Texture array is not uploaded yet! Are you trying to load a shader in the init phase?") shader.use() activate() shader.setTexture("$name[$index]", index) diff --git a/src/main/java/de/bixilon/minosoft/protocol/packets/s2c/play/sign/SignTextS2CP.kt b/src/main/java/de/bixilon/minosoft/protocol/packets/s2c/play/sign/SignTextS2CP.kt index c9940379e..10ff27c8e 100644 --- a/src/main/java/de/bixilon/minosoft/protocol/packets/s2c/play/sign/SignTextS2CP.kt +++ b/src/main/java/de/bixilon/minosoft/protocol/packets/s2c/play/sign/SignTextS2CP.kt @@ -15,7 +15,6 @@ package de.bixilon.minosoft.protocol.packets.s2c.play.sign import de.bixilon.kotlinglm.vec3.Vec3i import de.bixilon.kutil.cast.CastUtil.unsafeCast import de.bixilon.minosoft.data.entities.block.sign.SignBlockEntity -import de.bixilon.minosoft.data.text.ChatComponent import de.bixilon.minosoft.protocol.network.connection.play.PlayConnection import de.bixilon.minosoft.protocol.packets.s2c.PlayS2CPacket import de.bixilon.minosoft.protocol.protocol.ProtocolVersions @@ -30,17 +29,9 @@ class SignTextS2CP(buffer: PlayInByteBuffer) : PlayS2CPacket { } else { buffer.readBlockPosition() } - val lines: Array + val lines = Array(SignBlockEntity.LINES) { buffer.readChatComponent() } - init { - val lines: MutableList = mutableListOf() - for (i in 0 until SignBlockEntity.LINES) { - lines.add(buffer.readChatComponent()) - } - this.lines = lines.toTypedArray() - } - override fun handle(connection: PlayConnection) { val entity = connection.world.getBlockEntity(position)?.unsafeCast() ?: SignBlockEntity(connection) diff --git a/src/main/java/de/bixilon/minosoft/util/KUtil.kt b/src/main/java/de/bixilon/minosoft/util/KUtil.kt index 4bc97f7bc..c96076636 100644 --- a/src/main/java/de/bixilon/minosoft/util/KUtil.kt +++ b/src/main/java/de/bixilon/minosoft/util/KUtil.kt @@ -359,7 +359,7 @@ object KUtil { } @Deprecated("kutil 1.25") - fun TaskWorker.minusAssign(identifier: Any) { + operator fun TaskWorker.minusAssign(identifier: Any) { this::class.java.getDeclaredField("tasks").apply { isAccessible = true }.get(this).unsafeCast>().remove(identifier) } }