remove world parameter from TerraBiome#getGenerator

This commit is contained in:
dfsek 2021-07-22 18:36:30 -07:00
parent be9e817c88
commit 55030450b5
6 changed files with 10 additions and 12 deletions

View File

@ -54,7 +54,7 @@ public class NoiseChunkGenerator3D implements ChunkGenerator {
int cz = zOrig + (z << 2); int cz = zOrig + (z << 2);
TerraBiome b = grid.getBiome(cx, cz, seed); TerraBiome b = grid.getBiome(cx, cz, seed);
biome.setBiome(cx, cz, b.getVanillaBiomes().get(b.getGenerator(world).getBiomeNoise(), cx, 0, cz, world.getSeed())); biome.setBiome(cx, cz, b.getVanillaBiomes().get(b.getGenerator().getBiomeNoise(), cx, 0, cz, world.getSeed()));
} }
} }
} }
@ -98,7 +98,7 @@ public class NoiseChunkGenerator3D implements ChunkGenerator {
main.logger().info("null palette: " + biome.getID()); main.logger().info("null palette: " + biome.getID());
} }
GenerationSettings generationSettings = biome.getGenerator(world); GenerationSettings generationSettings = biome.getGenerator();
int sea = paletteInfo.getSeaLevel(); int sea = paletteInfo.getSeaLevel();
Palette seaPalette = paletteInfo.getOcean(); Palette seaPalette = paletteInfo.getOcean();
@ -171,7 +171,7 @@ public class NoiseChunkGenerator3D implements ChunkGenerator {
Sampler sampler = world.getConfig().getSamplerCache().get(x, z); Sampler sampler = world.getConfig().getSamplerCache().get(x, z);
PaletteInfo paletteInfo = biome.getContext().get(PaletteInfo.class); PaletteInfo paletteInfo = biome.getContext().get(PaletteInfo.class);
Palette palette = PaletteUtil.getPalette(x, y, z, biome.getGenerator(world), sampler, paletteInfo); Palette palette = PaletteUtil.getPalette(x, y, z, biome.getGenerator(), sampler, paletteInfo);
int fdX = FastMath.floorMod(x, 16); int fdX = FastMath.floorMod(x, 16);
int fdZ = FastMath.floorMod(z, 16); int fdZ = FastMath.floorMod(z, 16);
double noise = sampler.sample(fdX, y, fdZ); double noise = sampler.sample(fdX, y, fdZ);

View File

@ -38,7 +38,7 @@ public class ChunkInterpolator2D implements ChunkInterpolator {
for(int x = 0; x < 5; x++) { for(int x = 0; x < 5; x++) {
for(int z = 0; z < 5; z++) { for(int z = 0; z < 5; z++) {
GenerationSettings generationSettings = provider.getBiome(xOrigin + (x << 2), zOrigin + (z << 2), seed).getGenerator(w); GenerationSettings generationSettings = provider.getBiome(xOrigin + (x << 2), zOrigin + (z << 2), seed).getGenerator();
Map<GenerationSettings, MutableInteger> genMap = new HashMap<>(); Map<GenerationSettings, MutableInteger> genMap = new HashMap<>();
int step = generationSettings.getBlendStep(); int step = generationSettings.getBlendStep();
@ -46,7 +46,7 @@ public class ChunkInterpolator2D implements ChunkInterpolator {
for(int xi = -blend; xi <= blend; xi++) { for(int xi = -blend; xi <= blend; xi++) {
for(int zi = -blend; zi <= blend; zi++) { for(int zi = -blend; zi <= blend; zi++) {
genMap.computeIfAbsent(provider.getBiome(xOrigin + (x << 2) + (xi * step), zOrigin + (z << 2) + (zi * step), seed).getGenerator(w), g -> new MutableInteger(0)).increment(); // Increment by 1 genMap.computeIfAbsent(provider.getBiome(xOrigin + (x << 2) + (xi * step), zOrigin + (z << 2) + (zi * step), seed).getGenerator(), g -> new MutableInteger(0)).increment(); // Increment by 1
} }
} }

View File

@ -49,7 +49,7 @@ public class ChunkInterpolator3D implements ChunkInterpolator {
for(int x = 0; x < 5; x++) { for(int x = 0; x < 5; x++) {
for(int z = 0; z < 5; z++) { for(int z = 0; z < 5; z++) {
GenerationSettings generationSettings = provider.getBiome(xOrigin + (x << 2), zOrigin + (z << 2), seed).getGenerator(w); GenerationSettings generationSettings = provider.getBiome(xOrigin + (x << 2), zOrigin + (z << 2), seed).getGenerator();
Map<GenerationSettings, MutableInteger> genMap = new HashMap<>(); Map<GenerationSettings, MutableInteger> genMap = new HashMap<>();
int step = generationSettings.getBlendStep(); int step = generationSettings.getBlendStep();
@ -57,7 +57,7 @@ public class ChunkInterpolator3D implements ChunkInterpolator {
for(int xi = -blend; xi <= blend; xi++) { for(int xi = -blend; xi <= blend; xi++) {
for(int zi = -blend; zi <= blend; zi++) { for(int zi = -blend; zi <= blend; zi++) {
genMap.computeIfAbsent(provider.getBiome(xOrigin + (x << 2) + (xi * step), zOrigin + (z << 2) + (zi * step), seed).getGenerator(w), g -> new MutableInteger(0)).increment(); // Increment by 1 genMap.computeIfAbsent(provider.getBiome(xOrigin + (x << 2) + (xi * step), zOrigin + (z << 2) + (zi * step), seed).getGenerator(), g -> new MutableInteger(0)).increment(); // Increment by 1
} }
} }

View File

@ -18,7 +18,7 @@ public class ElevationInterpolator {
// Precompute generators. // Precompute generators.
for(int x = -1 - smooth; x <= 16 + smooth; x++) { for(int x = -1 - smooth; x <= 16 + smooth; x++) {
for(int z = -1 - smooth; z <= 16 + smooth; z++) { for(int z = -1 - smooth; z <= 16 + smooth; z++) {
gens[x + 1 + smooth][z + 1 + smooth] = provider.getBiome(xOrigin + x, zOrigin + z, seed).getGenerator(world); gens[x + 1 + smooth][z + 1 + smooth] = provider.getBiome(xOrigin + x, zOrigin + z, seed).getGenerator();
} }
} }

View File

@ -2,7 +2,6 @@ package com.dfsek.terra.addons.biome;
import com.dfsek.terra.api.properties.Context; import com.dfsek.terra.api.properties.Context;
import com.dfsek.terra.api.util.collection.ProbabilityCollection; import com.dfsek.terra.api.util.collection.ProbabilityCollection;
import com.dfsek.terra.api.world.World;
import com.dfsek.terra.api.world.biome.Biome; import com.dfsek.terra.api.world.biome.Biome;
import com.dfsek.terra.api.world.biome.GenerationSettings; import com.dfsek.terra.api.world.biome.GenerationSettings;
import com.dfsek.terra.api.world.biome.TerraBiome; import com.dfsek.terra.api.world.biome.TerraBiome;
@ -52,7 +51,7 @@ public class UserDefinedBiome implements TerraBiome {
} }
@Override @Override
public GenerationSettings getGenerator(World w) { public GenerationSettings getGenerator() {
return gen; return gen;
} }

View File

@ -3,7 +3,6 @@ package com.dfsek.terra.api.world.biome;
import com.dfsek.terra.api.properties.PropertyHolder; import com.dfsek.terra.api.properties.PropertyHolder;
import com.dfsek.terra.api.util.collection.ProbabilityCollection; import com.dfsek.terra.api.util.collection.ProbabilityCollection;
import com.dfsek.terra.api.world.World;
import java.util.Set; import java.util.Set;
@ -24,7 +23,7 @@ public interface TerraBiome extends PropertyHolder {
* *
* @return BiomeTerrain - The terrain generation instance. * @return BiomeTerrain - The terrain generation instance.
*/ */
GenerationSettings getGenerator(World w); GenerationSettings getGenerator();
int getColor(); int getColor();