Java Code Examples for net.minecraft.world.chunk.Chunk#generateSkylightMap()

The following examples show how to use net.minecraft.world.chunk.Chunk#generateSkylightMap() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ChunkGeneratorTorikki.java    From Wizardry with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Nonnull
@Override
public Chunk generateChunk(int x, int z) {
	this.rand.setSeed((long)x * 341873128712L + (long)z * 132897987541L);
	ChunkPrimer chunkprimer = new ChunkPrimer();

	generate(x, z, chunkprimer);

	Chunk chunk = new Chunk(world, chunkprimer, x, z);

	byte[] biomeArray = chunk.getBiomeArray();
	for (int i = 0; i < biomeArray.length; ++i) {
		biomeArray[i] = (byte) 42;
	}

	chunk.generateSkylightMap();
	return chunk;
}
 
Example 2
Source File: ChunkProviderSpace.java    From AdvancedRocketry with MIT License 6 votes vote down vote up
@Override
public Chunk generateChunk(int p_73154_1_, int p_73154_2_) {
	Block[] ablock = new Block[65536];
	byte[] abyte = new byte[65536];
	ChunkPrimer chunkprimer = new ChunkPrimer();
	
	//ChunkExtendedBiome
	Chunk chunk = new Chunk(this.worldObj, chunkprimer, p_73154_1_, p_73154_2_);//new Chunk(this.worldObj, ablock, abyte, p_73154_1_, p_73154_2_);
	//TODO: convert back to int
	byte[] abyte1 = chunk.getBiomeArray();

	Arrays.fill(abyte1, (byte)Biome.getIdForBiome(AdvancedRocketryBiomes.spaceBiome));

	chunk.generateSkylightMap();
	return chunk;
}
 
