use of net.minecraft.util.math.ChunkPos in project RecurrentComplex by Ivorforce.
the class WorldGenStructures method generateRandomStructureInChunk.
public static boolean generateRandomStructureInChunk(Random random, ChunkPos chunkPos, WorldServer world, Biome biomeGen) {
MixingStructureSelector<NaturalGeneration, NaturalStructureSelector.Category> structureSelector = StructureRegistry.INSTANCE.naturalStructureSelectors().get(biomeGen, world.provider);
float distanceToSpawn = distance(new ChunkPos(world.getSpawnPoint()), chunkPos);
for (int i = 0; i < STRUCTURE_TRIES; i++) {
Pair<Structure<?>, NaturalGeneration> pair = structureSelector.selectOne(random, world.provider, world.getBiome(chunkPos.getBlock(0, 0, 0)), null, distanceToSpawn);
if (pair != null) {
if (planStructureInChunk(chunkPos, world, pair.getLeft(), pair.getRight(), random.nextLong()))
return true;
}
}
return false;
}
use of net.minecraft.util.math.ChunkPos in project Realistic-Terrain-Generation by Team-RTG.
the class MapGenStrongholdRTG method getClosestStrongholdPos.
public BlockPos getClosestStrongholdPos(World worldIn, BlockPos pos) {
if (!this.ranBiomeCheck) {
this.generatePositions();
this.ranBiomeCheck = true;
}
BlockPos blockpos = null;
BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos(0, 0, 0);
double d0 = Double.MAX_VALUE;
for (ChunkPos chunkpos : this.structureCoords) {
blockpos$mutableblockpos.setPos((chunkpos.chunkXPos << 4) + 8, 32, (chunkpos.chunkZPos << 4) + 8);
double d1 = blockpos$mutableblockpos.distanceSq(pos);
if (blockpos == null) {
blockpos = new BlockPos(blockpos$mutableblockpos);
d0 = d1;
} else if (d1 < d0) {
blockpos = new BlockPos(blockpos$mutableblockpos);
d0 = d1;
}
}
return blockpos;
}
use of net.minecraft.util.math.ChunkPos in project Realistic-Terrain-Generation by Team-RTG.
the class VolcanoGenerator method generateMapGen.
public void generateMapGen(ChunkPrimer primer, Long unusedSeed, World world, IBiomeProviderRTG cmr, Random unusedMapRand, int chunkX, int chunkY, OpenSimplexNoise simplex, CellNoise cell, float[] noise) {
// Have volcanoes been disabled in the global config?
if (!rtgConfig.ENABLE_VOLCANOES.get())
return;
final int mapGenRadius = 5;
final int volcanoGenRadius = 15;
// Volcanoes generation
for (int baseX = chunkX - volcanoGenRadius; baseX <= chunkX + volcanoGenRadius; baseX++) {
for (int baseY = chunkY - volcanoGenRadius; baseY <= chunkY + volcanoGenRadius; baseY++) {
ChunkPos probe = new ChunkPos(baseX, baseY);
if (noVolcano.contains(probe))
continue;
noVolcano.add(probe);
mapRand.setSeed((long) baseX * l + (long) baseY * l1 ^ seed);
rMapVolcanoes(primer, world, cmr, baseX, baseY, chunkX, chunkY, simplex, cell, noise);
}
}
}
use of net.minecraft.util.math.ChunkPos in project Realistic-Terrain-Generation by Team-RTG.
the class LandscapeGenerator method noiseFor.
public float[] noiseFor(IBiomeProviderRTG cmr, int worldX, int worldZ) {
ChunkPos location = new ChunkPos(worldX, worldZ);
ChunkLandscape landscape = storage.get(location);
float[] result = cache.get(landscape);
if (result != null)
return result;
// not found; we have to make it;
result = new float[256];
// seems off? but decorations aren't matching their chunks.
final int adjust = 24;
TimeTracker.manager.start("Biome Layout");
for (int bx = -4; bx <= 4; bx++) {
for (int bz = -4; bz <= 4; bz++) {
result[getBiomeDataAt(cmr, worldX + adjust + bx * 4, worldZ + adjust + bz * 4)] += 0.01234569f;
}
}
TimeTracker.manager.stop("Biome Layout");
TimeTracker.manager.stop("Features");
cache.put(landscape, result);
return result;
}
use of net.minecraft.util.math.ChunkPos in project Realistic-Terrain-Generation by Team-RTG.
the class RealisticBiomeBase method rDecorate.
public void rDecorate(RTGWorld rtgWorld, Random rand, int worldX, int worldZ, float strength, float river, boolean hasPlacedVillageBlocks) {
ArrayList<DecoBase> decos = this.getDecos();
for (DecoBase deco : decos) {
decoStack.add(new ChunkDecoration(new ChunkPos(worldX, worldZ), deco));
if (decoStack.size() > 20) {
String problem = "";
for (ChunkDecoration inStack : decoStack) {
problem += "" + inStack.chunkLocation.toString() + " " + inStack.decoration.getClass().getSimpleName();
}
throw new RuntimeException(problem);
}
if (deco.preGenerate(this, rtgWorld, rand, worldX, worldZ, strength, river, hasPlacedVillageBlocks)) {
deco.generate(this, rtgWorld, rand, worldX, worldZ, strength, river, hasPlacedVillageBlocks);
}
decoStack.remove(decoStack.size() - 1);
}
}
Aggregations