This commit is contained in:
gnembon committed 2020-07-15 04:35:15 -03:00
1 parent b6543ff8dd
commit 3b90bd5d3a
12 files changed
+48 -48

No files matched your search

@@ -24,26 +24,26 @@ import net.minecraft.world.chunk.light.LightStorage;
public abstract class LightStorage_scarpetChunkCreationMixin implements LightStorageInterface
{
@Shadow
protected abstract ChunkNibbleArray getLightArray(final long sectionPos, final boolean cached);
protected abstract ChunkNibbleArray getLightSection(final long sectionPos, final boolean cached);
@Shadow
protected abstract void removeChunkData(final ChunkLightProvider<?, ?> storage, final long blockChunkPos);
protected abstract void removeSection(final ChunkLightProvider<?, ?> storage, final long blockChunkPos);
@Shadow
@Final
protected LongSet field_15802;
protected LongSet dirtySections;
@Shadow
@Final
protected ChunkToNibbleArrayMap<?> lightArrays;
protected ChunkToNibbleArrayMap<?> storage;
@Shadow protected abstract boolean hasLight(final long sectionPos);
@Shadow protected abstract boolean hasSection(final long sectionPos);
@Shadow
@Final
protected Long2ObjectMap<ChunkNibbleArray> lightArraysToAdd;
protected Long2ObjectMap<ChunkNibbleArray> queuedSections;
@Shadow protected abstract void setLightEnabled(final long l, final boolean bl);
@Shadow protected abstract void setColumnEnabled(final long l, final boolean bl);
@Unique
private final LongSet removedChunks = new LongOpenHashSet();
@@ -64,7 +64,7 @@ public abstract class LightStorage_scarpetChunkCreationMixin implements LightSto
}
@Inject(
method = "updateLightArrays(Lnet/minecraft/world/chunk/light/ChunkLightProvider;ZZ)V",
method = "updateLight(Lnet/minecraft/world/chunk/light/ChunkLightProvider;ZZ)V",
at = @At("HEAD")
)
private void processData(final ChunkLightProvider<?, ?> lightProvider, final boolean doSkylight, final boolean skipEdgeLightPropagation, final CallbackInfo ci)
@@ -77,16 +77,16 @@ public abstract class LightStorage_scarpetChunkCreationMixin implements LightSto
{
final long sectionPos = ChunkSectionPos.asLong(ChunkSectionPos.getX(cPos), y, ChunkSectionPos.getZ(cPos));
this.lightArraysToAdd.remove(sectionPos);
this.queuedSections.remove(sectionPos);
if (this.hasLight(sectionPos))
if (this.hasSection(sectionPos))
{
this.removeChunkData(lightProvider, sectionPos);
this.removeSection(lightProvider, sectionPos);
if (this.field_15802.add(sectionPos))
this.lightArrays.replaceWithCopy(sectionPos);
if (this.dirtySections.add(sectionPos))
this.storage.replaceWithCopy(sectionPos);
Arrays.fill(this.getLightArray(sectionPos, true).asByteArray(), (byte) 0);
Arrays.fill(this.getLightSection(sectionPos, true).asByteArray(), (byte) 0);
}
}