This commit is contained in:
Daniel Mills
2020-08-23 03:25:12 -04:00
parent 69218b6710
commit 308395aa86
9 changed files with 58 additions and 35 deletions

View File

@@ -9,6 +9,7 @@ import java.util.zip.GZIPInputStream;
import org.bukkit.World;
import com.volmit.iris.Iris;
import com.volmit.iris.IrisSettings;
import com.volmit.iris.util.ByteArrayTag;
import com.volmit.iris.util.CompoundTag;
@@ -100,7 +101,8 @@ public class AtomicRegionData
data.write(out);
out.flush();
out.close();
tag[(rz << 5) | rx] = new ByteArrayTag(rx + "." + rz, boas.toByteArray());
byte[] b = boas.toByteArray();
tag[(rz << 5) | rx] = new ByteArrayTag(rx + "." + rz, b);
}
public AtomicSliverMap get(int rx, int rz) throws IOException
@@ -112,9 +114,15 @@ public class AtomicRegionData
return data;
}
ByteArrayTag btag = (ByteArrayTag) tag[(rz << 5) | rx];
try
{
ByteArrayTag btag = (ByteArrayTag) tag[(rz << 5) | rx];
if(btag.getValue().length == 0)
{
Iris.warn("EMPTY BYTE TAG " + rx + " " + rz);
return data;
}
InputStream in;
@@ -129,11 +137,12 @@ public class AtomicRegionData
}
data.read(in);
in.close();
}
catch(Throwable e)
{
Iris.warn("Failed to load " + rx + "." + rz + " with " + btag.getValue().length);
}
return data;

View File

@@ -30,8 +30,8 @@ public class AtomicSliver
private transient IrisLock lock = new IrisLock("Sliver");
private transient int highestBiome = 0;
private transient long last = M.ms();
private transient int x;
private transient int z;
private transient final int x;
private transient final int z;
private transient boolean modified = false;
private KMap<Integer, BlockData> block;
private KSet<Integer> blockUpdates;
@@ -39,7 +39,6 @@ public class AtomicSliver
public AtomicSliver(int x, int z)
{
lock.setDisabled(true);
this.x = x;
this.z = z;
blockUpdates = new KSet<>();
@@ -204,12 +203,12 @@ public class AtomicSliver
lock.lock();
this.block = new KMap<Integer, BlockData>();
getUpdatables().clear();
// Block Palette
int h = din.readByte() - Byte.MIN_VALUE;
int p = din.readByte() - Byte.MIN_VALUE;
int h = din.readByte() - Byte.MIN_VALUE;
int u = din.readByte() - Byte.MIN_VALUE;
KList<BlockData> palette = new KList<BlockData>();
getUpdatables().clear();
highestBlock = h;
for(int i = 0; i < p; i++)
@@ -224,7 +223,7 @@ public class AtomicSliver
}
// Updates
for(int i = 0; i <= u; i++)
for(int i = 0; i < u; i++)
{
update(din.readByte() - Byte.MIN_VALUE);
}
@@ -236,7 +235,6 @@ public class AtomicSliver
public void write(DataOutputStream dos) throws IOException
{
lock.lock();
dos.writeByte(highestBlock + Byte.MIN_VALUE);
// Block Palette
KList<String> palette = new KList<>();
@@ -253,6 +251,7 @@ public class AtomicSliver
}
dos.writeByte(palette.size() + Byte.MIN_VALUE);
dos.writeByte(highestBlock + Byte.MIN_VALUE);
dos.writeByte(blockUpdates.size() + Byte.MIN_VALUE);
for(String i : palette)

View File

@@ -82,9 +82,18 @@ public class AtomicSliverMap
DataOutputStream dos = new DataOutputStream(out);
dos.writeBoolean(isParallaxGenerated());
dos.writeBoolean(isWorldGenerated());
for(int i = 0; i < 256; i++)
{
slivers[i].write(dos);
try
{
slivers[i].write(dos);
}
catch(Throwable e)
{
e.printStackTrace();
}
}
KList<String> structurePalette = new KList<>();
@@ -132,7 +141,7 @@ public class AtomicSliverMap
catch(Throwable e)
{
e.printStackTrace();
}
}

View File

@@ -313,7 +313,7 @@ public class AtomicWorldData
break;
}
if(M.ms() - lastChunk.get(i) > 15000)
if(M.ms() - lastChunk.get(i) > 60000)
{
m++;
unloadChunks.add(i);