Performance Improvements

This commit is contained in:
cyberpwn
2021-08-23 03:12:17 -04:00
parent 44acfc7ec8
commit 9d62113388
20 changed files with 292 additions and 106 deletions

View File

@@ -21,6 +21,8 @@ package com.volmit.iris.util.mantle;
import com.google.common.collect.ImmutableList;
import com.volmit.iris.Iris;
import com.volmit.iris.engine.data.cache.Cache;
import com.volmit.iris.engine.mantle.EngineMantle;
import com.volmit.iris.engine.mantle.MantleWriter;
import com.volmit.iris.engine.object.basic.IrisPosition;
import com.volmit.iris.engine.object.feature.IrisFeaturePositional;
import com.volmit.iris.util.collection.KMap;
@@ -101,6 +103,20 @@ public class Mantle {
}
}
/**
* Obtain a cached writer which only contains cached chunks.
* This avoids locking on regions when writing to lots of chunks
* @param x the x chunk
* @param z the z chunk
* @param radius the radius chunks
* @return the writer
*/
@ChunkCoordinates
public MantleWriter write(EngineMantle engineMantle, int x, int z, int radius)
{
return new MantleWriter(engineMantle, this, x, z, radius);
}
/**
* Lower a flag if it is raised. If the flag was lowered (meaning it was previously raised), execute the runnable
* @param x the chunk x
@@ -911,4 +927,8 @@ public class Mantle {
private static double lengthSq(double x, double z) {
return (x * x) + (z * z);
}
public int getWorldHeight() {
return worldHeight;
}
}