This commit is contained in:
mcrcortex
2024-02-14 21:13:54 +10:00
parent 31f228f725
commit f91755b043
5 changed files with 16 additions and 4 deletions

View File

@@ -20,6 +20,7 @@ public class VoxyConfig {
public static VoxyConfig CONFIG = loadOrCreate();
public boolean enabled = true;
public boolean ingestEnabled = true;
public int qualityScale = 20;
public int maxSections = 200_000;
public int geometryBufferSize = (1<<30)/8;

View File

@@ -67,6 +67,12 @@ public class VoxyConfigScreenFactory implements ModMenuApi {
.setDefaultValue(DEFAULT.enabled)
.build());
category.addEntry(entryBuilder.startBooleanToggle(Text.translatable("voxy.config.general.ingest"), config.ingestEnabled)
.setTooltip(Text.translatable("voxy.config.general.ingest.tooltip"))
.setSaveConsumer(val -> config.ingestEnabled = val)
.setDefaultValue(DEFAULT.ingestEnabled)
.build());
category.addEntry(entryBuilder.startIntSlider(Text.translatable("voxy.config.general.quality"), config.qualityScale, 8, 50)
.setTooltip(Text.translatable("voxy.config.general.quality.tooltip"))
.setSaveConsumer(val -> config.qualityScale = val)

View File

@@ -78,11 +78,13 @@ public class VoxelCore {
var biomeRegistry = MinecraftClient.getInstance().world.getRegistryManager().get(RegistryKeys.BIOME);
for (var biome : this.world.getMapper().getBiomeEntries()) {
this.renderer.getModelManager().addBiome(biome.id, biomeRegistry.get(new Identifier(biome.biome)));
//this.renderer.getModelManager().addBiome(biome.id, biomeRegistry.get(new Identifier(biome.biome)));
this.renderer.addBiome(biome);
}
for (var state : this.world.getMapper().getStateEntries()) {
this.renderer.getModelManager().addEntry(state.id, state.state);
//this.renderer.getModelManager().addEntry(state.id, state.state);
this.renderer.addBlockState(state);
}
//this.renderer.getModelManager().updateEntry(0, Blocks.GRASS_BLOCK.getDefaultState());

View File

@@ -105,8 +105,10 @@ public abstract class AbstractFarWorldRenderer {
UploadStream.INSTANCE.commit();
}
int maxUpdatesPerFrame = 30;
//Do any BlockChanges
while (!this.blockStateUpdates.isEmpty()) {
while ((!this.blockStateUpdates.isEmpty()) && (maxUpdatesPerFrame-- > 0)) {
var update = this.blockStateUpdates.pop();
this.models.addEntry(update.id, update.state);
}

View File

@@ -1,5 +1,6 @@
package me.cortex.voxy.client.mixin.minecraft;
import me.cortex.voxy.client.config.VoxyConfig;
import me.cortex.voxy.client.core.IGetVoxelCore;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.world.ClientChunkManager;
@@ -21,7 +22,7 @@ public class MixinClientChunkManager {
@Inject(require = 0, method = "unload", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/world/ClientChunkManager$ClientChunkMap;compareAndSet(ILnet/minecraft/world/chunk/WorldChunk;Lnet/minecraft/world/chunk/WorldChunk;)Lnet/minecraft/world/chunk/WorldChunk;", shift = At.Shift.BEFORE), locals = LocalCapture.CAPTURE_FAILHARD)
private void injectUnload(ChunkPos pos, CallbackInfo ci, int index, WorldChunk worldChunk) {
var core = ((IGetVoxelCore)(world.worldRenderer)).getVoxelCore();
if (core != null) {
if (core != null && VoxyConfig.CONFIG.ingestEnabled) {
core.enqueueIngest(worldChunk);
}
}