9
0
mirror of https://github.com/Samsuik/Sakura.git synced 2025-12-21 15:59:26 +00:00
Files
SakuraMC/patches/server/0057-Calculate-biome-noise-once-per-chunk-section.patch
2024-07-20 00:28:08 +01:00

31 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 d4bd71f70f80ea74947e6d478ff636be2ab7d432..40502c4de98cb2b97b9389fc10e319686e684141 100644
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java
+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java
@@ -241,12 +241,18 @@ public class LevelChunkSection implements ca.spottedleaf.moonrise.patches.collis
public void fillBiomesFromNoise(BiomeResolver biomeSupplier, Climate.Sampler sampler, int x, int y, int z) {
PalettedContainer<Holder<Biome>> datapaletteblock = this.biomes.recreate();
+ Holder<Biome> biome = null; // Sakura
boolean flag = true;
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, y + i1, z + j1, sampler));
+ // Sakura start - calculate biome noise once per chunk section
+ if (biome == null || !me.samsuik.sakura.configuration.GlobalConfiguration.get().environment.calculateBiomeNoiseOncePerChunkSection) {
+ biome = biomeSupplier.getNoiseBiome(x + l, y + i1, z + j1, sampler);
+ }
+ datapaletteblock.getAndSetUnchecked(l, i1, j1, biome);
+ // Sakura end
}
}
}