mirror of https://github.com/PaperMC/Paper.git
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:
parent
2f4281e2b4
commit
00331d943e
|
@ -4850,6 +4850,38 @@ index 0d536d72ac918fbd403397ff369d10143ee9c204..6051e5f272838ef23276a90e21c2fc82
|
|||
|
||||
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..33091331ec742767611fad1ab2a324fa334650c5 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/WorldGenRegion.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/WorldGenRegion.java
|
||||
@@ -107,6 +107,27 @@ public class WorldGenRegion implements WorldGenLevel {
|
||||
}
|
||||
}
|
||||
|
||||
+ // Paper start - starlight
|
||||
+ @Override
|
||||
+ public int getBrightness(final net.minecraft.world.level.LightLayer lightLayer, final BlockPos blockPos) {
|
||||
+ final ChunkAccess chunk = this.getChunk(blockPos.getX() >> 4, blockPos.getZ() >> 4);
|
||||
+ if (!chunk.isLightCorrect()) {
|
||||
+ return 0;
|
||||
+ }
|
||||
+ return this.getLightEngine().getLayerListener(lightLayer).getLightValue(blockPos);
|
||||
+ }
|
||||
+
|
||||
+
|
||||
+ @Override
|
||||
+ public int getRawBrightness(final BlockPos blockPos, final int subtract) {
|
||||
+ final ChunkAccess chunk = this.getChunk(blockPos.getX() >> 4, blockPos.getZ() >> 4);
|
||||
+ if (!chunk.isLightCorrect()) {
|
||||
+ return 0;
|
||||
+ }
|
||||
+ return this.getLightEngine().getRawBrightness(blockPos, subtract);
|
||||
+ }
|
||||
+ // Paper end - starlight
|
||||
+
|
||||
public boolean isOldChunkAround(ChunkPos chunkPos, int checkRadius) {
|
||||
return this.level.getChunkSource().chunkMap.isOldChunkAround(chunkPos, checkRadius);
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java
|
||||
index 2b8e88a75e9a974e1ecafe0360a9d69b79326d11..6c171199dcc30f56a6d0ab7ecf398b505d145067 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -13,10 +13,10 @@ we'll also only gen a trace for the first one, I see no real pressing need
|
|||
to generate more, given that that would *massively* negate this patch otherwise
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/WorldGenRegion.java b/src/main/java/net/minecraft/server/level/WorldGenRegion.java
|
||||
index 73b96f804079288e9c5fcc11da54e61e89a6782a..52fd12c474c01f3b53d0f6596b7a6fafee52bd0d 100644
|
||||
index a38e279c9b36e539c45f410da827056a80acc43c..78284a89900e6b3ee0c066d00ba3ddf043b63401 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/WorldGenRegion.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/WorldGenRegion.java
|
||||
@@ -275,6 +275,7 @@ public class WorldGenRegion implements WorldGenLevel {
|
||||
@@ -296,6 +296,7 @@ public class WorldGenRegion implements WorldGenLevel {
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -24,7 +24,7 @@ index 73b96f804079288e9c5fcc11da54e61e89a6782a..52fd12c474c01f3b53d0f6596b7a6faf
|
|||
@Override
|
||||
public boolean ensureCanWrite(BlockPos pos) {
|
||||
int i = SectionPos.blockToSectionCoord(pos.getX());
|
||||
@@ -294,7 +295,15 @@ public class WorldGenRegion implements WorldGenLevel {
|
||||
@@ -315,7 +316,15 @@ public class WorldGenRegion implements WorldGenLevel {
|
||||
|
||||
return true;
|
||||
} else {
|
||||
|
|
|
@ -5,10 +5,10 @@ Subject: [PATCH] Fix async entity add due to fungus trees
|
|||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/WorldGenRegion.java b/src/main/java/net/minecraft/server/level/WorldGenRegion.java
|
||||
index 52fd12c474c01f3b53d0f6596b7a6fafee52bd0d..877498729c66de9aa6a27c9148f7494d7895615c 100644
|
||||
index 78284a89900e6b3ee0c066d00ba3ddf043b63401..50ed7cfe1ecef6d075ba484804827cec83ba2bf2 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/WorldGenRegion.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/WorldGenRegion.java
|
||||
@@ -228,6 +228,7 @@ public class WorldGenRegion implements WorldGenLevel {
|
||||
@@ -249,6 +249,7 @@ public class WorldGenRegion implements WorldGenLevel {
|
||||
if (iblockdata.isAir()) {
|
||||
return false;
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue