Zero write detection?

This commit is contained in:
Daniel Mills 2021-07-22 20:49:00 -04:00
parent 5dae1ee34f
commit d06657e2ff
5 changed files with 45 additions and 10 deletions

View File

@ -32,6 +32,7 @@ import static com.volmit.iris.engine.data.mca.LoadFlags.*;
public class Chunk {
public transient int writes = 0;
public static final int DEFAULT_DATA_VERSION = 1628;
private boolean partial;
@ -327,6 +328,7 @@ public class Chunk {
sections.set(sectionIndex, section);
}
section.setBlockStateAt(blockX, blockY, blockZ, state, cleanup);
writes++;
}
/**
@ -689,4 +691,16 @@ public class Chunk {
public int sectionCount() {
return sections.length();
}
public void runLighting() {
for(int s = 15; s >= 0; s--)
{
Section section = getSection(s);
if(section != null)
{
section.runLighting();
}
}
}
}

View File

@ -107,6 +107,19 @@ public class Section {
return null;
}
public void runLighting() {
for(int x = 1; x < 14; x++)
{
for(int z = 1; z < 14; z++)
{
for(int y = 0; y < 16; y++)
{
}
}
}
}
@SuppressWarnings("ClassCanBeRecord")
private static class PaletteIndex {

View File

@ -34,6 +34,7 @@ import com.volmit.iris.engine.data.mca.NBTWorld;
import com.volmit.iris.engine.data.nbt.tag.CompoundTag;
import com.volmit.iris.engine.headless.HeadlessGenerator;
import com.volmit.iris.engine.hunk.Hunk;
import com.volmit.iris.engine.lighting.LightingChunk;
import com.volmit.iris.engine.object.IrisBiome;
import com.volmit.iris.engine.object.IrisDimension;
import com.volmit.iris.engine.object.IrisPosition;
@ -546,6 +547,11 @@ public class EngineCompositeGenerator extends ChunkGenerator implements IrisAcce
.injector((xx, yy, zz, biomeBase) -> chunk.setBiomeAt(ox + xx, yy, oz + zz,
INMS.get().getTrueBiomeBaseId(biomeBase)))
.build()).run();
if(chunk.writes == 0)
{
Iris.error("Chunk " + x + " " + z + " has 0 writes?");
}
}
catch(Throwable e)

View File

@ -24,6 +24,7 @@ import com.bergerkiller.bukkit.common.wrappers.BlockData;
import com.bergerkiller.bukkit.common.wrappers.ChunkSection;
import com.bergerkiller.generated.net.minecraft.server.NibbleArrayHandle;
import com.volmit.iris.Iris;
import com.volmit.iris.util.data.NibbleArray;
import java.util.concurrent.CompletableFuture;

View File

@ -100,21 +100,22 @@ public class NibbleArray implements Writable {
}
}
public byte getAsync(int index) {
int bitIndex = index * depth;
int byteIndex = bitIndex >> 3;
int bitInByte = bitIndex & 7;
int value = data[byteIndex] >> bitInByte;
public byte get(int x, int y, int z)
{
return get(index(x,y,z));
}
if (bitInByte + depth > 8) {
value |= data[byteIndex + 1] << bitInByte;
}
return (byte) (value & mask);
public int index(int x, int y, int z) {
return y << 8 | z << 4 | x;
}
private transient int bitIndex, byteIndex, bitInByte;
public void set(int x, int y, int z, int nibble)
{
set(index(x,y,z), nibble);
}
public void set(int index, int nibble) {
set(index, (byte) nibble);
}