Random things

This commit is contained in:
mcrcortex
2025-04-14 01:28:57 +10:00
parent 5163cbd26e
commit c6aa690eee
3 changed files with 6 additions and 7 deletions

View File

@@ -47,6 +47,4 @@ public class UnsafeUtil {
public static void memcpy(short[] src, long dst) { public static void memcpy(short[] src, long dst) {
UNSAFE.copyMemory(src, SHORT_ARRAY_BASE_OFFSET, null, dst, (long) src.length <<1); UNSAFE.copyMemory(src, SHORT_ARRAY_BASE_OFFSET, null, dst, (long) src.length <<1);
} }
} }

View File

@@ -41,17 +41,17 @@ public class WorldEngine {
public final @Nullable VoxyInstance instanceIn; public final @Nullable VoxyInstance instanceIn;
public WorldEngine(SectionStorage storage, int cacheCount) { public WorldEngine(SectionStorage storage) {
this(storage, cacheCount, null); this(storage, null);
} }
public WorldEngine(SectionStorage storage, int cacheCount, @Nullable VoxyInstance instance) { public WorldEngine(SectionStorage storage, @Nullable VoxyInstance instance) {
this.instanceIn = instance; this.instanceIn = instance;
this.storage = storage; this.storage = storage;
this.mapper = new Mapper(this.storage); this.mapper = new Mapper(this.storage);
//5 cache size bits means that the section tracker has 32 separate maps that it uses //5 cache size bits means that the section tracker has 32 separate maps that it uses
this.sectionTracker = new ActiveSectionTracker(10, storage::loadSection, cacheCount, this); this.sectionTracker = new ActiveSectionTracker(10, storage::loadSection, 2048, this);
} }
public WorldSection acquireIfExists(int lvl, int x, int y, int z) { public WorldSection acquireIfExists(int lvl, int x, int y, int z) {

View File

@@ -67,6 +67,7 @@ public class VoxyInstance {
if (!this.activeWorlds.isEmpty()) { if (!this.activeWorlds.isEmpty()) {
throw new IllegalStateException("Not all worlds shutdown"); throw new IllegalStateException("Not all worlds shutdown");
} }
Logger.info("Instance shutdown");
} }
public ServiceThreadPool getThreadPool() { public ServiceThreadPool getThreadPool() {
@@ -99,7 +100,7 @@ public class VoxyInstance {
} }
protected WorldEngine createWorld(SectionStorage storage) { protected WorldEngine createWorld(SectionStorage storage) {
var world = new WorldEngine(storage, 2048, this); var world = new WorldEngine(storage, this);
world.setSaveCallback(this.savingService::enqueueSave); world.setSaveCallback(this.savingService::enqueueSave);
this.activeWorlds.add(world); this.activeWorlds.add(world);
return world; return world;