mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-04-11 10:16:34 +00:00
Fix
This commit is contained in:
@@ -301,4 +301,16 @@ public class IrisChunkGenerator extends PostBlockChunkGenerator implements IrisC
|
||||
hr = region;
|
||||
return biome.getName() + " (" + Form.capitalizeWords(biome.getInferredType().name().toLowerCase().replaceAll("\\Q_\\E", " ") + ") in " + region.getName() + "\nY: " + (int) height);
|
||||
}
|
||||
|
||||
public void saveAllParallax()
|
||||
{
|
||||
try
|
||||
{
|
||||
getParallaxMap().saveAll();
|
||||
}
|
||||
catch(IOException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,6 +40,7 @@ public abstract class ParallaxChunkGenerator extends TerrainChunkGenerator imple
|
||||
protected KMap<ChunkPosition, AtomicSliver> sliverCache;
|
||||
protected AtomicWorldData parallaxMap;
|
||||
private MasterLock masterLock;
|
||||
private IrisLock flock = new IrisLock("ParallaxLock");
|
||||
private IrisLock lock = new IrisLock("ParallaxLock");
|
||||
private IrisLock lockq = new IrisLock("ParallaxQueueLock");
|
||||
private GenLayerUpdate glUpdate;
|
||||
@@ -112,9 +113,7 @@ public abstract class ParallaxChunkGenerator extends TerrainChunkGenerator imple
|
||||
@Override
|
||||
public void set(int x, int y, int z, BlockData d)
|
||||
{
|
||||
getMasterLock().lock((x >> 4) + "." + (z >> 4));
|
||||
getParallaxSliver(x, z).set(y, d);
|
||||
getMasterLock().unlock((x >> 4) + "." + (z >> 4));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -189,6 +188,7 @@ public abstract class ParallaxChunkGenerator extends TerrainChunkGenerator imple
|
||||
@Override
|
||||
protected void onPostGenerate(RNG random, int x, int z, ChunkData data, BiomeGrid grid, HeightMap height, BiomeMap biomeMap, AtomicSliverMap map)
|
||||
{
|
||||
// flock.lock();
|
||||
if(getSliverCache().size() > 20000)
|
||||
{
|
||||
getSliverCache().clear();
|
||||
@@ -213,6 +213,7 @@ public abstract class ParallaxChunkGenerator extends TerrainChunkGenerator imple
|
||||
super.onPostParallaxPostGenerate(random, x, z, data, grid, height, biomeMap, map);
|
||||
getParallaxMap().clean(ticks);
|
||||
getData().getObjectLoader().clean();
|
||||
// flock.unlock();
|
||||
}
|
||||
|
||||
public IrisStructureResult getStructure(int x, int y, int z)
|
||||
@@ -349,7 +350,6 @@ public abstract class ParallaxChunkGenerator extends TerrainChunkGenerator imple
|
||||
}
|
||||
|
||||
getAccelerant().waitFor(key);
|
||||
|
||||
lockq.lock();
|
||||
for(NastyRunnable i : q)
|
||||
{
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user