mirror of
https://github.com/Samsuik/Sakura.git
synced 2026-01-04 15:31:43 +00:00
Calculate biome noise once per chunk section
This is only intended for plot worlds, and disabled by default. Only use if you know what you're doing.
This commit is contained in:
@@ -318,16 +318,17 @@ index 0000000000000000000000000000000000000000..0b5f50c7447d1c1732a745bae54c4fcd
|
||||
+}
|
||||
diff --git a/src/main/java/me/samsuik/sakura/configuration/GlobalConfiguration.java b/src/main/java/me/samsuik/sakura/configuration/GlobalConfiguration.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..ebdb73fa24fd2600925bf5664ceda202b8da04c0
|
||||
index 0000000000000000000000000000000000000000..5296d4e0a1041932e36562f42fbf3e1dcfea33fe
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/me/samsuik/sakura/configuration/GlobalConfiguration.java
|
||||
@@ -0,0 +1,60 @@
|
||||
@@ -0,0 +1,64 @@
|
||||
+package me.samsuik.sakura.configuration;
|
||||
+
|
||||
+import com.mojang.logging.LogUtils;
|
||||
+import io.papermc.paper.configuration.Configuration;
|
||||
+import io.papermc.paper.configuration.ConfigurationPart;
|
||||
+import org.slf4j.Logger;
|
||||
+import org.spongepowered.configurate.objectmapping.meta.Comment;
|
||||
+import org.spongepowered.configurate.objectmapping.meta.Setting;
|
||||
+
|
||||
+@SuppressWarnings({"CanBeFinal", "FieldCanBeLocal", "FieldMayBeFinal", "NotNullFieldNotInitialized", "InnerClassMayBeStatic", "RedundantSuppression"})
|
||||
@@ -370,6 +371,9 @@ index 0000000000000000000000000000000000000000..ebdb73fa24fd2600925bf5664ceda202
|
||||
+
|
||||
+ public Environment environment;
|
||||
+ public class Environment extends ConfigurationPart {
|
||||
+ @Comment("This is only intended for plot worlds. Will affect chunk generation on servers.")
|
||||
+ public boolean calculateBiomeNoiseOncePerChunkSection = false;
|
||||
+
|
||||
+ public MobSpawnerDefaults mobSpawnerDefaults = new MobSpawnerDefaults();
|
||||
+ public class MobSpawnerDefaults extends ConfigurationPart {
|
||||
+ public int minSpawnDelay = 200;
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
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 f0de72afad4bb571153436399386a6a8a70582a6..0e38415230f4c59727cd8414ed3ff19b3b32f183 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java
|
||||
@@ -227,12 +227,18 @@ public class LevelChunkSection {
|
||||
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user