Fix mushrooms not generating in swamps

During feature generation, light data is not initialised and
will always return 15 in Starlight. Vanilla can possibly return
0 if partially initialised, which allows some mushroom blocks to
generate.

In general, the brightness value from the light engine should not
be used until the chunk is ready. To emulate Vanilla behavior better,
we return 0 as the brightness during world gen unless the target
chunk is finished lighting.

The regular light retrieval outside of WorldGenRegion remains
the same, as behaviorally chunks not lit should be at max
skylight and zero block light.
This commit is contained in:
Spottedleaf 2023-10-16 18:52:28 -07:00
parent 2f4281e2b4
commit 00331d943e
4 changed files with 40 additions and 8 deletions

View file

@ -20403,10 +20403,10 @@ index 6051e5f272838ef23276a90e21c2fc821ca155d1..658e63ebde81dc14c8ab5850fb246dc0
public static <T> TicketType<T> create(String name, Comparator<T> argumentComparator) {
return new TicketType<>(name, argumentComparator, 0L);
diff --git a/src/main/java/net/minecraft/server/level/WorldGenRegion.java b/src/main/java/net/minecraft/server/level/WorldGenRegion.java
index e96a0ca47e4701ba187555bd92c968345bc85677..73b96f804079288e9c5fcc11da54e61e89a6782a 100644
index 33091331ec742767611fad1ab2a324fa334650c5..a38e279c9b36e539c45f410da827056a80acc43c 100644
--- a/src/main/java/net/minecraft/server/level/WorldGenRegion.java
+++ b/src/main/java/net/minecraft/server/level/WorldGenRegion.java
@@ -504,4 +504,21 @@ public class WorldGenRegion implements WorldGenLevel {
@@ -525,4 +525,21 @@ public class WorldGenRegion implements WorldGenLevel {
public long nextSubTickCount() {
return this.subTickCount.getAndIncrement();
}
@ -21314,7 +21314,7 @@ index 846ae3fd184a1d63b743aa25e045604576697c96..a907b79fd8291a0e92db138f37239d17
public int getIndex() {
diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
index bcdaa86cfd31c2ce4aadad900c348aee0a9e3fc8..85b38592c87bbc071d3fc5de5db131c6626fe004 100644
index f225a51d284a64d5a962256ab5d7b2d07544dc88..998ca8d123e8b373f0ce5c10f76ec128d35b260a 100644
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
@@ -83,6 +83,7 @@ public class LevelChunk extends ChunkAccess {