use of net.minecraft.world.chunk.ChunkPrimer in project BiomesOPlenty by Glitchfiend.
the class ChunkGeneratorHellBOP method generateChunk.
@Override
public Chunk generateChunk(int chunkX, int chunkZ) {
// initialize the random generator using the chunk coordinates
this.rand.setSeed((long) chunkX * 341873128712L + (long) chunkZ * 132897987541L);
// create the primer
ChunkPrimer chunkprimer = new ChunkPrimer();
// start off by adding the basic terrain shape with air netherrack and lava blocks
this.setChunkLavaNetherrack(chunkX, chunkZ, chunkprimer);
this.buildSurfaces(chunkX, chunkZ, chunkprimer);
this.genNetherCaves.generate(this.world, chunkX, chunkZ, chunkprimer);
if (this.generateStructures) {
this.genNetherBridge.generate(this.world, chunkX, chunkZ, chunkprimer);
}
Biome[] biomes = this.world.getBiomeProvider().getBiomes(null, chunkX * 16, chunkZ * 16, 16, 16);
this.replaceBlocksForBiome(chunkX, chunkZ, chunkprimer, biomes);
Chunk chunk = new Chunk(this.world, chunkprimer, chunkX, chunkZ);
byte[] chunkBiomes = chunk.getBiomeArray();
for (int i = 0; i < chunkBiomes.length; ++i) {
chunkBiomes[i] = (byte) Biome.getIdForBiome(biomes[i]);
}
chunk.resetRelightChecks();
return chunk;
}
use of net.minecraft.world.chunk.ChunkPrimer 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;
}
use of net.minecraft.world.chunk.ChunkPrimer in project RecurrentComplex by Ivorforce.
the class RCTerrainGenEventHandler method onInitMapGen.
@SubscribeEvent
public void onInitMapGen(InitMapGenEvent event) {
if (RCConfig.decorationHacks) {
InitMapGenEvent.EventType type = event.getType();
// All need to inherit from the base type
MapGenStructureHook hook;
switch(type) {
case OCEAN_MONUMENT:
hook = new MapGenStructureHook((MapGenStructure) event.getNewGen(), RCBiomeDecorator.DecorationType.OCEAN_MONUMENT);
event.setNewGen(new StructureOceanMonument() {
@Override
public String getStructureName() {
return hook.getStructureName();
}
@Override
public boolean generateStructure(World worldIn, Random randomIn, ChunkPos chunkCoord) {
return hook.generateStructure(worldIn, randomIn, chunkCoord);
}
@Override
public boolean isInsideStructure(BlockPos pos) {
return hook.isInsideStructure(pos);
}
@Override
public boolean isPositionInStructure(World worldIn, BlockPos pos) {
return hook.isPositionInStructure(worldIn, pos);
}
@Override
@Nullable
public BlockPos getNearestStructurePos(World worldIn, BlockPos pos, boolean findUnexplored) {
return hook.getNearestStructurePos(worldIn, pos, findUnexplored);
}
@Override
public void generate(World worldIn, int x, int z, ChunkPrimer primer) {
hook.generate(worldIn, x, z, primer);
}
});
break;
case SCATTERED_FEATURE:
hook = new MapGenStructureHook((MapGenStructure) event.getNewGen(), RCBiomeDecorator.DecorationType.SCATTERED_FEATURE);
event.setNewGen(new MapGenScatteredFeature() {
@Override
public String getStructureName() {
return hook.getStructureName();
}
@Override
public boolean generateStructure(World worldIn, Random randomIn, ChunkPos chunkCoord) {
return hook.generateStructure(worldIn, randomIn, chunkCoord);
}
@Override
public boolean isInsideStructure(BlockPos pos) {
return hook.isInsideStructure(pos);
}
@Override
public boolean isPositionInStructure(World worldIn, BlockPos pos) {
return hook.isPositionInStructure(worldIn, pos);
}
@Override
@Nullable
public BlockPos getNearestStructurePos(World worldIn, BlockPos pos, boolean findUnexplored) {
return hook.getNearestStructurePos(worldIn, pos, findUnexplored);
}
@Override
public void generate(World worldIn, int x, int z, ChunkPrimer primer) {
hook.generate(worldIn, x, z, primer);
}
});
break;
case VILLAGE:
hook = new MapGenStructureHook((MapGenStructure) event.getNewGen(), RCBiomeDecorator.DecorationType.VILLAGE);
event.setNewGen(new MapGenVillage() {
@Override
public String getStructureName() {
return hook.getStructureName();
}
@Override
public boolean generateStructure(World worldIn, Random randomIn, ChunkPos chunkCoord) {
return hook.generateStructure(worldIn, randomIn, chunkCoord);
}
@Override
public boolean isInsideStructure(BlockPos pos) {
return hook.isInsideStructure(pos);
}
@Override
public boolean isPositionInStructure(World worldIn, BlockPos pos) {
return hook.isPositionInStructure(worldIn, pos);
}
@Override
@Nullable
public BlockPos getNearestStructurePos(World worldIn, BlockPos pos, boolean findUnexplored) {
return hook.getNearestStructurePos(worldIn, pos, findUnexplored);
}
@Override
public void generate(World worldIn, int x, int z, ChunkPrimer primer) {
hook.generate(worldIn, x, z, primer);
}
});
break;
case NETHER_BRIDGE:
hook = new MapGenStructureHook((MapGenStructure) event.getNewGen(), RCBiomeDecorator.DecorationType.NETHER_BRIDGE);
event.setNewGen(new MapGenNetherBridge() {
@Override
public String getStructureName() {
return hook.getStructureName();
}
@Override
public boolean generateStructure(World worldIn, Random randomIn, ChunkPos chunkCoord) {
return hook.generateStructure(worldIn, randomIn, chunkCoord);
}
@Override
public boolean isInsideStructure(BlockPos pos) {
return hook.isInsideStructure(pos);
}
@Override
public boolean isPositionInStructure(World worldIn, BlockPos pos) {
return hook.isPositionInStructure(worldIn, pos);
}
@Override
@Nullable
public BlockPos getNearestStructurePos(World worldIn, BlockPos pos, boolean findUnexplored) {
return hook.getNearestStructurePos(worldIn, pos, findUnexplored);
}
@Override
public void generate(World worldIn, int x, int z, ChunkPrimer primer) {
hook.generate(worldIn, x, z, primer);
}
});
break;
case STRONGHOLD:
hook = new MapGenStructureHook((MapGenStructure) event.getNewGen(), RCBiomeDecorator.DecorationType.STRONGHOLD);
event.setNewGen(new MapGenStronghold() {
@Override
public String getStructureName() {
return hook.getStructureName();
}
@Override
public boolean generateStructure(World worldIn, Random randomIn, ChunkPos chunkCoord) {
return hook.generateStructure(worldIn, randomIn, chunkCoord);
}
@Override
public boolean isInsideStructure(BlockPos pos) {
return hook.isInsideStructure(pos);
}
@Override
public boolean isPositionInStructure(World worldIn, BlockPos pos) {
return hook.isPositionInStructure(worldIn, pos);
}
@Override
@Nullable
public BlockPos getNearestStructurePos(World worldIn, BlockPos pos, boolean findUnexplored) {
return hook.getNearestStructurePos(worldIn, pos, findUnexplored);
}
@Override
public void generate(World worldIn, int x, int z, ChunkPrimer primer) {
hook.generate(worldIn, x, z, primer);
}
});
break;
case MINESHAFT:
hook = new MapGenStructureHook((MapGenStructure) event.getNewGen(), RCBiomeDecorator.DecorationType.MINESHAFT);
event.setNewGen(new MapGenMineshaft() {
@Override
public String getStructureName() {
return hook.getStructureName();
}
@Override
public boolean generateStructure(World worldIn, Random randomIn, ChunkPos chunkCoord) {
return hook.generateStructure(worldIn, randomIn, chunkCoord);
}
@Override
public boolean isInsideStructure(BlockPos pos) {
return hook.isInsideStructure(pos);
}
@Override
public boolean isPositionInStructure(World worldIn, BlockPos pos) {
return hook.isPositionInStructure(worldIn, pos);
}
@Override
@Nullable
public BlockPos getNearestStructurePos(World worldIn, BlockPos pos, boolean findUnexplored) {
return hook.getNearestStructurePos(worldIn, pos, findUnexplored);
}
@Override
public void generate(World worldIn, int x, int z, ChunkPrimer primer) {
hook.generate(worldIn, x, z, primer);
}
});
break;
}
}
}
use of net.minecraft.world.chunk.ChunkPrimer in project RecurrentComplex by Ivorforce.
the class CommandVanilla method recursiveGenerate.
public static void recursiveGenerate(MapGenBase gen, World world, ChunkPos pos) {
// ChunkPrimer mostly doesn't get used
ChunkPrimer primer = new ChunkPrimer();
if (recursiveGenerate == null)
recursiveGenerate = ReflectionHelper.findMethod(MapGenBase.class, "recursiveGenerate", "func_180701_a", World.class, Integer.TYPE, Integer.TYPE, Integer.TYPE, Integer.TYPE, ChunkPrimer.class);
ReflectionHelper.setPrivateValue(MapGenBase.class, gen, world, "world", "field_75039_c");
SafeReflector.invoke(gen, recursiveGenerate, null, world, pos.x, pos.z, 0, 0, primer);
}
use of net.minecraft.world.chunk.ChunkPrimer in project RFToolsDimensions by McJty.
the class GenericChunkProvider method provideChunk.
/**
* Will return back a chunk, if it doesn't exist and its not a MP client it will generates all the blocks for the
* specified chunk from the map seed and chunk seed
*/
@Override
public Chunk provideChunk(int chunkX, int chunkZ) {
this.rand.setSeed(chunkX * 341873128712L + chunkZ * 132897987541L + 123456);
ChunkPrimer chunkprimer = new ChunkPrimer();
// this.setBlocksInChunk(chunkX, chunkZ, chunkprimer);
this.biomesForGeneration = this.worldObj.getWorldChunkManager().getBiomesForGeneration(this.biomesForGeneration, chunkX * 4 - 2, chunkZ * 4 - 2, 10, 10);
terrainGenerator.generate(chunkX, chunkZ, chunkprimer);
this.biomesForGeneration = this.worldObj.getWorldChunkManager().loadBlockGeneratorData(this.biomesForGeneration, chunkX * 16, chunkZ * 16, 16, 16);
terrainGenerator.replaceBlocksForBiome(chunkX, chunkZ, chunkprimer, this.biomesForGeneration);
if (dimensionInformation.hasFeatureType(FeatureType.FEATURE_TENDRILS)) {
this.tendrilGenerator.generate(this.worldObj, chunkX, chunkZ, chunkprimer);
}
if (dimensionInformation.hasFeatureType(FeatureType.FEATURE_CANYONS)) {
this.canyonGenerator.generate(this.worldObj, chunkX, chunkZ, chunkprimer);
}
if (dimensionInformation.hasFeatureType(FeatureType.FEATURE_PYRAMIDS)) {
this.pyramidGenerator.generate(this.worldObj, chunkX, chunkZ, chunkprimer);
}
if (dimensionInformation.hasFeatureType(FeatureType.FEATURE_ORBS)) {
this.sphereGenerator.generate(this.worldObj, chunkX, chunkZ, chunkprimer);
}
if (dimensionInformation.hasFeatureType(FeatureType.FEATURE_HUGEORBS)) {
this.hugeSphereGenerator.generate(this.worldObj, chunkX, chunkZ, chunkprimer);
}
if (dimensionInformation.hasFeatureType(FeatureType.FEATURE_LIQUIDORBS)) {
this.liquidSphereGenerator.generate(this.worldObj, chunkX, chunkZ, chunkprimer);
}
if (dimensionInformation.hasFeatureType(FeatureType.FEATURE_HUGELIQUIDORBS)) {
this.hugeLiquidSphereGenerator.generate(this.worldObj, chunkX, chunkZ, chunkprimer);
}
if (dimensionInformation.hasFeatureType(FeatureType.FEATURE_CAVES)) {
this.caveGenerator.generate(this, this.worldObj, chunkX, chunkZ, chunkprimer);
}
if (dimensionInformation.hasFeatureType(FeatureType.FEATURE_DENSE_CAVES)) {
this.denseCaveGenerator.generate(this, this.worldObj, chunkX, chunkZ, chunkprimer);
}
if (dimensionInformation.hasFeatureType(FeatureType.FEATURE_RAVINES)) {
this.ravineGenerator.generate(this, this.worldObj, chunkX, chunkZ, chunkprimer);
}
if (dimensionInformation.hasStructureType(StructureType.STRUCTURE_MINESHAFT)) {
this.mineshaftGenerator.generate(this, this.worldObj, chunkX, chunkZ, chunkprimer);
}
if (dimensionInformation.hasStructureType(StructureType.STRUCTURE_VILLAGE)) {
this.villageGenerator.generate(this, this.worldObj, chunkX, chunkZ, chunkprimer);
}
if (dimensionInformation.hasStructureType(StructureType.STRUCTURE_STRONGHOLD)) {
this.strongholdGenerator.generate(this, this.worldObj, chunkX, chunkZ, chunkprimer);
}
if (dimensionInformation.hasStructureType(StructureType.STRUCTURE_FORTRESS)) {
this.genNetherBridge.generate(this, this.worldObj, chunkX, chunkZ, chunkprimer);
}
if (dimensionInformation.hasStructureType(StructureType.STRUCTURE_SCATTERED)) {
this.scatteredFeatureGenerator.generate(this, this.worldObj, chunkX, chunkZ, chunkprimer);
}
// this.ruinedCitiesGenerator.generate(this.worldObj, chunkX, chunkZ, ablock, abyte);
Chunk chunk = new Chunk(this.worldObj, chunkprimer, chunkX, chunkZ);
byte[] abyte1 = chunk.getBiomeArray();
for (int k = 0; k < abyte1.length; ++k) {
abyte1[k] = (byte) this.biomesForGeneration[k].biomeID;
}
chunk.generateSkylightMap();
return chunk;
}
Aggregations