Per world voxel engine
This commit is contained in:
@@ -3,6 +3,7 @@ package me.cortex.voxy.client;
|
|||||||
import me.cortex.voxy.client.core.VoxelCore;
|
import me.cortex.voxy.client.core.VoxelCore;
|
||||||
import me.cortex.voxy.client.saver.ContextSelectionSystem;
|
import me.cortex.voxy.client.saver.ContextSelectionSystem;
|
||||||
import me.cortex.voxy.client.terrain.WorldImportCommand;
|
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.config.Serialization;
|
||||||
import me.cortex.voxy.common.storage.compressors.ZSTDCompressor;
|
import me.cortex.voxy.common.storage.compressors.ZSTDCompressor;
|
||||||
import me.cortex.voxy.common.storage.config.StorageConfig;
|
import me.cortex.voxy.common.storage.config.StorageConfig;
|
||||||
@@ -41,9 +42,4 @@ public class Voxy implements ClientModInitializer {
|
|||||||
public static void breakpoint() {
|
public static void breakpoint() {
|
||||||
int breakpoint = 0;
|
int breakpoint = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static void logError(Object... args) {
|
|
||||||
System.err.println(Arrays.toString(args));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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.building.SectionUpdateRouter;
|
||||||
import me.cortex.voxy.client.core.rendering.section.AbstractSectionGeometryManager;
|
import me.cortex.voxy.client.core.rendering.section.AbstractSectionGeometryManager;
|
||||||
import me.cortex.voxy.client.core.util.ExpandingObjectAllocationList;
|
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.WorldEngine;
|
||||||
import me.cortex.voxy.common.world.WorldSection;
|
import me.cortex.voxy.common.world.WorldSection;
|
||||||
import me.jellysquid.mods.sodium.client.util.MathUtil;
|
import me.jellysquid.mods.sodium.client.util.MathUtil;
|
||||||
@@ -219,7 +220,7 @@ public class HierarchicalNodeManager {
|
|||||||
//============================================================================================================================================
|
//============================================================================================================================================
|
||||||
public void processChildChange(long position, byte childExistence) {
|
public void processChildChange(long position, byte childExistence) {
|
||||||
if (childExistence == 0) {
|
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);
|
int nodeId = this.activeSectionMap.get(position);
|
||||||
if (nodeId == NO_NODE) {
|
if (nodeId == NO_NODE) {
|
||||||
|
|||||||
16
src/main/java/me/cortex/voxy/common/Logger.java
Normal file
16
src/main/java/me/cortex/voxy/common/Logger.java
Normal 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(" ")));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
package me.cortex.voxy.commonImpl;
|
||||||
|
|
||||||
|
public interface IGetWorldInterface {
|
||||||
|
}
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
package me.cortex.voxy.commonImpl;
|
||||||
|
|
||||||
|
public class VoxyWorldService {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -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) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -3,6 +3,7 @@
|
|||||||
"package": "me.cortex.voxy.client.mixin",
|
"package": "me.cortex.voxy.client.mixin",
|
||||||
"compatibilityLevel": "JAVA_17",
|
"compatibilityLevel": "JAVA_17",
|
||||||
"client": [
|
"client": [
|
||||||
|
"chunky.MixinFabricWorld",
|
||||||
"joml.AccessFrustumIntersection",
|
"joml.AccessFrustumIntersection",
|
||||||
"minecraft.MixinClientChunkManager",
|
"minecraft.MixinClientChunkManager",
|
||||||
"minecraft.MixinDebugHud",
|
"minecraft.MixinDebugHud",
|
||||||
@@ -16,8 +17,5 @@
|
|||||||
],
|
],
|
||||||
"injectors": {
|
"injectors": {
|
||||||
"defaultRequire": 1
|
"defaultRequire": 1
|
||||||
},
|
}
|
||||||
"mixins": [
|
|
||||||
"chunky.MixinFabricWorld"
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
11
src/main/resources/common.voxy.mixins.json
Normal file
11
src/main/resources/common.voxy.mixins.json
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
{
|
||||||
|
"required": true,
|
||||||
|
"package": "me.cortex.voxy.commonImpl.mixin",
|
||||||
|
"compatibilityLevel": "JAVA_17",
|
||||||
|
"injectors": {
|
||||||
|
"defaultRequire": 1
|
||||||
|
},
|
||||||
|
"mixins": [
|
||||||
|
"minecraft.MixinWorld"
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -24,7 +24,8 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"mixins": [
|
"mixins": [
|
||||||
"voxy.mixins.json"
|
"client.voxy.mixins.json",
|
||||||
|
"common.voxy.mixins.json"
|
||||||
],
|
],
|
||||||
"depends": {
|
"depends": {
|
||||||
"minecraft": "1.21",
|
"minecraft": "1.21",
|
||||||
|
|||||||
Reference in New Issue
Block a user