9
0
mirror of https://github.com/VolmitSoftware/Iris.git synced 2025-12-24 01:29:16 +00:00

No Caching

This commit is contained in:
Dan Macbook
2020-08-14 03:39:35 -04:00
parent 7406da66a7
commit 948317c27a
20 changed files with 397 additions and 498 deletions

BIN
.DS_Store vendored

Binary file not shown.

2
.gitignore vendored
View File

@@ -11,3 +11,5 @@ lint/in.jar
lint/out.jar lint/out.jar
lint/mapping.txt lint/mapping.txt
.DS_Store

View File

@@ -41,8 +41,7 @@ import com.volmit.iris.util.Permission;
import com.volmit.iris.util.RollingSequence; import com.volmit.iris.util.RollingSequence;
import com.volmit.iris.util.ScoreDirection; import com.volmit.iris.util.ScoreDirection;
public class Iris extends MortarPlugin implements BoardProvider public class Iris extends MortarPlugin implements BoardProvider {
{
public static KList<GroupedExecutor> executors = new KList<>(); public static KList<GroupedExecutor> executors = new KList<>();
public static Iris instance; public static Iris instance;
public static IrisDataManager globaldata; public static IrisDataManager globaldata;
@@ -66,31 +65,27 @@ public class Iris extends MortarPlugin implements BoardProvider
@com.volmit.iris.util.Command @com.volmit.iris.util.Command
public CommandIris commandIris; public CommandIris commandIris;
public Iris() public Iris() {
{
IO.delete(new File("iris")); IO.delete(new File("iris"));
} }
@Override @Override
public void start() public void start() {
{
} }
@Override @Override
public void stop() public void stop() {
{
} }
@Override @Override
public String getTag(String subTag) public String getTag(String subTag) {
{ return ChatColor.BOLD + "" + ChatColor.DARK_GRAY + "[" + ChatColor.BOLD + "" + ChatColor.GREEN + "Iris"
return ChatColor.BOLD + "" + ChatColor.DARK_GRAY + "[" + ChatColor.BOLD + "" + ChatColor.GREEN + "Iris" + ChatColor.BOLD + ChatColor.DARK_GRAY + "]" + ChatColor.RESET + "" + ChatColor.GRAY + ": "; + ChatColor.BOLD + ChatColor.DARK_GRAY + "]" + ChatColor.RESET + "" + ChatColor.GRAY + ": ";
} }
public void onEnable() public void onEnable() {
{
lock = new IrisLock("Iris"); lock = new IrisLock("Iris");
instance = this; instance = this;
hotloader = new IrisHotloadManager(); hotloader = new IrisHotloadManager();
@@ -98,25 +93,22 @@ public class Iris extends MortarPlugin implements BoardProvider
wand = new WandController(); wand = new WandController();
postProcessors = loadPostProcessors(); postProcessors = loadPostProcessors();
proj = new ProjectManager(); proj = new ProjectManager();
manager = new BoardManager(this, BoardSettings.builder().boardProvider(this).scoreDirection(ScoreDirection.UP).build()); manager = new BoardManager(this,
BoardSettings.builder().boardProvider(this).scoreDirection(ScoreDirection.UP).build());
super.onEnable(); super.onEnable();
} }
public void onDisable() public void onDisable() {
{
lock.unlock(); lock.unlock();
proj.close(); proj.close();
for(GroupedExecutor i : executors) for (GroupedExecutor i : executors) {
{
i.close(); i.close();
} }
for(World i : Bukkit.getWorlds()) for (World i : Bukkit.getWorlds()) {
{ if (i.getGenerator() instanceof IrisChunkGenerator) {
if(i.getGenerator() instanceof IrisChunkGenerator)
{
((IrisChunkGenerator) i).close(); ((IrisChunkGenerator) i).close();
} }
} }
@@ -129,28 +121,23 @@ public class Iris extends MortarPlugin implements BoardProvider
} }
@Override @Override
public String getTitle(Player player) public String getTitle(Player player) {
{
return ChatColor.GREEN + "Iris"; return ChatColor.GREEN + "Iris";
} }
@Override @Override
public List<String> getLines(Player player) public List<String> getLines(Player player) {
{ if (!clf.flip()) {
if(!clf.flip())
{
return lines; return lines;
} }
World world = player.getWorld(); World world = player.getWorld();
lines.clear(); lines.clear();
if(world.getGenerator() instanceof IrisChunkGenerator) if (world.getGenerator() instanceof IrisChunkGenerator) {
{
IrisChunkGenerator g = (IrisChunkGenerator) world.getGenerator(); IrisChunkGenerator g = (IrisChunkGenerator) world.getGenerator();
if(cl.flip()) if (cl.flip()) {
{
mem = Form.memSize(g.guessMemoryUsage(), 2); mem = Form.memSize(g.guessMemoryUsage(), 2);
} }
@@ -163,21 +150,23 @@ public class Iris extends MortarPlugin implements BoardProvider
tp.put(g.getMetrics().getSpeed()); tp.put(g.getMetrics().getSpeed());
lines.add("&7&m-----------------"); lines.add("&7&m-----------------");
lines.add(ChatColor.GREEN + "Speed" + ChatColor.GRAY + ": " + ChatColor.BOLD + "" + ChatColor.GRAY + Form.f(g.getMetrics().getPerSecond().getAverage(), 0) + "/s " + Form.duration(g.getMetrics().getTotal().getAverage(), 1) + ""); lines.add(ChatColor.GREEN + "Speed" + ChatColor.GRAY + ": " + ChatColor.BOLD + "" + ChatColor.GRAY
+ Form.f(g.getMetrics().getPerSecond().getAverage(), 0) + "/s "
+ Form.duration(g.getMetrics().getTotal().getAverage(), 1) + "");
lines.add(ChatColor.GREEN + "Generators" + ChatColor.GRAY + ": " + Form.f(CNG.creates)); lines.add(ChatColor.GREEN + "Generators" + ChatColor.GRAY + ": " + Form.f(CNG.creates));
lines.add(ChatColor.GREEN + "Noise" + ChatColor.GRAY + ": " + Form.f((int) hits.getAverage())); lines.add(ChatColor.GREEN + "Noise" + ChatColor.GRAY + ": " + Form.f((int) hits.getAverage()));
lines.add(ChatColor.GREEN + "Parallax Chunks" + ChatColor.GRAY + ": " + Form.f((int) g.getParallaxMap().getLoadedChunks().size())); lines.add(ChatColor.GREEN + "Parallax Chunks" + ChatColor.GRAY + ": "
lines.add(ChatColor.GREEN + "Objects" + ChatColor.GRAY + ": " + Form.f(g.getData().getObjectLoader().count())); + Form.f((int) g.getParallaxMap().getLoadedChunks().size()));
lines.add(ChatColor.GREEN + "Objects" + ChatColor.GRAY + ": "
+ Form.f(g.getData().getObjectLoader().count()));
lines.add(ChatColor.GREEN + "Memory" + ChatColor.GRAY + ": " + mem); lines.add(ChatColor.GREEN + "Memory" + ChatColor.GRAY + ": " + mem);
if(er != null && b != null) if (er != null && b != null) {
{
lines.add(ChatColor.GREEN + "Biome" + ChatColor.GRAY + ": " + b.getName()); lines.add(ChatColor.GREEN + "Biome" + ChatColor.GRAY + ": " + b.getName());
lines.add(ChatColor.GREEN + "File" + ChatColor.GRAY + ": " + b.getLoadKey()); lines.add(ChatColor.GREEN + "File" + ChatColor.GRAY + ": " + b.getLoadKey());
} }
if(st != null) if (st != null) {
{
lines.add(ChatColor.GREEN + "Structure" + ChatColor.GRAY + ": " + st.getStructure().getName()); lines.add(ChatColor.GREEN + "Structure" + ChatColor.GRAY + ": " + st.getStructure().getName());
lines.add(ChatColor.GREEN + "Tile" + ChatColor.GRAY + ": " + st.getTile().toString()); lines.add(ChatColor.GREEN + "Tile" + ChatColor.GRAY + ": " + st.getTile().toString());
} }
@@ -185,16 +174,14 @@ public class Iris extends MortarPlugin implements BoardProvider
lines.add("&7&m-----------------"); lines.add("&7&m-----------------");
} }
else else {
{
lines.add(ChatColor.GREEN + "Join an Iris World!"); lines.add(ChatColor.GREEN + "Join an Iris World!");
} }
return lines; return lines;
} }
private static KList<Class<? extends IrisPostBlockFilter>> loadPostProcessors() private static KList<Class<? extends IrisPostBlockFilter>> loadPostProcessors() {
{
KList<Class<? extends IrisPostBlockFilter>> g = new KList<Class<? extends IrisPostBlockFilter>>(); KList<Class<? extends IrisPostBlockFilter>> g = new KList<Class<? extends IrisPostBlockFilter>>();
g.add(PostFloatingNibDeleter.class); g.add(PostFloatingNibDeleter.class);
@@ -208,65 +195,55 @@ public class Iris extends MortarPlugin implements BoardProvider
} }
@Override @Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
{
return super.onCommand(sender, command, label, args); return super.onCommand(sender, command, label, args);
} }
public void imsg(CommandSender s, String msg) public void imsg(CommandSender s, String msg) {
{ s.sendMessage(ChatColor.GREEN + "[" + ChatColor.DARK_GRAY + "Iris" + ChatColor.GREEN + "]" + ChatColor.GRAY
s.sendMessage(ChatColor.GREEN + "[" + ChatColor.DARK_GRAY + "Iris" + ChatColor.GREEN + "]" + ChatColor.GRAY + ": " + msg); + ": " + msg);
} }
@Override @Override
public ChunkGenerator getDefaultWorldGenerator(String worldName, String id) public ChunkGenerator getDefaultWorldGenerator(String worldName, String id) {
{
return new IrisChunkGenerator(16); return new IrisChunkGenerator(16);
} }
public static void msg(String string) public static void msg(String string) {
{
lock.lock(); lock.lock();
String msg = ChatColor.GREEN + "[Iris]: " + ChatColor.GRAY + string; String msg = ChatColor.GREEN + "[Iris]: " + ChatColor.GRAY + string;
if(last.equals(msg)) if (last.equals(msg)) {
{
lock.unlock(); lock.unlock();
return; return;
} }
last = msg; last = msg;
Bukkit.getScheduler().scheduleSyncDelayedTask(Iris.instance, () -> Bukkit.getConsoleSender().sendMessage(msg)); Bukkit.getConsoleSender().sendMessage(msg);
lock.unlock(); lock.unlock();
} }
public static void warn(String string) public static void warn(String string) {
{
msg(ChatColor.YELLOW + string); msg(ChatColor.YELLOW + string);
} }
public static void error(String string) public static void error(String string) {
{
msg(ChatColor.RED + string); msg(ChatColor.RED + string);
} }
public static void verbose(String string) public static void verbose(String string) {
{
msg(ChatColor.GRAY + string); msg(ChatColor.GRAY + string);
} }
public static void success(String string) public static void success(String string) {
{
msg(ChatColor.GREEN + string); msg(ChatColor.GREEN + string);
} }
public static void info(String string) public static void info(String string) {
{
msg(ChatColor.WHITE + string); msg(ChatColor.WHITE + string);
} }
public void hit(long hits2) public void hit(long hits2) {
{
hits.put(hits2); hits.put(hits2);
} }
} }

