Fix SquareTerrainGenerator not being square
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -73,7 +73,6 @@ public class Score {
|
||||
public List<String> getMapFormatted() {
|
||||
List<String> out = new ArrayList<>();
|
||||
|
||||
int counter = 0;
|
||||
for (Map.Entry<Player, Integer> entry : getMap().entrySet()) {
|
||||
out.add(entry.getValue() + ": " + entry.getKey().getUsername());
|
||||
}
|
||||
|
@ -11,6 +11,7 @@ import net.minestom.server.instance.generator.GenerationUnit;
|
||||
import net.minestom.server.instance.generator.Generator;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Random;
|
||||
|
||||
public class SquareTerrainGenerator implements Generator {
|
||||
@ -21,8 +22,6 @@ public class SquareTerrainGenerator implements Generator {
|
||||
|
||||
private final boolean generatePlate;
|
||||
|
||||
protected final Pos mapStart = new Pos(0, 50, 0);
|
||||
|
||||
public SquareTerrainGenerator(int width, int length, boolean generatePlate) {
|
||||
this.width = width;
|
||||
this.length = length;
|
||||
@ -60,8 +59,6 @@ public class SquareTerrainGenerator implements Generator {
|
||||
for (int z = 0; z < unit.size().z(); z++) {
|
||||
Point bottom = start.add(x, 0, z);
|
||||
|
||||
double distance = bottom.distance(new Pos(0, 0, 0));
|
||||
|
||||
if(generatePlate) {
|
||||
if(bottom.x() <= width && bottom.x() >= 0 && bottom.z() <= length && bottom.z() >= 0) {
|
||||
unit.modifier().fill(bottom, bottom.add(1, 50, 1), BlockPallet.GROUND.rnd());
|
||||
@ -73,7 +70,14 @@ public class SquareTerrainGenerator implements Generator {
|
||||
|
||||
synchronized (base) {
|
||||
double baseNoise = base.getNoise(bottom.x(), bottom.z());
|
||||
double currentHeight = minTwo(RangeMap.map(distance, 0, 400, -(this.width / 5), 200)) + baseNoise * 8;
|
||||
double possibleHeights[] = {
|
||||
minTwo(RangeMap.map(bottom.distance(new Pos(0, 0, 0)), 0, 400, -(this.width / 5), 200)) + baseNoise * 8,
|
||||
minTwo(RangeMap.map(bottom.distance(new Pos(width, 0, 0)), 0, 400, -(this.width / 5), 200)) + baseNoise * 8,
|
||||
minTwo(RangeMap.map(bottom.distance(new Pos(0, 0, length)), 0, 400, -(this.width / 5), 200)) + baseNoise * 8,
|
||||
minTwo(RangeMap.map(bottom.distance(new Pos(width, 0, length)), 0, 400, -(this.width / 5), 200)) + baseNoise * 8
|
||||
};
|
||||
|
||||
double currentHeight = Arrays.stream(possibleHeights).min().getAsDouble();
|
||||
|
||||
synchronized (batches) {
|
||||
double elementNoise = batches.getNoise(bottom.x(), bottom.z());
|
||||
|
Reference in New Issue
Block a user