mirror of
https://gitlab.bixilon.de/bixilon/minosoft.git
synced 2025-09-18 11:54:59 -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
|
||||
public void handle(Connection connection) {
|
||||
connection.getPlayer().getWorld().unloadChunk(getLocation());
|
||||
connection.getRenderer().getRenderWindow().getChunkRenderer().unloadChunk(this.location);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
x
Reference in New Issue
Block a user