50 lines
2.9 KiB
Java
50 lines
2.9 KiB
Java
package kaptainwutax.seedcracker.cracker;
|
|
|
|
import com.google.common.collect.ImmutableSet;
|
|
import net.minecraft.world.biome.Biome;
|
|
import net.minecraft.world.biome.Biomes;
|
|
import net.minecraft.world.biome.layer.BiomeLayers;
|
|
import net.minecraft.world.biome.source.BiomeLayerSampler;
|
|
import net.minecraft.world.biome.source.BiomeSource;
|
|
import net.minecraft.world.gen.chunk.OverworldChunkGeneratorConfig;
|
|
import net.minecraft.world.level.LevelGeneratorType;
|
|
import net.minecraft.world.level.LevelProperties;
|
|
|
|
import java.util.Set;
|
|
|
|
public class FakeBiomeSource extends BiomeSource {
|
|
|
|
public static final OverworldChunkGeneratorConfig CHUNK_GEN_CONFIG = new OverworldChunkGeneratorConfig();
|
|
|
|
private static final Set<Biome> BIOMES;
|
|
private final BiomeLayerSampler biomeSampler;
|
|
|
|
private long seed;
|
|
private long hashedSeed;
|
|
|
|
public FakeBiomeSource(long worldSeed) {
|
|
super(BIOMES);
|
|
this.seed = worldSeed;
|
|
this.hashedSeed = LevelProperties.sha256Hash(worldSeed);
|
|
this.biomeSampler = BiomeLayers.build(this.seed, LevelGeneratorType.DEFAULT, CHUNK_GEN_CONFIG);
|
|
}
|
|
|
|
@Override
|
|
public Biome getBiomeForNoiseGen(int biomeX, int biomeY, int biomeZ) {
|
|
return this.biomeSampler.sample(biomeX, biomeZ);
|
|
}
|
|
|
|
public long getSeed() {
|
|
return this.seed;
|
|
}
|
|
|
|
public long getHashedSeed() {
|
|
return this.hashedSeed;
|
|
}
|
|
|
|
static {
|
|
BIOMES = ImmutableSet.<Biome>of(Biomes.OCEAN, Biomes.PLAINS, Biomes.DESERT, Biomes.MOUNTAINS, Biomes.FOREST, Biomes.TAIGA, Biomes.SWAMP, Biomes.RIVER, Biomes.FROZEN_OCEAN, Biomes.FROZEN_RIVER, Biomes.SNOWY_TUNDRA, Biomes.SNOWY_MOUNTAINS, Biomes.MUSHROOM_FIELDS, Biomes.MUSHROOM_FIELD_SHORE, Biomes.BEACH, Biomes.DESERT_HILLS, Biomes.WOODED_HILLS, Biomes.TAIGA_HILLS, Biomes.MOUNTAIN_EDGE, Biomes.JUNGLE, Biomes.JUNGLE_HILLS, Biomes.JUNGLE_EDGE, Biomes.DEEP_OCEAN, Biomes.STONE_SHORE, Biomes.SNOWY_BEACH, Biomes.BIRCH_FOREST, Biomes.BIRCH_FOREST_HILLS, Biomes.DARK_FOREST, Biomes.SNOWY_TAIGA, Biomes.SNOWY_TAIGA_HILLS, Biomes.GIANT_TREE_TAIGA, Biomes.GIANT_TREE_TAIGA_HILLS, Biomes.WOODED_MOUNTAINS, Biomes.SAVANNA, Biomes.SAVANNA_PLATEAU, Biomes.BADLANDS, Biomes.WOODED_BADLANDS_PLATEAU, Biomes.BADLANDS_PLATEAU, Biomes.WARM_OCEAN, Biomes.LUKEWARM_OCEAN, Biomes.COLD_OCEAN, Biomes.DEEP_WARM_OCEAN, Biomes.DEEP_LUKEWARM_OCEAN, Biomes.DEEP_COLD_OCEAN, Biomes.DEEP_FROZEN_OCEAN, Biomes.SUNFLOWER_PLAINS, Biomes.DESERT_LAKES, Biomes.GRAVELLY_MOUNTAINS, Biomes.FLOWER_FOREST, Biomes.TAIGA_MOUNTAINS, Biomes.SWAMP_HILLS, Biomes.ICE_SPIKES, Biomes.MODIFIED_JUNGLE, Biomes.MODIFIED_JUNGLE_EDGE, Biomes.TALL_BIRCH_FOREST, Biomes.TALL_BIRCH_HILLS, Biomes.DARK_FOREST_HILLS, Biomes.SNOWY_TAIGA_MOUNTAINS, Biomes.GIANT_SPRUCE_TAIGA, Biomes.GIANT_SPRUCE_TAIGA_HILLS, Biomes.MODIFIED_GRAVELLY_MOUNTAINS, Biomes.SHATTERED_SAVANNA, Biomes.SHATTERED_SAVANNA_PLATEAU, Biomes.ERODED_BADLANDS, Biomes.MODIFIED_WOODED_BADLANDS_PLATEAU, Biomes.MODIFIED_BADLANDS_PLATEAU);
|
|
}
|
|
|
|
}
|