diff --git a/src/main/java/me/cortex/voxy/common/world/WorldEngine.java b/src/main/java/me/cortex/voxy/common/world/WorldEngine.java index cf3334eb..b31ce2b7 100644 --- a/src/main/java/me/cortex/voxy/common/world/WorldEngine.java +++ b/src/main/java/me/cortex/voxy/common/world/WorldEngine.java @@ -52,10 +52,15 @@ public class WorldEngine { public WorldEngine(SectionStorage storage, @Nullable VoxyInstance instance) { this.instanceIn = instance; + int cacheSize = 1024; + if (Runtime.getRuntime().maxMemory()>=(1L<<32)-200<<20) { + cacheSize = 2048; + } + this.storage = storage; this.mapper = new Mapper(this.storage); //5 cache size bits means that the section tracker has 32 separate maps that it uses - this.sectionTracker = new ActiveSectionTracker(6, storage::loadSection, 2048, this); + this.sectionTracker = new ActiveSectionTracker(6, storage::loadSection, cacheSize, this); } public WorldSection acquireIfExists(int lvl, int x, int y, int z) {