make vector2 immutable by default

This commit is contained in:
dfsek
2021-12-20 00:19:09 -07:00
parent 026547bdfc
commit 961a42d1cb
14 changed files with 164 additions and 136 deletions
@@ -16,12 +16,12 @@ import com.dfsek.terra.api.util.vector.Vector2;
public class BiomeHolderImpl implements BiomeHolder {
private final Vector2 origin;
private final Vector2.Mutable origin;
private final int width;
private final int offset;
private BiomeDelegate[][] biomes;
public BiomeHolderImpl(int width, Vector2 origin) {
public BiomeHolderImpl(int width, Vector2.Mutable origin) {
width += 4;
this.width = width;
biomes = new BiomeDelegate[width][width];
@@ -29,7 +29,7 @@ public class BiomeHolderImpl implements BiomeHolder {
this.offset = 2;
}
private BiomeHolderImpl(BiomeDelegate[][] biomes, Vector2 origin, int width, int offset) {
private BiomeHolderImpl(BiomeDelegate[][] biomes, Vector2.Mutable origin, int width, int offset) {
this.biomes = biomes;
this.origin = origin;
this.width = width;
@@ -39,7 +39,7 @@ public class BiomePipeline {
* @return BiomeHolder containing biomes.
*/
public BiomeHolder getBiomes(int x, int z, long seed) {
BiomeHolder holder = new BiomeHolderImpl(init, Vector2.of(x * (init - 1), z * (init - 1)));
BiomeHolder holder = new BiomeHolderImpl(init, Vector2.of(x * (init - 1), z * (init - 1)).mutable());
holder.fill(source, seed);
for(Stage stage : stages) holder = stage.apply(holder, seed);
return holder;