Merge remote-tracking branch 'origin/master' into asmparser

This commit is contained in:
dfsek
2021-02-07 16:18:02 -07:00
10 changed files with 235 additions and 18 deletions

View File

@@ -33,9 +33,9 @@ public class UserDefinedBiome implements TerraBiome {
}
/**
* Gets the Vanilla biome to represent the custom biome.
* Gets the Vanilla biomes to represent the custom biome.
*
* @return TerraBiome - The Vanilla biome.
* @return Collection of biomes to represent the custom biome.
*/
@Override
public ProbabilityCollection<Biome> getVanillaBiomes() {

View File

@@ -1,4 +0,0 @@
package com.dfsek.terra.config.loaders.config.sampler;
public class NormalizerLoader {
}

View File

@@ -0,0 +1,205 @@
package com.dfsek.terra.config.templates;
import com.dfsek.tectonic.annotations.Abstractable;
import com.dfsek.tectonic.annotations.Default;
import com.dfsek.tectonic.annotations.Value;
import com.dfsek.terra.api.math.Range;
import com.dfsek.terra.api.platform.block.MaterialData;
import com.dfsek.terra.carving.CarverPalette;
import com.dfsek.terra.util.MaterialSet;
import java.util.HashMap;
import java.util.Map;
@SuppressWarnings({"unused", "FieldMayBeFinal"})
public class CarverTemplate extends AbstractableTemplate {
@Value("id")
private String id;
@Value("step")
@Abstractable
@Default
private int step = 2;
@Value("recalculate-magnitude")
@Default
@Abstractable
private double recaclulateMagnitude = 4;
@Value("recalculate-direction")
@Abstractable
@Default
private Range recalc = new Range(8, 10);
@Value("length")
@Abstractable
private Range length;
@Value("start.x")
@Abstractable
private double startX;
@Value("start.y")
@Abstractable
private double startY;
@Value("start.z")
@Abstractable
private double startZ;
@Value("start.radius.x")
@Abstractable
private String radMX;
@Value("start.radius.y")
@Abstractable
private String radMY;
@Value("start.radius.z")
@Abstractable
private String radMZ;
@Value("start.height")
@Abstractable
private Range height;
@Value("cut.bottom")
@Abstractable
@Default
private int cutBottom = 0;
@Value("cut.top")
@Abstractable
@Default
private int cutTop = 0;
@Value("mutate.x")
@Abstractable
private double mutateX;
@Value("mutate.y")
@Abstractable
private double mutateY;
@Value("mutate.z")
@Abstractable
private double mutateZ;
@Value("palette.top")
@Abstractable
private CarverPalette top;
@Value("palette.bottom")
@Abstractable
private CarverPalette bottom;
@Value("palette.outer")
@Abstractable
private CarverPalette outer;
@Value("palette.inner")
@Abstractable
private CarverPalette inner;
@Value("shift")
@Abstractable
@Default
private Map<MaterialData, MaterialSet> shift = new HashMap<>();
@Value("update")
@Abstractable
@Default
private MaterialSet update = new MaterialSet();
public String getID() {
return id;
}
public int getStep() {
return step;
}
public Range getLength() {
return length;
}
public double getStartX() {
return startX;
}
public double getStartY() {
return startY;
}
public double getStartZ() {
return startZ;
}
public String getRadMX() {
return radMX;
}
public String getRadMY() {
return radMY;
}
public String getRadMZ() {
return radMZ;
}
public Range getHeight() {
return height;
}
public int getCutBottom() {
return cutBottom;
}
public int getCutTop() {
return cutTop;
}
public double getMutateX() {
return mutateX;
}
public double getMutateY() {
return mutateY;
}
public double getMutateZ() {
return mutateZ;
}
public CarverPalette getTop() {
return top;
}
public CarverPalette getBottom() {
return bottom;
}
public CarverPalette getOuter() {
return outer;
}
public CarverPalette getInner() {
return inner;
}
public Map<MaterialData, MaterialSet> getShift() {
return shift;
}
public MaterialSet getUpdate() {
return update;
}
public Range getRecalc() {
return recalc;
}
public double getRecaclulateMagnitude() {
return recaclulateMagnitude;
}
}

View File

@@ -102,14 +102,14 @@ public class TerraFlora implements Flora {
List<BlockFace> faces = doRotation ? getFaces(location.clone().add(0, c, 0).getBlock()) : new GlueList<>();
if(doRotation && faces.size() == 0) return false; // Don't plant if no faces are valid.
BlockFace oneFace = doRotation ? faces.get(new FastRandom(location.getBlockX() ^ location.getBlockZ()).nextInt(faces.size())) : null; // Get random face.
for(int i = 0; FastMath.abs(i) < size; i += c) { // Down if ceiling, up if floor
int lvl = (FastMath.abs(i));
BlockData data = floraPalette.get((ceiling ? lvl : size - lvl - 1), location.getX(), location.getY(), location.getZ()).clone();
if(doRotation) {
BlockFace oneFace = faces.get(new FastRandom(location.getBlockX() ^ location.getBlockZ()).nextInt(faces.size())); // Get random face.
if(data instanceof Directional) {
((Directional) data).setFacing(oneFace);
((Directional) data).setFacing(oneFace.getOppositeFace());
} else if(data instanceof MultipleFacing) {
MultipleFacing o = (MultipleFacing) data;
for(BlockFace face : o.getFaces()) o.setFace(face, false);