Update starlight + read null light data (#7912)
This commit is contained in:
parent
7c55e62abc
commit
d833c0c39a
|
@ -5040,7 +5040,7 @@ index 5ce6a2b83546f4dbc3183a386f51b4bacc173744..a7231ceda4f3e96c0e0c11eee953f129
|
||||||
this.fluidTicks = fluidTickScheduler;
|
this.fluidTicks = fluidTickScheduler;
|
||||||
}
|
}
|
||||||
diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java
|
diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java
|
||||||
index be9c15fe141ede1132dbe07ba4bfcf22036ab194..3a2d6200d41c9758763d7a975d62e6e6842da3e2 100644
|
index be9c15fe141ede1132dbe07ba4bfcf22036ab194..2f3c56b1141dc17b38899cb84d14e7d6bcb55ed7 100644
|
||||||
--- a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java
|
--- a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java
|
||||||
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java
|
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java
|
||||||
@@ -94,6 +94,14 @@ public class ChunkSerializer {
|
@@ -94,6 +94,14 @@ public class ChunkSerializer {
|
||||||
|
@ -5048,7 +5048,7 @@ index be9c15fe141ede1132dbe07ba4bfcf22036ab194..3a2d6200d41c9758763d7a975d62e6e6
|
||||||
public static final String SKY_LIGHT_TAG = "SkyLight";
|
public static final String SKY_LIGHT_TAG = "SkyLight";
|
||||||
|
|
||||||
+ // Paper start - replace light engine impl
|
+ // Paper start - replace light engine impl
|
||||||
+ private static final int STARLIGHT_LIGHT_VERSION = 7;
|
+ private static final int STARLIGHT_LIGHT_VERSION = 8;
|
||||||
+
|
+
|
||||||
+ private static final String BLOCKLIGHT_STATE_TAG = "starlight.blocklight_state";
|
+ private static final String BLOCKLIGHT_STATE_TAG = "starlight.blocklight_state";
|
||||||
+ private static final String SKYLIGHT_STATE_TAG = "starlight.skylight_state";
|
+ private static final String SKYLIGHT_STATE_TAG = "starlight.skylight_state";
|
||||||
|
@ -5089,7 +5089,7 @@ index be9c15fe141ede1132dbe07ba4bfcf22036ab194..3a2d6200d41c9758763d7a975d62e6e6
|
||||||
byte b0 = nbttagcompound1.getByte("Y");
|
byte b0 = nbttagcompound1.getByte("Y");
|
||||||
int k = world.getSectionIndexFromSectionY(b0);
|
int k = world.getSectionIndexFromSectionY(b0);
|
||||||
|
|
||||||
@@ -214,31 +229,32 @@ public class ChunkSerializer {
|
@@ -214,31 +229,34 @@ public class ChunkSerializer {
|
||||||
boolean flag3 = nbttagcompound1.contains("BlockLight", 7);
|
boolean flag3 = nbttagcompound1.contains("BlockLight", 7);
|
||||||
boolean flag4 = flag1 && nbttagcompound1.contains("SkyLight", 7);
|
boolean flag4 = flag1 && nbttagcompound1.contains("SkyLight", 7);
|
||||||
|
|
||||||
|
@ -5131,12 +5131,14 @@ index be9c15fe141ede1132dbe07ba4bfcf22036ab194..3a2d6200d41c9758763d7a975d62e6e6
|
||||||
+ // is forced to re-light them if it encounters our data. It's too much of a burden
|
+ // is forced to re-light them if it encounters our data. It's too much of a burden
|
||||||
+ // to try and maintain compatibility with a broken and inferior skylight management system.
|
+ // to try and maintain compatibility with a broken and inferior skylight management system.
|
||||||
+ skyNibbles[y - minSection] = new ca.spottedleaf.starlight.common.light.SWMRNibbleArray(sectionData.getByteArray("SkyLight").clone(), sectionData.getInt(SKYLIGHT_STATE_TAG)); // clone for data safety
|
+ skyNibbles[y - minSection] = new ca.spottedleaf.starlight.common.light.SWMRNibbleArray(sectionData.getByteArray("SkyLight").clone(), sectionData.getInt(SKYLIGHT_STATE_TAG)); // clone for data safety
|
||||||
|
+ } else {
|
||||||
|
+ blockNibbles[y - minSection] = new ca.spottedleaf.starlight.common.light.SWMRNibbleArray(null, sectionData.getInt(BLOCKLIGHT_STATE_TAG));
|
||||||
}
|
}
|
||||||
+ // Paper end - rewrite light engine
|
+ // Paper end - rewrite light engine
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -267,6 +283,8 @@ public class ChunkSerializer {
|
@@ -267,6 +285,8 @@ public class ChunkSerializer {
|
||||||
}, chunkPos);
|
}, chunkPos);
|
||||||
|
|
||||||
object1 = new LevelChunk(world.getLevel(), chunkPos, chunkconverter, levelchunkticks, levelchunkticks1, l, achunksection, ChunkSerializer.postLoadChunk(world, nbt), blendingdata);
|
object1 = new LevelChunk(world.getLevel(), chunkPos, chunkconverter, levelchunkticks, levelchunkticks1, l, achunksection, ChunkSerializer.postLoadChunk(world, nbt), blendingdata);
|
||||||
|
@ -5145,7 +5147,7 @@ index be9c15fe141ede1132dbe07ba4bfcf22036ab194..3a2d6200d41c9758763d7a975d62e6e6
|
||||||
} else {
|
} else {
|
||||||
ProtoChunkTicks<Block> protochunkticklist = ProtoChunkTicks.load(nbt.getList("block_ticks", 10), (s) -> {
|
ProtoChunkTicks<Block> protochunkticklist = ProtoChunkTicks.load(nbt.getList("block_ticks", 10), (s) -> {
|
||||||
return Registry.BLOCK.getOptional(ResourceLocation.tryParse(s));
|
return Registry.BLOCK.getOptional(ResourceLocation.tryParse(s));
|
||||||
@@ -275,6 +293,8 @@ public class ChunkSerializer {
|
@@ -275,6 +295,8 @@ public class ChunkSerializer {
|
||||||
return Registry.FLUID.getOptional(ResourceLocation.tryParse(s));
|
return Registry.FLUID.getOptional(ResourceLocation.tryParse(s));
|
||||||
}, chunkPos);
|
}, chunkPos);
|
||||||
ProtoChunk protochunk = new ProtoChunk(chunkPos, chunkconverter, achunksection, protochunkticklist, protochunkticklist1, world, iregistry, blendingdata);
|
ProtoChunk protochunk = new ProtoChunk(chunkPos, chunkconverter, achunksection, protochunkticklist, protochunkticklist1, world, iregistry, blendingdata);
|
||||||
|
@ -5154,7 +5156,7 @@ index be9c15fe141ede1132dbe07ba4bfcf22036ab194..3a2d6200d41c9758763d7a975d62e6e6
|
||||||
|
|
||||||
object1 = protochunk;
|
object1 = protochunk;
|
||||||
protochunk.setInhabitedTime(l);
|
protochunk.setInhabitedTime(l);
|
||||||
@@ -420,7 +440,7 @@ public class ChunkSerializer {
|
@@ -420,7 +442,7 @@ public class ChunkSerializer {
|
||||||
DataLayer[] blockLight = new DataLayer[lightenginethreaded.getMaxLightSection() - lightenginethreaded.getMinLightSection()];
|
DataLayer[] blockLight = new DataLayer[lightenginethreaded.getMaxLightSection() - lightenginethreaded.getMinLightSection()];
|
||||||
DataLayer[] skyLight = new DataLayer[lightenginethreaded.getMaxLightSection() - lightenginethreaded.getMinLightSection()];
|
DataLayer[] skyLight = new DataLayer[lightenginethreaded.getMaxLightSection() - lightenginethreaded.getMinLightSection()];
|
||||||
|
|
||||||
|
@ -5163,7 +5165,7 @@ index be9c15fe141ede1132dbe07ba4bfcf22036ab194..3a2d6200d41c9758763d7a975d62e6e6
|
||||||
DataLayer blockArray = lightenginethreaded.getLayerListener(LightLayer.BLOCK).getDataLayerData(SectionPos.of(chunkPos, i));
|
DataLayer blockArray = lightenginethreaded.getLayerListener(LightLayer.BLOCK).getDataLayerData(SectionPos.of(chunkPos, i));
|
||||||
DataLayer skyArray = lightenginethreaded.getLayerListener(LightLayer.SKY).getDataLayerData(SectionPos.of(chunkPos, i));
|
DataLayer skyArray = lightenginethreaded.getLayerListener(LightLayer.SKY).getDataLayerData(SectionPos.of(chunkPos, i));
|
||||||
|
|
||||||
@@ -478,6 +498,12 @@ public class ChunkSerializer {
|
@@ -478,6 +500,12 @@ public class ChunkSerializer {
|
||||||
}
|
}
|
||||||
public static CompoundTag saveChunk(ServerLevel world, ChunkAccess chunk, @org.checkerframework.checker.nullness.qual.Nullable AsyncSaveData asyncsavedata) {
|
public static CompoundTag saveChunk(ServerLevel world, ChunkAccess chunk, @org.checkerframework.checker.nullness.qual.Nullable AsyncSaveData asyncsavedata) {
|
||||||
// Paper end
|
// Paper end
|
||||||
|
@ -5176,7 +5178,7 @@ index be9c15fe141ede1132dbe07ba4bfcf22036ab194..3a2d6200d41c9758763d7a975d62e6e6
|
||||||
ChunkPos chunkcoordintpair = chunk.getPos();
|
ChunkPos chunkcoordintpair = chunk.getPos();
|
||||||
CompoundTag nbttagcompound = new CompoundTag();
|
CompoundTag nbttagcompound = new CompoundTag();
|
||||||
|
|
||||||
@@ -528,20 +554,14 @@ public class ChunkSerializer {
|
@@ -528,20 +556,14 @@ public class ChunkSerializer {
|
||||||
for (int i = lightenginethreaded.getMinLightSection(); i < lightenginethreaded.getMaxLightSection(); ++i) {
|
for (int i = lightenginethreaded.getMinLightSection(); i < lightenginethreaded.getMaxLightSection(); ++i) {
|
||||||
int j = chunk.getSectionIndexFromSectionY(i);
|
int j = chunk.getSectionIndexFromSectionY(i);
|
||||||
boolean flag1 = j >= 0 && j < achunksection.length;
|
boolean flag1 = j >= 0 && j < achunksection.length;
|
||||||
|
@ -5204,7 +5206,7 @@ index be9c15fe141ede1132dbe07ba4bfcf22036ab194..3a2d6200d41c9758763d7a975d62e6e6
|
||||||
|
|
||||||
if (flag1) {
|
if (flag1) {
|
||||||
LevelChunkSection chunksection = achunksection[j];
|
LevelChunkSection chunksection = achunksection[j];
|
||||||
@@ -556,13 +576,27 @@ public class ChunkSerializer {
|
@@ -556,13 +578,27 @@ public class ChunkSerializer {
|
||||||
nbttagcompound1.put("biomes", (Tag) dataresult1.getOrThrow(false, logger1::error));
|
nbttagcompound1.put("biomes", (Tag) dataresult1.getOrThrow(false, logger1::error));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5236,7 +5238,7 @@ index be9c15fe141ede1132dbe07ba4bfcf22036ab194..3a2d6200d41c9758763d7a975d62e6e6
|
||||||
|
|
||||||
if (!nbttagcompound1.isEmpty()) {
|
if (!nbttagcompound1.isEmpty()) {
|
||||||
nbttagcompound1.putByte("Y", (byte) i);
|
nbttagcompound1.putByte("Y", (byte) i);
|
||||||
@@ -573,7 +607,8 @@ public class ChunkSerializer {
|
@@ -573,7 +609,8 @@ public class ChunkSerializer {
|
||||||
|
|
||||||
nbttagcompound.put("sections", nbttaglist);
|
nbttagcompound.put("sections", nbttaglist);
|
||||||
if (flag) {
|
if (flag) {
|
||||||
|
|
|
@ -8,10 +8,10 @@ Chunks not marked as lit will always go through the light engine,
|
||||||
so they should always have their block sources parsed.
|
so they should always have their block sources parsed.
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java
|
diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java
|
||||||
index 3a2d6200d41c9758763d7a975d62e6e6842da3e2..8038688a9a5cd691cdd6fde45662a10e4b27c782 100644
|
index 2f3c56b1141dc17b38899cb84d14e7d6bcb55ed7..9a612438d075631fcc2a9ce082e891a3a615a382 100644
|
||||||
--- a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java
|
--- a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java
|
||||||
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java
|
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java
|
||||||
@@ -318,16 +318,33 @@ public class ChunkSerializer {
|
@@ -320,16 +320,33 @@ public class ChunkSerializer {
|
||||||
BelowZeroRetrogen belowzeroretrogen = protochunk.getBelowZeroRetrogen();
|
BelowZeroRetrogen belowzeroretrogen = protochunk.getBelowZeroRetrogen();
|
||||||
boolean flag5 = chunkstatus.isOrAfter(ChunkStatus.LIGHT) || belowzeroretrogen != null && belowzeroretrogen.targetStatus().isOrAfter(ChunkStatus.LIGHT);
|
boolean flag5 = chunkstatus.isOrAfter(ChunkStatus.LIGHT) || belowzeroretrogen != null && belowzeroretrogen.targetStatus().isOrAfter(ChunkStatus.LIGHT);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue