Clean up imports

This commit is contained in:
dfsek
2020-10-26 10:58:28 -07:00
parent f198b371e0
commit 224dfbe638
109 changed files with 833 additions and 637 deletions

View File

@@ -22,7 +22,7 @@ public class BiomeZone {
private final ImageLoader.Channel channel;
public BiomeZone(World w, WorldConfig wc, BiomeGrid[] grids) {
this.noise = new FastNoiseLite((int) w.getSeed()+2);
this.noise = new FastNoiseLite((int) w.getSeed() + 2);
this.noise.setNoiseType(FastNoiseLite.NoiseType.OpenSimplex2);
this.noise.setFractalType(FastNoiseLite.FractalType.FBm);
this.noise.setFractalOctaves(4);
@@ -35,6 +35,7 @@ public class BiomeZone {
/**
* Get BiomeGrid at location
*
* @param x X coordinate
* @param z Z coordinate
* @return BiomeGrid at coordinates.
@@ -45,6 +46,7 @@ public class BiomeZone {
/**
* Get the number of BiomeGrids this BiomeZone holds.
*
* @return Number of grids
*/
public int getSize() {
@@ -53,6 +55,7 @@ public class BiomeZone {
/**
* Get the normalized grid noise at location
*
* @param x X coordinate
* @param z Z coordinate
* @return Normalized noise at coordinates
@@ -63,6 +66,7 @@ public class BiomeZone {
/**
* Get raw grid noise at location
*
* @param x X coordinate
* @param z Z coordinate
* @return Raw noise at coordinates

View File

@@ -13,15 +13,16 @@ public class CoordinatePerturb {
/**
* Create a CoordinatePerturb object with a given frequency, amplitude, and seed.
*
* @param frequency Noise frequency
* @param amplitude Offset amplitude
* @param seed Noise seed
* @param seed Noise seed
*/
public CoordinatePerturb(float frequency, int amplitude, long seed) {
perturbX = new FastNoiseLite((int) seed);
perturbX.setNoiseType(FastNoiseLite.NoiseType.OpenSimplex2);
perturbX.setFrequency(frequency);
perturbZ = new FastNoiseLite((int) seed+1);
perturbZ = new FastNoiseLite((int) seed + 1);
perturbZ.setNoiseType(FastNoiseLite.NoiseType.OpenSimplex2);
perturbZ.setFrequency(frequency);
this.amplitude = amplitude;
@@ -29,11 +30,12 @@ public class CoordinatePerturb {
/**
* Offset a coordinate pair
*
* @param x X coordinate
* @param z Z coordinate
* @return Vector2 containing offset coordinates
*/
public Vector2 getShiftedCoords(int x, int z) {
return new Vector2(perturbX.getNoise(x, z)*amplitude+x, perturbZ.getNoise(x, z)*amplitude+z);
return new Vector2(perturbX.getNoise(x, z) * amplitude + x, perturbZ.getNoise(x, z) * amplitude + z);
}
}

View File

@@ -8,8 +8,9 @@ import org.polydev.gaea.math.FastNoiseLite;
public class ErosionNoise {
private final double thresh;
private final FastNoiseLite noise;
public ErosionNoise(float freq1, double thresh, int octaves, long seed) {
FastNoiseLite main = new FastNoiseLite((int) (seed+1));
FastNoiseLite main = new FastNoiseLite((int) (seed + 1));
main.setNoiseType(FastNoiseLite.NoiseType.OpenSimplex2);
main.setFractalType(FastNoiseLite.FractalType.FBm);
main.setFractalOctaves(octaves);
@@ -20,6 +21,7 @@ public class ErosionNoise {
/**
* Get whether a location is eroded
*
* @param x X coordinate
* @param z Z coordinate
* @return Whether location is eroded

View File

@@ -47,7 +47,8 @@ public class TerraBiomeGrid extends BiomeGrid {
b = (UserDefinedBiome) zone.getGrid(xp, zp).getBiome(xp, zp, phase);
} catch(NullPointerException e) {
if(ConfigUtil.debug) e.printStackTrace();
if(failNum % 256 == 0) LangUtil.log("error.severe-config", Level.SEVERE, String.valueOf(x), String.valueOf(z));
if(failNum % 256 == 0)
LangUtil.log("error.severe-config", Level.SEVERE, String.valueOf(x), String.valueOf(z));
failNum++;
return ConfigUtil.failType.fail();
}

View File

@@ -3,8 +3,8 @@ package com.dfsek.terra.biome;
import com.dfsek.terra.generation.UserDefinedDecorator;
import com.dfsek.terra.generation.UserDefinedGenerator;
import org.polydev.gaea.biome.Biome;
import org.polydev.gaea.biome.Generator;
import org.polydev.gaea.biome.Decorator;
import org.polydev.gaea.biome.Generator;
import org.polydev.gaea.structures.features.Feature;
import java.util.List;

View File

@@ -14,6 +14,7 @@ public class UserDefinedGrid extends BiomeGrid {
private final boolean fromImage;
private final ImageLoader.Channel channelX;
private final ImageLoader.Channel channelZ;
public UserDefinedGrid(World w, float freq1, float freq2, UserDefinedBiome[][] b, WorldConfig c) {
super(w, freq1, freq2, b.length, b[0].length);
super.setGrid(b);

View File

@@ -26,8 +26,8 @@ public enum FailType {
},
/**
* Returns null, hard crashing the server, but not generating any corrupted terrain.<br>
* This option is <br>NOT</br> stable, but it has the least risk of blank chunks being generated.
* However, it has the highest risk of corruption!
* This option is <br>NOT</br> stable, but it has the least risk of blank chunks being generated.
* However, it has the highest risk of corruption!
*/
CRASH {
@Override
@@ -53,6 +53,7 @@ public enum FailType {
/**
* Performs the action specified by the enum type to occur on failure of terrain generation.
*
* @return Failover biome, if specified, null if not.
*/
public abstract Biome fail();

View File

@@ -2,8 +2,6 @@ package com.dfsek.terra.biome.failsafe;
import com.dfsek.terra.generation.UserDefinedDecorator;
import org.polydev.gaea.math.ProbabilityCollection;
import org.polydev.gaea.tree.Tree;
import org.polydev.gaea.world.Flora;
public final class FailoverDecorator extends UserDefinedDecorator {
public FailoverDecorator() {

View File

@@ -13,9 +13,11 @@ import java.util.TreeMap;
public final class FailoverGenerator extends UserDefinedGenerator {
private static final TreeMap<Integer, Palette<BlockData>> palette = new TreeMap<>();
static {
palette.put(255, new RandomPalette<BlockData>(new Random(2403)).add(Material.STONE.createBlockData(), 1));
}
public FailoverGenerator() throws ParseException {
super("0", Collections.emptyList(), palette, false);
}