From 05eb0b20be87d72b7016b6231f85411f045b4d41 Mon Sep 17 00:00:00 2001 From: Daniel Mills Date: Thu, 16 Jan 2020 20:36:17 -0500 Subject: [PATCH] Tweaks --- .../java/ninja/bytecode/iris/Settings.java | 10 +- .../iris/generator/IrisGenerator.java | 14 +- .../iris/generator/layer/GenLayerBiome.java | 49 ++++- .../ninja/bytecode/iris/pack/IrisBiome.java | 168 ++++++++++++++++++ .../iris/util/ParallelChunkGenerator.java | 3 - 5 files changed, 230 insertions(+), 14 deletions(-) diff --git a/src/main/java/ninja/bytecode/iris/Settings.java b/src/main/java/ninja/bytecode/iris/Settings.java index c083f06da..8b5b91054 100644 --- a/src/main/java/ninja/bytecode/iris/Settings.java +++ b/src/main/java/ninja/bytecode/iris/Settings.java @@ -14,7 +14,7 @@ public class Settings public int threadPriority = Thread.MAX_PRIORITY; public int compilerPriority = Thread.MAX_PRIORITY; public int threadCount = 4; - public boolean debugMode = true; + public boolean debugMode = false; public int compilerThreads = 12; public int decorationAccuracy = 1; public int cascadeLimit = 14; @@ -41,10 +41,10 @@ public class Settings public double caveScale = 1.45; public double biomeScale = 2.5; public boolean flatBedrock = true; - public boolean genObjects = true; - public boolean genCarving = true; - public boolean genCaverns = true; - public boolean genCaves = true; + public boolean genObjects = false; + public boolean genCarving = false; + public boolean genCaverns = false; + public boolean genCaves = false; public double carvingChance = 0.352; public double cavernChance = 0.321; public int minCarvingHeight = 75; diff --git a/src/main/java/ninja/bytecode/iris/generator/IrisGenerator.java b/src/main/java/ninja/bytecode/iris/generator/IrisGenerator.java index 408268089..d0ce79ec3 100644 --- a/src/main/java/ninja/bytecode/iris/generator/IrisGenerator.java +++ b/src/main/java/ninja/bytecode/iris/generator/IrisGenerator.java @@ -59,6 +59,7 @@ public class IrisGenerator extends ParallelChunkGenerator private double[][][] scatterCache; private CNG scatter; + private CNG fff; public GMap biomeCache = new GMap<>(); private MB WATER = new MB(Material.STATIONARY_WATER); private MB ICE = new MB(Material.ICE); @@ -144,6 +145,7 @@ public class IrisGenerator extends ParallelChunkGenerator glCliffs = new GenLayerCliffs(this, world, random, rTerrain.nextParallelRNG(9)); scatterCache = new double[16][][]; scatter = new CNG(rTerrain.nextParallelRNG(52), 1, 1).scale(10); + fff = new CNG(rTerrain.nextParallelRNG(53), 1, 1).scale(0.01); for(int i = 0; i < 16; i++) { @@ -159,8 +161,8 @@ public class IrisGenerator extends ParallelChunkGenerator } } } - - L.i("Signature = " + world.getSeed() + " + " + glBiome.getBiome(0, 0).getRealBiome().ordinal() +" + "+ computeHeight(0, 0, new ChunkPlan(), biome("Plains"))); + + L.i("Signature = " + world.getSeed() + " + " + glBiome.getBiome(0, 0).getRealBiome().ordinal() + " + " + computeHeight(0, 0, new ChunkPlan(), biome("Plains"))); } @Override @@ -255,12 +257,14 @@ public class IrisGenerator extends ParallelChunkGenerator } @Override - public Biome genColumn(int wxx, int wzx, int x, int z, ChunkPlan plan) + public Biome genColumn(int wxxf, int wzxf, int x, int z, ChunkPlan plan) { + double wx = getOffsetX(wxxf); + double wz = getOffsetZ(wzxf); + int wxx = (int) wx; + int wzx = (int) wz; int highest = 0; int seaLevel = Iris.settings.gen.seaLevel; - double wx = getOffsetX(wxx); - double wz = getOffsetZ(wzx); IrisBiome biome = getBiome(wxx, wzx); boolean frozen = getRegion(biome) != null ? getRegion(biome).isFrozen() : false; int height = computeHeight(wxx, wzx, plan, biome); diff --git a/src/main/java/ninja/bytecode/iris/generator/layer/GenLayerBiome.java b/src/main/java/ninja/bytecode/iris/generator/layer/GenLayerBiome.java index f748898ee..121627aa3 100644 --- a/src/main/java/ninja/bytecode/iris/generator/layer/GenLayerBiome.java +++ b/src/main/java/ninja/bytecode/iris/generator/layer/GenLayerBiome.java @@ -39,7 +39,7 @@ public class GenLayerBiome extends GenLayer { continue; } - + if(!regions.containsKey(i.getRegion())) { regions.put(i.getRegion(), new IrisRegion(i.getRegion())); @@ -63,6 +63,53 @@ public class GenLayerBiome extends GenLayer } } + public boolean hasBorder(int checks, double distance, double... dims) + { + IrisBiome current = getBiome(dims[0], dims[1]); + double ajump = 360D / (double) checks; + + if(dims.length == 2) + { + for(int i = 0; i < checks; i++) + { + double dx = M.sin((float) Math.toRadians(ajump * i)); + double dz = M.cos((float) Math.toRadians(ajump * i)); + if(!current.equals(getBiome((dx * distance) + dims[0], (dz * distance) + dims[1]))) + { + return true; + } + } + } + + return false; + } + + public boolean hasHeightBorder(int checks, double distance, double... dims) + { + IrisBiome current = getBiome(dims[0], dims[1]); + double ajump = 360D / (double) checks; + + if(dims.length == 2) + { + for(int i = 0; i < checks; i++) + { + double dx = M.sin((float) Math.toRadians(ajump * i)); + double dz = M.cos((float) Math.toRadians(ajump * i)); + if(current.getHeight() != getBiome((dx * distance) + dims[0], (dz * distance) + dims[1]).getHeight()) + { + return true; + } + } + } + + return false; + } + + public boolean isBorder(int wx, int wz, double range) + { + return hasHeightBorder(6, range, wx, wz); + } + public EnumPolygonGenerator getRegionGenerator(double xx, double zz) { return regionGenerator.getChoice(xx, zz).getGen(); diff --git a/src/main/java/ninja/bytecode/iris/pack/IrisBiome.java b/src/main/java/ninja/bytecode/iris/pack/IrisBiome.java index 4b63f8662..3444af079 100644 --- a/src/main/java/ninja/bytecode/iris/pack/IrisBiome.java +++ b/src/main/java/ninja/bytecode/iris/pack/IrisBiome.java @@ -657,4 +657,172 @@ public class IrisBiome { return cliffChance; } + + @Override + public int hashCode() + { + final int prime = 31; + int result = 1; + long temp; + temp = Double.doubleToLongBits(amp); + result = prime * result + (int) (temp ^ (temp >>> 32)); + temp = Double.doubleToLongBits(cliffChance); + result = prime * result + (int) (temp ^ (temp >>> 32)); + temp = Double.doubleToLongBits(cliffScale); + result = prime * result + (int) (temp ^ (temp >>> 32)); + result = prime * result + (cliffs ? 1231 : 1237); + result = prime * result + (core ? 1231 : 1237); + result = prime * result + ((dirt == null) ? 0 : dirt.hashCode()); + result = prime * result + dirtDepth; + temp = Double.doubleToLongBits(height); + result = prime * result + (int) (temp ^ (temp >>> 32)); + result = prime * result + ((name == null) ? 0 : name.hashCode()); + result = prime * result + ((poly == null) ? 0 : poly.hashCode()); + result = prime * result + ((polyRock == null) ? 0 : polyRock.hashCode()); + result = prime * result + ((polySub == null) ? 0 : polySub.hashCode()); + result = prime * result + ((realBiome == null) ? 0 : realBiome.hashCode()); + result = prime * result + ((region == null) ? 0 : region.hashCode()); + result = prime * result + ((rock == null) ? 0 : rock.hashCode()); + result = prime * result + rockDepth; + temp = Double.doubleToLongBits(rockScale); + result = prime * result + (int) (temp ^ (temp >>> 32)); + result = prime * result + ((scatterChance == null) ? 0 : scatterChance.hashCode()); + result = prime * result + (scatterSurface ? 1231 : 1237); + result = prime * result + (scatterSurfaceRock ? 1231 : 1237); + result = prime * result + (scatterSurfaceSub ? 1231 : 1237); + result = prime * result + ((schematicGroups == null) ? 0 : schematicGroups.hashCode()); + result = prime * result + (simplexScatter ? 1231 : 1237); + result = prime * result + (simplexScatterRock ? 1231 : 1237); + result = prime * result + (simplexScatterSub ? 1231 : 1237); + temp = Double.doubleToLongBits(snow); + result = prime * result + (int) (temp ^ (temp >>> 32)); + temp = Double.doubleToLongBits(subSurfaceScale); + result = prime * result + (int) (temp ^ (temp >>> 32)); + result = prime * result + ((surface == null) ? 0 : surface.hashCode()); + temp = Double.doubleToLongBits(surfaceScale); + result = prime * result + (int) (temp ^ (temp >>> 32)); + return result; + } + + @Override + public boolean equals(Object obj) + { + if(this == obj) + return true; + if(obj == null) + return false; + if(getClass() != obj.getClass()) + return false; + IrisBiome other = (IrisBiome) obj; + if(Double.doubleToLongBits(amp) != Double.doubleToLongBits(other.amp)) + return false; + if(Double.doubleToLongBits(cliffChance) != Double.doubleToLongBits(other.cliffChance)) + return false; + if(Double.doubleToLongBits(cliffScale) != Double.doubleToLongBits(other.cliffScale)) + return false; + if(cliffs != other.cliffs) + return false; + if(core != other.core) + return false; + if(dirt == null) + { + if(other.dirt != null) + return false; + } + else if(!dirt.equals(other.dirt)) + return false; + if(dirtDepth != other.dirtDepth) + return false; + if(Double.doubleToLongBits(height) != Double.doubleToLongBits(other.height)) + return false; + if(name == null) + { + if(other.name != null) + return false; + } + else if(!name.equals(other.name)) + return false; + if(poly == null) + { + if(other.poly != null) + return false; + } + else if(!poly.equals(other.poly)) + return false; + if(polyRock == null) + { + if(other.polyRock != null) + return false; + } + else if(!polyRock.equals(other.polyRock)) + return false; + if(polySub == null) + { + if(other.polySub != null) + return false; + } + else if(!polySub.equals(other.polySub)) + return false; + if(realBiome != other.realBiome) + return false; + if(region == null) + { + if(other.region != null) + return false; + } + else if(!region.equals(other.region)) + return false; + if(rock == null) + { + if(other.rock != null) + return false; + } + else if(!rock.equals(other.rock)) + return false; + if(rockDepth != other.rockDepth) + return false; + if(Double.doubleToLongBits(rockScale) != Double.doubleToLongBits(other.rockScale)) + return false; + if(scatterChance == null) + { + if(other.scatterChance != null) + return false; + } + else if(!scatterChance.equals(other.scatterChance)) + return false; + if(scatterSurface != other.scatterSurface) + return false; + if(scatterSurfaceRock != other.scatterSurfaceRock) + return false; + if(scatterSurfaceSub != other.scatterSurfaceSub) + return false; + if(schematicGroups == null) + { + if(other.schematicGroups != null) + return false; + } + else if(!schematicGroups.equals(other.schematicGroups)) + return false; + if(simplexScatter != other.simplexScatter) + return false; + if(simplexScatterRock != other.simplexScatterRock) + return false; + if(simplexScatterSub != other.simplexScatterSub) + return false; + if(Double.doubleToLongBits(snow) != Double.doubleToLongBits(other.snow)) + return false; + if(Double.doubleToLongBits(subSurfaceScale) != Double.doubleToLongBits(other.subSurfaceScale)) + return false; + if(surface == null) + { + if(other.surface != null) + return false; + } + else if(!surface.equals(other.surface)) + return false; + if(Double.doubleToLongBits(surfaceScale) != Double.doubleToLongBits(other.surfaceScale)) + return false; + return true; + } + } diff --git a/src/main/java/ninja/bytecode/iris/util/ParallelChunkGenerator.java b/src/main/java/ninja/bytecode/iris/util/ParallelChunkGenerator.java index 2315f3dff..888ae197d 100644 --- a/src/main/java/ninja/bytecode/iris/util/ParallelChunkGenerator.java +++ b/src/main/java/ninja/bytecode/iris/util/ParallelChunkGenerator.java @@ -14,7 +14,6 @@ import ninja.bytecode.shuriken.execution.ChronoLatch; import ninja.bytecode.shuriken.execution.TaskExecutor; import ninja.bytecode.shuriken.execution.TaskExecutor.TaskGroup; import ninja.bytecode.shuriken.execution.TaskExecutor.TaskResult; -import ninja.bytecode.shuriken.logging.L; import ninja.bytecode.shuriken.math.RollingSequence; import ninja.bytecode.shuriken.reaction.O; @@ -99,8 +98,6 @@ public abstract class ParallelChunkGenerator extends ChunkGenerator catch(Throwable e) { - e.printStackTrace(); - for(int i = 0; i < 16; i++) { for(int j = 0; j < 16; j++)