This repository has been archived by the owner on Mar 8, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 134
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Completely rewrite how lighting is loaded in for clients Attempts to fix #25 and #40 The old hook was vulnerable to mods doing unexpected things, especially serverside. The old method also relied on unreliable ordering of events inside packet handling. New method just hooks directly into the packet handling methods to avoid conflicting behavior with mods and to create more reliable hooks. - Completely rewrites internal scheduling of light tasks Old scheduling was very vulnerable to block updates completely overloading everything. The old scheduling was also incapable of indicating to the chunk system whether block updates or other light modifying tasks were pending for a chunk. The new scheduling now groups tasks by chunk (light update, needs lighting, edge checks) and simply drains tasks by chunks. In the event that there are a lot of block updates, they no longer pile up in a queue since they are just grouped onto their chunk, which will eliminate duplicate updates. And since it's a FIFO by chunk, the maximum latency for a light update to happen is simply the number of chunks queued. The new queue also tells the chunk system to not unload chunks until any lighting task is fully complete for that chunk and its 1 radius neighbours. This will eliminate problems where the light engine was never able to complete tasks before server shutdown. This also officially kills light suppression. Before you ask, no I'm not going to re-add lighting _bugs_ to my light engine. I want lighting to work, which means I need to fix it when it clearly doesn't work. - Mark the vanilla light engine fields in LevelLightEngine as null This will break any mod expecting them to be non-null. But since we replace the light engine, it's better this way since it forces an explicit break rather than a silent break.
- Loading branch information
1 parent
da00dff
commit c52e9ec
Showing
10 changed files
with
392 additions
and
192 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
src/main/java/ca/spottedleaf/starlight/common/light/StarLightLightingProvider.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,21 @@ | ||
package ca.spottedleaf.starlight.common.light; | ||
|
||
import net.minecraft.core.SectionPos; | ||
import net.minecraft.world.level.ChunkPos; | ||
import net.minecraft.world.level.LightLayer; | ||
import net.minecraft.world.level.chunk.DataLayer; | ||
import net.minecraft.world.level.chunk.LevelChunk; | ||
import org.jetbrains.annotations.Nullable; | ||
|
||
public interface StarLightLightingProvider { | ||
|
||
public StarLightInterface getLightEngine(); | ||
|
||
public void clientUpdateLight(final LightLayer lightType, final SectionPos pos, | ||
final @Nullable DataLayer nibble, final boolean trustEdges); | ||
|
||
public void clientRemoveLightData(final ChunkPos chunkPos); | ||
|
||
public void clientChunkLoad(final ChunkPos pos, final LevelChunk chunk); | ||
|
||
} |
Oops, something went wrong.