mirror of
https://gitlab.bixilon.de/bixilon/minosoft.git
synced 2025-09-19 12:25:12 -04:00
rendering: handle unload chunk packet
This commit is contained in:
parent
edcc288898
commit
2ce1f233af
@ -149,4 +149,15 @@ class ChunkRenderer(private val connection: Connection, private val world: World
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun unloadChunk(location: ChunkLocation) {
|
||||||
|
renderWindow.renderQueue.add {
|
||||||
|
chunkSectionsToDraw[location]?.let {
|
||||||
|
for ((_, mesh) in it) {
|
||||||
|
mesh.unload()
|
||||||
|
}
|
||||||
|
chunkSectionsToDraw.remove(location)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -31,6 +31,7 @@ public class PacketUnloadChunk extends ClientboundPacket {
|
|||||||
@Override
|
@Override
|
||||||
public void handle(Connection connection) {
|
public void handle(Connection connection) {
|
||||||
connection.getPlayer().getWorld().unloadChunk(getLocation());
|
connection.getPlayer().getWorld().unloadChunk(getLocation());
|
||||||
|
connection.getRenderer().getRenderWindow().getChunkRenderer().unloadChunk(this.location);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
x
Reference in New Issue
Block a user