File tree Expand file tree Collapse file tree 1 file changed +29
-0
lines changed
common/src/main/kotlin/com/lambda/graphics/renderer/esp Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Original file line number Diff line number Diff line change 1+ package com.lambda.graphics.renderer.esp
2+
3+ import com.lambda.core.Loadable
4+ import com.lambda.event.events.ConnectionEvent
5+ import com.lambda.event.events.WorldEvent
6+ import com.lambda.event.listener.SafeListener.Companion.concurrentListener
7+ import net.minecraft.util.math.ChunkPos
8+ import net.minecraft.world.chunk.WorldChunk
9+ import java.util.concurrent.ConcurrentHashMap
10+
11+ object ChunkStorage : Loadable {
12+ val chunkMap = ChunkMap ()
13+
14+ init {
15+ concurrentListener<WorldEvent .ChunkEvent .Load > { event ->
16+ chunkMap[event.chunk.pos] = event.chunk
17+ }
18+
19+ concurrentListener<WorldEvent .ChunkEvent .Unload > { event ->
20+ chunkMap.remove(event.chunk.pos)
21+ }
22+
23+ concurrentListener<ConnectionEvent .Disconnect > {
24+ chunkMap.clear()
25+ }
26+ }
27+ }
28+
29+ typealias ChunkMap = ConcurrentHashMap <ChunkPos , WorldChunk >
You can’t perform that action at this time.
0 commit comments