use column in ChunkInterpolator

This commit is contained in:
dfsek
2022-06-11 02:27:45 -07:00
parent c9221ca64c
commit ad5435f69d
5 changed files with 34 additions and 11 deletions

View File

@@ -70,7 +70,11 @@ public interface BiomeProvider {
default Column<Biome> getColumn(int x, int z, WorldProperties properties) {
return new BiomeColumn(this, properties.getMinHeight(), properties.getMaxHeight(), x, z, properties.getSeed());
return getColumn(x, z, properties.getSeed(), properties.getMinHeight(), properties.getMaxHeight());
}
default Column<Biome> getColumn(int x, int z, long seed, int min, int max) {
return new BiomeColumn(this, min, max, x, z, seed);
}
/**

View File

@@ -22,6 +22,7 @@ public class CachingBiomeProvider implements BiomeProvider, Handle {
private final int minY;
private final int maxY;
private final Map<Long, Biome[]> cache = new HashMap<>();
private final Map<Long, Column<Biome>> columnCache = new HashMap<>();
protected CachingBiomeProvider(BiomeProvider delegate, int minY, int maxY) {
this.delegate = delegate;
@@ -51,8 +52,8 @@ public class CachingBiomeProvider implements BiomeProvider, Handle {
}
@Override
public Column<Biome> getColumn(int x, int z, WorldProperties properties) {
return delegate.getColumn(x, z, properties);
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));
}
@Override