Per world voxel engine

This commit is contained in:
mcrcortex
2024-08-23 00:02:11 +10:00
parent 1a42f115fb
commit c0cc236c40
9 changed files with 67 additions and 11 deletions

View File

@@ -3,6 +3,7 @@ package me.cortex.voxy.client;
import me.cortex.voxy.client.core.VoxelCore;
import me.cortex.voxy.client.saver.ContextSelectionSystem;
import me.cortex.voxy.client.terrain.WorldImportCommand;
import me.cortex.voxy.common.Logger;
import me.cortex.voxy.common.config.Serialization;
import me.cortex.voxy.common.storage.compressors.ZSTDCompressor;
import me.cortex.voxy.common.storage.config.StorageConfig;
@@ -41,9 +42,4 @@ public class Voxy implements ClientModInitializer {
public static void breakpoint() {
int breakpoint = 0;
}
public static void logError(Object... args) {
System.err.println(Arrays.toString(args));
}
}

View File

@@ -8,6 +8,7 @@ import me.cortex.voxy.client.core.rendering.building.BuiltSection;
import me.cortex.voxy.client.core.rendering.building.SectionUpdateRouter;
import me.cortex.voxy.client.core.rendering.section.AbstractSectionGeometryManager;
import me.cortex.voxy.client.core.util.ExpandingObjectAllocationList;
import me.cortex.voxy.common.Logger;
import me.cortex.voxy.common.world.WorldEngine;
import me.cortex.voxy.common.world.WorldSection;
import me.jellysquid.mods.sodium.client.util.MathUtil;
@@ -219,7 +220,7 @@ public class HierarchicalNodeManager {
//============================================================================================================================================
public void processChildChange(long position, byte childExistence) {
if (childExistence == 0) {
Voxy.logError("Section at " + WorldEngine.pprintPos(position) + " had empty child existence!!");
Logger.logError("Section at " + WorldEngine.pprintPos(position) + " had empty child existence!!");
}
int nodeId = this.activeSectionMap.get(position);
if (nodeId == NO_NODE) {

View File

@@ -0,0 +1,16 @@
package me.cortex.voxy.common;
import org.slf4j.LoggerFactory;
import java.util.Arrays;
import java.util.stream.Collectors;
import java.util.stream.Stream;
public class Logger {
private static final org.slf4j.Logger LOGGER = LoggerFactory.getLogger("Voxy");
public static void logError(Object... args) {
var stackEntry = new Throwable().getStackTrace()[1];
LOGGER.error("["+stackEntry.getClassName()+"]: "+ Stream.of(args).map(Object::toString).collect(Collectors.joining(" ")));
}
}

View File

@@ -0,0 +1,4 @@
package me.cortex.voxy.commonImpl;
public interface IGetWorldInterface {
}

View File

@@ -0,0 +1,5 @@
package me.cortex.voxy.commonImpl;
public class VoxyWorldService {
}

View File

@@ -0,0 +1,24 @@
package me.cortex.voxy.commonImpl.mixin.minecraft;
import me.cortex.voxy.client.Voxy;
import me.cortex.voxy.common.world.WorldEngine;
import net.minecraft.world.World;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Unique;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(World.class)
public class MixinWorld {
@Unique private WorldEngine voxyWorldEngine;
@Inject(method = "close", at = @At("HEAD"))
private void closeVoxyWorld(CallbackInfo ci) {
if (this.voxyWorldEngine != null) {
try {this.voxyWorldEngine.shutdown();} catch (Exception e) {
}
}
}
}

View File

@@ -3,6 +3,7 @@
"package": "me.cortex.voxy.client.mixin",
"compatibilityLevel": "JAVA_17",
"client": [
"chunky.MixinFabricWorld",
"joml.AccessFrustumIntersection",
"minecraft.MixinClientChunkManager",
"minecraft.MixinDebugHud",
@@ -16,8 +17,5 @@
],
"injectors": {
"defaultRequire": 1
},
"mixins": [
"chunky.MixinFabricWorld"
]
}
}

View File

@@ -0,0 +1,11 @@
{
"required": true,
"package": "me.cortex.voxy.commonImpl.mixin",
"compatibilityLevel": "JAVA_17",
"injectors": {
"defaultRequire": 1
},
"mixins": [
"minecraft.MixinWorld"
]
}

View File

@@ -24,7 +24,8 @@
]
},
"mixins": [
"voxy.mixins.json"
"client.voxy.mixins.json",
"common.voxy.mixins.json"
],
"depends": {
"minecraft": "1.21",