Experiments

This commit is contained in:
mcrcortex
2024-01-13 11:57:48 +10:00
parent 8d7fc753b8
commit 168c4f4d81
8 changed files with 28 additions and 12 deletions

View File

@@ -36,7 +36,7 @@ dependencies {
modImplementation(fabricApi.module("fabric-command-api-v2", project.fabric_version)) modImplementation(fabricApi.module("fabric-command-api-v2", project.fabric_version))
modImplementation("net.fabricmc.fabric-api:fabric-rendering-data-attachment-v1:0.3.38+73761d2e9a") modImplementation("net.fabricmc.fabric-api:fabric-rendering-data-attachment-v1:0.3.38+73761d2e9a")
modImplementation "maven.modrinth:sodium:mc1.20.2-0.5.3" modImplementation "maven.modrinth:sodium:mc1.20.3-0.5.5"
} }

View File

@@ -3,13 +3,13 @@ org.gradle.jvmargs=-Xmx1G
# Fabric Properties # Fabric Properties
# check these on https://modmuss50.me/fabric.html # check these on https://modmuss50.me/fabric.html
minecraft_version=1.20.2 minecraft_version=1.20.4
yarn_mappings=1.20.2+build.1 yarn_mappings=1.20.4+build.1
loader_version=0.14.22 loader_version=0.14.22
# Mod Properties # Mod Properties
mod_version = 0.0.1 mod_version = 0.0.1
maven_group = me.cortex maven_group = me.cortex
archives_base_name = voxelmon archives_base_name = zenith
fabric_version=0.89.0+1.20.2 fabric_version=0.89.0+1.20.2

View File

@@ -57,6 +57,5 @@ public class Test {
//WorldEngine engine = new WorldEngine(new File("storagefile2.db"), 5); //WorldEngine engine = new WorldEngine(new File("storagefile2.db"), 5);
WorldImporter importer = new WorldImporter(null, null); WorldImporter importer = new WorldImporter(null, null);
//importer.importWorld(new File("run/saves/Drehmal 2.2 Apotheosis Beta - 1.0.0/region/")); //importer.importWorld(new File("run/saves/Drehmal 2.2 Apotheosis Beta - 1.0.0/region/"));
importer.importWorldAsyncStart(new File("D:\\PrismLauncher-Windows-MSVC-Portable-7.1\\instances\\1.20.1(3)\\.minecraft\\.bobby\\build.docm77.de\\-8149132374211427218\\minecraft\\overworld\\"), 2,null, null);
} }
} }

View File

@@ -203,5 +203,9 @@ public class DistanceTracker {
}); });
ops.clear(); ops.clear();
} }
public void fill() {
}
} }
} }

View File

@@ -0,0 +1,10 @@
package me.cortex.voxelmon.core;
//Tracks the distance with respect to the entire world size
public class TreeDistanceTracker {
private final int scalingFactor;
public TreeDistanceTracker(int scalingFactor) {
this.scalingFactor = scalingFactor;
}
}

View File

