remove unneeded specialised column impl

This commit is contained in:
dfsek 2022-06-14 18:56:51 -07:00
parent eac8d3b4e8
commit 61a40b4825
4 changed files with 2 additions and 83 deletions

View File

@ -61,9 +61,4 @@ public class BiomeExtrusionProvider implements BiomeProvider {
public BiomeProvider getDelegate() {
return delegate;
}
@Override
public Column<Biome> getColumn(int x, int z, long seed, int min, int max) {
return new ExtrusionColumn(min, max, this, x, z, seed);
}
}

View File

@ -1,76 +0,0 @@
package com.dfsek.terra.addons.biome.extrusion;
import com.dfsek.terra.api.util.Column;
import com.dfsek.terra.api.util.function.IntIntObjConsumer;
import com.dfsek.terra.api.world.biome.Biome;
import com.dfsek.terra.api.world.info.WorldProperties;
public class ExtrusionColumn implements Column<Biome> {
private final int min;
private final int max;
private final BiomeExtrusionProvider provider;
private final int x, z;
private final long seed;
private final Column<Biome> delegate;
public ExtrusionColumn(int min, int max, BiomeExtrusionProvider provider, int x, int z, long seed) {
this.min = min;
this.max = max;
this.provider = provider;
this.x = x;
this.z = z;
this.seed = seed;
this.delegate = provider.getDelegate().getColumn(x, z, seed, min, max);
}
@Override
public int getMinY() {
return min;
}
@Override
public int getMaxY() {
return max;
}
@Override
public int getX() {
return x;
}
@Override
public int getZ() {
return z;
}
@Override
public Biome get(int y) {
return provider.getBiome(x, y, z, seed, delegate.get(y));
}
@Override
public void forRanges(IntIntObjConsumer<Biome> consumer) {
int min = getMinY();
int y = min;
Biome runningObj = get(y);
int runningMin = min;
int max = getMaxY() - 1;
while(y < max) {
y += provider.getResolution();
Biome current = get(y);
if(!current.equals(runningObj)) {
consumer.accept(runningMin, y, runningObj);
runningMin = y;
runningObj = current;
}
}
consumer.accept(runningMin, ++y, runningObj);
}
}

View File

@ -53,7 +53,7 @@ public class CachingBiomeProvider implements BiomeProvider, Handle {
@Override
public Column<Biome> getColumn(int x, int z, long seed, int min, int max) {
return columnCache.computeIfAbsent(MathUtil.squash(x, z), k -> delegate.getColumn(x, z, seed, min, max));
return columnCache.computeIfAbsent(MathUtil.squash(x, z), k -> new BiomeColumn(this, min, max, x, z, seed));
}
@Override

View File

@ -75,7 +75,7 @@ public class ChunkLocalCachingBiomeProvider extends CachingBiomeProvider {
int index = (x & 15) + (16 * (z & 15));
Column<Biome> column = columnCache[index];
if(column == null) {
column = delegate.getColumn(x, z, seed, min, max);
column = new BiomeColumn(this, min, max, x, z, seed);
columnCache[index] = column;
}
return column;