mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-03 17:52:28 +01:00
#1278: Return correct default light in chunk snapshot
By: DerFrZocker <derrieple@gmail.com>
This commit is contained in:
parent
4dc97ffa9d
commit
9713b3f255
1 changed files with 7 additions and 6 deletions
|
@ -56,7 +56,8 @@ public class CraftChunk implements Chunk {
|
|||
private final int x;
|
||||
private final int z;
|
||||
private static final DataPaletteBlock<IBlockData> emptyBlockIDs = new DataPaletteBlock<>(net.minecraft.world.level.block.Block.BLOCK_STATE_REGISTRY, Blocks.AIR.defaultBlockState(), DataPaletteBlock.d.SECTION_STATES);
|
||||
private static final byte[] emptyLight = new byte[2048];
|
||||
private static final byte[] FULL_LIGHT = new byte[2048];
|
||||
private static final byte[] EMPTY_LIGHT = new byte[2048];
|
||||
|
||||
public CraftChunk(net.minecraft.world.level.chunk.Chunk chunk) {
|
||||
worldServer = chunk.level;
|
||||
|
@ -318,14 +319,14 @@ public class CraftChunk implements Chunk {
|
|||
LevelLightEngine lightengine = worldServer.getLightEngine();
|
||||
NibbleArray skyLightArray = lightengine.getLayerListener(EnumSkyBlock.SKY).getDataLayerData(SectionPosition.of(x, chunk.getSectionYFromSectionIndex(i), z)); // SPIGOT-7498: Convert section index
|
||||
if (skyLightArray == null) {
|
||||
sectionSkyLights[i] = emptyLight;
|
||||
sectionSkyLights[i] = worldServer.dimensionType().hasSkyLight() ? FULL_LIGHT : EMPTY_LIGHT;
|
||||
} else {
|
||||
sectionSkyLights[i] = new byte[2048];
|
||||
System.arraycopy(skyLightArray.getData(), 0, sectionSkyLights[i], 0, 2048);
|
||||
}
|
||||
NibbleArray emitLightArray = lightengine.getLayerListener(EnumSkyBlock.BLOCK).getDataLayerData(SectionPosition.of(x, chunk.getSectionYFromSectionIndex(i), z)); // SPIGOT-7498: Convert section index
|
||||
if (emitLightArray == null) {
|
||||
sectionEmitLights[i] = emptyLight;
|
||||
sectionEmitLights[i] = EMPTY_LIGHT;
|
||||
} else {
|
||||
sectionEmitLights[i] = new byte[2048];
|
||||
System.arraycopy(emitLightArray.getData(), 0, sectionEmitLights[i], 0, 2048);
|
||||
|
@ -397,8 +398,8 @@ public class CraftChunk implements Chunk {
|
|||
|
||||
for (int i = 0; i < hSection; i++) {
|
||||
blockIDs[i] = emptyBlockIDs;
|
||||
skyLight[i] = emptyLight;
|
||||
emitLight[i] = emptyLight;
|
||||
skyLight[i] = world.getHandle().dimensionType().hasSkyLight() ? FULL_LIGHT : EMPTY_LIGHT;
|
||||
emitLight[i] = EMPTY_LIGHT;
|
||||
empty[i] = true;
|
||||
|
||||
if (biome != null) {
|
||||
|
@ -416,6 +417,6 @@ public class CraftChunk implements Chunk {
|
|||
}
|
||||
|
||||
static {
|
||||
Arrays.fill(emptyLight, (byte) 0xFF);
|
||||
Arrays.fill(FULL_LIGHT, (byte) 0xFF);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue