mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2026-06-17 14:21:08 +00:00
implement getBaseBiome
This commit is contained in:
+6
@@ -7,6 +7,7 @@ import com.dfsek.terra.api.world.biome.generation.BiomeProvider;
|
|||||||
import com.dfsek.terra.api.world.info.WorldProperties;
|
import com.dfsek.terra.api.world.info.WorldProperties;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Optional;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@@ -35,6 +36,11 @@ public class BiomeExtrusionProvider implements BiomeProvider {
|
|||||||
return delegated;
|
return delegated;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Optional<Biome> getBaseBiome(int x, int z, long seed) {
|
||||||
|
return delegate.getBaseBiome(x, z, seed);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Iterable<Biome> getBiomes() {
|
public Iterable<Biome> getBiomes() {
|
||||||
return biomes;
|
return biomes;
|
||||||
|
|||||||
+10
@@ -13,6 +13,7 @@ import java.awt.Color;
|
|||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Optional;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import com.dfsek.terra.api.world.biome.Biome;
|
import com.dfsek.terra.api.world.biome.Biome;
|
||||||
@@ -38,6 +39,10 @@ public class ImageBiomeProvider implements BiomeProvider {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Biome getBiome(int x, int y, int z, long seed) {
|
public Biome getBiome(int x, int y, int z, long seed) {
|
||||||
|
return getBiome(x, z);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Biome getBiome(int x, int z) {
|
||||||
x /= resolution;
|
x /= resolution;
|
||||||
z /= resolution;
|
z /= resolution;
|
||||||
Color color = align.getColor(image, x, z);
|
Color color = align.getColor(image, x, z);
|
||||||
@@ -51,6 +56,11 @@ public class ImageBiomeProvider implements BiomeProvider {
|
|||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Optional<Biome> getBaseBiome(int x, int z, long seed) {
|
||||||
|
return Optional.of(getBiome(x, z));
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Iterable<Biome> getBiomes() {
|
public Iterable<Biome> getBiomes() {
|
||||||
return colorBiomeMap.values();
|
return colorBiomeMap.values();
|
||||||
|
|||||||
+15
-5
@@ -16,6 +16,7 @@ import net.jafama.FastMath;
|
|||||||
|
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
import java.util.Optional;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.stream.StreamSupport;
|
import java.util.stream.StreamSupport;
|
||||||
|
|
||||||
@@ -76,18 +77,27 @@ public class BiomePipelineProvider implements BiomeProvider {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Biome getBiome(int x, int y, int z, long seed) {
|
public Biome getBiome(int x, int y, int z, long seed) {
|
||||||
|
return getBiome(x, z, seed);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Biome getBiome(int x, int z, long seed) {
|
||||||
x += mutator.noise(seed + 1, x, z) * noiseAmp;
|
x += mutator.noise(seed + 1, x, z) * noiseAmp;
|
||||||
z += mutator.noise(seed + 2, x, z) * noiseAmp;
|
z += mutator.noise(seed + 2, x, z) * noiseAmp;
|
||||||
|
|
||||||
|
|
||||||
x = FastMath.floorToInt(FastMath.floorDiv(x, resolution));
|
x = FastMath.floorToInt(FastMath.floorDiv(x, resolution));
|
||||||
|
|
||||||
z = FastMath.floorToInt(FastMath.floorDiv(z, resolution));
|
z = FastMath.floorToInt(FastMath.floorDiv(z, resolution));
|
||||||
|
|
||||||
int fdX = FastMath.floorDiv(x, pipeline.getSize());
|
int fdX = FastMath.floorDiv(x, pipeline.getSize());
|
||||||
int fdZ = FastMath.floorDiv(z, pipeline.getSize());
|
int fdZ = FastMath.floorDiv(z, pipeline.getSize());
|
||||||
return holderCache.get(new SeededVector(fdX, fdZ, seed)).getBiome(x - fdX * pipeline.getSize(),
|
return holderCache.get(new SeededVector(fdX, fdZ, seed)).getBiome(x - fdX * pipeline.getSize(),
|
||||||
z - fdZ * pipeline.getSize()).getBiome();
|
z - fdZ * pipeline.getSize()).getBiome();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Optional<Biome> getBaseBiome(int x, int z, long seed) {
|
||||||
|
return Optional.of(getBiome(x, z, seed));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
+6
@@ -8,6 +8,7 @@
|
|||||||
package com.dfsek.terra.addons.biome.single;
|
package com.dfsek.terra.addons.biome.single;
|
||||||
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
import com.dfsek.terra.api.world.biome.Biome;
|
import com.dfsek.terra.api.world.biome.Biome;
|
||||||
import com.dfsek.terra.api.world.biome.generation.BiomeProvider;
|
import com.dfsek.terra.api.world.biome.generation.BiomeProvider;
|
||||||
@@ -25,6 +26,11 @@ public class SingleBiomeProvider implements BiomeProvider {
|
|||||||
return biome;
|
return biome;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Optional<Biome> getBaseBiome(int x, int z, long seed) {
|
||||||
|
return Optional.of(biome);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Iterable<Biome> getBiomes() {
|
public Iterable<Biome> getBiomes() {
|
||||||
return Collections.singleton(biome);
|
return Collections.singleton(biome);
|
||||||
|
|||||||
+6
@@ -9,6 +9,7 @@ import com.dfsek.terra.api.world.info.WorldProperties;
|
|||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -44,6 +45,11 @@ public class CachingBiomeProvider implements BiomeProvider, Handle {
|
|||||||
return biomes[yi];
|
return biomes[yi];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Optional<Biome> getBaseBiome(int x, int z, long seed) {
|
||||||
|
return delegate.getBaseBiome(x, z, seed);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Column<Biome> getColumn(int x, int z, WorldProperties properties) {
|
public Column<Biome> getColumn(int x, int z, WorldProperties properties) {
|
||||||
return delegate.getColumn(x, z, properties);
|
return delegate.getColumn(x, z, properties);
|
||||||
|
|||||||
Reference in New Issue
Block a user