9
0
mirror of https://github.com/VolmitSoftware/Iris.git synced 2025-12-29 12:09:07 +00:00
This commit is contained in:
Daniel Mills
2020-09-03 00:09:31 -04:00
parent 9aa6d1c0fc
commit 3663b9f957
7 changed files with 41 additions and 19 deletions

View File

@@ -22,6 +22,7 @@ public class B
private static final IrisDimension defaultCompat = new IrisDimension();
private static final KMap<Material, Boolean> solid = new KMap<>();
private static final KMap<String, Material> types = new KMap<>();
private static IrisLock lock = new IrisLock("Typelock");
public static BlockData get(String bd)
{
@@ -188,7 +189,9 @@ public class B
if(str)
{
lock.lock();
storage.add(mat);
lock.unlock();
return true;
}
@@ -230,7 +233,9 @@ public class B
if(str)
{
lock.lock();
storageChest.add(mat);
lock.unlock();
return true;
}
@@ -269,7 +274,9 @@ public class B
//@done
if(str)
{
lock.lock();
lit.add(mat);
lock.unlock();
return true;
}
@@ -292,11 +299,15 @@ public class B
if(str)
{
lock.lock();
updatable.add(mat);
lock.unlock();
return true;
}
lock.lock();
notUpdatable.add(mat);
lock.unlock();
return false;
}
@@ -311,13 +322,17 @@ public class B
if(onto.equals(Material.AIR) || onto.equals(B.mat("CAVE_AIR")))
{
lock.lock();
canPlaceOn.add(key);
lock.unlock();
return false;
}
if(onto.equals(Material.GRASS_BLOCK) && mat.equals(Material.DEAD_BUSH))
{
lock.lock();
canPlaceOn.add(key);
lock.unlock();
return false;
}
@@ -325,7 +340,9 @@ public class B
{
if(!mat.isSolid())
{
lock.lock();
canPlaceOn.add(key);
lock.unlock();
return false;
}
}
@@ -334,7 +351,9 @@ public class B
{
if(mat.equals(Material.POPPY) || mat.equals(Material.DANDELION) || mat.equals(B.mat("CORNFLOWER")) || mat.equals(Material.ORANGE_TULIP) || mat.equals(Material.PINK_TULIP) || mat.equals(Material.RED_TULIP) || mat.equals(Material.WHITE_TULIP) || mat.equals(Material.FERN) || mat.equals(Material.LARGE_FERN) || mat.equals(Material.GRASS) || mat.equals(Material.TALL_GRASS))
{
lock.lock();
canPlaceOn.add(key);
lock.unlock();
return false;
}
}
@@ -343,7 +362,9 @@ public class B
{
if(!mat.isSolid())
{
lock.lock();
canPlaceOn.add(key);
lock.unlock();
return false;
}
}

View File

@@ -7,9 +7,9 @@ import lombok.Data;
@Data
public class IrisLock
{
private final ReentrantLock lock;
private final String name;
private boolean disabled = false;
private transient final ReentrantLock lock;
private transient final String name;
private transient boolean disabled = false;
public IrisLock(String name)
{

View File

@@ -20,6 +20,7 @@ public class PregenJob
public static int task = -1;
private PrecisionStopwatch s;
private ChronoLatch cl;
private ChronoLatch clx;
private MortarSender sender;
private Runnable onDone;
@@ -37,6 +38,7 @@ public class PregenJob
rcx = 0;
this.sender = sender;
cl = new ChronoLatch(3000);
clx = new ChronoLatch(15000);
rcz = 0;
total = (size / 16) * (size / 16);
genned = 0;
@@ -148,7 +150,6 @@ public class PregenJob
try
{
verify(lx, lz);
Iris.verbose("Verified " + lx + " " + lz);
}
catch(Throwable e)
@@ -170,11 +171,20 @@ public class PregenJob
{
Chunk c = world.getChunkAt(x + (lx * 32), z + (lz * 32));
c.load(true);
world.unloadChunkRequest(x + (lx * 32), z + (lz * 32));
}
}
}
saveAll();
saveAllRequest();
}
public void saveAllRequest()
{
if(clx.flip())
{
saveAll();
}
}
public void saveAll()