Don't unlight border chunks
This commit is contained in:
parent
8d5e329eea
commit
bcbf307e8d
@ -6,6 +6,7 @@ import com.boydti.fawe.object.FaweChunk;
|
||||
import com.boydti.fawe.object.FaweQueue;
|
||||
import com.boydti.fawe.object.IntegerTrio;
|
||||
import com.boydti.fawe.object.RunnableVal;
|
||||
import com.boydti.fawe.object.collection.LocalBlockVector2DSet;
|
||||
import com.boydti.fawe.util.MathMan;
|
||||
import com.boydti.fawe.util.TaskManager;
|
||||
import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap;
|
||||
@ -100,6 +101,14 @@ public class NMSRelighter implements Relighter {
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized void clear() {
|
||||
queuedSkyToRelight.clear();
|
||||
skyToRelight.clear();
|
||||
chunksToSend.clear();
|
||||
lightQueue.clear();
|
||||
concurrentLightQueue.clear();
|
||||
}
|
||||
|
||||
public boolean addChunk(int cx, int cz, byte[] fix, int bitmask) {
|
||||
RelightSkyEntry toPut = new RelightSkyEntry(cx, cz, fix, bitmask);
|
||||
queuedSkyToRelight.add(toPut);
|
||||
@ -380,6 +389,23 @@ public class NMSRelighter implements Relighter {
|
||||
|
||||
private void fixSkyLighting(List<RelightSkyEntry> sorted) {
|
||||
RelightSkyEntry[] chunks = sorted.toArray(new RelightSkyEntry[sorted.size()]);
|
||||
boolean remove = this.removeFirst;
|
||||
LocalBlockVector2DSet chunkSet = null;
|
||||
if (remove) {
|
||||
chunkSet = new LocalBlockVector2DSet();
|
||||
LocalBlockVector2DSet tmpSet = new LocalBlockVector2DSet();
|
||||
for (RelightSkyEntry chunk : chunks) {
|
||||
chunkSet.add(chunk.x, chunk.z);
|
||||
}
|
||||
for (RelightSkyEntry chunk : chunks) {
|
||||
int x = chunk.x;
|
||||
int z = chunk.z;
|
||||
if (tmpSet.contains(x + 1, z) && tmpSet.contains(x - 1, z) && tmpSet.contains(x, z + 1) && tmpSet.contains(x, z - 1)) {
|
||||
chunkSet.add(x, z);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
byte[] cacheX = FaweCache.CACHE_X[0];
|
||||
byte[] cacheZ = FaweCache.CACHE_Z[0];
|
||||
for (int y = FaweChunk.HEIGHT - 1; y > 0; y--) {
|
||||
@ -401,7 +427,7 @@ public class NMSRelighter implements Relighter {
|
||||
if (section == null) continue;
|
||||
chunk.smooth = false;
|
||||
|
||||
if (removeFirst && (y & 15) == 15) {
|
||||
if (remove && (y & 15) == 15 && chunkSet.contains(chunk.x, chunk.z)) {
|
||||
queue.removeSectionLighting(section, y >> 4, true);
|
||||
}
|
||||
|
||||
|
@ -22,6 +22,11 @@ public class NullRelighter implements Relighter {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clear() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeLighting() {
|
||||
|
||||
|
@ -12,6 +12,8 @@ public interface Relighter {
|
||||
fixLightingSafe(sky);
|
||||
}
|
||||
|
||||
void clear();
|
||||
|
||||
void removeLighting();
|
||||
|
||||
void fixBlockLighting();
|
||||
|
Loading…
Reference in New Issue
Block a user