use of net.minecraft.world.biome.BiomeProvider in project Realistic-Terrain-Generation by Team-RTG.
the class WorldTypeRTG method getBiomeProvider.
@Override
@Nonnull
public BiomeProvider getBiomeProvider(@Nonnull World world) {
if (DimensionManagerRTG.isValidDimension(world.provider.getDimension())) {
if (biomeProvider == null) {
biomeProvider = new BiomeProviderRTG(world, this);
RTG.instance.runOnNextServerCloseOnly(clearProvider(biomeProvider));
}
Logger.debug("WorldTypeRTG#getBiomeProvider() returning BiomeProviderRTG");
return biomeProvider;
} else {
Logger.debug("WorldTypeRTG#getBiomeProvider() returning vanilla BiomeProvider");
return new BiomeProvider(world.getWorldInfo());
}
}
use of net.minecraft.world.biome.BiomeProvider in project SpongeCommon by SpongePowered.
the class MixinWorldServer method createWorldGenerator.
@Override
public SpongeWorldGenerator createWorldGenerator(String settings) {
final WorldServer worldServer = (WorldServer) (Object) this;
final WorldType worldType = worldServer.getWorldType();
final IChunkGenerator chunkGenerator;
final BiomeProvider biomeProvider;
if (worldType instanceof SpongeWorldType) {
chunkGenerator = ((SpongeWorldType) worldType).getChunkGenerator(worldServer, settings);
biomeProvider = ((SpongeWorldType) worldType).getBiomeProvider(worldServer);
} else {
final IChunkGenerator currentGenerator = this.getChunkProvider().chunkGenerator;
if (currentGenerator != null) {
chunkGenerator = currentGenerator;
} else {
final WorldProvider worldProvider = worldServer.provider;
((IMixinWorldProvider) worldProvider).setGeneratorSettings(settings);
chunkGenerator = worldProvider.createChunkGenerator();
}
biomeProvider = worldServer.provider.biomeProvider;
}
return new SpongeWorldGenerator(worldServer, (BiomeGenerator) biomeProvider, SpongeGenerationPopulator.of(worldServer, chunkGenerator));
}
use of net.minecraft.world.biome.BiomeProvider in project Cavern2 by kegare.
the class WorldProviderCrownCliffs method init.
@Override
protected void init() {
hasSkyLight = true;
biomeProvider = new BiomeProvider(world.getWorldInfo());
seedData = world instanceof WorldServer ? new CustomSeedData(world.getWorldInfo().getDimensionData(getDimension())) : new CustomSeedData();
}
use of net.minecraft.world.biome.BiomeProvider in project BiomesOPlenty by Glitchfiend.
the class BiomeUtils method spiralOutwardsLookingForBiome.
// sample points in an archimedean spiral starting from startX,startY each one sampleSpace apart
// stop when the specified biome is found (and return the position it was found at) or when we reach maxDistance (and return null)
public static BlockPos spiralOutwardsLookingForBiome(World world, Biome biomeToFind, double startX, double startZ, int maxDist, int sampleSpace) {
if (maxDist <= 0 || sampleSpace <= 0) {
throw new IllegalArgumentException("maxDist and sampleSpace must be positive");
}
BiomeProvider chunkManager = world.getBiomeProvider();
double a = sampleSpace / Math.sqrt(Math.PI);
double b = 2 * Math.sqrt(Math.PI);
double x = 0;
double z = 0;
double dist = 0;
int n = 0;
String biomeName = FMLCommonHandler.instance().getSide() == Side.CLIENT ? biomeToFind.getBiomeName() : "biome";
for (n = 0; dist < maxDist; ++n) {
double rootN = Math.sqrt(n);
dist = a * rootN;
x = startX + (dist * Math.sin(b * rootN));
z = startZ + (dist * Math.cos(b * rootN));
// chunkManager.genBiomes is the first layer returned from initializeAllBiomeGenerators()
// chunkManager.biomeIndexLayer is the second layer returned from initializeAllBiomeGenerators(), it's zoomed twice from genBiomes (>> 2) this one is actual size
// chunkManager.getBiomeGenAt uses biomeIndexLayer to get the biome
Biome[] biomesAtSample = chunkManager.getBiomes(null, (int) x, (int) z, 1, 1, false);
if (biomesAtSample[0] == biomeToFind) {
BiomesOPlenty.logger.info("Found " + biomeName + " after " + n + " samples, spaced " + sampleSpace + " blocks apart at (" + ((int) x) + "," + ((int) z) + ") distance " + ((int) dist));
return new BlockPos((int) x, 0, (int) z);
}
}
BiomesOPlenty.logger.info("Failed to find " + biomeName + " gave up after " + n + " samples, spaced " + sampleSpace + " blocks apart distance " + ((int) dist));
return null;
}
use of net.minecraft.world.biome.BiomeProvider in project Realistic-Terrain-Generation by Team-RTG.
the class ChunkGeneratorRTG method generateChunk.
@Override
public Chunk generateChunk(final int cx, final int cz) {
final ChunkPos chunkPos = new ChunkPos(cx, cz);
final BlockPos blockPos = new BlockPos(cx * 16, 0, cz * 16);
final BiomeProvider biomeProvider = this.world.getBiomeProvider();
this.rand.setSeed(cx * 341873128712L + cz * 132897987541L);
final ChunkPrimer primer = new ChunkPrimer();
final ChunkLandscape landscape = getLandscape(biomeProvider, chunkPos);
generateTerrain(primer, landscape.noise);
// get standard biome Data
for (int i = 0; i < 256; i++) {
this.baseBiomesList[i] = landscape.biome[i].baseBiome();
}
ISimplexData2D jitterData = SimplexData2D.newDisk();
IRealisticBiome[] jitteredBiomes = new IRealisticBiome[256];
IRealisticBiome jitterbiome, actualbiome;
for (int i = 0; i < 16; i++) {
for (int j = 0; j < 16; j++) {
int x = blockPos.getX() + i;
int z = blockPos.getZ() + j;
this.rtgWorld.simplexInstance(0).multiEval2D(x, z, jitterData);
int pX = (int) Math.round(x + jitterData.getDeltaX() * RTGConfig.surfaceBlendRadius());
int pZ = (int) Math.round(z + jitterData.getDeltaY() * RTGConfig.surfaceBlendRadius());
actualbiome = landscape.biome[(x & 15) * 16 + (z & 15)];
jitterbiome = landscape.biome[(pX & 15) * 16 + (pZ & 15)];
jitteredBiomes[i * 16 + j] = (actualbiome.getConfig().SURFACE_BLEED_IN.get() && jitterbiome.getConfig().SURFACE_BLEED_OUT.get()) ? jitterbiome : actualbiome;
}
}
replaceBiomeBlocks(cx, cz, primer, jitteredBiomes, this.baseBiomesList, landscape.noise);
if (this.settings.useCaves) {
this.caveGenerator.generate(this.world, cx, cz, primer);
}
if (this.settings.useRavines) {
this.ravineGenerator.generate(this.world, cx, cz, primer);
}
if (this.mapFeaturesEnabled) {
if (settings.useMineShafts) {
this.mineshaftGenerator.generate(this.world, cx, cz, primer);
}
if (settings.useStrongholds) {
this.strongholdGenerator.generate(this.world, cx, cz, primer);
}
if (settings.useVillages) {
this.villageGenerator.generate(this.world, cx, cz, primer);
}
if (settings.useTemples) {
this.scatteredFeatureGenerator.generate(this.world, cx, cz, primer);
}
if (settings.useMonuments) {
this.oceanMonumentGenerator.generate(this.world, cx, cz, primer);
}
if (settings.useMansions) {
this.woodlandMansionGenerator.generate(this.world, cx, cz, primer);
}
}
// store in the in process pile
Chunk chunk = new Chunk(this.world, primer, cx, cz);
byte[] abyte1 = chunk.getBiomeArray();
for (int i = 0; i < abyte1.length; ++i) {
// Biomes are y-first and terrain x-first
byte b = (byte) Biome.getIdForBiome(this.baseBiomesList[this.xyinverted[i]]);
abyte1[i] = b;
}
chunk.setBiomeArray(abyte1);
chunk.generateSkylightMap();
return chunk;
}
Aggregations