Remove chunk cache tweaking from datapack

This commit is contained in:
DBotThePony 2025-03-02 11:29:08 +07:00
parent f9c8130e26
commit cc9ebef018
Signed by: DBot
GPG Key ID: DCC23B5715498507

View File

@ -39,11 +39,6 @@ abstract class AbstractEnormousPlacement(val parameters: Parameters) : Placement
* Baseline placement modifiers, dictating how to appear in chunk * Baseline placement modifiers, dictating how to appear in chunk
*/ */
val placementModifiers: List<PlacementModifier>, val placementModifiers: List<PlacementModifier>,
/**
* How many chunks to remember placements in, usually not required to be adjusted
*/
val chunkCacheSize: Int = 16384,
) )
private class GeneratedChunk(positions: Stream<BlockPos>) { private class GeneratedChunk(positions: Stream<BlockPos>) {
@ -66,7 +61,7 @@ abstract class AbstractEnormousPlacement(val parameters: Parameters) : Placement
private val chunkCache = Caffeine.newBuilder() private val chunkCache = Caffeine.newBuilder()
.scheduler(Scheduler.systemScheduler()) .scheduler(Scheduler.systemScheduler())
.executor(Util.backgroundExecutor()) .executor(Util.backgroundExecutor())
.maximumSize(parameters.chunkCacheSize.toLong()) .maximumSize(16384L)
.expireAfterWrite(Duration.ofMinutes(5)) .expireAfterWrite(Duration.ofMinutes(5))
.softValues() .softValues()
.build<ChunkPos, GeneratedChunk>() .build<ChunkPos, GeneratedChunk>()
@ -103,7 +98,6 @@ abstract class AbstractEnormousPlacement(val parameters: Parameters) : Placement
it.group( it.group(
Codec.INT.minRange(0).fieldOf("chunk_scan_range").forGetter(Parameters::chunkScanRange), Codec.INT.minRange(0).fieldOf("chunk_scan_range").forGetter(Parameters::chunkScanRange),
CODEC.listOf().fieldOf("placement").forGetter(Parameters::placementModifiers), CODEC.listOf().fieldOf("placement").forGetter(Parameters::placementModifiers),
Codec.INT.inRange(0, 128_000).optionalFieldOf("cache_size", 16384).forGetter(Parameters::chunkCacheSize),
).apply(it, ::Parameters) ).apply(it, ::Parameters)
} }
} }