View File

@@ -56,6 +56,8 @@ public class NoiseView extends JPanel implements MouseWheelListener {
double lx = Double.MAX_VALUE; double lx = Double.MAX_VALUE;
double lz = Double.MAX_VALUE; double lz = Double.MAX_VALUE;
double tz = 1D;
double t = 1D;
public NoiseView() { public NoiseView() {
@@ -82,7 +84,13 @@ public class NoiseView extends JPanel implements MouseWheelListener {
} }
public void mouseWheelMoved(MouseWheelEvent e) { public void mouseWheelMoved(MouseWheelEvent e) {
int notches = e.getWheelRotation(); int notches = e.getWheelRotation();
if (e.isControlDown()) {
t = t + ((0.001 * t) * notches);
return;
}
scale = scale + ((0.044 * scale) * notches); scale = scale + ((0.044 * scale) * notches);
scale = scale < 0.00001 ? 0.00001 : scale; scale = scale < 0.00001 ? 0.00001 : scale;
} }
@@ -98,6 +106,14 @@ public class NoiseView extends JPanel implements MouseWheelListener {
ascale += Math.abs(ascale - scale) * 0.16; ascale += Math.abs(ascale - scale) * 0.16;
} }
if (t < tz) {
tz -= Math.abs(t - tz) * 0.29;
}
if (t > tz) {
tz += Math.abs(tz - t) * 0.29;
}
if (ox < oxp) { if (ox < oxp) {
oxp -= Math.abs(ox - oxp) * 0.16; oxp -= Math.abs(ox - oxp) * 0.16;
} }
@@ -134,8 +150,7 @@ public class NoiseView extends JPanel implements MouseWheelListener {
int xx = x; int xx = x;
gx.queue("a", () -> { gx.queue("a", () -> {
for (int z = 0; z < getParent().getHeight(); z += accuracy) { for (int z = 0; z < getParent().getHeight(); z += accuracy) {
double n = cng.noise((xx * ascale) + oxp, Math.sin((double) M.ms() / 20000D) * 800D, double n = cng.noise((xx * ascale) + oxp, tz, (z * ascale) + ozp);
(z * ascale) + ozp);
if (n > 1 || n < 0) { if (n > 1 || n < 0) {
System.out.println("EXCEEDED " + n); System.out.println("EXCEEDED " + n);
@@ -162,6 +177,8 @@ public class NoiseView extends JPanel implements MouseWheelListener {
} }
p.end(); p.end();
t += 1D;
r.put(p.getMilliseconds()); r.put(p.getMilliseconds());
EventQueue.invokeLater(() -> { EventQueue.invokeLater(() -> {
repaint(); repaint();

View File

@@ -13,7 +13,6 @@ import com.volmit.iris.object.IrisGenerator;
import com.volmit.iris.object.IrisRegion; import com.volmit.iris.object.IrisRegion;
import com.volmit.iris.util.BiomeResult; import com.volmit.iris.util.BiomeResult;
import com.volmit.iris.util.ChronoLatch; import com.volmit.iris.util.ChronoLatch;
import com.volmit.iris.util.ChunkPosition;
import com.volmit.iris.util.IrisInterpolation; import com.volmit.iris.util.IrisInterpolation;
import com.volmit.iris.util.IrisLock; import com.volmit.iris.util.IrisLock;
import com.volmit.iris.util.KList; import com.volmit.iris.util.KList;
@@ -26,68 +25,39 @@ import lombok.EqualsAndHashCode;
@Data @Data
@EqualsAndHashCode(callSuper = false) @EqualsAndHashCode(callSuper = false)
public abstract class BiomeChunkGenerator extends DimensionChunkGenerator public abstract class BiomeChunkGenerator extends DimensionChunkGenerator {
{
protected IrisLock regLock; protected IrisLock regLock;
private KMap<String, IrisGenerator> generators; private KMap<String, IrisGenerator> generators;
private KMap<String, IrisGenerator> ceilingGenerators; private KMap<String, IrisGenerator> ceilingGenerators;
protected GenLayerBiome glBiome; protected GenLayerBiome glBiome;
protected CNG masterFracture; protected CNG masterFracture;
private KMap<ChunkPosition, BiomeResult> biomeHitCache;
private KMap<ChunkPosition, BiomeResult> ceilingBiomeHitCache;
protected ChronoLatch cwarn = new ChronoLatch(1000); protected ChronoLatch cwarn = new ChronoLatch(1000);
private IrisBiome[] biomeCache;
public BiomeChunkGenerator(String dimensionName) public BiomeChunkGenerator(String dimensionName) {
{
super(dimensionName); super(dimensionName);
generators = new KMap<>(); generators = new KMap<>();
ceilingGenerators = new KMap<>(); ceilingGenerators = new KMap<>();
regLock = new IrisLock("BiomeChunkGenerator"); regLock = new IrisLock("BiomeChunkGenerator");
biomeHitCache = new KMap<>();
ceilingBiomeHitCache = new KMap<>();
biomeCache = new IrisBiome[256];
} }
public void onInit(World world, RNG rng) public void onInit(World world, RNG rng) {
{
super.onInit(world, rng); super.onInit(world, rng);
loadGenerators(); loadGenerators();
glBiome = new GenLayerBiome(this, masterRandom.nextParallelRNG(1)); glBiome = new GenLayerBiome(this, masterRandom.nextParallelRNG(1));
masterFracture = CNG.signature(rng.nextParallelRNG(13)).scale(0.12); masterFracture = CNG.signature(rng.nextParallelRNG(13)).scale(0.12);
} }
protected IrisBiome getCachedInternalBiome(int x, int z)
{
return biomeCache[(z << 4) | x];
}
protected void cacheInternalBiome(int x, int z, IrisBiome b)
{
biomeCache[(z << 4) | x] = b;
}
public KMap<ChunkPosition, BiomeResult> getBiomeHitCache()
{
return getDimension().isInverted() ? ceilingBiomeHitCache : biomeHitCache;
}
@Override @Override
public void onHotload() public void onHotload() {
{
super.onHotload(); super.onHotload();
biomeHitCache = new KMap<>();
ceilingBiomeHitCache = new KMap<>();
loadGenerators(); loadGenerators();
} }
public void registerGenerator(IrisGenerator g, IrisDimension dim) public void registerGenerator(IrisGenerator g, IrisDimension dim) {
{
KMap<String, IrisGenerator> generators = dim.isInverted() ? ceilingGenerators : this.generators; KMap<String, IrisGenerator> generators = dim.isInverted() ? ceilingGenerators : this.generators;
regLock.lock(); regLock.lock();
if(g.getLoadKey() == null || generators.containsKey(g.getLoadKey())) if (g.getLoadKey() == null || generators.containsKey(g.getLoadKey())) {
{
regLock.unlock(); regLock.unlock();
return; return;
} }
@@ -96,66 +66,56 @@ public abstract class BiomeChunkGenerator extends DimensionChunkGenerator
generators.put(g.getLoadKey(), g); generators.put(g.getLoadKey(), g);
} }
protected KMap<String, IrisGenerator> getGenerators() protected KMap<String, IrisGenerator> getGenerators() {
{
return getDimension().isInverted() ? ceilingGenerators : generators; return getDimension().isInverted() ? ceilingGenerators : generators;
} }
protected double getBiomeHeight(double rx, double rz, int x, int z) protected double getBiomeHeight(double rx, double rz, int x, int z) {
{
double h = 0; double h = 0;
for(IrisGenerator i : getGenerators().values()) for (IrisGenerator i : getGenerators().values()) {
{
h += interpolateGenerator(rx, rz, i); h += interpolateGenerator(rx, rz, i);
} }
return h; return h;
} }
protected double interpolateGenerator(double rx, double rz, IrisGenerator gen) protected double interpolateGenerator(double rx, double rz, IrisGenerator gen) {
{ double hi = IrisInterpolation.getNoise(gen.getInterpolationFunction(), (int) Math.round(rx),
double hi = IrisInterpolation.getNoise(gen.getInterpolationFunction(), (int) Math.round(rx), (int) Math.round(rz), gen.getInterpolationScale(), (xx, zz) -> (int) Math.round(rz), gen.getInterpolationScale(), (xx, zz) -> {
{ try {
try
{
IrisBiome b = sampleBiome((int) xx, (int) zz).getBiome(); IrisBiome b = sampleBiome((int) xx, (int) zz).getBiome();
for(IrisBiomeGeneratorLink i : b.getGenerators()) for (IrisBiomeGeneratorLink i : b.getGenerators()) {
{ if (i.getGenerator().equals(gen.getLoadKey())) {
if(i.getGenerator().equals(gen.getLoadKey()))
{
return i.getMax(); return i.getMax();
} }
} }
} }
catch(Throwable e) catch (Throwable e) {
{ Iris.warn("Failed to sample biome at " + rx + " " + rz + " using the generator "
Iris.warn("Failed to sample biome at " + rx + " " + rz + " using the generator " + gen.getLoadKey()); + gen.getLoadKey());
} }
return 0; return 0;
}); });
double lo = IrisInterpolation.getNoise(gen.getInterpolationFunction(), (int) Math.round(rx), (int) Math.round(rz), gen.getInterpolationScale(), (xx, zz) -> double lo = IrisInterpolation.getNoise(gen.getInterpolationFunction(), (int) Math.round(rx),
{ (int) Math.round(rz), gen.getInterpolationScale(), (xx, zz) -> {
try try {
{
IrisBiome b = sampleBiome((int) xx, (int) zz).getBiome(); IrisBiome b = sampleBiome((int) xx, (int) zz).getBiome();
for(IrisBiomeGeneratorLink i : b.getGenerators()) for (IrisBiomeGeneratorLink i : b.getGenerators()) {
{ if (i.getGenerator().equals(gen.getLoadKey())) {
if(i.getGenerator().equals(gen.getLoadKey()))
{
return i.getMin(); return i.getMin();
} }
} }
} }
catch(Throwable e) catch (Throwable e) {
{ Iris.warn("Failed to sample biome at " + rx + " " + rz + " using the generator "
Iris.warn("Failed to sample biome at " + rx + " " + rz + " using the generator " + gen.getLoadKey()); + gen.getLoadKey());
} }
return 0; return 0;
@@ -164,30 +124,25 @@ public abstract class BiomeChunkGenerator extends DimensionChunkGenerator
return M.lerp(lo, hi, gen.getHeight(rx, rz, world.getSeed() + 239945)); return M.lerp(lo, hi, gen.getHeight(rx, rz, world.getSeed() + 239945));
} }
protected void loadGenerators() protected void loadGenerators() {
{
generators.clear(); generators.clear();
ceilingGenerators.clear(); ceilingGenerators.clear();
loadGenerators(((CeilingChunkGenerator) this).getFloorDimension()); loadGenerators(((CeilingChunkGenerator) this).getFloorDimension());
loadGenerators(((CeilingChunkGenerator) this).getCeilingDimension()); loadGenerators(((CeilingChunkGenerator) this).getCeilingDimension());
} }
protected void loadGenerators(IrisDimension dim) protected void loadGenerators(IrisDimension dim) {
{ if (dim == null) {
if(dim == null)
{
return; return;
} }
KList<String> touch = new KList<>(); KList<String> touch = new KList<>();
KList<String> loadQueue = new KList<>(); KList<String> loadQueue = new KList<>();
for(String i : dim.getRegions()) for (String i : dim.getRegions()) {
{
IrisRegion r = loadRegion(i); IrisRegion r = loadRegion(i);
if(r != null) if (r != null) {
{
loadQueue.addAll(r.getLandBiomes()); loadQueue.addAll(r.getLandBiomes());
loadQueue.addAll(r.getSeaBiomes()); loadQueue.addAll(r.getSeaBiomes());
loadQueue.addAll(r.getShoreBiomes()); loadQueue.addAll(r.getShoreBiomes());
@@ -196,12 +151,10 @@ public abstract class BiomeChunkGenerator extends DimensionChunkGenerator
} }
} }
while(!loadQueue.isEmpty()) while (!loadQueue.isEmpty()) {
{
String next = loadQueue.pop(); String next = loadQueue.pop();
if(!touch.contains(next)) if (!touch.contains(next)) {
{
touch.add(next); touch.add(next);
IrisBiome biome = loadBiome(next); IrisBiome biome = loadBiome(next);
biome.getGenerators().forEach((i) -> registerGenerator(i.getCachedGenerator(this), dim)); biome.getGenerators().forEach((i) -> registerGenerator(i.getCachedGenerator(this), dim));
@@ -210,37 +163,31 @@ public abstract class BiomeChunkGenerator extends DimensionChunkGenerator
} }
} }
public IrisRegion sampleRegion(int x, int z) public IrisRegion sampleRegion(int x, int z) {
{
double wx = getModifiedX(x, z); double wx = getModifiedX(x, z);
double wz = getModifiedZ(x, z); double wz = getModifiedZ(x, z);
return glBiome.getRegion(wx, wz); return glBiome.getRegion(wx, wz);
} }
public BiomeResult sampleBiome(int x, int z) public BiomeResult sampleBiome(int x, int z) {
{ if (!getDimension().getFocus().equals("")) {
if(!getDimension().getFocus().equals(""))
{
IrisBiome biome = loadBiome(getDimension().getFocus()); IrisBiome biome = loadBiome(getDimension().getFocus());
for(String i : getDimension().getRegions()) for (String i : getDimension().getRegions()) {
{
IrisRegion reg = loadRegion(i); IrisRegion reg = loadRegion(i);
if(reg.getLandBiomes().contains(biome.getLoadKey())) if (reg.getLandBiomes().contains(biome.getLoadKey())) {
{
biome.setInferredType(InferredType.LAND); biome.setInferredType(InferredType.LAND);
break; break;
} }
if(reg.getSeaBiomes().contains(biome.getLoadKey())) if (reg.getSeaBiomes().contains(biome.getLoadKey())) {
{
biome.setInferredType(InferredType.SEA); biome.setInferredType(InferredType.SEA);
break; break;
} }
if(reg.getShoreBiomes().contains(biome.getLoadKey())) if (reg.getShoreBiomes().contains(biome.getLoadKey())) {
{
biome.setInferredType(InferredType.SHORE); biome.setInferredType(InferredType.SHORE);
break; break;
} }
@@ -249,18 +196,10 @@ public abstract class BiomeChunkGenerator extends DimensionChunkGenerator
return new BiomeResult(biome, 0); return new BiomeResult(biome, 0);
} }
ChunkPosition pos = new ChunkPosition(x, z);
if(getBiomeHitCache().containsKey(pos))
{
return getBiomeHitCache().get(pos);
}
double wx = getModifiedX(x, z); double wx = getModifiedX(x, z);
double wz = getModifiedZ(x, z); double wz = getModifiedZ(x, z);
IrisRegion region = glBiome.getRegion(wx, wz); IrisRegion region = glBiome.getRegion(wx, wz);
BiomeResult res = glBiome.generateRegionData(wx, wz, x, z, region); BiomeResult res = glBiome.generateRegionData(wx, wz, x, z, region);
getBiomeHitCache().put(pos, res);
return res; return res;
} }

View File

@@ -270,7 +270,7 @@ public abstract class ContextualChunkGenerator extends ChunkGenerator implements
@Override @Override
public ChunkData generateChunkData(World world, Random no, int x, int z, BiomeGrid biomeGrid) { public ChunkData generateChunkData(World world, Random no, int x, int z, BiomeGrid biomeGrid) {
hlock.getLock(); hlock.lock();
if (!dev) { if (!dev) {
pregenDone = true; pregenDone = true;
fastPregen = false; fastPregen = false;

View File

@@ -123,11 +123,7 @@ public class IrisChunkGenerator extends CeilingChunkGenerator implements IrisCon
e.printStackTrace(); e.printStackTrace();
} }
setBiomeCache(null);
setAvailableFilters(null); setAvailableFilters(null);
setBiomeHitCache(null);
setCacheTrueBiome(null);
setCacheHeightMap(null);
setCeilingSliverCache(null); setCeilingSliverCache(null);
setSliverCache(null); setSliverCache(null);
Iris.info("Closing Iris Dimension " + getWorld().getName()); Iris.info("Closing Iris Dimension " + getWorld().getName());

View File

@@ -33,8 +33,7 @@ import lombok.EqualsAndHashCode;
@Data @Data
@EqualsAndHashCode(callSuper = false) @EqualsAndHashCode(callSuper = false)
public abstract class ParallaxChunkGenerator extends TerrainChunkGenerator implements IObjectPlacer public abstract class ParallaxChunkGenerator extends TerrainChunkGenerator implements IObjectPlacer {
{
protected KMap<ChunkPosition, AtomicSliver> sliverCache; protected KMap<ChunkPosition, AtomicSliver> sliverCache;
protected AtomicWorldData parallaxMap; protected AtomicWorldData parallaxMap;
protected KMap<ChunkPosition, AtomicSliver> ceilingSliverCache; protected KMap<ChunkPosition, AtomicSliver> ceilingSliverCache;
@@ -44,8 +43,7 @@ public abstract class ParallaxChunkGenerator extends TerrainChunkGenerator imple
private IrisLock lockq = new IrisLock("ParallaxQueueLock"); private IrisLock lockq = new IrisLock("ParallaxQueueLock");
private int sliverBuffer; private int sliverBuffer;
public ParallaxChunkGenerator(String dimensionName, int threads) public ParallaxChunkGenerator(String dimensionName, int threads) {
{
super(dimensionName, threads); super(dimensionName, threads);
sliverCache = new KMap<>(); sliverCache = new KMap<>();
ceilingSliverCache = new KMap<>(); ceilingSliverCache = new KMap<>();
@@ -53,49 +51,40 @@ public abstract class ParallaxChunkGenerator extends TerrainChunkGenerator imple
masterLock = new MasterLock(); masterLock = new MasterLock();
} }
public void onInit(World world, RNG rng) public void onInit(World world, RNG rng) {
{
super.onInit(world, rng); super.onInit(world, rng);
parallaxMap = new AtomicWorldData(world, "floor"); parallaxMap = new AtomicWorldData(world, "floor");
ceilingParallaxMap = new AtomicWorldData(world, "ceiling"); ceilingParallaxMap = new AtomicWorldData(world, "ceiling");
} }
protected KMap<ChunkPosition, AtomicSliver> getSliverCache() protected KMap<ChunkPosition, AtomicSliver> getSliverCache() {
{
return getDimension().isInverted() ? ceilingSliverCache : sliverCache; return getDimension().isInverted() ? ceilingSliverCache : sliverCache;
} }
protected void onClose() protected void onClose() {
{
super.onClose(); super.onClose();
try try {
{
parallaxMap.unloadAll(true); parallaxMap.unloadAll(true);
ceilingParallaxMap.unloadAll(true); ceilingParallaxMap.unloadAll(true);
} }
catch(IOException e) catch (IOException e) {
{
e.printStackTrace(); e.printStackTrace();
} }
} }
@Override @Override
public int getHighest(int x, int z) public int getHighest(int x, int z) {
{
return getHighest(x, z, false); return getHighest(x, z, false);
} }
@Override @Override
public int getHighest(int x, int z, boolean ignoreFluid) public int getHighest(int x, int z, boolean ignoreFluid) {
{
int h = (int) Math.round(ignoreFluid ? getTerrainHeight(x, z) : getTerrainWaterHeight(x, z)); int h = (int) Math.round(ignoreFluid ? getTerrainHeight(x, z) : getTerrainWaterHeight(x, z));
if(getDimension().isCarving() && h >= getDimension().getCarvingMin()) if (getDimension().isCarving() && h >= getDimension().getCarvingMin()) {
{ while (getGlCarve().isCarved(x, h, z)) {
while(getGlCarve().isCarved(x, h, z))
{
h--; h--;
} }
@@ -106,28 +95,24 @@ public abstract class ParallaxChunkGenerator extends TerrainChunkGenerator imple
} }
@Override @Override
public void set(int x, int y, int z, BlockData d) public void set(int x, int y, int z, BlockData d) {
{
getMasterLock().lock((x >> 4) + "." + (z >> 4)); getMasterLock().lock((x >> 4) + "." + (z >> 4));
getParallaxSliver(x, z).set(y, d); getParallaxSliver(x, z).set(y, d);
getMasterLock().unlock((x >> 4) + "." + (z >> 4)); getMasterLock().unlock((x >> 4) + "." + (z >> 4));
} }
@Override @Override
public BlockData get(int x, int y, int z) public BlockData get(int x, int y, int z) {
{
BlockData b = sampleSliver(x, z).getBlock().get(y); BlockData b = sampleSliver(x, z).getBlock().get(y);
return b == null ? AIR : b; return b == null ? AIR : b;
} }
@Override @Override
public boolean isSolid(int x, int y, int z) public boolean isSolid(int x, int y, int z) {
{
return get(x, y, z).getMaterial().isSolid(); return get(x, y, z).getMaterial().isSolid();
} }
public AtomicSliver getParallaxSliver(int wx, int wz) public AtomicSliver getParallaxSliver(int wx, int wz) {
{
getMasterLock().lock("gpc"); getMasterLock().lock("gpc");
getMasterLock().lock((wx >> 4) + "." + (wz >> 4)); getMasterLock().lock((wx >> 4) + "." + (wz >> 4));
AtomicSliverMap map = getParallaxChunk(wx >> 4, wz >> 4); AtomicSliverMap map = getParallaxChunk(wx >> 4, wz >> 4);
@@ -138,30 +123,24 @@ public abstract class ParallaxChunkGenerator extends TerrainChunkGenerator imple
return sliver; return sliver;
} }
public boolean isParallaxGenerated(int x, int z) public boolean isParallaxGenerated(int x, int z) {
{
return getParallaxChunk(x, z).isParallaxGenerated(); return getParallaxChunk(x, z).isParallaxGenerated();
} }
public boolean isWorldGenerated(int x, int z) public boolean isWorldGenerated(int x, int z) {
{
return getParallaxChunk(x, z).isWorldGenerated(); return getParallaxChunk(x, z).isWorldGenerated();
} }
public AtomicWorldData getParallaxMap() public AtomicWorldData getParallaxMap() {
{
return getDimension().isInverted() ? ceilingParallaxMap : parallaxMap; return getDimension().isInverted() ? ceilingParallaxMap : parallaxMap;
} }
public AtomicSliverMap getParallaxChunk(int x, int z) public AtomicSliverMap getParallaxChunk(int x, int z) {
{ try {
try
{
return getParallaxMap().loadChunk(x, z); return getParallaxMap().loadChunk(x, z);
} }
catch(IOException e) catch (IOException e) {
{
fail(e); fail(e);
} }
@@ -169,19 +148,16 @@ public abstract class ParallaxChunkGenerator extends TerrainChunkGenerator imple
} }
@Override @Override
protected void onPostGenerate(RNG random, int x, int z, ChunkData data, BiomeGrid grid, HeightMap height, BiomeMap biomeMap) protected void onPostGenerate(RNG random, int x, int z, ChunkData data, BiomeGrid grid, HeightMap height,
{ BiomeMap biomeMap) {
if(getSliverCache().size() > 20000) if (getSliverCache().size() > 20000) {
{
getSliverCache().clear(); getSliverCache().clear();
} }
super.onPostGenerate(random, x, z, data, grid, height, biomeMap); super.onPostGenerate(random, x, z, data, grid, height, biomeMap);
PrecisionStopwatch p = PrecisionStopwatch.start(); PrecisionStopwatch p = PrecisionStopwatch.start();
getBiomeHitCache().clear();
if(getDimension().isPlaceObjects()) if (getDimension().isPlaceObjects()) {
{
onGenerateParallax(random, x, z); onGenerateParallax(random, x, z);
getParallaxChunk(x, z).inject(data); getParallaxChunk(x, z).inject(data);
setSliverBuffer(getSliverCache().size()); setSliverBuffer(getSliverCache().size());
@@ -196,58 +172,50 @@ public abstract class ParallaxChunkGenerator extends TerrainChunkGenerator imple
getData().getObjectLoader().clean(); getData().getObjectLoader().clean();
} }
public IrisStructureResult getStructure(int x, int y, int z) public IrisStructureResult getStructure(int x, int y, int z) {
{
IrisBiome b = sampleTrueBiome(x, z).getBiome(); IrisBiome b = sampleTrueBiome(x, z).getBiome();
IrisRegion r = sampleRegion(x, z); IrisRegion r = sampleRegion(x, z);
RNG ro = getMasterRandom().nextParallelRNG(496888 + (x >> 4) + (z >> 4)); RNG ro = getMasterRandom().nextParallelRNG(496888 + (x >> 4) + (z >> 4));
int h = (int) Math.round(getTerrainHeight(x, z)); int h = (int) Math.round(getTerrainHeight(x, z));
KList<IrisStructurePlacement> p = new KList<>(); KList<IrisStructurePlacement> p = new KList<>();
for(IrisStructurePlacement i : r.getStructures()) for (IrisStructurePlacement i : r.getStructures()) {
{ if (i.getHeight() > -1) {
if(i.getHeight() > -1) if (y >= i.getHeight() && y <= i.getHeight()
{ + (i.getStructure(this).getGridHeight() * i.getStructure(this).getMaxLayers())) {
if(y >= i.getHeight() && y <= i.getHeight() + (i.getStructure(this).getGridHeight() * i.getStructure(this).getMaxLayers()))
{
p.add(i); p.add(i);
} }
} }
else if(y >= h && y <= i.getStructure(this).getGridHeight() + h) else if (y >= h && y <= i.getStructure(this).getGridHeight() + h) {
{
p.add(i); p.add(i);
} }
} }
for(IrisStructurePlacement i : b.getStructures()) for (IrisStructurePlacement i : b.getStructures()) {
{ if (i.getHeight() > -1) {
if(i.getHeight() > -1) if (y >= i.getHeight() && y <= i.getHeight()
{ + (i.getStructure(this).getGridHeight() * i.getStructure(this).getMaxLayers())) {
if(y >= i.getHeight() && y <= i.getHeight() + (i.getStructure(this).getGridHeight() * i.getStructure(this).getMaxLayers()))
{
p.add(i); p.add(i);
} }
} }
else if(y >= h && y <= i.getStructure(this).getGridHeight() + h) else if (y >= h && y <= i.getStructure(this).getGridHeight() + h) {
{
p.add(i); p.add(i);
} }
} }
for(IrisStructurePlacement i : p) for (IrisStructurePlacement i : p) {
{ if (!i.hasStructure(ro, x, y, z)) {
if(!i.hasStructure(ro, x, y, z))
{
continue; continue;
} }
int hv = (i.getHeight() == -1 ? 0 : i.getHeight()) + (Math.floorDiv(y, i.getStructure(this).getGridHeight()) * i.getStructure(this).getGridHeight()); int hv = (i.getHeight() == -1 ? 0 : i.getHeight())
TileResult tile = i.getStructure(this).getTile(ro, Math.floorDiv(i.gridSize(this), x) * i.gridSize(this), hv, Math.floorDiv(i.gridSize(this), z) * i.gridSize(this)); + (Math.floorDiv(y, i.getStructure(this).getGridHeight()) * i.getStructure(this).getGridHeight());
TileResult tile = i.getStructure(this).getTile(ro, Math.floorDiv(i.gridSize(this), x) * i.gridSize(this),
hv, Math.floorDiv(i.gridSize(this), z) * i.gridSize(this));
if(tile != null && tile.getTile() != null) if (tile != null && tile.getTile() != null) {
{
return new IrisStructureResult(tile.getTile(), i.getStructure(this)); return new IrisStructureResult(tile.getTile(), i.getStructure(this));
} }
} }
@@ -255,58 +223,52 @@ public abstract class ParallaxChunkGenerator extends TerrainChunkGenerator imple
return null; return null;
} }
protected void onGenerateParallax(RNG random, int x, int z) protected void onGenerateParallax(RNG random, int x, int z) {
{
String key = "par." + x + "." + "z"; String key = "par." + x + "." + "z";
ChunkPosition rad = getDimension().getParallaxSize(this); ChunkPosition rad = getDimension().getParallaxSize(this);
KList<NastyRunnable> q = new KList<>(); KList<NastyRunnable> q = new KList<>();
for(int ii = x - (rad.getX() / 2); ii <= x + (rad.getX() / 2); ii++) for (int ii = x - (rad.getX() / 2); ii <= x + (rad.getX() / 2); ii++) {
{
int i = ii; int i = ii;
for(int jj = z - (rad.getZ() / 2); jj <= z + (rad.getZ() / 2); jj++) for (int jj = z - (rad.getZ() / 2); jj <= z + (rad.getZ() / 2); jj++) {
{
int j = jj; int j = jj;
if(isParallaxGenerated(ii, jj)) if (isParallaxGenerated(ii, jj)) {
{
continue; continue;
} }
if(isWorldGenerated(ii, jj)) if (isWorldGenerated(ii, jj)) {
{
continue; continue;
} }
getAccelerant().queue(key, () -> getAccelerant().queue(key, () -> {
{
IrisBiome b = sampleTrueBiome((i * 16) + 7, (j * 16) + 7).getBiome(); IrisBiome b = sampleTrueBiome((i * 16) + 7, (j * 16) + 7).getBiome();
RNG ro = getMasterRandom().nextParallelRNG(496888 + i + j); RNG ro = getMasterRandom().nextParallelRNG(496888 + i + j);
int g = 1; int g = 1;
searching: for(IrisBiomeMutation k : getDimension().getMutations()) searching: for (IrisBiomeMutation k : getDimension().getMutations()) {
{ for (int l = 0; l < k.getChecks(); l++) {
for(int l = 0; l < k.getChecks(); l++) IrisBiome sa = sampleTrueBiome(
{ ((i * 16) + ro.nextInt(16)) + ro.i(-k.getRadius(), k.getRadius()),
IrisBiome sa = sampleTrueBiome(((i * 16) + ro.nextInt(16)) + ro.i(-k.getRadius(), k.getRadius()), ((j * 16) + ro.nextInt(16)) + ro.i(-k.getRadius(), k.getRadius())).getBiome(); ((j * 16) + ro.nextInt(16)) + ro.i(-k.getRadius(), k.getRadius())).getBiome();
IrisBiome sb = sampleTrueBiome(((i * 16) + ro.nextInt(16)) + ro.i(-k.getRadius(), k.getRadius()), ((j * 16) + ro.nextInt(16)) + ro.i(-k.getRadius(), k.getRadius())).getBiome(); IrisBiome sb = sampleTrueBiome(
((i * 16) + ro.nextInt(16)) + ro.i(-k.getRadius(), k.getRadius()),
((j * 16) + ro.nextInt(16)) + ro.i(-k.getRadius(), k.getRadius())).getBiome();
if(sa.getLoadKey().equals(sb.getLoadKey())) if (sa.getLoadKey().equals(sb.getLoadKey())) {
{
continue; continue;
} }
if(k.getRealSideA(this).contains(sa.getLoadKey()) && k.getRealSideB(this).contains(sb.getLoadKey())) if (k.getRealSideA(this).contains(sa.getLoadKey())
{ && k.getRealSideB(this).contains(sb.getLoadKey())) {
for(IrisObjectPlacement m : k.getObjects()) for (IrisObjectPlacement m : k.getObjects()) {
{
int gg = g++; int gg = g++;
lockq.lock(); lockq.lock();
q.add(() -> q.add(() -> {
{ placeObject(m, i, j, random.nextParallelRNG(
placeObject(m, i, j, random.nextParallelRNG((34 * ((i * 30) + (j * 30) + gg) * i * j) + i - j + 1569962)); (34 * ((i * 30) + (j * 30) + gg) * i * j) + i - j + 1569962));
}); });
lockq.unlock(); lockq.unlock();
} }
@@ -318,61 +280,52 @@ public abstract class ParallaxChunkGenerator extends TerrainChunkGenerator imple
IrisRegion r = sampleRegion((i * 16) + 7, (j * 16) + 7); IrisRegion r = sampleRegion((i * 16) + 7, (j * 16) + 7);
for(IrisStructurePlacement k : r.getStructures()) for (IrisStructurePlacement k : r.getStructures()) {
{
lockq.lock(); lockq.lock();
q.add(() -> q.add(() -> {
{
k.place(this, random.nextParallelRNG(2228), i, j); k.place(this, random.nextParallelRNG(2228), i, j);
}); });
lockq.unlock(); lockq.unlock();
} }
for(IrisStructurePlacement k : b.getStructures()) for (IrisStructurePlacement k : b.getStructures()) {
{
lockq.lock(); lockq.lock();
q.add(() -> q.add(() -> {
{
k.place(this, random.nextParallelRNG(-22228), i, j); k.place(this, random.nextParallelRNG(-22228), i, j);
}); });
lockq.unlock(); lockq.unlock();
} }
for(IrisObjectPlacement k : b.getObjects()) for (IrisObjectPlacement k : b.getObjects()) {
{
int gg = g++; int gg = g++;
lockq.lock(); lockq.lock();
q.add(() -> q.add(() -> {
{ placeObject(k, i, j, random
placeObject(k, i, j, random.nextParallelRNG((34 * ((i * 30) + (j * 30) + gg) * i * j) + i - j + 3569222)); .nextParallelRNG((34 * ((i * 30) + (j * 30) + gg) * i * j) + i - j + 3569222));
}); });
lockq.unlock(); lockq.unlock();
} }
if(getDimension().isCaves()) if (getDimension().isCaves()) {
{
int bx = (i * 16) + ro.nextInt(16); int bx = (i * 16) + ro.nextInt(16);
int bz = (j * 16) + ro.nextInt(16); int bz = (j * 16) + ro.nextInt(16);
IrisBiome biome = sampleCaveBiome(bx, bz).getBiome(); IrisBiome biome = sampleCaveBiome(bx, bz).getBiome();
if(biome == null) if (biome == null) {
{
return; return;
} }
if(biome.getObjects().isEmpty()) if (biome.getObjects().isEmpty()) {
{
return; return;
} }
for(IrisObjectPlacement k : biome.getObjects()) for (IrisObjectPlacement k : biome.getObjects()) {
{
int gg = g++; int gg = g++;
lockq.lock(); lockq.lock();
q.add(() -> q.add(() -> {
{ placeCaveObject(k, i, j, random
placeCaveObject(k, i, j, random.nextParallelRNG((34 * ((i * 30) + (j * 30) + gg) * i * j) + i - j + 1869322)); .nextParallelRNG((34 * ((i * 30) + (j * 30) + gg) * i * j) + i - j + 1869322));
}); });
lockq.unlock(); lockq.unlock();
} }
@@ -386,8 +339,7 @@ public abstract class ParallaxChunkGenerator extends TerrainChunkGenerator imple
getAccelerant().waitFor(key); getAccelerant().waitFor(key);
lockq.lock(); lockq.lock();
for(NastyRunnable i : q) for (NastyRunnable i : q) {
{
getAccelerant().queue(key + "-obj", i); getAccelerant().queue(key + "-obj", i);
} }
lockq.unlock(); lockq.unlock();
@@ -395,39 +347,34 @@ public abstract class ParallaxChunkGenerator extends TerrainChunkGenerator imple
getAccelerant().waitFor(key + "-obj"); getAccelerant().waitFor(key + "-obj");
} }
public void placeObject(IrisObjectPlacement o, int x, int z, RNG rng) public void placeObject(IrisObjectPlacement o, int x, int z, RNG rng) {
{ for (int i = 0; i < o.getTriesForChunk(rng); i++) {
for(int i = 0; i < o.getTriesForChunk(rng); i++)
{
rng = rng.nextParallelRNG((i * 3 + 8) - 23040); rng = rng.nextParallelRNG((i * 3 + 8) - 23040);
o.getSchematic(this, rng).place((x * 16) + rng.nextInt(16), (z * 16) + rng.nextInt(16), this, o, rng); o.getSchematic(this, rng).place((x * 16) + rng.nextInt(16), (z * 16) + rng.nextInt(16), this, o, rng);
} }
} }
public void placeCaveObject(IrisObjectPlacement o, int x, int z, RNG rng) public void placeCaveObject(IrisObjectPlacement o, int x, int z, RNG rng) {
{ for (int i = 0; i < o.getTriesForChunk(rng); i++) {
for(int i = 0; i < o.getTriesForChunk(rng); i++)
{
rng = rng.nextParallelRNG((i * 3 + 8) - 23040); rng = rng.nextParallelRNG((i * 3 + 8) - 23040);
int xx = (x * 16) + rng.nextInt(16); int xx = (x * 16) + rng.nextInt(16);
int zz = (z * 16) + rng.nextInt(16); int zz = (z * 16) + rng.nextInt(16);
KList<CaveResult> res = getCaves(xx, zz); KList<CaveResult> res = getCaves(xx, zz);
if(res.isEmpty()) if (res.isEmpty()) {
{
continue; continue;
} }
o.getSchematic(this, rng).place(xx, res.get(rng.nextParallelRNG(29345 * (i + 234)).nextInt(res.size())).getFloor() + 2, zz, this, o, rng); o.getSchematic(this, rng).place(xx,
res.get(rng.nextParallelRNG(29345 * (i + 234)).nextInt(res.size())).getFloor() + 2, zz, this, o,
rng);
} }
} }
public AtomicSliver sampleSliver(int x, int z) public AtomicSliver sampleSliver(int x, int z) {
{
ChunkPosition key = new ChunkPosition(x, z); ChunkPosition key = new ChunkPosition(x, z);
if(getSliverCache().containsKey(key)) if (getSliverCache().containsKey(key)) {
{
return getSliverCache().get(key); return getSliverCache().get(key);
} }
@@ -439,8 +386,7 @@ public abstract class ParallaxChunkGenerator extends TerrainChunkGenerator imple
} }
@Override @Override
public boolean isPreventingDecay() public boolean isPreventingDecay() {
{
return getDimension().isPreventLeafDecay(); return getDimension().isPreventLeafDecay();
} }
} }

View File

@@ -17,57 +17,54 @@ import lombok.EqualsAndHashCode;
@Data @Data
@EqualsAndHashCode(callSuper = false) @EqualsAndHashCode(callSuper = false)
public abstract class ParallelChunkGenerator extends BiomeChunkGenerator public abstract class ParallelChunkGenerator extends BiomeChunkGenerator {
{
private GroupedExecutor accelerant; private GroupedExecutor accelerant;
private int threads; private int threads;
protected boolean unsafe; protected boolean safe;
protected int cacheX; protected int cacheX;
protected int cacheZ; protected int cacheZ;
private IrisLock genlock; private IrisLock genlock;
protected boolean cachingAllowed; protected boolean cachingAllowed;
public ParallelChunkGenerator(String dimensionName, int threads) public ParallelChunkGenerator(String dimensionName, int threads) {
{
super(dimensionName); super(dimensionName);
unsafe = false; safe = false;
cacheX = 0; cacheX = 0;
cacheZ = 0; cacheZ = 0;
this.threads = threads; this.threads = threads;
genlock = new IrisLock("ParallelGenLock"); genlock = new IrisLock("ParallelGenLock");
cachingAllowed = false;
} }
public void changeThreadCount(int tc) public void changeThreadCount(int tc) {
{
threads = tc; threads = tc;
GroupedExecutor e = accelerant; GroupedExecutor e = accelerant;
accelerant = new GroupedExecutor(threads, Thread.NORM_PRIORITY, "Iris Generator - " + world.getName()); accelerant = new GroupedExecutor(threads, Thread.NORM_PRIORITY, "Iris Generator - " + world.getName());
Iris.executors.add(accelerant); Iris.executors.add(accelerant);
if(e != null) if (e != null) {
{
e.close(); e.close();
} }
} }
protected abstract void onGenerateColumn(int cx, int cz, int wx, int wz, int x, int z, AtomicSliver sliver, BiomeMap biomeMap, boolean sampled); protected abstract void onGenerateColumn(int cx, int cz, int wx, int wz, int x, int z, AtomicSliver sliver,
BiomeMap biomeMap, boolean sampled);
protected void onGenerateColumn(int cx, int cz, int wx, int wz, int x, int z, AtomicSliver sliver, BiomeMap biomeMap) protected void onGenerateColumn(int cx, int cz, int wx, int wz, int x, int z, AtomicSliver sliver,
{ BiomeMap biomeMap) {
onGenerateColumn(cx, cz, wx, wz, x, z, sliver, biomeMap, false); onGenerateColumn(cx, cz, wx, wz, x, z, sliver, biomeMap, false);
} }
protected abstract int onSampleColumnHeight(int cx, int cz, int wx, int wz, int x, int z); protected abstract int onSampleColumnHeight(int cx, int cz, int wx, int wz, int x, int z);
protected abstract void onPostGenerate(RNG random, int x, int z, ChunkData data, BiomeGrid grid, HeightMap height, BiomeMap biomeMap); protected abstract void onPostGenerate(RNG random, int x, int z, ChunkData data, BiomeGrid grid, HeightMap height,
BiomeMap biomeMap);
protected int sampleHeight(int x, int z) protected int sampleHeight(int x, int z) {
{
return onSampleColumnHeight(x >> 4, z >> 4, x, z, x & 15, z & 15); return onSampleColumnHeight(x >> 4, z >> 4, x, z, x & 15, z & 15);
} }
protected void onGenerate(RNG random, int x, int z, ChunkData data, BiomeGrid grid) protected void onGenerate(RNG random, int x, int z, ChunkData data, BiomeGrid grid) {
{
genlock.lock(); genlock.lock();
cacheX = x; cacheX = x;
cacheZ = z; cacheZ = z;
@@ -78,28 +75,25 @@ public abstract class ParallelChunkGenerator extends BiomeChunkGenerator
BiomeMap biomeMap = new BiomeMap(); BiomeMap biomeMap = new BiomeMap();
int ii, jj; int ii, jj;
for(ii = 0; ii < 16; ii++) for (ii = 0; ii < 16; ii++) {
{
int i = ii; int i = ii;
int wx = (x * 16) + i; int wx = (x * 16) + i;
for(jj = 0; jj < 16; jj++) for (jj = 0; jj < 16; jj++) {
{
int j = jj; int j = jj;
int wz = (z * 16) + j; int wz = (z * 16) + j;
AtomicSliver sliver = map.getSliver(i, j); AtomicSliver sliver = map.getSliver(i, j);
accelerant.queue(key, () -> accelerant.queue(key, () -> {
{
onGenerateColumn(x, z, wx, wz, i, j, sliver, biomeMap); onGenerateColumn(x, z, wx, wz, i, j, sliver, biomeMap);
}); });
} }
} }
setCachingAllowed(true); setCachingAllowed(true);
setUnsafe(true); setSafe(false);
accelerant.waitFor(key); accelerant.waitFor(key);
setUnsafe(false); setSafe(true);
setCachingAllowed(false); setCachingAllowed(false);
map.write(data, grid, height); map.write(data, grid, height);
getMetrics().getTerrain().put(p.getMilliseconds()); getMetrics().getTerrain().put(p.getMilliseconds());
@@ -108,26 +102,18 @@ public abstract class ParallelChunkGenerator extends BiomeChunkGenerator
genlock.unlock(); genlock.unlock();
} }
protected void onClose() protected void onClose() {
{
accelerant.close(); accelerant.close();
Iris.executors.remove(accelerant); Iris.executors.remove(accelerant);
} }
public void onInit(World world, RNG rng) public void onInit(World world, RNG rng) {
{
super.onInit(world, rng); super.onInit(world, rng);
changeThreadCount(threads); changeThreadCount(threads);
} }
public boolean isSafe()
{
return !unsafe;
}
@Override @Override
public boolean isParallelCapable() public boolean isParallelCapable() {
{
return false; return false;
} }
} }

View File

@@ -18,8 +18,7 @@ import lombok.EqualsAndHashCode;
@Data @Data
@EqualsAndHashCode(callSuper = false) @EqualsAndHashCode(callSuper = false)
public abstract class PostBlockChunkGenerator extends ParallaxChunkGenerator implements IPostBlockAccess public abstract class PostBlockChunkGenerator extends ParallaxChunkGenerator implements IPostBlockAccess {
{
protected boolean generatingCeiling = false; protected boolean generatingCeiling = false;
protected boolean ceilingCached = false; protected boolean ceilingCached = false;
protected IrisDimension cacheCeiling = null; protected IrisDimension cacheCeiling = null;
@@ -33,27 +32,22 @@ public abstract class PostBlockChunkGenerator extends ParallaxChunkGenerator imp
private int minPhase; private int minPhase;
private int maxPhase; private int maxPhase;
public PostBlockChunkGenerator(String dimensionName, int threads) public PostBlockChunkGenerator(String dimensionName, int threads) {
{
super(dimensionName, threads); super(dimensionName, threads);
availableFilters = new KList<>(); availableFilters = new KList<>();
postKey = "post-" + dimensionName; postKey = "post-" + dimensionName;
lock = new IrisLock("PostChunkGenerator"); lock = new IrisLock("PostChunkGenerator");
} }
public void onInit(World world, RNG rng) public void onInit(World world, RNG rng) {
{
super.onInit(world, rng); super.onInit(world, rng);
for(Class<? extends IrisPostBlockFilter> i : Iris.postProcessors) for (Class<? extends IrisPostBlockFilter> i : Iris.postProcessors) {
{ try {
try
{
availableFilters.add(i.getConstructor(PostBlockChunkGenerator.class).newInstance(this)); availableFilters.add(i.getConstructor(PostBlockChunkGenerator.class).newInstance(this));
} }
catch(Throwable e) catch (Throwable e) {
{
Iris.error("Failed to initialize post processor: " + i.getCanonicalName()); Iris.error("Failed to initialize post processor: " + i.getCanonicalName());
fail(e); fail(e);
} }
@@ -61,12 +55,10 @@ public abstract class PostBlockChunkGenerator extends ParallaxChunkGenerator imp
} }
@Override @Override
protected void onGenerate(RNG random, int x, int z, ChunkData data, BiomeGrid grid) protected void onGenerate(RNG random, int x, int z, ChunkData data, BiomeGrid grid) {
{
super.onGenerate(random, x, z, data, grid); super.onGenerate(random, x, z, data, grid);
if(!getDimension().isPostProcessing()) if (!getDimension().isPostProcessing()) {
{
return; return;
} }
@@ -77,24 +69,18 @@ public abstract class PostBlockChunkGenerator extends ParallaxChunkGenerator imp
int rx, i, j; int rx, i, j;
PrecisionStopwatch p = PrecisionStopwatch.start(); PrecisionStopwatch p = PrecisionStopwatch.start();
for(int h = getMinPhase(); h <= getMaxPhase(); h++) for (int h = getMinPhase(); h <= getMaxPhase(); h++) {
{ for (i = 0; i < 16; i++) {
for(i = 0; i < 16; i++)
{
rx = (x << 4) + i; rx = (x << 4) + i;
for(j = 0; j < 16; j++) for (j = 0; j < 16; j++) {
{
int rxx = rx; int rxx = rx;
int rzz = (z << 4) + j; int rzz = (z << 4) + j;
int hh = h; int hh = h;
getAccelerant().queue("post", () -> getAccelerant().queue("post", () -> {
{ for (IrisPostBlockFilter f : filters) {
for(IrisPostBlockFilter f : filters) if (f.getPhase() == hh) {
{
if(f.getPhase() == hh)
{
f.onPost(rxx, rzz); f.onPost(rxx, rzz);
} }
} }
@@ -104,19 +90,14 @@ public abstract class PostBlockChunkGenerator extends ParallaxChunkGenerator imp
getAccelerant().waitFor("post"); getAccelerant().waitFor("post");
for(IrisPostBlockFilter f : filters) for (IrisPostBlockFilter f : filters) {
{ if (f.getPhase() == h) {
if(f.getPhase() == h) while (f.getQueue().size() > 0) {
{ try {
while(f.getQueue().size() > 0)
{
try
{
f.getQueue().pop().run(); f.getQueue().pop().run();
} }
catch(Throwable e) catch (Throwable e) {
{
} }
} }
@@ -128,19 +109,15 @@ public abstract class PostBlockChunkGenerator extends ParallaxChunkGenerator imp
getMetrics().getPost().put(p.getMilliseconds()); getMetrics().getPost().put(p.getMilliseconds());
} }
public IrisPostBlockFilter createProcessor(String processor, int phase) public IrisPostBlockFilter createProcessor(String processor, int phase) {
{ for (IrisPostBlockFilter i : availableFilters) {
for(IrisPostBlockFilter i : availableFilters) if (i.getKey().equals(processor)) {
{ try {
if(i.getKey().equals(processor)) return i.getClass().getConstructor(PostBlockChunkGenerator.class, int.class).newInstance(this,
{ phase);
try
{
return i.getClass().getConstructor(PostBlockChunkGenerator.class, int.class).newInstance(this, phase);
} }
catch(Throwable e) catch (Throwable e) {
{
Iris.error("Failed initialize find post processor: " + processor); Iris.error("Failed initialize find post processor: " + processor);
fail(e); fail(e);
} }
@@ -153,24 +130,20 @@ public abstract class PostBlockChunkGenerator extends ParallaxChunkGenerator imp
} }
@Override @Override
public void updateHeight(int x, int z, int h) public void updateHeight(int x, int z, int h) {
{ if (x >> 4 == currentPostX && z >> 4 == currentPostZ) {
if(x >> 4 == currentPostX && z >> 4 == currentPostZ) //cacheHeight(x, z, h);
{
getCacheHeightMap()[((z & 15) << 4) | (x & 15)] = h;
} }
else else {
{ Iris.error("Invalid Heightmap set! Chunk Currently at " + currentPostX + "," + currentPostZ
Iris.error("Invalid Heightmap set! Chunk Currently at " + currentPostX + "," + currentPostZ + ". Attempted to place at " + (x >> 4) + " " + (z >> 4) + " which is bad."); + ". Attempted to place at " + (x >> 4) + " " + (z >> 4) + " which is bad.");
} }
} }
@Override @Override
public BlockData getPostBlock(int x, int y, int z) public BlockData getPostBlock(int x, int y, int z) {
{ if (x >> 4 == currentPostX && z >> 4 == currentPostZ) {
if(x >> 4 == currentPostX && z >> 4 == currentPostZ)
{
lock.lock(); lock.lock();
BlockData d = currentData.getBlockData(x & 15, y, z & 15); BlockData d = currentData.getBlockData(x & 15, y, z & 15);
lock.unlock(); lock.unlock();
@@ -181,36 +154,31 @@ public abstract class PostBlockChunkGenerator extends ParallaxChunkGenerator imp
} }
@Override @Override
public void setPostBlock(int x, int y, int z, BlockData d) public void setPostBlock(int x, int y, int z, BlockData d) {
{ if (x >> 4 == currentPostX && z >> 4 == currentPostZ) {
if(x >> 4 == currentPostX && z >> 4 == currentPostZ)
{
lock.lock(); lock.lock();
currentData.setBlock(x & 15, y, z & 15, d); currentData.setBlock(x & 15, y, z & 15, d);
lock.unlock(); lock.unlock();
} }
else else {
{ Iris.warn("Post Block Overdraw: " + currentPostX + "," + currentPostZ + " into " + (x >> 4) + ", "
Iris.warn("Post Block Overdraw: " + currentPostX + "," + currentPostZ + " into " + (x >> 4) + ", " + (z >> 4)); + (z >> 4));
} }
} }
@Override @Override
public int highestTerrainOrFluidBlock(int x, int z) public int highestTerrainOrFluidBlock(int x, int z) {
{
return getHighest(x, z, false); return getHighest(x, z, false);
} }
@Override @Override
public int highestTerrainBlock(int x, int z) public int highestTerrainBlock(int x, int z) {
{
return getHighest(x, z, true); return getHighest(x, z, true);
} }
@Override @Override
public KList<CaveResult> caveFloors(int x, int z) public KList<CaveResult> caveFloors(int x, int z) {
{
return getCaves(x, z); return getCaves(x, z);
} }
} }

View File

@@ -6,7 +6,6 @@ import org.bukkit.block.data.Bisected;
import org.bukkit.block.data.Bisected.Half; import org.bukkit.block.data.Bisected.Half;
import org.bukkit.block.data.BlockData; import org.bukkit.block.data.BlockData;
import com.volmit.iris.Iris;
import com.volmit.iris.gen.atomics.AtomicSliver; import com.volmit.iris.gen.atomics.AtomicSliver;
import com.volmit.iris.gen.layer.GenLayerCarve; import com.volmit.iris.gen.layer.GenLayerCarve;
import com.volmit.iris.gen.layer.GenLayerCave; import com.volmit.iris.gen.layer.GenLayerCave;
@@ -16,12 +15,11 @@ import com.volmit.iris.object.IrisBiome;
import com.volmit.iris.object.IrisBiomeDecorator; import com.volmit.iris.object.IrisBiomeDecorator;
import com.volmit.iris.object.IrisDepositGenerator; import com.volmit.iris.object.IrisDepositGenerator;
import com.volmit.iris.object.IrisRegion; import com.volmit.iris.object.IrisRegion;
import com.volmit.iris.util.B;
import com.volmit.iris.util.BiomeMap; import com.volmit.iris.util.BiomeMap;
import com.volmit.iris.util.BiomeResult; import com.volmit.iris.util.BiomeResult;
import com.volmit.iris.util.B;
import com.volmit.iris.util.CaveResult; import com.volmit.iris.util.CaveResult;
import com.volmit.iris.util.HeightMap; import com.volmit.iris.util.HeightMap;
import com.volmit.iris.util.IrisLock;
import com.volmit.iris.util.KList; import com.volmit.iris.util.KList;
import com.volmit.iris.util.M; import com.volmit.iris.util.M;
import com.volmit.iris.util.RNG; import com.volmit.iris.util.RNG;
@@ -37,16 +35,9 @@ public abstract class TerrainChunkGenerator extends ParallelChunkGenerator {
private GenLayerCave glCave; private GenLayerCave glCave;
private GenLayerCarve glCarve; private GenLayerCarve glCarve;
private RNG rockRandom; private RNG rockRandom;
private int[] cacheHeightMap;
private BiomeResult[] cacheTrueBiome;
private IrisLock cacheLock;
public TerrainChunkGenerator(String dimensionName, int threads) { public TerrainChunkGenerator(String dimensionName, int threads) {
super(dimensionName, threads); super(dimensionName, threads);
cacheHeightMap = new int[256];
cacheTrueBiome = new BiomeResult[256];
cachingAllowed = true;
cacheLock = new IrisLock("TerrainCacheLock");
} }
public void onInit(World world, RNG rng) { public void onInit(World world, RNG rng) {
@@ -68,6 +59,7 @@ public abstract class TerrainChunkGenerator extends ParallelChunkGenerator {
} }
try { try {
int highestPlaced = 0; int highestPlaced = 0;
BlockData block; BlockData block;
int fluidHeight = getDimension().getFluidHeight(); int fluidHeight = getDimension().getFluidHeight();
@@ -87,8 +79,6 @@ public abstract class TerrainChunkGenerator extends ParallelChunkGenerator {
throw new RuntimeException("Null Biome!"); throw new RuntimeException("Null Biome!");
} }
cacheBiome(cachingAllowed && !sampled, x, z, biomeResult, height);
cacheInternalBiome(cachingAllowed && !sampled, x, z, biome);
KList<BlockData> layers = biome.generateLayers(rx, rz, masterRandom, height, height - getFluidHeight()); KList<BlockData> layers = biome.generateLayers(rx, rz, masterRandom, height, height - getFluidHeight());
KList<BlockData> seaLayers = biome.isSea() KList<BlockData> seaLayers = biome.isSea()
? biome.generateSeaLayers(rx, rz, masterRandom, fluidHeight - height) ? biome.generateSeaLayers(rx, rz, masterRandom, fluidHeight - height)
@@ -213,11 +203,6 @@ public abstract class TerrainChunkGenerator extends ParallelChunkGenerator {
if (block.getMaterial().isSolid()) { if (block.getMaterial().isSolid()) {
decorateLand(biome, sliver, wx, Math.max(height, fluidHeight), wz, rx, rz, block); decorateLand(biome, sliver, wx, Math.max(height, fluidHeight), wz, rx, rz, block);
} }
// Update Height Map
if (!sampled && cachingAllowed && highestPlaced < height) {
cacheHeightMap[(z << 4) | x] = highestPlaced;
}
} }
catch (Throwable e) { catch (Throwable e) {
@@ -225,25 +210,6 @@ public abstract class TerrainChunkGenerator extends ParallelChunkGenerator {
} }
} }
protected void cacheInternalBiome(boolean b, int x, int z, IrisBiome bv) {
if (b) {
cacheInternalBiome(x, z, bv);
}
}
private void cacheBiome(boolean b, int x, int z, BiomeResult biomeResult, int height) {
if (b) {
try {
cacheTrueBiome[(z << 4) | x] = biomeResult;
cacheHeightMap[(z << 4) | x] = height;
}
catch (Throwable e) {
Iris.error("Failed to write cache at " + x + " " + z);
}
}
}
@Override @Override
protected void onGenerate(RNG random, int x, int z, ChunkData data, BiomeGrid grid) { protected void onGenerate(RNG random, int x, int z, ChunkData data, BiomeGrid grid) {
super.onGenerate(random, x, z, data, grid); super.onGenerate(random, x, z, data, grid);
@@ -446,8 +412,9 @@ public abstract class TerrainChunkGenerator extends ParallelChunkGenerator {
protected double getNoiseHeight(int rx, int rz) { protected double getNoiseHeight(int rx, int rz) {
double wx = getZoomed(rx); double wx = getZoomed(rx);
double wz = getZoomed(rz); double wz = getZoomed(rz);
double h = getBiomeHeight(wx, wz, rx, rz);
return getBiomeHeight(wx, wz, rx, rz); return h;
} }
public BiomeResult sampleTrueBiomeBase(int x, int z, int height) { public BiomeResult sampleTrueBiomeBase(int x, int z, int height) {
@@ -508,15 +475,18 @@ public abstract class TerrainChunkGenerator extends ParallelChunkGenerator {
return sampleTrueBiome(x, z, getTerrainHeight(x, z)); return sampleTrueBiome(x, z, getTerrainHeight(x, z));
} }
@Override
public IrisRegion sampleRegion(int x, int z) {
IrisRegion r = super.sampleRegion(x, z);
return r;
}
public BiomeResult sampleTrueBiome(int x, int z, double noise) { public BiomeResult sampleTrueBiome(int x, int z, double noise) {
if (!getDimension().getFocus().equals("")) { if (!getDimension().getFocus().equals("")) {
return focus(); return focus();
} }
if (isSafe() && x >> 4 == cacheX && z >> 4 == cacheZ) {
return cacheTrueBiome[((z & 15) << 4) | (x & 15)];
}
double wx = getModifiedX(x, z); double wx = getModifiedX(x, z);
double wz = getModifiedZ(x, z); double wz = getModifiedZ(x, z);
IrisRegion region = sampleRegion(x, z); IrisRegion region = sampleRegion(x, z);
@@ -558,10 +528,6 @@ public abstract class TerrainChunkGenerator extends ParallelChunkGenerator {
} }
public double getTerrainHeight(int x, int z) { public double getTerrainHeight(int x, int z) {
if (isSafe() && x >> 4 == cacheX && z >> 4 == cacheZ) {
return cacheHeightMap[((z & 15) << 4) | (x & 15)];
}
return getNoiseHeight(x, z) + getFluidHeight(); return getNoiseHeight(x, z) + getFluidHeight();
} }

View File

@@ -0,0 +1,7 @@
package com.volmit.iris.gen.atomics;
import com.volmit.iris.object.IrisBiome;
public class AtomicBiomeMap extends AtomicObjectMap<IrisBiome> {
}

View File

@@ -0,0 +1,23 @@
package com.volmit.iris.gen.atomics;
import com.google.common.util.concurrent.AtomicDoubleArray;
public class AtomicDoubleMap {
private final AtomicDoubleArray data;
public AtomicDoubleMap() {
data = new AtomicDoubleArray(256);
}
public double get(int x, int z) {
return data.get((z << 4) | x);
}
public int getInt(int x, int z) {
return (int) Math.round(get(x, z));
}
public void set(int x, int z, double v) {
data.set((z << 4) | x, v);
}
}

View File

@@ -0,0 +1,19 @@
package com.volmit.iris.gen.atomics;
import java.util.concurrent.atomic.AtomicIntegerArray;
public class AtomicIntMap {
private final AtomicIntegerArray data;
public AtomicIntMap() {
data = new AtomicIntegerArray(256);
}
public int get(int x, int z) {
return data.get((z << 4) | x);
}
public void set(int x, int z, int v) {
data.set((z << 4) | x, v);
}
}

View File

@@ -0,0 +1,19 @@
package com.volmit.iris.gen.atomics;
import java.util.concurrent.atomic.AtomicReferenceArray;
public class AtomicObjectMap<T> {
private final AtomicReferenceArray<T> data;
public AtomicObjectMap() {
data = new AtomicReferenceArray<T>(256);
}
public T get(int x, int z) {
return data.get((z << 4) | x);
}
public void set(int x, int z, T v) {
data.set((z << 4) | x, v);
}
}

View File

@@ -0,0 +1,7 @@
package com.volmit.iris.gen.atomics;
import com.volmit.iris.object.IrisRegion;
public class AtomicRegionMap extends AtomicObjectMap<IrisRegion> {
}

View File

@@ -0,0 +1,22 @@
package com.volmit.iris.noise;
public class FlatNoise implements NoiseGenerator {
public FlatNoise(long seed) {
}
@Override
public double noise(double x) {
return 0.5;
}
@Override
public double noise(double x, double z) {
return 0.5;
}
@Override
public double noise(double x, double y, double z) {
return 0.5;
}
}

View File

@@ -8,6 +8,7 @@ public enum NoiseType {
FRACTAL_BILLOW_PERLIN(seed -> new FractalBillowPerlinNoise(seed)), FRACTAL_BILLOW_PERLIN(seed -> new FractalBillowPerlinNoise(seed)),
FRACTAL_FBM_SIMPLEX(seed -> new FractalFBMSimplexNoise(seed)), FRACTAL_FBM_SIMPLEX(seed -> new FractalFBMSimplexNoise(seed)),
FRACTAL_RIGID_MULTI_SIMPLEX(seed -> new FractalRigidMultiSimplexNoise(seed)), FRACTAL_RIGID_MULTI_SIMPLEX(seed -> new FractalRigidMultiSimplexNoise(seed)),
FLAT(seed -> new FlatNoise(seed)),
CELLULAR(seed -> new CellularNoise(seed)), CELLULAR(seed -> new CellularNoise(seed)),
GLOB(seed -> new GlobNoise(seed)), GLOB(seed -> new GlobNoise(seed)),
CUBIC(seed -> new CubicNoise(seed)), CUBIC(seed -> new CubicNoise(seed)),

View File

@@ -14,8 +14,8 @@ import lombok.Data;
@Data @Data
public class IrisObjectTranslate public class IrisObjectTranslate
{ {
@MinNumber(-8) @MinNumber(-128)
@MaxNumber(8) @MaxNumber(128)
@DontObfuscate @DontObfuscate
@Desc("The x shift in blocks") @Desc("The x shift in blocks")
private int x = 0; private int x = 0;
@@ -27,8 +27,8 @@ public class IrisObjectTranslate
@Desc("The x shift in blocks") @Desc("The x shift in blocks")
private int y = 0; private int y = 0;
@MinNumber(-8) @MinNumber(-128)
@MaxNumber(8) @MaxNumber(128)
@DontObfuscate @DontObfuscate
@Desc("The x shift in blocks") @Desc("The x shift in blocks")
private int z = 0; private int z = 0;

View File

@@ -392,6 +392,10 @@ public enum NoiseStyle {
@DontObfuscate @DontObfuscate
VASCULAR(rng -> new CNG(rng, NoiseType.VASCULAR, 1D, 1)), VASCULAR(rng -> new CNG(rng, NoiseType.VASCULAR, 1D, 1)),
@Desc("It always returns 0.5")
@DontObfuscate
FLAT(rng -> new CNG(rng, NoiseType.FLAT, 1D, 1)),
@Desc("Vascular noise gets higher as the position nears a cell border. Cells are distorted using Iris styled wispy noise.") @Desc("Vascular noise gets higher as the position nears a cell border. Cells are distorted using Iris styled wispy noise.")
@DontObfuscate @DontObfuscate
VASCULAR_IRIS(rng -> CNG.signature(rng, NoiseType.VASCULAR)), VASCULAR_IRIS(rng -> CNG.signature(rng, NoiseType.VASCULAR)),