This commit is contained in:
mcrcortex
2024-02-08 17:23:13 +10:00
parent 7a59330eb6
commit 69b200f894
5 changed files with 27 additions and 12 deletions

View File

@@ -105,6 +105,6 @@ dependencies {
include(runtimeOnly "org.lwjgl:lwjgl-lmdb:$lwjglVersion:natives-linux")
include(runtimeOnly "org.lwjgl:lwjgl-zstd:$lwjglVersion:natives-linux")
implementation 'org.rocksdb:rocksdbjni:8.10.0'
implementation 'redis.clients:jedis:5.1.0'
include(implementation 'org.rocksdb:rocksdbjni:8.10.0')
include(implementation 'redis.clients:jedis:5.1.0')
}

View File

@@ -87,7 +87,7 @@ public class DistanceTracker {
public void init(int x, int z) {
//Radius of chunks to enqueue
int SIZE = 40;
int SIZE = 64;
//Insert highest LOD level
for (int ox = -SIZE; ox <= SIZE; ox++) {
for (int oz = -SIZE; oz <= SIZE; oz++) {

View File

@@ -10,6 +10,9 @@ import me.cortex.voxy.common.world.other.Mapper;
import net.minecraft.block.FluidBlock;
import org.lwjgl.system.MemoryUtil;
import java.lang.reflect.Array;
import java.util.Arrays;
public class RenderDataFactory {
private final WorldEngine world;
@@ -148,9 +151,13 @@ public class RenderDataFactory {
//Need to access the other connecting section
if (primary == 0) {
if (!obtainedOppositeSection0) {
var connectedSection = this.world.acquire(section.lvl, section.x - aX, section.y - aY, section.z - aZ);
var connectedSection = this.world.acquireIfExists(section.lvl, section.x - aX, section.y - aY, section.z - aZ);
if (connectedSection != null) {
connectedSection.copyDataTo(this.connectedSectionCache);
connectedSection.release();
} else {
Arrays.fill(this.connectedSectionCache, 0);
}
obtainedOppositeSection0 = true;
}
facingState = this.connectedSectionCache[WorldSection.getIndex(x*(1-aX)+(31*aX), y*(1-aY)+(31*aY), z*(1-aZ)+(31*aZ))];
@@ -165,9 +172,13 @@ public class RenderDataFactory {
//Need to access the other connecting section
if (primary == 31) {
if (!obtainedOppositeSection31) {
var connectedSection = this.world.acquire(section.lvl, section.x + aX, section.y + aY, section.z + aZ);
var connectedSection = this.world.acquireIfExists(section.lvl, section.x + aX, section.y + aY, section.z + aZ);
if (connectedSection != null) {
connectedSection.copyDataTo(this.connectedSectionCache);
connectedSection.release();
} else {
Arrays.fill(this.connectedSectionCache, 0);
}
obtainedOppositeSection31 = true;
}
facingState = this.connectedSectionCache[WorldSection.getIndex(x*(1-aX), y*(1-aY), z*(1-aZ))];

View File

@@ -49,8 +49,10 @@ public class ActiveSectionTracker {
}
if (status < 0) {
//TODO: Instead if throwing an exception do something better
throw new IllegalStateException("Unable to load section");
//TODO: Instead if throwing an exception do something better, like attempting to regen
//throw new IllegalStateException("Unable to load section: ");
System.err.println("Unable to load section " + section.key + " setting to air");
status = 1;
}
section.acquire();
holder.obj = section;

View File

@@ -67,7 +67,9 @@ public class SaveLoadSystem {
}
if (section.key != key) {
throw new IllegalStateException("Decompressed section not the same as requested. got: " + key + " expected: " + section.key);
//throw new IllegalStateException("Decompressed section not the same as requested. got: " + key + " expected: " + section.key);
System.err.println("Decompressed section not the same as requested. got: " + key + " expected: " + section.key);
return false;
}
for (int i = 0; i < section.data.length; i++) {