@@ -53,7 +53,7 @@ public class VoxelCore {
Blocks.SPRUCE_LEAVES, Blocks.SPRUCE_LEAVES,
Blocks.BIRCH_LEAVES, Blocks.BIRCH_LEAVES,
Blocks.PINK_PETALS, Blocks.PINK_PETALS,
Blocks.FERN, Blocks.GRASS, Blocks.POTTED_FERN)); Blocks.FERN, Blocks.POTTED_FERN));
private static final Set<Block> biomeTintableUpFace = new HashSet<>(List.of(Blocks.GRASS_BLOCK)); private static final Set<Block> biomeTintableUpFace = new HashSet<>(List.of(Blocks.GRASS_BLOCK));
private static final Set<Block> waterTint = new HashSet<>(List.of(Blocks.WATER)); private static final Set<Block> waterTint = new HashSet<>(List.of(Blocks.WATER));
@@ -73,10 +73,10 @@ public class VoxelCore {
//Trigger the shared index buffer loading //Trigger the shared index buffer loading
SharedIndexBuffer.INSTANCE.id(); SharedIndexBuffer.INSTANCE.id();
this.renderer = new Gl46FarWorldRenderer(); this.renderer = new Gl46FarWorldRenderer();
this.world = new WorldEngine(new File("storagefile.db"), 20, 5);//"storagefile.db"//"ethoslab.db" this.world = new WorldEngine(new File("storagefile.db"), 5, 20, 5);//"storagefile.db"//"ethoslab.db"
this.renderTracker = new RenderTracker(this.world, this.renderer); this.renderTracker = new RenderTracker(this.world, this.renderer);
this.renderGen = new RenderGenerationService(this.world,4, this.renderTracker::processBuildResult); this.renderGen = new RenderGenerationService(this.world,10, this.renderTracker::processBuildResult);
this.world.setRenderTracker(this.renderTracker); this.world.setRenderTracker(this.renderTracker);
this.renderTracker.setRenderGen(this.renderGen); this.renderTracker.setRenderGen(this.renderGen);

View File

@@ -35,14 +35,14 @@ public class WorldEngine {
private final int maxMipLevels; private final int maxMipLevels;
public WorldEngine(File storagePath, int savingServiceWorkers, int maxMipLayers) { public WorldEngine(File storagePath, int ingestWorkers, int savingServiceWorkers, int maxMipLayers) {
this.maxMipLevels = maxMipLayers; this.maxMipLevels = maxMipLayers;
this.storage = new StorageBackend(storagePath); this.storage = new StorageBackend(storagePath);
this.mapper = new Mapper(this.storage); this.mapper = new Mapper(this.storage);
this.sectionTracker = new ActiveSectionTracker(maxMipLayers, this::unsafeLoadSection); this.sectionTracker = new ActiveSectionTracker(maxMipLayers, this::unsafeLoadSection);
this.savingService = new SectionSavingService(this, savingServiceWorkers); this.savingService = new SectionSavingService(this, savingServiceWorkers);
this.ingestService = new VoxelIngestService(this, 2); this.ingestService = new VoxelIngestService(this, ingestWorkers);
} }
private int unsafeLoadSection(WorldSection into) { private int unsafeLoadSection(WorldSection into) {
@@ -89,6 +89,8 @@ public class WorldEngine {
this.savingService.enqueueSave(section); this.savingService.enqueueSave(section);
} }
//TODO: move this to auxilery class so that it can take into account larger than 4 mip levels
//Executes an update to the world and automatically updates all the parent mip layers up to level 4 (e.g. where 1 chunk section is 1 block big) //Executes an update to the world and automatically updates all the parent mip layers up to level 4 (e.g. where 1 chunk section is 1 block big)
public void insertUpdate(VoxelizedSection section) { public void insertUpdate(VoxelizedSection section) {
//The >>1 is cause the world sections size is 32x32x32 vs the 16x16x16 of the voxelized section //The >>1 is cause the world sections size is 32x32x32 vs the 16x16x16 of the voxelized section

View File

@@ -9,6 +9,7 @@ import net.minecraft.block.Blocks;
import net.minecraft.nbt.NbtCompound; import net.minecraft.nbt.NbtCompound;
import net.minecraft.nbt.NbtIo; import net.minecraft.nbt.NbtIo;
import net.minecraft.nbt.NbtOps; import net.minecraft.nbt.NbtOps;
import net.minecraft.nbt.NbtTagSizeTracker;
import net.minecraft.registry.entry.RegistryEntry; import net.minecraft.registry.entry.RegistryEntry;
import net.minecraft.stat.Stat; import net.minecraft.stat.Stat;
import net.minecraft.world.biome.Biome; import net.minecraft.world.biome.Biome;
@@ -199,7 +200,7 @@ public class Mapper {
public static StateEntry deserialize(int id, byte[] data) { public static StateEntry deserialize(int id, byte[] data) {
try { try {
var compound = NbtIo.readCompressed(new ByteArrayInputStream(data)); var compound = NbtIo.readCompressed(new ByteArrayInputStream(data), NbtTagSizeTracker.ofUnlimitedBytes());
if (compound.getInt("id") != id) { if (compound.getInt("id") != id) {
throw new IllegalStateException("Encoded id != expected id"); throw new IllegalStateException("Encoded id != expected id");
} }
@@ -235,7 +236,7 @@ public class Mapper {
public static BiomeEntry deserialize(int id, byte[] data) { public static BiomeEntry deserialize(int id, byte[] data) {
try { try {
var compound = NbtIo.readCompressed(new ByteArrayInputStream(data)); var compound = NbtIo.readCompressed(new ByteArrayInputStream(data), NbtTagSizeTracker.ofUnlimitedBytes());
if (compound.getInt("id") != id) { if (compound.getInt("id") != id) {
throw new IllegalStateException("Encoded id != expected id"); throw new IllegalStateException("Encoded id != expected id");
} }