Example 3
Source File: ChunkProviderPlanet.java    From AdvancedRocketry with MIT License 6 votes vote down vote up
/**
 * 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 generateChunk(int x, int z)
{
	this.rand.setSeed((long)x * 341873128712L + (long)z * 132897987541L);


	//ChunkExtendedBiome
	Chunk chunk = new Chunk(this.worldObj, getChunkPrimer(x, z), 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;
}
 
Example 4
Source File: ChunkProviderPaths.java    From TFC2 with GNU General Public License v3.0 6 votes vote down vote up
@Override
public Chunk provideChunk(int chunkX, int chunkZ)
{
	worldX = chunkX * 16;
	worldZ = chunkZ * 16;
	islandChunkX = worldX % MAP_SIZE;
	islandChunkZ = worldZ % MAP_SIZE;
	mapX = (chunkX >> 8);
	mapZ = (chunkZ >> 8);
	islandMap = WorldGen.getInstance().getIslandMap(((chunkX*16/8) >> 12), ((chunkZ*16/8) >> 12));


	this.rand.setSeed((long)chunkX * 341873128712L + (long)chunkZ * 132897987541L);
	ChunkPrimer chunkprimer = new ChunkPrimer();
	generateTerrain(chunkprimer);
	Chunk chunk = new Chunk(this.worldObj, chunkprimer, chunkX, chunkZ);
	chunk.generateSkylightMap();
	return chunk;  
}
 
Example 5
Source File: WorldProviderHellVoid.java    From YUNoMakeGoodMap with Apache License 2.0 6 votes vote down vote up
@Override
public Chunk generateChunk(int x, int z)
{
    ChunkPrimer data = new ChunkPrimer();

    if(YUNoMakeGoodMap.instance.shouldGenerateNetherFortress(world))
        genNetherBridge.generate(world, x, z, data);
    else
        genNetherBridge.generate(world, x, z, null);

    Chunk ret = new Chunk(world, data, x, z);
    Biome[] biomes = world.getBiomeProvider().getBiomes(null, x * 16, z * 16, 16, 16);
    byte[] ids = ret.getBiomeArray();

    for (int i = 0; i < ids.length; ++i)
    {
        ids[i] = (byte)Biome.getIdForBiome(biomes[i]);
    }

    ret.generateSkylightMap();
    return ret;
}
 
Example 6
Source File: WorldProviderEndVoid.java    From YUNoMakeGoodMap with Apache License 2.0 6 votes vote down vote up
@Override public Chunk generateChunk(int x, int z)
{
    ChunkPrimer primer = new ChunkPrimer();

    if (YUNoMakeGoodMap.instance.shouldGenerateEndCities(this.world))
        this.endCityGen.generate(world, x, z, primer);
    else
        this.endCityGen.generate(world, x, z, null);

    Chunk ret = new Chunk(world, primer, x, z);
    Biome[] biomes = world.getBiomeProvider().getBiomes(null, x * 16, z * 16, 16, 16);
    byte[] ids = ret.getBiomeArray();

    for (int i = 0; i < ids.length; ++i)
    {
        ids[i] = (byte)Biome.getIdForBiome(biomes[i]);
    }

    ret.generateSkylightMap();
    return ret;
}
 
Example 7
Source File: ChunkProviderTofu.java    From TofuCraftReload with MIT License 5 votes vote down vote up
@Override
public Chunk generateChunk(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.world.getBiomeProvider().getBiomes(this.biomesForGeneration, x * 16, z * 16, 16, 16);
    this.setBlocksInChunk(x, z, chunkprimer);
    this.buildSurfaces(chunkprimer);
    this.setBedRock(chunkprimer);

    this.caveGenerator.generate(this.world, x, z, chunkprimer);


    if (this.mapFeaturesEnabled) {
        this.mineshaft.generate(this.world, x, z, chunkprimer);
        this.villageGenerator.generate(this.world, x, z, chunkprimer);
        this.tofuCastle.generate(this.world, x, z, chunkprimer);
    }

    Chunk chunk = new Chunk(this.world, 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;
}
 
Example 8
Source File: ChunkProviderRoss128b.java    From bartworks with MIT License 5 votes vote down vote up
public Chunk provideChunk(int p_73154_1_, int p_73154_2_) {
    this.rand.setSeed((long) p_73154_1_ * 341873128712L + (long) p_73154_2_ * 132897987541L);
    Block[] ablock = new Block[65536];
    byte[] abyte = new byte[65536];
    this.func_147424_a(p_73154_1_, p_73154_2_, ablock);
    this.biomesForGeneration = this.worldObj.getWorldChunkManager().loadBlockGeneratorData(this.biomesForGeneration, p_73154_1_ * 16, p_73154_2_ * 16, 16, 16);
    for (int i = 0; i < this.biomesForGeneration.length; i++) {
        BiomeGenBase biomeGenBase = this.biomesForGeneration[i];
        if (biomeGenBase.biomeID == BiomeGenBase.mushroomIsland.biomeID) {
            this.biomesForGeneration[i] = BiomeGenBase.taiga;
        } else if (biomeGenBase.biomeID == BiomeGenBase.mushroomIslandShore.biomeID) {
            this.biomesForGeneration[i] = BiomeGenBase.stoneBeach;
        }
        if (LoaderReference.Thaumcraft) {
            if (ThaumcraftHandler.isTaintBiome(biomeGenBase.biomeID))
                this.biomesForGeneration[i] = BiomeGenBase.taiga;
            else if (ConfigHandler.disableMagicalForest && ThaumcraftHandler.isMagicalForestBiome(biomeGenBase.biomeID))
                this.biomesForGeneration[i] = BiomeGenBase.birchForest;
        }
    }
    this.replaceBlocksForBiome(p_73154_1_, p_73154_2_, ablock, abyte, this.biomesForGeneration);
    this.caveGenerator.func_151539_a(this, this.worldObj, p_73154_1_, p_73154_2_, ablock);
    this.ravineGenerator.func_151539_a(this, this.worldObj, p_73154_1_, p_73154_2_, ablock);

    Chunk chunk = new Chunk(this.worldObj, ablock, abyte, p_73154_1_, p_73154_2_);
    byte[] abyte1 = chunk.getBiomeArray();

    for (int k = 0; k < abyte1.length; ++k) {
        abyte1[k] = (byte) this.biomesForGeneration[k].biomeID;
    }

    chunk.generateSkylightMap();
    return chunk;
}
 
Example 9
Source File: ClaimedChunkCacheController.java    From Valkyrien-Skies with Apache License 2.0 5 votes vote down vote up
public void injectChunkIntoWorld(Chunk chunk, int x, int z, boolean putInId2ChunkMap) {
    VSChunkClaim chunkClaim = parent.getOwnedChunks();
    chunk.generateSkylightMap();
    chunk.checkLight();

    // Make sure this chunk knows we own it.
    ((IPhysicsChunk) chunk).setParentPhysicsObject(Optional.of(this.parent));

    ChunkProviderServer provider = (ChunkProviderServer) world.getChunkProvider();
    chunk.dirty = true;
    claimedChunks[x - chunkClaim.minX()][z - chunkClaim.minZ()] = chunk;

    if (putInId2ChunkMap) {
        provider.loadedChunks.put(ChunkPos.asLong(x, z), chunk);
    }

    chunk.onLoad();
    // We need to set these otherwise certain events like Sponge's PhaseTracker will refuse to work properly with ships!
    chunk.setTerrainPopulated(true);
    chunk.setLightPopulated(true);
    // Inject the entry into the player chunk map.
    // Sanity check first
    if (!((WorldServer) world).isCallingFromMinecraftThread()) {
        throw new IllegalThreadStateException("We cannot call this crap from another thread!");
    }
    PlayerChunkMap map = ((WorldServer) world).getPlayerChunkMap();
    PlayerChunkMapEntry entry = map.getOrCreateEntry(x, z);
    entry.sentToPlayers = true;
    entry.players = parent.getWatchingPlayers();
}
 
Example 10
Source File: ChunkGeneratorFlatVoid.java    From YUNoMakeGoodMap with Apache License 2.0 5 votes vote down vote up
@Override public Chunk generateChunk(int x, int z)
{
    Chunk ret = new Chunk(world, new ChunkPrimer(), x, z);
    Biome[] biomes = world.getBiomeProvider().getBiomes(null, x * 16, z * 16, 16, 16);
    byte[] ids = ret.getBiomeArray();

    for (int i = 0; i < ids.length; ++i)
    {
        ids[i] = (byte)Biome.getIdForBiome(biomes[i]);
    }

    ret.generateSkylightMap();
    return ret;
}
 
Example 11
Source File: MoCChunkProviderWyvernLair.java    From mocreaturesdev with GNU General Public License v3.0 5 votes vote down vote up
/**
 * 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
 */
