mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-12 03:24:06 +09:00
fix: new world from world portal not updating world ref of IngameRenderer
This commit is contained in:
@@ -175,26 +175,29 @@ object IngameRenderer : Disposable {
|
||||
* - When the game make transition to the new world (advancing to the next level/entering or exiting the room)
|
||||
*/
|
||||
fun setRenderedWorld(world: GameWorld) {
|
||||
try {
|
||||
if (this.world != world) {
|
||||
printdbg(this, "Set new RenderedWorld (UUID=${world.worldIndex}) at time ${System.currentTimeMillis()}, called by:")
|
||||
printStackTrace(this)
|
||||
|
||||
try {
|
||||
if (this.world != world) {
|
||||
// printdbg(this, "World change detected -- " +
|
||||
// "old world: ${this.world.hashCode()}, " +
|
||||
// "new world: ${world.hashCode()}")
|
||||
|
||||
// change worlds from internal methods
|
||||
this.world = world
|
||||
LightmapRenderer.internalSetWorld(world)
|
||||
BlocksDrawer.world = world
|
||||
FeaturesDrawer.world = world
|
||||
|
||||
newWorldLoadedLatch = true
|
||||
}
|
||||
}
|
||||
catch (e: UninitializedPropertyAccessException) {
|
||||
// new init, do nothing
|
||||
// change worlds from internal methods
|
||||
this.world = world
|
||||
LightmapRenderer.internalSetWorld(world)
|
||||
BlocksDrawer.world = world
|
||||
FeaturesDrawer.world = world
|
||||
|
||||
newWorldLoadedLatch = true
|
||||
}
|
||||
}
|
||||
catch (e: UninitializedPropertyAccessException) {
|
||||
// new init, do nothing
|
||||
this.world = world
|
||||
}
|
||||
}
|
||||
|
||||
private var oldCamX = 0
|
||||
|
||||
|
||||
@@ -52,6 +52,8 @@ class WorldgenLoadScreen(screenToBeLoaded: IngameInstance, private val worldwidt
|
||||
|
||||
previewPixmap.setColor(Color.BLACK)
|
||||
previewPixmap.fill()
|
||||
|
||||
IngameRenderer.setRenderedWorld(world)
|
||||
}
|
||||
|
||||
override fun render(delta: Float) {
|
||||
|
||||
Reference in New Issue
Block a user