9
0
mirror of https://github.com/Samsuik/Sakura.git synced 2025-12-23 16:59:16 +00:00
Files
SakuraMC/patches/server/0058-Calculate-biome-noise-once-per-chunk-section.patch
2024-12-01 17:09:32 +00:00

30 lines
1.7 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Samsuik <kfian294ma4@gmail.com>
Date: Mon, 22 Jan 2024 15:52:33 +0000
Subject: [PATCH] Calculate biome noise once per chunk section
diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java
index b0c9fce9d4e06cac139e341d218d0b6aac1f1943..a256712836ae89bea619f534097d6111ba58d390 100644
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java
+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java
@@ -315,11 +315,17 @@ public class LevelChunkSection {
PalettedContainer<Holder<Biome>> datapaletteblock = this.biomes.recreate();
int k = QuartPos.fromBlock(this.bottomBlockY());
boolean flag = true;
+ Holder<Biome> biomeHolder = null; // Sakura - calculate biome noise once per chunk section
for (int l = 0; l < 4; ++l) {
for (int i1 = 0; i1 < 4; ++i1) {
for (int j1 = 0; j1 < 4; ++j1) {
- datapaletteblock.getAndSetUnchecked(l, i1, j1, biomeSupplier.getNoiseBiome(x + l, k + i1, z + j1, sampler));
+ // Sakura start - calculate biome noise once per chunk section
+ if (biomeHolder == null || !me.samsuik.sakura.configuration.GlobalConfiguration.get().environment.calculateBiomeNoiseOncePerChunkSection) {
+ biomeHolder = biomeSupplier.getNoiseBiome(x + l, k + i1, z + j1, sampler);
+ }
+ datapaletteblock.getAndSetUnchecked(l, i1, j1, biomeHolder);
+ // Sakura end - calculate biome noise once per chunk section
}
}
}