Speed up plax mgr

This commit is contained in:
Daniel Mills
2021-07-18 04:46:55 -04:00
parent c420a8a686
commit a03539ad8b
7 changed files with 76 additions and 27 deletions

View File

@@ -343,6 +343,7 @@ public class IrisDimension extends IrisRegistrant {
private final transient AtomicCache<Double> sinr = new AtomicCache<>();
private final transient AtomicCache<Double> cosr = new AtomicCache<>();
private final transient AtomicCache<Double> rad = new AtomicCache<>();
private final transient AtomicCache<Boolean> featuresUsed = new AtomicCache<>();
public boolean hasSky() {
return getSky() != null;
@@ -511,4 +512,48 @@ public class IrisDimension extends IrisRegistrant {
return changed;
}
public boolean hasFeatures(DataProvider data) {
return featuresUsed.aquire(() -> {
if(getFeatures().isNotEmpty() || getSpecificFeatures().isNotEmpty())
{
return true;
}
for(IrisRegion i : getAllRegions(data))
{
if(i.getFeatures().isNotEmpty())
{
return true;
}
for(IrisObjectPlacement j : i.getObjects())
{
if(j.isVacuum())
{
return true;
}
}
for(IrisBiome j : i.getAllBiomes(data))
{
if(j.getFeatures().isNotEmpty())
{
return true;
}
for(IrisObjectPlacement k : i.getObjects())
{
if(k.isVacuum())
{
return true;
}
}
}
}
Iris.verbose("Not using parallax noise features (they arent used in this dimension)");
return false;
});
}
}