#1278: Return correct default light in chunk snapshot
This commit is contained in:
parent
2a381856b9
commit
b59004114e
@ -56,7 +56,8 @@ public class CraftChunk implements Chunk {
|
|||||||
private final int x;
|
private final int x;
|
||||||
private final int z;
|
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 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) {
|
public CraftChunk(net.minecraft.world.level.chunk.Chunk chunk) {
|
||||||
worldServer = chunk.level;
|
worldServer = chunk.level;
|
||||||
@ -318,14 +319,14 @@ public class CraftChunk implements Chunk {
|
|||||||
LevelLightEngine lightengine = worldServer.getLightEngine();
|
LevelLightEngine lightengine = worldServer.getLightEngine();
|
||||||
NibbleArray skyLightArray = lightengine.getLayerListener(EnumSkyBlock.SKY).getDataLayerData(SectionPosition.of(x, chunk.getSectionYFromSectionIndex(i), z)); // SPIGOT-7498: Convert section index
|
NibbleArray skyLightArray = lightengine.getLayerListener(EnumSkyBlock.SKY).getDataLayerData(SectionPosition.of(x, chunk.getSectionYFromSectionIndex(i), z)); // SPIGOT-7498: Convert section index
|
||||||
if (skyLightArray == null) {
|
if (skyLightArray == null) {
|
||||||
sectionSkyLights[i] = emptyLight;
|
sectionSkyLights[i] = worldServer.dimensionType().hasSkyLight() ? FULL_LIGHT : EMPTY_LIGHT;
|
||||||
} else {
|
} else {
|
||||||
sectionSkyLights[i] = new byte[2048];
|
sectionSkyLights[i] = new byte[2048];
|
||||||
System.arraycopy(skyLightArray.getData(), 0, sectionSkyLights[i], 0, 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
|
NibbleArray emitLightArray = lightengine.getLayerListener(EnumSkyBlock.BLOCK).getDataLayerData(SectionPosition.of(x, chunk.getSectionYFromSectionIndex(i), z)); // SPIGOT-7498: Convert section index
|
||||||
if (emitLightArray == null) {
|
if (emitLightArray == null) {
|
||||||
sectionEmitLights[i] = emptyLight;
|
sectionEmitLights[i] = EMPTY_LIGHT;
|
||||||
} else {
|
} else {
|
||||||
sectionEmitLights[i] = new byte[2048];
|
sectionEmitLights[i] = new byte[2048];
|
||||||
System.arraycopy(emitLightArray.getData(), 0, sectionEmitLights[i], 0, 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++) {
|
for (int i = 0; i < hSection; i++) {
|
||||||
blockIDs[i] = emptyBlockIDs;
|
blockIDs[i] = emptyBlockIDs;
|
||||||
skyLight[i] = emptyLight;
|
skyLight[i] = world.getHandle().dimensionType().hasSkyLight() ? FULL_LIGHT : EMPTY_LIGHT;
|
||||||
emitLight[i] = emptyLight;
|
emitLight[i] = EMPTY_LIGHT;
|
||||||
empty[i] = true;
|
empty[i] = true;
|
||||||
|
|
||||||
if (biome != null) {
|
if (biome != null) {
|
||||||
@ -416,6 +417,6 @@ public class CraftChunk implements Chunk {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static {
|
static {
|
||||||
Arrays.fill(emptyLight, (byte) 0xFF);
|
Arrays.fill(FULL_LIGHT, (byte) 0xFF);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user