This commit is contained in:
dfsek
2021-02-21 17:49:07 -07:00
parent e00209c99c
commit 6025e0f557
2 changed files with 12 additions and 18 deletions

View File

@@ -24,7 +24,7 @@ public class Range implements Iterable<Integer> {
return max;
}
public com.dfsek.terra.api.math.Range setMax(int max) {
public Range setMax(int max) {
this.max = max;
return this;
}
@@ -33,7 +33,7 @@ public class Range implements Iterable<Integer> {
return min;
}
public com.dfsek.terra.api.math.Range setMin(int min) {
public Range setMin(int min) {
this.min = min;
return this;
}
@@ -42,35 +42,35 @@ public class Range implements Iterable<Integer> {
return max - min;
}
public com.dfsek.terra.api.math.Range multiply(int mult) {
public Range multiply(int mult) {
min *= mult;
max *= mult;
return this;
}
public com.dfsek.terra.api.math.Range reflect(int pt) {
return new com.dfsek.terra.api.math.Range(2 * pt - this.getMax(), 2 * pt - this.getMin());
public Range reflect(int pt) {
return new Range(2 * pt - this.getMax(), 2 * pt - this.getMin());
}
public int get(Random r) {
return r.nextInt((max - min) + 1) + min;
}
public com.dfsek.terra.api.math.Range intersects(com.dfsek.terra.api.math.Range other) {
public Range intersects(com.dfsek.terra.api.math.Range other) {
try {
return new com.dfsek.terra.api.math.Range(FastMath.max(this.getMin(), other.getMin()), FastMath.min(this.getMax(), other.getMax()));
return new Range(FastMath.max(this.getMin(), other.getMin()), FastMath.min(this.getMax(), other.getMax()));
} catch(IllegalArgumentException e) {
return null;
}
}
public com.dfsek.terra.api.math.Range add(int add) {
public Range add(int add) {
this.min += add;
this.max += add;
return this;
}
public com.dfsek.terra.api.math.Range sub(int sub) {
public Range sub(int sub) {
this.min -= sub;
this.max -= sub;
return this;
@@ -89,7 +89,7 @@ public class Range implements Iterable<Integer> {
@Override
public boolean equals(Object obj) {
if(!(obj instanceof com.dfsek.terra.api.math.Range)) return false;
com.dfsek.terra.api.math.Range other = (com.dfsek.terra.api.math.Range) obj;
Range other = (com.dfsek.terra.api.math.Range) obj;
return other.getMin() == this.getMin() && other.getMax() == this.getMax();
}
@@ -100,10 +100,10 @@ public class Range implements Iterable<Integer> {
}
private static class RangeIterator implements Iterator<Integer> {
private final com.dfsek.terra.api.math.Range m;
private final Range m;
private Integer current;
public RangeIterator(com.dfsek.terra.api.math.Range m) {
public RangeIterator(Range m) {
this.m = m;
current = m.getMin();
}

View File

@@ -3,7 +3,6 @@ package com.dfsek.terra.world.generation.generators;
import com.dfsek.terra.api.core.TerraPlugin;
import com.dfsek.terra.api.math.Range;
import com.dfsek.terra.api.platform.block.BlockData;
import com.dfsek.terra.api.platform.block.MaterialData;
import com.dfsek.terra.api.platform.world.BiomeGrid;
import com.dfsek.terra.api.platform.world.World;
import com.dfsek.terra.api.platform.world.generator.ChunkData;
@@ -13,7 +12,6 @@ import com.dfsek.terra.api.world.biome.UserDefinedBiome;
import com.dfsek.terra.api.world.biome.provider.BiomeProvider;
import com.dfsek.terra.api.world.generation.TerraChunkGenerator;
import com.dfsek.terra.api.world.palette.Palette;
import com.dfsek.terra.api.world.palette.SinglePalette;
import com.dfsek.terra.config.pack.ConfigPack;
import com.dfsek.terra.config.templates.BiomeTemplate;
import com.dfsek.terra.profiler.ProfileFuture;
@@ -31,8 +29,6 @@ import java.util.Random;
public class DefaultChunkGenerator2D implements TerraChunkGenerator {
private final ConfigPack configPack;
private final TerraPlugin main;
private final MaterialData water;
private final SinglePalette<BlockData> blank;
private final Carver carver;
@@ -42,8 +38,6 @@ public class DefaultChunkGenerator2D implements TerraChunkGenerator {
this.configPack = c;
this.main = main;
carver = new NoiseCarver(new Range(0, 255), main.getWorldHandle().createBlockData("minecraft:air"), main);
water = main.getWorldHandle().createMaterialData("minecraft:water");
blank = new SinglePalette<>(main.getWorldHandle().createBlockData("minecraft:air"));
this.cache = cache;
}