mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-07-18 18:23:06 +00:00
Fix
This commit is contained in:
parent
69218b6710
commit
308395aa86
@ -104,14 +104,8 @@ public class Iris extends MortarPlugin implements BoardProvider
|
||||
|
||||
public void onDisable()
|
||||
{
|
||||
lock.unlock();
|
||||
proj.close();
|
||||
|
||||
for(GroupedExecutor i : executors)
|
||||
{
|
||||
i.close();
|
||||
}
|
||||
|
||||
for(World i : Bukkit.getWorlds())
|
||||
{
|
||||
if(i.getGenerator() instanceof IrisChunkGenerator)
|
||||
@ -119,6 +113,10 @@ public class Iris extends MortarPlugin implements BoardProvider
|
||||
((IrisChunkGenerator) i).close();
|
||||
}
|
||||
}
|
||||
for(GroupedExecutor i : executors)
|
||||
{
|
||||
i.close();
|
||||
}
|
||||
|
||||
executors.clear();
|
||||
manager.onDisable();
|
||||
|
@ -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);
|
||||
|
@ -19,7 +19,6 @@ import com.volmit.iris.util.DontObfuscate;
|
||||
import com.volmit.iris.util.Form;
|
||||
import com.volmit.iris.util.IrisLock;
|
||||
import com.volmit.iris.util.IrisPostBlockFilter;
|
||||
import com.volmit.iris.util.J;
|
||||
import com.volmit.iris.util.KList;
|
||||
import com.volmit.iris.util.KSet;
|
||||
import com.volmit.iris.util.MaxNumber;
|
||||
@ -619,8 +618,10 @@ public class IrisDimension extends IrisRegistrant
|
||||
{
|
||||
Iris.info("Calculating the Parallax Size in Parallel");
|
||||
O<Integer> xg = new O<>();
|
||||
O<Integer> yg = new O<>();
|
||||
O<Integer> zg = new O<>();
|
||||
xg.set(0);
|
||||
yg.set(0);
|
||||
zg.set(0);
|
||||
|
||||
KSet<String> objects = new KSet<>();
|
||||
@ -649,6 +650,7 @@ public class IrisDimension extends IrisRegistrant
|
||||
BlockVector bv = IrisObject.sampleSize(g.getData().getObjectLoader().findFile(i));
|
||||
t.lock();
|
||||
xg.set(bv.getBlockX() > xg.get() ? bv.getBlockX() : xg.get());
|
||||
yg.set(bv.getBlockY() > yg.get() ? bv.getBlockY() : yg.get());
|
||||
zg.set(bv.getBlockZ() > zg.get() ? bv.getBlockZ() : zg.get());
|
||||
t.unlock();
|
||||
}
|
||||
@ -662,8 +664,8 @@ public class IrisDimension extends IrisRegistrant
|
||||
|
||||
g.getAccelerant().waitFor("tx-psize");
|
||||
g.changeThreadCount(tc);
|
||||
int x = xg.get();
|
||||
int z = zg.get();
|
||||
int x = Math.max(xg.get(), Math.max(yg.get(), zg.get()));
|
||||
int z = x;
|
||||
|
||||
for(IrisDepositGenerator i : getDeposits())
|
||||
{
|
||||
@ -696,6 +698,8 @@ public class IrisDimension extends IrisRegistrant
|
||||
z = (Math.max(z, 16) + 16) >> 4;
|
||||
x = x % 2 == 0 ? x + 1 : x;
|
||||
z = z % 2 == 0 ? z + 1 : z;
|
||||
z = Math.max(x, z);
|
||||
x = z;
|
||||
Iris.info("Done! Parallax Size: " + x + ", " + z);
|
||||
return new ChunkPosition(x, z);
|
||||
});
|
||||
|
@ -147,18 +147,10 @@ public class IrisObject extends IrisRegistrant
|
||||
{
|
||||
if(config.getMode().equals(ObjectPlaceMode.CENTER_HEIGHT_RIGID))
|
||||
{
|
||||
if(config.isTranslateCenter())
|
||||
{
|
||||
y = placer.getHighest(x, z, config.isUnderwater()) + rty;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
y = placer.getHighest(x, z, config.isUnderwater()) + rty;
|
||||
}
|
||||
y = placer.getHighest(x, z, config.isUnderwater()) + rty;
|
||||
}
|
||||
|
||||
if(config.getMode().equals(ObjectPlaceMode.MAX_HEIGHT_RIGID_ACCURATE))
|
||||
else if(config.getMode().equals(ObjectPlaceMode.MAX_HEIGHT_RIGID_ACCURATE))
|
||||
{
|
||||
BlockVector offset = new BlockVector(config.getTranslate().getX(), config.getTranslate().getY(), config.getTranslate().getZ());
|
||||
BlockVector rotatedDimensions = config.getRotation().rotate(new BlockVector(getW(), getH(), getD()), spinx, spiny, spinz).clone();
|
||||
|
Loading…
x
Reference in New Issue
Block a user