mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-07-18 10:12:53 +00:00
Optimizations
This commit is contained in:
parent
80b1374a61
commit
74e59fa47b
@ -41,15 +41,15 @@ public class IrisSettings
|
|||||||
@DontObfuscate
|
@DontObfuscate
|
||||||
@Desc("Useful information when creating iris worlds. Shows object loads & more.")
|
@Desc("Useful information when creating iris worlds. Shows object loads & more.")
|
||||||
public boolean verbose = false;
|
public boolean verbose = false;
|
||||||
|
|
||||||
@DontObfuscate
|
@DontObfuscate
|
||||||
@Desc("System Effects")
|
@Desc("System Effects")
|
||||||
public boolean systemEffects = true;
|
public boolean systemEffects = true;
|
||||||
|
|
||||||
@DontObfuscate
|
@DontObfuscate
|
||||||
@Desc("System Spawn Overrides")
|
@Desc("System Spawn Overrides")
|
||||||
public boolean systemEntitySpawnOverrides = true;
|
public boolean systemEntitySpawnOverrides = true;
|
||||||
|
|
||||||
@DontObfuscate
|
@DontObfuscate
|
||||||
@Desc("System Spawn Initials")
|
@Desc("System Spawn Initials")
|
||||||
public boolean systemEntityInitialSpawns = true;
|
public boolean systemEntityInitialSpawns = true;
|
||||||
@ -96,6 +96,11 @@ public class IrisSettings
|
|||||||
|
|
||||||
public static IrisSettings get()
|
public static IrisSettings get()
|
||||||
{
|
{
|
||||||
|
if(settings != null)
|
||||||
|
{
|
||||||
|
return settings;
|
||||||
|
}
|
||||||
|
|
||||||
IrisSettings defaults = new IrisSettings();
|
IrisSettings defaults = new IrisSettings();
|
||||||
JSONObject def = new JSONObject(new Gson().toJson(defaults));
|
JSONObject def = new JSONObject(new Gson().toJson(defaults));
|
||||||
if(settings == null)
|
if(settings == null)
|
||||||
@ -157,7 +162,7 @@ public class IrisSettings
|
|||||||
catch(JSONException | IOException e)
|
catch(JSONException | IOException e)
|
||||||
{
|
{
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
//noinspection ResultOfMethodCallIgnored
|
// noinspection ResultOfMethodCallIgnored
|
||||||
s.delete();
|
s.delete();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,6 @@ import com.volmit.iris.object.DecorationPart;
|
|||||||
import com.volmit.iris.object.InferredType;
|
import com.volmit.iris.object.InferredType;
|
||||||
import com.volmit.iris.object.IrisBiome;
|
import com.volmit.iris.object.IrisBiome;
|
||||||
import com.volmit.iris.object.IrisBiomeDecorator;
|
import com.volmit.iris.object.IrisBiomeDecorator;
|
||||||
import com.volmit.iris.object.IrisBiomeGeneratorLink;
|
|
||||||
import com.volmit.iris.object.IrisDepositGenerator;
|
import com.volmit.iris.object.IrisDepositGenerator;
|
||||||
import com.volmit.iris.object.IrisDimension;
|
import com.volmit.iris.object.IrisDimension;
|
||||||
import com.volmit.iris.object.IrisGenerator;
|
import com.volmit.iris.object.IrisGenerator;
|
||||||
@ -781,16 +780,7 @@ public abstract class TopographicTerrainProvider extends ParallelTerrainProvider
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
IrisBiome b = sampleBiome((int) xx, (int) zz);
|
return sampleBiome((int) xx, (int) zz).getGenLinkMax(gen.getLoadKey());
|
||||||
|
|
||||||
for(int j = 0; j < b.getGenerators().size(); j++)
|
|
||||||
{
|
|
||||||
IrisBiomeGeneratorLink i = b.getGenerators().get(j);
|
|
||||||
if(i.getGenerator().equals(gen.getLoadKey()))
|
|
||||||
{
|
|
||||||
return i.getMax();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
catch(Throwable e)
|
catch(Throwable e)
|
||||||
@ -805,16 +795,7 @@ public abstract class TopographicTerrainProvider extends ParallelTerrainProvider
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
IrisBiome b = sampleBiome((int) xx, (int) zz);
|
return sampleBiome((int) xx, (int) zz).getGenLinkMin(gen.getLoadKey());
|
||||||
|
|
||||||
for(int j = 0; j < b.getGenerators().size(); j++)
|
|
||||||
{
|
|
||||||
IrisBiomeGeneratorLink i = b.getGenerators().get(j);
|
|
||||||
if(i.getGenerator().equals(gen.getLoadKey()))
|
|
||||||
{
|
|
||||||
return i.getMin();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
catch(Throwable e)
|
catch(Throwable e)
|
||||||
|
@ -17,6 +17,7 @@ import com.volmit.iris.util.Desc;
|
|||||||
import com.volmit.iris.util.DontObfuscate;
|
import com.volmit.iris.util.DontObfuscate;
|
||||||
import com.volmit.iris.util.IRare;
|
import com.volmit.iris.util.IRare;
|
||||||
import com.volmit.iris.util.KList;
|
import com.volmit.iris.util.KList;
|
||||||
|
import com.volmit.iris.util.KMap;
|
||||||
import com.volmit.iris.util.KSet;
|
import com.volmit.iris.util.KSet;
|
||||||
import com.volmit.iris.util.MaxNumber;
|
import com.volmit.iris.util.MaxNumber;
|
||||||
import com.volmit.iris.util.MinNumber;
|
import com.volmit.iris.util.MinNumber;
|
||||||
@ -190,6 +191,9 @@ public class IrisBiome extends IrisRegistrant implements IRare
|
|||||||
|
|
||||||
private transient InferredType inferredType;
|
private transient InferredType inferredType;
|
||||||
|
|
||||||
|
private final transient AtomicCache<KMap<String, IrisBiomeGeneratorLink>> genCache = new AtomicCache<>();
|
||||||
|
private final transient AtomicCache<KMap<String, Integer>> genCacheMax = new AtomicCache<>();
|
||||||
|
private final transient AtomicCache<KMap<String, Integer>> genCacheMin = new AtomicCache<>();
|
||||||
private final transient AtomicCache<KList<IrisObjectPlacement>> surfaceObjectsCache = new AtomicCache<>(false);
|
private final transient AtomicCache<KList<IrisObjectPlacement>> surfaceObjectsCache = new AtomicCache<>(false);
|
||||||
private final transient AtomicCache<KList<IrisObjectPlacement>> carveObjectsCache = new AtomicCache<>(false);
|
private final transient AtomicCache<KList<IrisObjectPlacement>> carveObjectsCache = new AtomicCache<>(false);
|
||||||
private final transient AtomicCache<Color> cacheColor = new AtomicCache<>(true);
|
private final transient AtomicCache<Color> cacheColor = new AtomicCache<>(true);
|
||||||
@ -201,6 +205,51 @@ public class IrisBiome extends IrisRegistrant implements IRare
|
|||||||
private final transient AtomicCache<KList<CNG>> layerHeightGenerators = new AtomicCache<>();
|
private final transient AtomicCache<KList<CNG>> layerHeightGenerators = new AtomicCache<>();
|
||||||
private final transient AtomicCache<KList<CNG>> layerSeaHeightGenerators = new AtomicCache<>();
|
private final transient AtomicCache<KList<CNG>> layerSeaHeightGenerators = new AtomicCache<>();
|
||||||
|
|
||||||
|
public double getGenLinkMax(String loadKey)
|
||||||
|
{
|
||||||
|
return genCacheMax.aquire(() ->
|
||||||
|
{
|
||||||
|
KMap<String, Integer> l = new KMap<>();
|
||||||
|
|
||||||
|
for(IrisBiomeGeneratorLink i : getGenerators())
|
||||||
|
{
|
||||||
|
l.put(i.getGenerator(), i.getMax());
|
||||||
|
}
|
||||||
|
|
||||||
|
return l;
|
||||||
|
}).compute(loadKey, (k, v) -> v != null ? v : 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getGenLinkMin(String loadKey)
|
||||||
|
{
|
||||||
|
return genCacheMin.aquire(() ->
|
||||||
|
{
|
||||||
|
KMap<String, Integer> l = new KMap<>();
|
||||||
|
|
||||||
|
for(IrisBiomeGeneratorLink i : getGenerators())
|
||||||
|
{
|
||||||
|
l.put(i.getGenerator(), i.getMin());
|
||||||
|
}
|
||||||
|
|
||||||
|
return l;
|
||||||
|
}).compute(loadKey, (k, v) -> v != null ? v : 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IrisBiomeGeneratorLink getGenLink(String loadKey)
|
||||||
|
{
|
||||||
|
return genCache.aquire(() ->
|
||||||
|
{
|
||||||
|
KMap<String, IrisBiomeGeneratorLink> l = new KMap<>();
|
||||||
|
|
||||||
|
for(IrisBiomeGeneratorLink i : getGenerators())
|
||||||
|
{
|
||||||
|
l.put(i.getGenerator(), i);
|
||||||
|
}
|
||||||
|
|
||||||
|
return l;
|
||||||
|
}).get(loadKey);
|
||||||
|
}
|
||||||
|
|
||||||
public IrisBiome getRealCarvingBiome(IrisDataManager data)
|
public IrisBiome getRealCarvingBiome(IrisDataManager data)
|
||||||
{
|
{
|
||||||
return realCarveBiome.aquire(() ->
|
return realCarveBiome.aquire(() ->
|
||||||
@ -617,7 +666,7 @@ public class IrisBiome extends IrisRegistrant implements IRare
|
|||||||
{
|
{
|
||||||
return B.get("AIR");
|
return B.get("AIR");
|
||||||
}
|
}
|
||||||
|
|
||||||
return getLayers().get(0).get(rng, x, 0, z, idm);
|
return getLayers().get(0).get(rng, x, 0, z, idm);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user