mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-12-26 10:39:07 +00:00
Goes faster
This commit is contained in:
@@ -35,6 +35,8 @@ import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
@Snippet("style")
|
||||
@Accessors(chain = true)
|
||||
@NoArgsConstructor
|
||||
@@ -70,6 +72,10 @@ public class IrisGeneratorStyle {
|
||||
@MaxNumber(64)
|
||||
@Desc("The exponent")
|
||||
private double exponent = 1;
|
||||
@MinNumber(0)
|
||||
@MaxNumber(8192)
|
||||
@Desc("If the cache size is set above 0, this generator will be cached")
|
||||
private int cacheSize = 0;
|
||||
|
||||
public IrisGeneratorStyle(NoiseStyle s) {
|
||||
this.style = s;
|
||||
@@ -81,6 +87,18 @@ public class IrisGeneratorStyle {
|
||||
}
|
||||
|
||||
public CNG createNoCache(RNG rng, IrisData data) {
|
||||
return createNoCache(rng, data, false);
|
||||
}
|
||||
|
||||
|
||||
private int hash()
|
||||
{
|
||||
return Objects.hash(expression, imageMap, multiplier, axialFracturing, fracture != null ? fracture.hash() : 0, exponent, cacheSize, zoom, cellularZoom, cellularFrequency, style);
|
||||
}
|
||||
|
||||
public CNG createNoCache(RNG rng, IrisData data, boolean actuallyCached) {
|
||||
String cacheKey = hash() + "";
|
||||
|
||||
if(getExpression() != null) {
|
||||
IrisExpression e = data.getExpressionLoader().load(getExpression());
|
||||
|
||||
@@ -134,7 +152,7 @@ public class IrisGeneratorStyle {
|
||||
}
|
||||
|
||||
public CNG create(RNG rng, IrisData data) {
|
||||
return cng.aquire(() -> createNoCache(rng, data));
|
||||
return cng.aquire(() -> createNoCache(rng, data, true));
|
||||
}
|
||||
|
||||
@SuppressWarnings("BooleanMethodIsAlwaysInverted")
|
||||
|
||||
@@ -31,11 +31,15 @@ import com.volmit.iris.engine.object.StudioMode;
|
||||
import com.volmit.iris.engine.platform.studio.StudioGenerator;
|
||||
import com.volmit.iris.util.collection.KList;
|
||||
import com.volmit.iris.util.data.IrisBiomeStorage;
|
||||
import com.volmit.iris.util.format.Form;
|
||||
import com.volmit.iris.util.hunk.Hunk;
|
||||
import com.volmit.iris.util.hunk.view.BiomeGridHunkHolder;
|
||||
import com.volmit.iris.util.hunk.view.ChunkDataHunkHolder;
|
||||
import com.volmit.iris.util.io.ReactiveFolder;
|
||||
import com.volmit.iris.util.scheduling.ChronoLatch;
|
||||
import com.volmit.iris.util.scheduling.J;
|
||||
import com.volmit.iris.util.scheduling.Looper;
|
||||
import com.volmit.iris.util.scheduling.PrecisionStopwatch;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Setter;
|
||||
@@ -278,9 +282,11 @@ public class BukkitChunkGenerator extends ChunkGenerator implements PlatformChun
|
||||
if(studioGenerator != null) {
|
||||
studioGenerator.generateChunk(getEngine(), tc, x, z);
|
||||
} else {
|
||||
Hunk<BlockData> blocks = Hunk.view(tc);
|
||||
Hunk<Biome> biomes = Hunk.view(tc, tc.getMinHeight(), tc.getMaxHeight());
|
||||
ChunkDataHunkHolder blocks = new ChunkDataHunkHolder(tc);
|
||||
BiomeGridHunkHolder biomes = new BiomeGridHunkHolder(tc, tc.getMinHeight(), tc.getMaxHeight());
|
||||
getEngine().generate(x << 4, z << 4, blocks, biomes, true);
|
||||
blocks.apply();
|
||||
biomes.apply();
|
||||
}
|
||||
|
||||
ChunkData c = tc.getRaw();
|
||||
|
||||
Reference in New Issue
Block a user