File tree Expand file tree Collapse file tree 2 files changed +17
-0
lines changed
c2me-rewrites-chunk-system/src/main/java/com/ishland/c2me/rewrites/chunksystem Expand file tree Collapse file tree 2 files changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -20,6 +20,20 @@ public class Config {
2020 """ )
2121 .getBoolean (false , false );
2222
23+ public static final boolean allowPOIUnloading = new ConfigSystem .ConfigAccessor ()
24+ .key ("chunkSystem.allowPOIUnloading" )
25+ .comment ("""
26+ Whether to allow POIs (Point of Interest) to be unloaded
27+ Unloaded POIs are reloaded on-demand or when the corresponding chunks are loaded again,
28+ which should not cause any behavior change
29+ \s
30+ Note:
31+ Vanilla never unloads POIs when chunks unload, causing small memory leaks
32+ These leaks adds up and eventually cause issues after generating millions of chunks
33+ in a single world instance
34+ """ )
35+ .getBoolean (true , false );
36+
2337 public static void init () {
2438 // intentionally empty
2539 }
Original file line number Diff line number Diff line change 11package com .ishland .c2me .rewrites .chunksystem .mixin ;
22
3+ import com .ishland .c2me .rewrites .chunksystem .common .Config ;
34import com .ishland .c2me .rewrites .chunksystem .common .ducks .IPOIUnloading ;
45import it .unimi .dsi .fastutil .longs .Long2ObjectMap ;
56import net .minecraft .util .math .ChunkPos ;
@@ -23,6 +24,8 @@ public abstract class MixinSerializingRegionBasedStorage<R> implements IPOIUnloa
2324
2425 @ Override
2526 public void c2me$unloadPoi (ChunkPos pos ) {
27+ if (!Config .allowPOIUnloading ) return ;
28+
2629 if (!this .c2me$shouldUnloadPoi (pos )) {
2730 return ;
2831 }
You can’t perform that action at this time.
0 commit comments