use of net.minecraft.util.SharedSeedRandom in project NetherEx by LogicTechCorp.
the class CaveChunkGenerator method decorate.
@Override
public void decorate(WorldGenRegion region) {
int chunkX = region.getMainChunkX();
int chunkZ = region.getMainChunkZ();
int posX = chunkX * 16;
int posZ = chunkZ * 16;
BlockPos pos = new BlockPos(posX, 0, posZ);
BiomeData biomeData = NetherEx.BIOME_DATA_MANAGER.getBiomeData(this.getBiome(region.getBiomeManager(), pos.add(8, 8, 8)));
SharedSeedRandom random = new SharedSeedRandom();
long decorationSeed = random.setDecorationSeed(region.getSeed(), posX, posZ);
if (biomeData != BiomeData.EMPTY) {
for (GenerationStage.Decoration stage : GenerationStage.Decoration.values()) {
biomeData.decorate(stage, this, region, decorationSeed, random, pos);
}
}
}
use of net.minecraft.util.SharedSeedRandom in project BluePower by Qmunity.
the class WorldGenVolcano method place.
@Override
public boolean place(ISeedReader world, ChunkGenerator chunkGenerator, Random rand, BlockPos blockPos, NoFeatureConfig noFeatureConfig) {
int startChunkX = blockPos.getX() >> 8;
int startChunkZ = blockPos.getZ() >> 8;
volcanoMap = new HashMap<>();
((SharedSeedRandom) rand).setBaseChunkSeed(startChunkX, startChunkZ);
int volcanoHeight = 100 + rand.nextInt(40);
List<Pos>[] distMap = calculateDistMap();
boolean first = true;
int middleX = (startChunkX << 8) + 128;
int middleZ = (startChunkZ << 8) + 128;
for (int dist = 0; dist < distMap.length; dist++) {
// Loop through every XZ position of the volcano, in order of how close the positions are
// from the center. The volcano will be generated from the center to the edge.
List<Pos> distList = distMap[dist];
// Will stay true as long as there were still blocks being generated at this distance from the volcano.
boolean isFinished = true;
for (Pos p : distList) {
int posHeight = first ? volcanoHeight : getNewVolcanoHeight(p, rand, dist);
if (posHeight > 0) {
volcanoMap.put(new Pos(p.x, p.z), posHeight);
if (!first && middleX + p.x >> 4 == blockPos.getX() >> 4 && middleZ + p.z >> 4 == blockPos.getZ() >> 4) {
int worldHeight = world.getHeight(Heightmap.Type.WORLD_SURFACE, p.x + middleX, p.z + middleZ);
for (int i = posHeight; i > 0 && (i > worldHeight || canReplace(world, p.x + middleX, i, p.z + middleZ)); i--) {
setBlock(world, new BlockPos(p.x + middleX, i, p.z + middleZ), BPBlocks.basalt.defaultBlockState());
}
for (int i = posHeight + 1; i < volcanoHeight; i++) {
if (canReplace(world, p.x + middleX, i, p.z + middleZ) && world.getBlockState(new BlockPos(p.x + middleX, i, p.z + middleZ)).getMaterial() != Material.WATER)
setBlock(world, new BlockPos(p.x + middleX, i, p.z + middleZ), Blocks.AIR.defaultBlockState());
}
}
isFinished = false;
}
first = false;
}
if (isFinished)
break;
}
if (middleX >> 4 == blockPos.getX() >> 4 && middleZ >> 4 == blockPos.getZ() >> 4) {
generateLavaColumn(world, middleX, volcanoHeight, middleZ, rand);
generateLootChamber(world, middleX, rand.nextInt(volcanoHeight - 80) + 60, middleZ, rand);
}
return true;
}
Aggregations