biome cache resetting

This commit is contained in:
Moritz Zwerger 2023-12-08 07:41:07 +01:00
parent e6c9c73bb9
commit 0bc7a7bbf6
No known key found for this signature in database
GPG Key ID: 5CAD791931B09AC4
3 changed files with 9 additions and 2 deletions

View File

@ -29,7 +29,6 @@ class PerformanceC(profile: RenderingProfile) {
* Biomes may not match anymore.
* If true, chunk receiving is way faster.
* Only affects 19w36+ (~1.14.4)
* ToDo: Requires rejoin to apply
*/
var fastBiomeNoise by BooleanDelegate(profile, false)

View File

@ -67,6 +67,13 @@ class WorldBiomes(val world: World) : BiomeAccessor {
fun resetCache() {
// TODO
world.lock.lock()
for ((_, chunk) in world.chunks.chunks.unsafe) {
for (section in chunk.sections) {
if (section == null) continue
section.biomes.clear()
}
}
world.lock.unlock()
}
}

View File

@ -25,6 +25,7 @@ object DebugCommand : ConnectionCommand {
.addChild(LiteralNode("network").addChild(
LiteralNode("detach", executor = { it.connection.network.detach(); it.connection.util.sendDebugMessage("Now you are alone on the wire...") }),
))
.addChild(LiteralNode("cache").addChild(LiteralNode("biome", executor = { it.connection.world.biomes.resetCache(); it.connection.util.sendDebugMessage("Biome cache cleared!") })))
private fun CommandStack.fly() {