mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2025-07-18 10:32:30 +00:00
Continue work on slant palettes and elevation.
This commit is contained in:
parent
dd33998cf8
commit
f6a4479855
@ -19,7 +19,7 @@ public class TerraProfiler extends WorldProfiler {
|
|||||||
.addMeasurement(new Measurement(1500000, DataType.PERIOD_MILLISECONDS), "OreTime")
|
.addMeasurement(new Measurement(1500000, DataType.PERIOD_MILLISECONDS), "OreTime")
|
||||||
.addMeasurement(new Measurement(1500000, DataType.PERIOD_MILLISECONDS), "CaveTime")
|
.addMeasurement(new Measurement(1500000, DataType.PERIOD_MILLISECONDS), "CaveTime")
|
||||||
.addMeasurement(new Measurement(1500000, DataType.PERIOD_MILLISECONDS), "StructureTime")
|
.addMeasurement(new Measurement(1500000, DataType.PERIOD_MILLISECONDS), "StructureTime")
|
||||||
.addMeasurement(new Measurement(1500000, DataType.PERIOD_MILLISECONDS), "StructurePasteTime")
|
.addMeasurement(new Measurement(1500000, DataType.PERIOD_MILLISECONDS), "ElevationTime")
|
||||||
.addMeasurement(new Measurement(1500000, DataType.PERIOD_MILLISECONDS), "SnowTime")
|
.addMeasurement(new Measurement(1500000, DataType.PERIOD_MILLISECONDS), "SnowTime")
|
||||||
.addMeasurement(new Measurement(1500000, DataType.PERIOD_MILLISECONDS), "CaveBlockUpdate");
|
.addMeasurement(new Measurement(1500000, DataType.PERIOD_MILLISECONDS), "CaveBlockUpdate");
|
||||||
}
|
}
|
||||||
|
@ -19,6 +19,6 @@ public final class FailoverGenerator extends UserDefinedGenerator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public FailoverGenerator() throws ParseException {
|
public FailoverGenerator() throws ParseException {
|
||||||
super("0", null, Collections.emptyList(), palette, false);
|
super("0", null, Collections.emptyList(), palette, new TreeMap<>(), false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -34,7 +34,7 @@ public class AbstractBiomeConfig extends TerraConfig {
|
|||||||
|
|
||||||
if(contains("carving")) carving = new BiomeCarverConfig(this);
|
if(contains("carving")) carving = new BiomeCarverConfig(this);
|
||||||
|
|
||||||
if(contains("palette")) palette = new BiomePaletteConfig(this);
|
if(contains("palette")) palette = new BiomePaletteConfig(this, "palette");
|
||||||
|
|
||||||
if(contains("flora")) flora = new BiomeFloraConfig(this);
|
if(contains("flora")) flora = new BiomeFloraConfig(this);
|
||||||
|
|
||||||
|
@ -24,6 +24,7 @@ import java.util.ArrayList;
|
|||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
import java.util.TreeMap;
|
||||||
|
|
||||||
public class BiomeConfig extends TerraConfig {
|
public class BiomeConfig extends TerraConfig {
|
||||||
|
|
||||||
@ -38,7 +39,6 @@ public class BiomeConfig extends TerraConfig {
|
|||||||
private final BiomeSnowConfig snow;
|
private final BiomeSnowConfig snow;
|
||||||
private final List<StructureConfig> structures;
|
private final List<StructureConfig> structures;
|
||||||
private final ConfigPack config;
|
private final ConfigPack config;
|
||||||
private final Palette<BlockData> slant;
|
|
||||||
private final double ySlantOffsetTop;
|
private final double ySlantOffsetTop;
|
||||||
private final double ySlantOffsetBottom;
|
private final double ySlantOffsetBottom;
|
||||||
|
|
||||||
@ -78,7 +78,7 @@ public class BiomeConfig extends TerraConfig {
|
|||||||
if(extending && abstractBiome.getPaletteData() != null && !contains("palette")) {
|
if(extending && abstractBiome.getPaletteData() != null && !contains("palette")) {
|
||||||
palette = abstractBiome.getPaletteData();
|
palette = abstractBiome.getPaletteData();
|
||||||
Debug.info("Using super palette");
|
Debug.info("Using super palette");
|
||||||
} else palette = new BiomePaletteConfig(this);
|
} else palette = new BiomePaletteConfig(this, "palette");
|
||||||
|
|
||||||
// Palette must not be null
|
// Palette must not be null
|
||||||
if(palette.getPaletteMap() == null)
|
if(palette.getPaletteMap() == null)
|
||||||
@ -127,12 +127,13 @@ public class BiomeConfig extends TerraConfig {
|
|||||||
} else snow = new BiomeSnowConfig(this);
|
} else snow = new BiomeSnowConfig(this);
|
||||||
|
|
||||||
// Get slant stuff
|
// Get slant stuff
|
||||||
|
TreeMap<Integer, Palette<BlockData>> slant = new TreeMap<>();
|
||||||
if(contains("slant")) {
|
if(contains("slant")) {
|
||||||
String slantS = getString("slant.palette");
|
String slantS = getString("slant.palette");
|
||||||
slant = config.getPalette(slantS).getPalette();
|
slant = new BiomePaletteConfig(this, "slant.palette").getPaletteMap();
|
||||||
Debug.info("Using slant palette: " + slantS);
|
Debug.info("Using slant palette: " + slantS);
|
||||||
if(slant == null) throw new NotFoundException("Slant Palette", slantS, getID());
|
if(slant == null) throw new NotFoundException("Slant Palette", slantS, getID());
|
||||||
} else slant = null;
|
}
|
||||||
ySlantOffsetTop = getDouble("slant.y-offset.top", 0.25);
|
ySlantOffsetTop = getDouble("slant.y-offset.top", 0.25);
|
||||||
ySlantOffsetBottom = getDouble("slant.y-offset.bottom", 0.25);
|
ySlantOffsetBottom = getDouble("slant.y-offset.bottom", 0.25);
|
||||||
|
|
||||||
@ -166,11 +167,13 @@ public class BiomeConfig extends TerraConfig {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
String elevation = getString("elevation-equation", null);
|
String elevation = getString("elevation.equation", null);
|
||||||
|
boolean doElevationInterpolation = getBoolean("elevation.interpolation", true);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// Get UserDefinedBiome instance representing this config.
|
// Get UserDefinedBiome instance representing this config.
|
||||||
UserDefinedGenerator gen = new UserDefinedGenerator(eq, elevation, Collections.emptyList(), palette.getPaletteMap(), getBoolean("prevent-smooth", false));
|
UserDefinedGenerator gen = new UserDefinedGenerator(eq, elevation, Collections.emptyList(), palette.getPaletteMap(), slant, getBoolean("prevent-smooth", false));
|
||||||
|
gen.setElevationInterpolation(doElevationInterpolation);
|
||||||
this.biome = new UserDefinedBiome(vanillaBiome, dec, gen, getBoolean("erodible", false), biomeID);
|
this.biome = new UserDefinedBiome(vanillaBiome, dec, gen, getBoolean("erodible", false), biomeID);
|
||||||
} catch(ParseException e) {
|
} catch(ParseException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
@ -194,10 +197,6 @@ public class BiomeConfig extends TerraConfig {
|
|||||||
return flora.getFloraHeights().computeIfAbsent(f, input -> new Range(-1, -1));
|
return flora.getFloraHeights().computeIfAbsent(f, input -> new Range(-1, -1));
|
||||||
}
|
}
|
||||||
|
|
||||||
public Palette<BlockData> getSlant() {
|
|
||||||
return slant;
|
|
||||||
}
|
|
||||||
|
|
||||||
public double getYSlantOffsetTop() {
|
public double getYSlantOffsetTop() {
|
||||||
return ySlantOffsetTop;
|
return ySlantOffsetTop;
|
||||||
}
|
}
|
||||||
|
@ -19,10 +19,9 @@ import java.util.TreeMap;
|
|||||||
public class BiomePaletteConfig extends TerraConfigSection {
|
public class BiomePaletteConfig extends TerraConfigSection {
|
||||||
private TreeMap<Integer, Palette<BlockData>> paletteMap;
|
private TreeMap<Integer, Palette<BlockData>> paletteMap;
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
public BiomePaletteConfig(TerraConfig parent, String key) throws InvalidConfigurationException {
|
||||||
public BiomePaletteConfig(TerraConfig parent) throws InvalidConfigurationException {
|
|
||||||
super(parent);
|
super(parent);
|
||||||
List<Map<?, ?>> cfg = parent.getMapList("palette");
|
List<Map<?, ?>> cfg = parent.getMapList(key);
|
||||||
if(cfg.size() == 0) return;
|
if(cfg.size() == 0) return;
|
||||||
paletteMap = new TreeMap<>();
|
paletteMap = new TreeMap<>();
|
||||||
for(Map<?, ?> e : cfg) {
|
for(Map<?, ?> e : cfg) {
|
||||||
|
@ -2,7 +2,6 @@ package com.dfsek.terra.generation;
|
|||||||
|
|
||||||
import com.dfsek.terra.biome.TerraBiomeGrid;
|
import com.dfsek.terra.biome.TerraBiomeGrid;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.polydev.gaea.biome.Generator;
|
|
||||||
import org.polydev.gaea.generation.GenerationPhase;
|
import org.polydev.gaea.generation.GenerationPhase;
|
||||||
import org.polydev.gaea.math.FastNoiseLite;
|
import org.polydev.gaea.math.FastNoiseLite;
|
||||||
import org.polydev.gaea.math.Interpolator;
|
import org.polydev.gaea.math.Interpolator;
|
||||||
@ -13,11 +12,13 @@ public class ElevationInterpolator {
|
|||||||
private final FastNoiseLite noise;
|
private final FastNoiseLite noise;
|
||||||
private final int xOrigin;
|
private final int xOrigin;
|
||||||
private final int zOrigin;
|
private final int zOrigin;
|
||||||
|
private final TerraBiomeGrid grid;
|
||||||
|
|
||||||
public ElevationInterpolator(World w, int chunkX, int chunkZ, TerraBiomeGrid grid, FastNoiseLite noise) {
|
public ElevationInterpolator(World w, int chunkX, int chunkZ, TerraBiomeGrid grid, FastNoiseLite noise) {
|
||||||
this.xOrigin = chunkX << 4;
|
this.xOrigin = chunkX << 4;
|
||||||
this.zOrigin = chunkZ << 4;
|
this.zOrigin = chunkZ << 4;
|
||||||
this.noise = noise;
|
this.noise = noise;
|
||||||
|
this.grid = grid;
|
||||||
|
|
||||||
for(int x = -1; x < 7; x++) {
|
for(int x = -1; x < 7; x++) {
|
||||||
for(int z = -1; z < 7; z++) {
|
for(int z = -1; z < 7; z++) {
|
||||||
@ -27,20 +28,26 @@ public class ElevationInterpolator {
|
|||||||
|
|
||||||
for(byte x = -1; x <= 16; x++) {
|
for(byte x = -1; x <= 16; x++) {
|
||||||
for(byte z = -1; z <= 16; z++) {
|
for(byte z = -1; z <= 16; z++) {
|
||||||
if(compareGens((x / 4) + 1, (z / 4) + 1)) {
|
UserDefinedGenerator generator = getGenerator(x, z);
|
||||||
|
if(compareGens((x / 4) + 1, (z / 4) + 1) && generator.interpolateElevation()) {
|
||||||
Interpolator interpolator = new Interpolator(biomeAvg(x / 4, z / 4),
|
Interpolator interpolator = new Interpolator(biomeAvg(x / 4, z / 4),
|
||||||
biomeAvg((x / 4) + 1, z / 4),
|
biomeAvg((x / 4) + 1, z / 4),
|
||||||
biomeAvg(x / 4, (z / 4) + 1),
|
biomeAvg(x / 4, (z / 4) + 1),
|
||||||
biomeAvg((x / 4) + 1, (z / 4) + 1),
|
biomeAvg((x / 4) + 1, (z / 4) + 1),
|
||||||
Interpolator.Type.LINEAR);
|
Interpolator.Type.LINEAR);
|
||||||
values[x + 1][z + 1] = interpolator.bilerp((double) (x % 4) / 4, (double) (z % 4) / 4);
|
values[x + 1][z + 1] = interpolator.bilerp((double) (x % 4) / 4, (double) (z % 4) / 4);
|
||||||
} else values[x + 1][z + 1] = elevate(gens[x / 4][z / 4], xOrigin + x, zOrigin + z);
|
} else values[x + 1][z + 1] = elevate(generator, xOrigin + x, zOrigin + z);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private UserDefinedGenerator getGenerator(int x, int z) {
|
||||||
|
return (UserDefinedGenerator) grid.getBiome(xOrigin + x, zOrigin + z, GenerationPhase.BASE).getGenerator();
|
||||||
|
}
|
||||||
|
|
||||||
private boolean compareGens(int x, int z) {
|
private boolean compareGens(int x, int z) {
|
||||||
Generator comp = gens[x][z];
|
UserDefinedGenerator comp = gens[x][z];
|
||||||
|
|
||||||
if(!comp.equals(gens[x + 1][z])) return true;
|
if(!comp.equals(gens[x + 1][z])) return true;
|
||||||
|
|
||||||
if(!comp.equals(gens[x][z + 1])) return true;
|
if(!comp.equals(gens[x][z + 1])) return true;
|
||||||
|
@ -2,6 +2,7 @@ package com.dfsek.terra.generation;
|
|||||||
|
|
||||||
import com.dfsek.terra.Debug;
|
import com.dfsek.terra.Debug;
|
||||||
import com.dfsek.terra.Terra;
|
import com.dfsek.terra.Terra;
|
||||||
|
import com.dfsek.terra.TerraProfiler;
|
||||||
import com.dfsek.terra.TerraWorld;
|
import com.dfsek.terra.TerraWorld;
|
||||||
import com.dfsek.terra.biome.UserDefinedBiome;
|
import com.dfsek.terra.biome.UserDefinedBiome;
|
||||||
import com.dfsek.terra.config.base.ConfigPack;
|
import com.dfsek.terra.config.base.ConfigPack;
|
||||||
@ -30,6 +31,7 @@ import org.polydev.gaea.generation.GenerationPhase;
|
|||||||
import org.polydev.gaea.generation.GenerationPopulator;
|
import org.polydev.gaea.generation.GenerationPopulator;
|
||||||
import org.polydev.gaea.math.ChunkInterpolator;
|
import org.polydev.gaea.math.ChunkInterpolator;
|
||||||
import org.polydev.gaea.population.PopulationManager;
|
import org.polydev.gaea.population.PopulationManager;
|
||||||
|
import org.polydev.gaea.profiler.ProfileFuture;
|
||||||
import org.polydev.gaea.profiler.WorldProfiler;
|
import org.polydev.gaea.profiler.WorldProfiler;
|
||||||
import org.polydev.gaea.world.palette.Palette;
|
import org.polydev.gaea.world.palette.Palette;
|
||||||
|
|
||||||
@ -81,7 +83,7 @@ public class TerraChunkGenerator extends GaeaChunkGenerator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static Palette<BlockData> getPalette(int x, int y, int z, BiomeConfig c, ChunkInterpolator interpolator, ElevationInterpolator elevationInterpolator) {
|
private static Palette<BlockData> getPalette(int x, int y, int z, BiomeConfig c, ChunkInterpolator interpolator, ElevationInterpolator elevationInterpolator) {
|
||||||
Palette<BlockData> slant = c.getSlant();
|
Palette<BlockData> slant = ((UserDefinedGenerator) c.getBiome().getGenerator()).getSlantPalette(y);
|
||||||
if(slant != null) {
|
if(slant != null) {
|
||||||
boolean north = interpolator.getNoise(x, y - elevationInterpolator.getElevation(x, z + 1), z + 1) > 0;
|
boolean north = interpolator.getNoise(x, y - elevationInterpolator.getElevation(x, z + 1), z + 1) > 0;
|
||||||
boolean south = interpolator.getNoise(x, y - elevationInterpolator.getElevation(x, z - 1), z - 1) > 0;
|
boolean south = interpolator.getNoise(x, y - elevationInterpolator.getElevation(x, z - 1), z - 1) > 0;
|
||||||
@ -99,20 +101,25 @@ public class TerraChunkGenerator extends GaeaChunkGenerator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static void prepareBlockPart(BlockData down, BlockData orig, ChunkData chunk, Vector block, Map<Material, Palette<BlockData>> slabs,
|
private static void prepareBlockPart(BlockData down, BlockData orig, ChunkData chunk, Vector block, Map<Material, Palette<BlockData>> slabs,
|
||||||
Map<Material, Palette<BlockData>> stairs, double thresh, ChunkInterpolator interpolator) {
|
Map<Material, Palette<BlockData>> stairs, double thresh, ChunkInterpolator interpolator, ElevationInterpolator elevationInterpolator) {
|
||||||
if(interpolator.getNoise(block.getBlockX(), block.getBlockY() - 0.4, block.getBlockZ()) > thresh) {
|
double elevation = elevationInterpolator.getElevation(block.getBlockX(), block.getBlockZ());
|
||||||
|
if(interpolator.getNoise(block.getBlockX(), block.getBlockY() - 0.4 - elevation, block.getBlockZ()) > thresh) {
|
||||||
if(stairs != null) {
|
if(stairs != null) {
|
||||||
Palette<BlockData> stairPalette = stairs.get(down.getMaterial());
|
Palette<BlockData> stairPalette = stairs.get(down.getMaterial());
|
||||||
if(stairPalette != null) {
|
if(stairPalette != null) {
|
||||||
BlockData stair = stairPalette.get(0, block.getBlockX(), block.getBlockZ());
|
BlockData stair = stairPalette.get(0, block.getBlockX(), block.getBlockZ());
|
||||||
Stairs stairNew = (Stairs) stair.clone();
|
Stairs stairNew = (Stairs) stair.clone();
|
||||||
if(interpolator.getNoise(block.getBlockX() - 0.5, block.getBlockY(), block.getBlockZ()) > thresh) {
|
double elevationN = elevationInterpolator.getElevation(block.getBlockX(), block.getBlockZ() - 1); // Northern elevation
|
||||||
|
double elevationS = elevationInterpolator.getElevation(block.getBlockX(), block.getBlockZ() + 1); // Southern elevation
|
||||||
|
double elevationE = elevationInterpolator.getElevation(block.getBlockX() + 1, block.getBlockZ()); // Eastern elevation
|
||||||
|
double elevationW = elevationInterpolator.getElevation(block.getBlockX() - 1, block.getBlockZ()); // Western elevation
|
||||||
|
if(interpolator.getNoise(block.getBlockX() - 0.5, block.getBlockY() - elevationW, block.getBlockZ()) > thresh) {
|
||||||
stairNew.setFacing(BlockFace.WEST);
|
stairNew.setFacing(BlockFace.WEST);
|
||||||
} else if(interpolator.getNoise(block.getBlockX(), block.getBlockY(), block.getBlockZ() - 0.5) > thresh) {
|
} else if(interpolator.getNoise(block.getBlockX(), block.getBlockY() - elevationN, block.getBlockZ() - 0.5) > thresh) {
|
||||||
stairNew.setFacing(BlockFace.NORTH);
|
stairNew.setFacing(BlockFace.NORTH);
|
||||||
} else if(interpolator.getNoise(block.getBlockX(), block.getBlockY(), block.getBlockZ() + 0.5) > thresh) {
|
} else if(interpolator.getNoise(block.getBlockX(), block.getBlockY() - elevationS, block.getBlockZ() + 0.5) > thresh) {
|
||||||
stairNew.setFacing(BlockFace.SOUTH);
|
stairNew.setFacing(BlockFace.SOUTH);
|
||||||
} else if(interpolator.getNoise(block.getBlockX() + 0.5, block.getBlockY(), block.getBlockZ()) > thresh) {
|
} else if(interpolator.getNoise(block.getBlockX() + 0.5, block.getBlockY() - elevationE, block.getBlockZ()) > thresh) {
|
||||||
stairNew.setFacing(BlockFace.EAST);
|
stairNew.setFacing(BlockFace.EAST);
|
||||||
} else stairNew = null;
|
} else stairNew = null;
|
||||||
if(stairNew != null) {
|
if(stairNew != null) {
|
||||||
@ -131,6 +138,7 @@ public class TerraChunkGenerator extends GaeaChunkGenerator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@SuppressWarnings("try")
|
||||||
public ChunkData generateBase(@NotNull World world, @NotNull Random random, int chunkX, int chunkZ, ChunkInterpolator interpolator) {
|
public ChunkData generateBase(@NotNull World world, @NotNull Random random, int chunkX, int chunkZ, ChunkInterpolator interpolator) {
|
||||||
if(needsLoad) load(world); // Load population data for world.
|
if(needsLoad) load(world); // Load population data for world.
|
||||||
ChunkData chunk = createChunkData(world);
|
ChunkData chunk = createChunkData(world);
|
||||||
@ -141,7 +149,10 @@ public class TerraChunkGenerator extends GaeaChunkGenerator {
|
|||||||
int zOrig = (chunkZ << 4);
|
int zOrig = (chunkZ << 4);
|
||||||
org.polydev.gaea.biome.BiomeGrid grid = getBiomeGrid(world);
|
org.polydev.gaea.biome.BiomeGrid grid = getBiomeGrid(world);
|
||||||
|
|
||||||
ElevationInterpolator elevationInterpolator = new ElevationInterpolator(world, chunkX, chunkZ, tw.getGrid(), getNoiseGenerator());
|
ElevationInterpolator elevationInterpolator;
|
||||||
|
try(ProfileFuture ignore = TerraProfiler.fromWorld(world).measure("ElevationTime")) {
|
||||||
|
elevationInterpolator = new ElevationInterpolator(world, chunkX, chunkZ, tw.getGrid(), getNoiseGenerator());
|
||||||
|
}
|
||||||
|
|
||||||
for(byte x = 0; x < 16; x++) {
|
for(byte x = 0; x < 16; x++) {
|
||||||
for(byte z = 0; z < 16; z++) {
|
for(byte z = 0; z < 16; z++) {
|
||||||
@ -153,7 +164,7 @@ public class TerraChunkGenerator extends GaeaChunkGenerator {
|
|||||||
Biome b = grid.getBiome(xOrig + x, zOrig + z, GenerationPhase.PALETTE_APPLY);
|
Biome b = grid.getBiome(xOrig + x, zOrig + z, GenerationPhase.PALETTE_APPLY);
|
||||||
BiomeConfig c = config.getBiome((UserDefinedBiome) b);
|
BiomeConfig c = config.getBiome((UserDefinedBiome) b);
|
||||||
|
|
||||||
int elevate = (int) elevationInterpolator.getElevation(x, z);
|
double elevate = elevationInterpolator.getElevation(x, z);
|
||||||
|
|
||||||
BiomeSlabConfig slab = c.getSlabs();
|
BiomeSlabConfig slab = c.getSlabs();
|
||||||
int sea = c.getOcean().getSeaLevel();
|
int sea = c.getOcean().getSeaLevel();
|
||||||
@ -164,7 +175,7 @@ public class TerraChunkGenerator extends GaeaChunkGenerator {
|
|||||||
chunk.setBlock(x, y, z, data);
|
chunk.setBlock(x, y, z, data);
|
||||||
if(paletteLevel == 0 && slab != null && y < 255) {
|
if(paletteLevel == 0 && slab != null && y < 255) {
|
||||||
prepareBlockPart(data, chunk.getBlockData(x, y + 1, z), chunk, new Vector(x, y + 1, z), slab.getSlabs(),
|
prepareBlockPart(data, chunk.getBlockData(x, y + 1, z), chunk, new Vector(x, y + 1, z), slab.getSlabs(),
|
||||||
slab.getStairs(), slab.getSlabThreshold(), interpolator);
|
slab.getStairs(), slab.getSlabThreshold(), interpolator, elevationInterpolator);
|
||||||
}
|
}
|
||||||
paletteLevel++;
|
paletteLevel++;
|
||||||
} else if(y <= sea) {
|
} else if(y <= sea) {
|
||||||
|
@ -30,13 +30,16 @@ public class UserDefinedGenerator extends Generator {
|
|||||||
private final Variable zVar = s.getVariable("z");
|
private final Variable zVar = s.getVariable("z");
|
||||||
@SuppressWarnings({"unchecked", "rawtypes", "RedundantSuppression"})
|
@SuppressWarnings({"unchecked", "rawtypes", "RedundantSuppression"})
|
||||||
private final Palette<BlockData>[] palettes = new Palette[256];
|
private final Palette<BlockData>[] palettes = new Palette[256];
|
||||||
|
@SuppressWarnings({"unchecked", "rawtypes", "RedundantSuppression"})
|
||||||
|
private final Palette<BlockData>[] slantPalettes = new Palette[256];
|
||||||
private final NoiseFunction2 n2 = new NoiseFunction2();
|
private final NoiseFunction2 n2 = new NoiseFunction2();
|
||||||
private final NoiseFunction3 n3 = new NoiseFunction3();
|
private final NoiseFunction3 n3 = new NoiseFunction3();
|
||||||
private final ElevationEquation elevationEquation;
|
private final ElevationEquation elevationEquation;
|
||||||
private final boolean preventSmooth;
|
private final boolean preventSmooth;
|
||||||
|
private boolean elevationInterpolation;
|
||||||
|
|
||||||
|
|
||||||
public UserDefinedGenerator(String equation, @Nullable String elevateEquation, List<Variable> userVariables, Map<Integer, Palette<BlockData>> paletteMap, boolean preventSmooth)
|
public UserDefinedGenerator(String equation, @Nullable String elevateEquation, List<Variable> userVariables, Map<Integer, Palette<BlockData>> paletteMap, Map<Integer, Palette<BlockData>> slantPaletteMap, boolean preventSmooth)
|
||||||
throws ParseException {
|
throws ParseException {
|
||||||
Parser p = new Parser();
|
Parser p = new Parser();
|
||||||
p.registerFunction("noise2", n2);
|
p.registerFunction("noise2", n2);
|
||||||
@ -50,6 +53,14 @@ public class UserDefinedGenerator extends Generator {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
palettes[y] = d;
|
palettes[y] = d;
|
||||||
|
Palette<BlockData> slantPalette = null;
|
||||||
|
for(Map.Entry<Integer, Palette<BlockData>> e : slantPaletteMap.entrySet()) {
|
||||||
|
if(e.getKey() >= y) {
|
||||||
|
slantPalette = e.getValue();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
slantPalettes[y] = slantPalette;
|
||||||
}
|
}
|
||||||
if(elevateEquation != null) {
|
if(elevateEquation != null) {
|
||||||
Debug.info("Using elevation equation");
|
Debug.info("Using elevation equation");
|
||||||
@ -110,6 +121,11 @@ public class UserDefinedGenerator extends Generator {
|
|||||||
return palettes[y];
|
return palettes[y];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Palette<BlockData> getSlantPalette(int y) {
|
||||||
|
return slantPalettes[y];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean useMinimalInterpolation() {
|
public boolean useMinimalInterpolation() {
|
||||||
return preventSmooth;
|
return preventSmooth;
|
||||||
@ -123,4 +139,12 @@ public class UserDefinedGenerator extends Generator {
|
|||||||
public ElevationEquation getElevationEquation() {
|
public ElevationEquation getElevationEquation() {
|
||||||
return elevationEquation;
|
return elevationEquation;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean interpolateElevation() {
|
||||||
|
return elevationInterpolation;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setElevationInterpolation(boolean elevationInterpolation) {
|
||||||
|
this.elevationInterpolation = elevationInterpolation;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -49,7 +49,6 @@ public class StructurePopulator extends BlockPopulator {
|
|||||||
if(!struc.checkSpawns(spawn, rotation)) continue;
|
if(!struc.checkSpawns(spawn, rotation)) continue;
|
||||||
double horizontal = struc.getStructureInfo().getMaxHorizontal();
|
double horizontal = struc.getStructureInfo().getMaxHorizontal();
|
||||||
if(Math.abs((cx + 8) - spawn.getBlockX()) <= horizontal && Math.abs((cz + 8) - spawn.getBlockZ()) <= horizontal) {
|
if(Math.abs((cx + 8) - spawn.getBlockX()) <= horizontal && Math.abs((cz + 8) - spawn.getBlockZ()) <= horizontal) {
|
||||||
try(ProfileFuture ignore = TerraProfiler.fromWorld(world).measure("StructurePasteTime")) {
|
|
||||||
struc.paste(spawn, chunk, rotation);
|
struc.paste(spawn, chunk, rotation);
|
||||||
for(StructureContainedInventory i : struc.getInventories()) {
|
for(StructureContainedInventory i : struc.getInventories()) {
|
||||||
try {
|
try {
|
||||||
@ -77,5 +76,4 @@ public class StructurePopulator extends BlockPopulator {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,12 @@
|
|||||||
noise-equation: "((-((y / 64)^2)) + 1) + min(floor(((max(noise2(x/1.5, z/1.5)+0.1, 0)) + 0.1)*5), 3)/2.5 + |(noise2(x, z)+0.1)/3|"
|
noise-equation: "((-((y / 63)^2)) + 1) + (noise2(x/1.5, z/1.5)+0.1)/2.5"
|
||||||
|
elevation:
|
||||||
|
equation: "min(floor(((max(noise2(x/1.5, z/1.5)+0.1, 0)) + 0.1)*5), 3)*10"
|
||||||
|
interpolation: true
|
||||||
extends: "BASIC_ORES"
|
extends: "BASIC_ORES"
|
||||||
id: "MESA"
|
id: "MESA"
|
||||||
|
|
||||||
palette:
|
slant:
|
||||||
|
palette:
|
||||||
- "BLOCK:minecraft:bedrock": 0
|
- "BLOCK:minecraft:bedrock": 0
|
||||||
- BEDROCK_MOST: 1
|
- BEDROCK_MOST: 1
|
||||||
- BEDROCK_HALF: 2
|
- BEDROCK_HALF: 2
|
||||||
@ -21,7 +25,23 @@ palette:
|
|||||||
- "BLOCK:minecraft:yellow_terracotta": 88
|
- "BLOCK:minecraft:yellow_terracotta": 88
|
||||||
- "BLOCK:minecraft:red_terracotta": 84
|
- "BLOCK:minecraft:red_terracotta": 84
|
||||||
- "BLOCK:minecraft:orange_terracotta": 80
|
- "BLOCK:minecraft:orange_terracotta": 80
|
||||||
- RED_DESERT: 72
|
- "BLOCK:minecraft:terracotta": 76
|
||||||
|
- "BLOCK:minecraft:yellow_terracotta": 72
|
||||||
|
- "BLOCK:minecraft:red_terracotta": 68
|
||||||
|
- "BLOCK:minecraft:orange_terracotta": 64
|
||||||
|
- "BLOCK:minecraft:terracotta": 60
|
||||||
|
- "BLOCK:minecraft:yellow_terracotta": 56
|
||||||
|
- "BLOCK:minecraft:red_terracotta": 52
|
||||||
|
y-offset:
|
||||||
|
top: 0.3
|
||||||
|
bottom: 0.25
|
||||||
|
|
||||||
|
palette:
|
||||||
|
- "BLOCK:minecraft:bedrock": 0
|
||||||
|
- BEDROCK_MOST: 1
|
||||||
|
- BEDROCK_HALF: 2
|
||||||
|
- BEDROCK_LITTLE: 3
|
||||||
|
- RED_DESERT: 255
|
||||||
vanilla: BADLANDS
|
vanilla: BADLANDS
|
||||||
|
|
||||||
flora-chance: 2
|
flora-chance: 2
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
noise-equation: "((-((y / 64)^2)) + 1) + |noise2(x/2.5, z/2.5)|"
|
noise-equation: "((-((y / 64)^2)) + 1) + |noise2(x/2.5, z/2.5)|"
|
||||||
elevation-equation: "min(floor(((|noise2(x/2.5, z/2.5)|) + 0.1)*4)*5, 15)"
|
elevation:
|
||||||
|
equation: "min(floor(((|noise2(x/2.5, z/2.5)|) + 0.1)*4)*4, 12)"
|
||||||
|
interpolation: true
|
||||||
|
|
||||||
id: "ARID_MOUNTAINS"
|
id: "ARID_MOUNTAINS"
|
||||||
extends: "BASIC_ORES"
|
extends: "BASIC_ORES"
|
||||||
@ -15,10 +17,12 @@ vanilla: SAVANNA
|
|||||||
|
|
||||||
erodible: false
|
erodible: false
|
||||||
prevent-smooth: true
|
prevent-smooth: true
|
||||||
|
|
||||||
slant:
|
slant:
|
||||||
palette: STONE
|
palette:
|
||||||
|
- ARID_SIDE: 255
|
||||||
y-offset:
|
y-offset:
|
||||||
top: 0.25
|
top: 0.4
|
||||||
bottom: 0.25
|
bottom: 0.25
|
||||||
|
|
||||||
flora:
|
flora:
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
grid:
|
grid:
|
||||||
|
- [ "FROZEN_OCEAN_DEEP", "COLD_OCEAN_DEEP", "COLD_OCEAN_DEEP", "OCEAN_DEEP", "OCEAN_DEEP", "OCEAN_DEEP", "OCEAN_DEEP", "LUKEWARM_OCEAN_SHELF", "WARM_OCEAN", "MUSHROOM_ISLANDS", "MUSHROOM_ISLANDS" ]
|
||||||
|
- [ "FROZEN_OCEAN_DEEP", "COLD_OCEAN_DEEP", "COLD_OCEAN_DEEP", "OCEAN_DEEP", "OCEAN_DEEP", "OCEAN_DEEP", "OCEAN_DEEP", "LUKEWARM_OCEAN_DEEP", "WARM_OCEAN_SHELF", "WARM_OCEAN", "MUSHROOM_ISLANDS" ]
|
||||||
|
- [ "FROZEN_OCEAN_DEEP", "COLD_OCEAN_DEEP", "COLD_OCEAN_DEEP", "OCEAN_DEEP", "OCEAN_DEEP", "OCEAN_DEEP", "OCEAN_DEEP", "LUKEWARM_OCEAN_DEEP", "WARM_OCEAN_DEEP", "WARM_OCEAN_SHELF", "WARM_OCEAN" ]
|
||||||
|
- [ "FROZEN_OCEAN_DEEP", "COLD_OCEAN_DEEP", "COLD_OCEAN_DEEP", "OCEAN_DEEP", "OCEAN_DEEP", "OCEAN_DEEP", "OCEAN_DEEP", "LUKEWARM_OCEAN_DEEP", "WARM_OCEAN_DEEP", "WARM_OCEAN_DEEP", "WARM_OCEAN_SHELF" ]
|
||||||
- [ "FROZEN_OCEAN_DEEP", "COLD_OCEAN_DEEP", "COLD_OCEAN_DEEP", "OCEAN_DEEP", "OCEAN_DEEP", "OCEAN_DEEP", "OCEAN_DEEP", "LUKEWARM_OCEAN_DEEP", "WARM_OCEAN_DEEP", "WARM_OCEAN_DEEP", "WARM_OCEAN_DEEP" ]
|
- [ "FROZEN_OCEAN_DEEP", "COLD_OCEAN_DEEP", "COLD_OCEAN_DEEP", "OCEAN_DEEP", "OCEAN_DEEP", "OCEAN_DEEP", "OCEAN_DEEP", "LUKEWARM_OCEAN_DEEP", "WARM_OCEAN_DEEP", "WARM_OCEAN_DEEP", "WARM_OCEAN_DEEP" ]
|
||||||
- [ "FROZEN_OCEAN_DEEP", "COLD_OCEAN_DEEP", "COLD_OCEAN_DEEP", "OCEAN_DEEP", "OCEAN_DEEP", "OCEAN_DEEP", "OCEAN_DEEP", "LUKEWARM_OCEAN_DEEP", "WARM_OCEAN_DEEP", "WARM_OCEAN_DEEP", "WARM_OCEAN_DEEP" ]
|
- [ "FROZEN_OCEAN_DEEP", "COLD_OCEAN_DEEP", "COLD_OCEAN_DEEP", "OCEAN_DEEP", "OCEAN_DEEP", "OCEAN_DEEP", "OCEAN_DEEP", "LUKEWARM_OCEAN_DEEP", "WARM_OCEAN_DEEP", "WARM_OCEAN_DEEP", "WARM_OCEAN_DEEP" ]
|
||||||
- [ "FROZEN_OCEAN_DEEP", "COLD_OCEAN_DEEP", "COLD_OCEAN_DEEP", "OCEAN_DEEP", "OCEAN_DEEP", "OCEAN_SHELF", "OCEAN_DEEP", "LUKEWARM_OCEAN_DEEP", "WARM_OCEAN_DEEP", "WARM_OCEAN_DEEP", "WARM_OCEAN_DEEP" ]
|
- [ "FROZEN_OCEAN_DEEP", "COLD_OCEAN_DEEP", "COLD_OCEAN_DEEP", "OCEAN_DEEP", "OCEAN_DEEP", "OCEAN_DEEP", "OCEAN_DEEP", "LUKEWARM_OCEAN_DEEP", "WARM_OCEAN_DEEP", "WARM_OCEAN_DEEP", "WARM_OCEAN_DEEP" ]
|
||||||
- [ "FROZEN_OCEAN_DEEP", "COLD_OCEAN_DEEP", "COLD_OCEAN_DEEP", "OCEAN_DEEP", "OCEAN_SHELF", "OCEAN", "OCEAN_SHELF", "LUKEWARM_OCEAN_DEEP", "WARM_OCEAN_DEEP", "WARM_OCEAN_DEEP", "WARM_OCEAN_DEEP" ]
|
- [ "FROZEN_OCEAN_DEEP", "COLD_OCEAN_DEEP", "COLD_OCEAN_DEEP", "OCEAN_DEEP", "OCEAN_DEEP", "OCEAN_DEEP", "OCEAN_DEEP", "LUKEWARM_OCEAN_DEEP", "WARM_OCEAN_DEEP", "WARM_OCEAN_DEEP", "WARM_OCEAN_DEEP" ]
|
||||||
- [ "FROZEN_OCEAN_DEEP", "COLD_OCEAN_DEEP", "COLD_OCEAN_DEEP", "OCEAN_SHELF", "OCEAN", "MUSHROOM_ISLANDS", "OCEAN", "LUKEWARM_OCEAN_SHELF", "WARM_OCEAN_DEEP", "WARM_OCEAN_DEEP", "WARM_OCEAN_DEEP" ]
|
- [ "FROZEN_OCEAN_DEEP", "COLD_OCEAN_DEEP", "COLD_OCEAN_DEEP", "OCEAN_DEEP", "OCEAN_DEEP", "OCEAN_DEEP", "OCEAN_DEEP", "LUKEWARM_OCEAN_DEEP", "LUKEWARM_OCEAN_DEEP", "WARM_OCEAN_DEEP", "WARM_OCEAN_DEEP" ]
|
||||||
- [ "FROZEN_OCEAN_DEEP", "COLD_OCEAN_DEEP", "COLD_OCEAN_SHELF", "OCEAN", "MUSHROOM_ISLANDS", "MUSHROOM_ISLANDS", "MUSHROOM_ISLANDS", "OCEAN", "WARM_OCEAN_SHELF", "WARM_OCEAN_DEEP", "WARM_OCEAN_DEEP" ]
|
|
||||||
- [ "FROZEN_OCEAN_DEEP", "COLD_OCEAN_DEEP", "COLD_OCEAN_DEEP", "OCEAN_SHELF", "OCEAN", "MUSHROOM_ISLANDS", "OCEAN", "LUKEWARM_OCEAN_SHELF", "WARM_OCEAN_DEEP", "WARM_OCEAN_DEEP", "WARM_OCEAN_DEEP" ]
|
|
||||||
- [ "FROZEN_OCEAN_DEEP", "COLD_OCEAN_DEEP", "COLD_OCEAN_DEEP", "OCEAN_DEEP", "OCEAN_SHELF", "OCEAN", "OCEAN_SHELF", "LUKEWARM_OCEAN_DEEP", "WARM_OCEAN_DEEP", "WARM_OCEAN_DEEP", "WARM_OCEAN_DEEP" ]
|
|
||||||
- [ "FROZEN_OCEAN_DEEP", "COLD_OCEAN_DEEP", "COLD_OCEAN_DEEP", "OCEAN_DEEP", "OCEAN_DEEP", "OCEAN_SHELF", "OCEAN_DEEP", "LUKEWARM_OCEAN_DEEP", "LUKEWARM_OCEAN_DEEP", "WARM_OCEAN_DEEP", "WARM_OCEAN_DEEP" ]
|
|
||||||
- [ "FROZEN_OCEAN_DEEP", "COLD_OCEAN_DEEP", "COLD_OCEAN_DEEP", "OCEAN_DEEP", "OCEAN_DEEP", "OCEAN_DEEP", "OCEAN_DEEP", "LUKEWARM_OCEAN_DEEP", "LUKEWARM_OCEAN_DEEP", "LUKEWARM_OCEAN_DEEP", "WARM_OCEAN_DEEP" ]
|
- [ "FROZEN_OCEAN_DEEP", "COLD_OCEAN_DEEP", "COLD_OCEAN_DEEP", "OCEAN_DEEP", "OCEAN_DEEP", "OCEAN_DEEP", "OCEAN_DEEP", "LUKEWARM_OCEAN_DEEP", "LUKEWARM_OCEAN_DEEP", "LUKEWARM_OCEAN_DEEP", "WARM_OCEAN_DEEP" ]
|
||||||
- [ "FROZEN_OCEAN_DEEP", "COLD_OCEAN_DEEP", "COLD_OCEAN_DEEP", "OCEAN_DEEP", "OCEAN_DEEP", "OCEAN_DEEP", "OCEAN_DEEP", "LUKEWARM_OCEAN_DEEP", "LUKEWARM_OCEAN_DEEP", "LUKEWARM_OCEAN_DEEP", "WARM_OCEAN_DEEP" ]
|
- [ "FROZEN_OCEAN_DEEP", "COLD_OCEAN_DEEP", "COLD_OCEAN_DEEP", "OCEAN_DEEP", "OCEAN_DEEP", "OCEAN_DEEP", "OCEAN_DEEP", "LUKEWARM_OCEAN_DEEP", "LUKEWARM_OCEAN_DEEP", "LUKEWARM_OCEAN_DEEP", "WARM_OCEAN_DEEP" ]
|
||||||
id: "OCEAN_DEEP"
|
id: "OCEAN_DEEP"
|
@ -0,0 +1,26 @@
|
|||||||
|
layers:
|
||||||
|
- materials:
|
||||||
|
- "minecraft:grass_block": 1
|
||||||
|
- "minecraft:grass_block": 1
|
||||||
|
- "minecraft:grass_path": 1
|
||||||
|
- "minecraft:grass_block": 1
|
||||||
|
- "minecraft:grass_block": 1
|
||||||
|
- "minecraft:grass_block": 1
|
||||||
|
- "minecraft:grass_block": 1
|
||||||
|
- "minecraft:grass_block": 1
|
||||||
|
- "minecraft:grass_path": 1
|
||||||
|
- "minecraft:grass_block": 1
|
||||||
|
- "minecraft:grass_block": 1
|
||||||
|
- "minecraft:grass_block": 1
|
||||||
|
- "minecraft:grass_block": 1
|
||||||
|
- "minecraft:grass_block": 1
|
||||||
|
- "minecraft:white_terracotta": 2
|
||||||
|
layers: 1
|
||||||
|
- materials:
|
||||||
|
- "minecraft:dirt": 7
|
||||||
|
- "minecraft:white_terracotta": 1
|
||||||
|
layers: 1
|
||||||
|
id: "ARID_SIDE"
|
||||||
|
simplex: true
|
||||||
|
frequency: 0.05
|
||||||
|
seed: 3
|
@ -1,5 +0,0 @@
|
|||||||
layers:
|
|
||||||
- materials:
|
|
||||||
- "minecraft:stone": 1
|
|
||||||
layers: 1
|
|
||||||
id: "STONE"
|
|
@ -4,6 +4,7 @@ main: "com.dfsek.terra.Terra"
|
|||||||
version: "1.2.1-BETA"
|
version: "1.2.1-BETA"
|
||||||
load: "STARTUP"
|
load: "STARTUP"
|
||||||
api-version: "1.16"
|
api-version: "1.16"
|
||||||
|
description: "An insanely powerful free & open-source data-driven world generator."
|
||||||
softdepend: [ "WorldEdit" ]
|
softdepend: [ "WorldEdit" ]
|
||||||
commands:
|
commands:
|
||||||
terra:
|
terra:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user