package uk.co.wehavecookies56.kk.common.world.dimension;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
import javax.annotation.Nullable;
import net.minecraft.block.BlockFalling;
import net.minecraft.entity.EnumCreatureType;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraft.world.biome.Biome;
import net.minecraft.world.chunk.Chunk;
import net.minecraft.world.chunk.ChunkPrimer;
import net.minecraft.world.chunk.IChunkGenerator;
/**
* Created by Toby on 01/08/2016.
*/
public class ChunkProviderDiveToTheHeart implements IChunkGenerator {
private final Random rand;
private final World worldObj;
private Biome[] biomesForGeneration;
private int chunkX = 0;
private int chunkZ = 0;
public ChunkProviderDiveToTheHeart(World worldObjIn, boolean mapFeaturesEnabledIn, long seed) {
this.rand = new Random(seed);
this.worldObj = worldObjIn;
}
@Override
public Chunk provideChunk(int x, int z) {
this.chunkX = x; this.chunkZ = z;
this.rand.setSeed((long)x * 341873128712L + (long)z * 132897987541L);
ChunkPrimer chunkprimer = new ChunkPrimer();
this.biomesForGeneration = this.worldObj.getBiomeProvider().getBiomes(this.biomesForGeneration, x * 16, z * 16, 16, 16);
Chunk chunk = new Chunk(this.worldObj, chunkprimer, x, z);
byte[] abyte = chunk.getBiomeArray();
for (int i = 0; i < abyte.length; ++i)
{
abyte[i] = (byte)Biome.getIdForBiome(this.biomesForGeneration[i]);
}
chunk.generateSkylightMap();
return chunk;
}
@Override
public void populate(int x, int z) {
BlockFalling.fallInstantly = true;
net.minecraftforge.event.ForgeEventFactory.onChunkPopulate(true, this, this.worldObj, this.rand, x, z, false);
BlockFalling.fallInstantly = false;
}
@Override
public boolean generateStructures(Chunk chunkIn, int x, int z) {
return false;
}
@Override
public List<Biome.SpawnListEntry> getPossibleCreatures(EnumCreatureType creatureType, BlockPos pos) {
return new ArrayList<Biome.SpawnListEntry>();
}
@Nullable
@Override
public BlockPos getStrongholdGen(World worldIn, String structureName, BlockPos position) {
return null;
}
@Override
public void recreateStructures(Chunk chunkIn, int x, int z) {
}
}