public Chunk provideChunk(int par1, int par2)
{
	//System.out.println("providing chunk " + par1 + ", " + par2);
	
    this.RNGa.setSeed((long)par1 * 341873128712L + (long)par2 * 132897987541L);
    byte[] var3 = new byte[32768];
    this.biomesForGeneration = this.worldObj.getWorldChunkManager().loadBlockGeneratorData(this.biomesForGeneration, par1 * 16, par2 * 16, 16, 16);
    this.generateTerrain(par1, par2, var3, this.biomesForGeneration);
    this.replaceBlocksForBiome(par1, par2, var3, this.biomesForGeneration);
    
    //to add metadata specific dimension info, used to reduce the number of block IDs with multiBLocks
    byte[] metadat = new byte[32768];
    for (int i = 0; i<32768; i++)
    {
       	metadat[i] = (byte)metaData;
    }
    
    //changed constructor to add metadata
    Chunk var4 = new Chunk(this.worldObj, var3, metadat, par1, par2);
    
    byte[] var5 = var4.getBiomeArray();

    for (int var6 = 0; var6 < var5.length; ++var6)
    {
        var5[var6] = (byte)this.biomesForGeneration[var6].biomeID;
    }

    
    var4.generateSkylightMap();
    return var4;
}
 
Example 12
Source File: SpaceChunkGenerator.java    From CommunityMod with GNU Lesser General Public License v2.1 4 votes vote down vote up
@Override
   public Chunk generateChunk(int x, int z) {
Chunk chunk = new Chunk(world, x, z);
chunk.generateSkylightMap();
return chunk;
   }
 
Example 13
Source File: StorageChunkGenerator.java    From CommunityMod with GNU Lesser General Public License v2.1 4 votes vote down vote up
@Override
   public Chunk generateChunk(int x, int z) {
Chunk chunk = new Chunk(world, x, z);
chunk.generateSkylightMap();
return chunk;
   }
 
Example 14
Source File: ChunkProviderSurface.java    From TFC2 with GNU General Public License v3.0 4 votes vote down vote up
@Override
public Chunk provideChunk(int chunkX, int chunkZ)
{
	centerCache = new Center[48][48];

	elevationMap = new int[256];

	this.chunkX = chunkX;
	this.chunkZ = chunkZ;

	worldX = chunkX * 16;
	worldZ = chunkZ * 16;
	islandChunkX = worldX % MAP_SIZE;
	islandChunkZ = worldZ % MAP_SIZE;
	mapX = (chunkX >> 8);
	mapZ = (chunkZ >> 8);
	islandMap = WorldGen.getInstance().getIslandMap(mapX, mapZ);
	centersInChunk = new Vector<Center>();

	for(int x = -16; x < 32; x++)
	{
		for(int z = -16; z < 32; z++)
		{
			getHex(new Point(x,z));
		}
	}

	this.rand.setSeed((long)chunkX * 341873128712L + (long)chunkZ * 132897987541L);
	ChunkPrimer chunkprimer = new ChunkPrimer();
	generateTerrain(chunkprimer, chunkX, chunkZ);

	decorate(chunkprimer, chunkX, chunkZ);
	carveRiverSpline(chunkprimer);

	carveCaves(chunkprimer);
	placeOreSeams(chunkprimer);
	placeOreLayers(chunkprimer);
	createDungeons(chunkprimer);

	if(TFCOptions.shouldStripChunks)
		stripChunk(chunkprimer);

	Chunk chunk = new Chunk(this.worldObj, chunkprimer, chunkX, chunkZ);
	chunk.setHeightMap(elevationMap);

	byte[] biomeArray = chunk.getBiomeArray();
	Point p = new Point(0, 0);
	for (int x = 0; x < 16; x++) 
	{
		for (int z = 0; z < 16; z++) 
		{
			Center c = getHex(p.plus(x, z));

			biomeArray[z << 4 | x] = (byte) Biome.getIdForBiome(c.biome.biome);
		}
	}
	chunk.setBiomeArray(biomeArray);
	chunk.generateSkylightMap();
	return chunk;  
}