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

@ -278,7 +278,7 @@ public class AtomicWorldData
break; break;
} }
if(M.ms() - lastRegion.get(i) > 60000) if(M.ms() - lastRegion.get(i) > 30000)
{ {
unloadRegions.add(i); unloadRegions.add(i);
m++; m++;
@ -311,7 +311,7 @@ public class AtomicWorldData
break; break;
} }
if(M.ms() - lastChunk.get(i) > 60000) if(M.ms() - lastChunk.get(i) > 30000)
{ {
m++; m++;
unloadChunks.add(i); unloadChunks.add(i);

View File

@ -118,11 +118,6 @@ public class IrisEntity extends IrisRegistrant
@Desc("Loot tables for drops") @Desc("Loot tables for drops")
private IrisLootReference loot = new IrisLootReference(); private IrisLootReference loot = new IrisLootReference();
@DontObfuscate
@Desc("Potion effects to add to this entity")
@ArrayType(min = 1, type = IrisPotionEffect.class)
private KList<IrisPotionEffect> potionEffects = new KList<>();
@DontObfuscate @DontObfuscate
@Desc("If specified, this entity will be leashed by this entity. I.e. THIS ENTITY Leashed by SPECIFIED. This has no effect on EnderDragons, Withers, Players, or Bats.Non-living entities excluding leashes will not persist as leashholders.") @Desc("If specified, this entity will be leashed by this entity. I.e. THIS ENTITY Leashed by SPECIFIED. This has no effect on EnderDragons, Withers, Players, or Bats.Non-living entities excluding leashes will not persist as leashholders.")
private IrisEntity leashHolder = null; private IrisEntity leashHolder = null;
@ -218,11 +213,6 @@ public class IrisEntity extends IrisRegistrant
l.setRemoveWhenFarAway(isRemovable()); l.setRemoveWhenFarAway(isRemovable());
for(IrisPotionEffect i : getPotionEffects())
{
i.apply(l);
}
if(getHelmet() != null && rng.i(1, getHelmet().getRarity()) == 1) if(getHelmet() != null && rng.i(1, getHelmet().getRarity()) == 1)
{ {
l.getEquipment().setHelmet(getHelmet().get(gen.isDev(), rng)); l.getEquipment().setHelmet(getHelmet().get(gen.isDev(), rng));

View File

@ -404,7 +404,7 @@ public class IrisObject extends IrisRegistrant
listener.accept(new BlockPosition(xx, yy, zz)); listener.accept(new BlockPosition(xx, yy, zz));
} }
if(!data.getMaterial().equals(Material.AIR)) if(!data.getMaterial().equals(Material.AIR) && !data.getMaterial().equals(Material.CAVE_AIR))
{ {
placer.set(xx, yy, zz, data); placer.set(xx, yy, zz, data);
} }
@ -447,7 +447,7 @@ public class IrisObject extends IrisRegistrant
{ {
for(int j = yf; j > yg - config.getOverStilt(); j--) for(int j = yf; j > yg - config.getOverStilt(); j--)
{ {
if(!d.getMaterial().equals(Material.AIR)) if(!d.getMaterial().equals(Material.AIR) && !d.getMaterial().equals(Material.CAVE_AIR))
{ {
placer.set(xf, j, zf, d); placer.set(xf, j, zf, d);
} }

View File

@ -14,6 +14,7 @@ import com.volmit.iris.util.Required;
import lombok.Data; import lombok.Data;
@DontObfuscate
@Desc("An iris potion effect") @Desc("An iris potion effect")
@Data @Data
public class IrisPotionEffect public class IrisPotionEffect

View File

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

View File

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

View File

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