13
0
geforkt von Mirrors/Paper

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.
Dieser Commit ist enthalten in:
Spottedleaf 2023-10-16 18:52:28 -07:00
Ursprung b6f04d399f
Commit b119425c8e

Datei anzeigen

@ -4850,6 +4850,38 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/level/WorldGenRegion.java
+++ b/src/main/java/net/minecraft/server/level/WorldGenRegion.java
@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java