BillBodkin
BillBodkin
DHDistant Horizons
Created by BillBodkin on 7/25/2024 in #help-me
Mod dev question - How to check if a chunk has been cached to sqlite?
Hi. I am currently creating a crude mod to cache chunks on singleplayer or multiplayer by teleporting the player around the spawn area to have their client cache the chunks into DH. What I have currently works on a basic level, however I believe the way I am checking if a chunk is already in the sqlite db is sub optimal:
BlockPos blockPos = some block within the chunk I wish to check;

var cachedBlockData = DhApi.Delayed.terrainRepo.getSingleDataPointAtBlockPos(
DhApi.Delayed.worldProxy.getSinglePlayerLevel(),
blockPos.getX(),
blockPos.getY(),
blockPos.getZ()
);

bool chunkCached = cachedBlockData.success;
BlockPos blockPos = some block within the chunk I wish to check;

var cachedBlockData = DhApi.Delayed.terrainRepo.getSingleDataPointAtBlockPos(
DhApi.Delayed.worldProxy.getSinglePlayerLevel(),
blockPos.getX(),
blockPos.getY(),
blockPos.getZ()
);

bool chunkCached = cachedBlockData.success;
(Full repo: https://gitlab.com/billyg270/bb-preload-world) My question is if there is a more preformant way to preform this check. Thanks!
23 replies