當前位置: 首頁>>代碼示例>>Java>>正文


Java TerrainGen.populate方法代碼示例

本文整理匯總了Java中net.minecraftforge.event.terraingen.TerrainGen.populate方法的典型用法代碼示例。如果您正苦於以下問題:Java TerrainGen.populate方法的具體用法?Java TerrainGen.populate怎麽用?Java TerrainGen.populate使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在net.minecraftforge.event.terraingen.TerrainGen的用法示例。


在下文中一共展示了TerrainGen.populate方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: populate

import net.minecraftforge.event.terraingen.TerrainGen; //導入方法依賴的package包/類
@SubscribeEvent
public void populate(PopulateChunkEvent.Post event)
{
    final boolean doGen = TerrainGen.populate(event.chunkProvider, event.world, event.rand, event.chunkX, event.chunkZ, event.hasVillageGenerated, PopulateChunkEvent.Populate.EventType.CUSTOM);
    
    if (!doGen) return;
    
    final int worldX = event.chunkX << 4;
    final int worldZ = event.chunkZ << 4;

    EventHandlerGC.generateOil(event.world, event.rand, worldX + event.rand.nextInt(16), worldZ + event.rand.nextInt(16), false);
}
 
開發者ID:4Space,項目名稱:4Space-5,代碼行數:13,代碼來源:EventHandlerGC.java

示例2: populate

import net.minecraftforge.event.terraingen.TerrainGen; //導入方法依賴的package包/類
/**
 * Populates chunk with ores etc etc
 */
public void populate(IChunkProvider p_73153_1_, int p_73153_2_, int p_73153_3_)
{
    BlockFalling.fallInstantly = true;
    int k = p_73153_2_ * 16;
    int l = p_73153_3_ * 16;
    BiomeGenBase biomegenbase = this.worldObj.getBiomeGenForCoords(k + 16, l + 16);
    this.rand.setSeed(this.worldObj.getSeed());
    long i1 = this.rand.nextLong() / 2L * 2L + 1L;
    long j1 = this.rand.nextLong() / 2L * 2L + 1L;
    this.rand.setSeed((long)p_73153_2_ * i1 + (long)p_73153_3_ * j1 ^ this.worldObj.getSeed());

    MinecraftForge.EVENT_BUS.post(new PopulateChunkEvent.Pre(p_73153_1_, worldObj, rand, p_73153_2_, p_73153_3_, false));

    int k1;
    int l1;
    int i2;

    if (this.rand.nextInt(4) == 0)
    {
        k1 = k + this.rand.nextInt(16) + 8;
        l1 = this.rand.nextInt(256);
        i2 = l + this.rand.nextInt(16) + 8;
        (new WorldGenLakes(Blocks.water)).generate(this.worldObj, this.rand, k1, l1, i2);
    }
    
    if (biomegenbase.theBiomeDecorator.currentWorld == null)
    	biomegenbase.decorate(this.worldObj, this.rand, k, l);
    
    if (TerrainGen.populate(p_73153_1_, worldObj, rand, p_73153_2_, p_73153_3_, false, ANIMALS))
    {
    	SpawnerAnimals.performWorldGenSpawning(this.worldObj, biomegenbase, k + 8, l + 8, 16, 16, this.rand);
    }
    k += 8;
    l += 8;

    MinecraftForge.EVENT_BUS.post(new PopulateChunkEvent.Post(p_73153_1_, worldObj, rand, p_73153_2_, p_73153_3_, false));

    BlockFalling.fallInstantly = false;
}
 
開發者ID:GhostMonk3408,項目名稱:MidgarCrusade,代碼行數:43,代碼來源:ChunkGeneratorSky.java

示例3: populate

import net.minecraftforge.event.terraingen.TerrainGen; //導入方法依賴的package包/類
@SubscribeEvent
public void populate( PopulateChunkEvent.Post event )
{
  try
  {
    if( _mBuildCraftOilBlock == null ) {
        return;
    }

    int tMinDist = MainRegistry.CoreConfig.OilFixConfig.OilDepostMinDistance;
    if (tMinDist > 1)
    {
      if (event.chunkX % tMinDist != 0 || event.chunkZ % tMinDist != 0) {
          return;
      }
    }
    
    boolean doGen = TerrainGen.populate( event.chunkProvider, event.world, event.rand, event.chunkX, event.chunkZ, event.hasVillageGenerated, PopulateChunkEvent.Populate.EventType.CUSTOM );

    if( !doGen ) {
        return;
    }

    int worldX = event.chunkX << 4;
    int worldZ = event.chunkZ << 4;

    generateOil( event.world, event.rand, worldX + event.rand.nextInt( 16 ), worldZ + event.rand.nextInt( 16 ), false );
  }
  catch( Exception e )
  {
    e.printStackTrace();
  }
}
 
開發者ID:GTNewHorizons,項目名稱:NewHorizonsCoreMod,代碼行數:34,代碼來源:OilGeneratorFix.java

示例4: populate

import net.minecraftforge.event.terraingen.TerrainGen; //導入方法依賴的package包/類
@Override
public void populate(IChunkProvider ichunkprovider, int i, int j) {
	BlockSand.fallInstantly = true;
	int k = i * 16;
	int l = j * 16;
	BiomeGenBase biome = this.worldObj.getBiomeGenForCoords(k + 16, l + 16);
	this.rand.setSeed(this.worldObj.getSeed());
	long i1 = this.rand.nextLong() / 2L * 2L + 1L;
	long j1 = this.rand.nextLong() / 2L * 2L + 1L;
	this.rand.setSeed((long)i*i1 + (long)j*j1 ^ this.worldObj.getSeed());
	boolean flag = false;
	
	MinecraftForge.EVENT_BUS.post(new PopulateChunkEvent.Pre(ichunkprovider, worldObj, rand, i, j, flag));

	if(mapFeaturesEnabled){
		this.mineshaftGenerator.generateStructuresInChunk(this.worldObj, rand, i, j);
		this.scatteredFeatureGenerator.generateStructuresInChunk(this.worldObj, rand, i, j);
	}
	
	int k1;
	int l1;
	int i2;
	
	if(biome != BiomeGenBase.desert && biome != BiomeGenBase.desertHills && !flag && this.rand.nextInt(4) == 0 && TerrainGen.populate(ichunkprovider, this.worldObj, rand, i, j, flag, LAKE)){
		k1 = k + this.rand.nextInt(16) + 8;
		l1 = this.rand.nextInt(128);
		i2 = l + this.rand.nextInt(16) + 8;
		(new WorldGenLakes(Block.waterStill.blockID)).generate(this.worldObj, this.rand, k1, l1, i2);
	}
	
	biome.decorate(worldObj, rand, k, j);
	 	k+=8;
		l+=8;
		
		MinecraftForge.EVENT_BUS.post(new PopulateChunkEvent.Post(ichunkprovider, worldObj, rand, i, j, flag));

		BlockSand.fallInstantly = false;
}
 
開發者ID:MinecraftModArchive,項目名稱:Runes-And-Silver,代碼行數:39,代碼來源:ChunkProviderCustomDimension.java

示例5: addDungeonSpawn

import net.minecraftforge.event.terraingen.TerrainGen; //導入方法依賴的package包/類
public void addDungeonSpawn(IChunkProvider chunkGenerator, World world, Random random, int blockXPos, int blockZPos)
{
	int chunkX = blockXPos / 16;
	int chunkZ = blockZPos / 16;
   	boolean doGen = TerrainGen.populate(chunkGenerator, world, random, chunkX, chunkZ, false, DUNGEON);
	for (int x = 0; doGen && x < 8; ++x)
       {
           int posX = blockXPos + random.nextInt(16) + 8;
           int posY = random.nextInt(256);
           int posZ = blockZPos + random.nextInt(16) + 8;
           (new SMMObsidianDungeon()).generate(world, random, posX, posY, posZ);
       }
}
 
開發者ID:Spencerio1,項目名稱:Spencerios-Mod-Mod,代碼行數:14,代碼來源:SMMGenerationManager.java

示例6: populate

import net.minecraftforge.event.terraingen.TerrainGen; //導入方法依賴的package包/類
@Override
public void populate(int chunkX, int chunkZ) {
    BlockFalling.fallInstantly = true;
    int x = chunkX * 16;
    int z = chunkZ * 16;
    BlockPos pos = new BlockPos(x, 0, z);
    Biome biome = this.world.getBiome(pos.add(16, 0, 16));
    this.random.setSeed(this.world.getSeed());
    long k = this.random.nextLong() / 2L * 2L + 1L;
    long l = this.random.nextLong() / 2L * 2L + 1L;
    this.random.setSeed((long) chunkX * k + (long) chunkZ * l ^ this.world.getSeed());
    boolean generatedVillage = false;

    if (this.decorate) {
        ForgeEventFactory.onChunkPopulate(true, this, this.world, this.random, chunkX, chunkZ, generatedVillage);

        biome.decorate(this.world, this.random, new BlockPos(x, 0, z));
        if (TerrainGen.populate(this, this.world, this.random, chunkX, chunkZ, generatedVillage, PopulateChunkEvent.Populate.EventType.ANIMALS)) {
            WorldEntitySpawner.performWorldGenSpawning(this.world, biome, x + 8, z + 8, 16, 16, this.random);
        }
        pos = pos.add(8, 0, 8);

        if (TerrainGen.populate(this, this.world, this.random, chunkX, chunkZ, generatedVillage, PopulateChunkEvent.Populate.EventType.ICE)) {
            for (int offsetX = 0; offsetX < 16; ++offsetX) {
                for (int offsetZ = 0; offsetZ < 16; ++offsetZ) {
                    BlockPos snowPos = this.world.getPrecipitationHeight(pos.add(offsetX, 0, offsetZ));
                    BlockPos groundPos = snowPos.down();

                    if (this.world.canBlockFreezeWater(groundPos)) {
                        this.world.setBlockState(groundPos, Blocks.ICE.getDefaultState(), 2);
                    }

                    if (this.world.canSnowAt(snowPos, true)) {
                        this.world.setBlockState(snowPos, Blocks.SNOW_LAYER.getDefaultState(), 2);
                    }
                }
            }
        }

        ForgeEventFactory.onChunkPopulate(false, this, this.world, this.random, chunkX, chunkZ, generatedVillage);
    }

    BlockFalling.fallInstantly = false;
}
 
開發者ID:gegy1000,項目名稱:Earth,代碼行數:45,代碼來源:ChunkGeneratorEarth.java

示例7: populate

import net.minecraftforge.event.terraingen.TerrainGen; //導入方法依賴的package包/類
/**
 * Populates chunk with ores etc etc
 */
@Override
public void populate(IChunkProvider par1IChunkProvider, int par2, int par3) {
	BlockFalling.fallInstantly = true;
	int k = par2 * 16;
	int l = par3 * 16;
	BiomeGenBase biomegenbase = this.worldObj.getBiomeGenForCoords(k + 16, l + 16);
	this.rand.setSeed(this.worldObj.getSeed());
	long i1 = this.rand.nextLong() / 2L * 2L + 1L;
	long j1 = this.rand.nextLong() / 2L * 2L + 1L;
	this.rand.setSeed((long)par2 * i1 + (long)par3 * j1 ^ this.worldObj.getSeed());
	boolean flag = false;
	MinecraftForge.EVENT_BUS.post(new PopulateChunkEvent.Pre(par1IChunkProvider, worldObj, rand, par2, par3, flag));

	//Enable map features ??
	if (this.mapFeaturesEnabled) {
		this.scatteredFeatureGenerator.generateStructuresInChunk(this.worldObj, this.rand, par2, par3);
	}
	int k1;
	int l1;
	int i2;

	//Add Lakes ??
	if (biomegenbase != BiomeGenBase.desert && biomegenbase != BiomeGenBase.desertHills && !flag && this.rand.nextInt(4) == 0
			&& TerrainGen.populate(par1IChunkProvider, worldObj, rand, par2, par3, flag, LAKE)) {
		k1 = k + this.rand.nextInt(16) + 8;
		l1 = this.rand.nextInt(256);
		i2 = l + this.rand.nextInt(16) + 8;
		(new WorldGenLakes(Blocks.water)).generate(this.worldObj, this.rand, k1, l1, i2);
	}

	//Add Lakes ??
	if (TerrainGen.populate(par1IChunkProvider, worldObj, rand, par2, par3, flag, LAVA) && !flag && this.rand.nextInt(8) == 0) {
		k1 = k + this.rand.nextInt(16) + 8;
		l1 = this.rand.nextInt(this.rand.nextInt(248) + 8);
		i2 = l + this.rand.nextInt(16) + 8;

		if (l1 < 63 || this.rand.nextInt(10) == 0)  {
			(new WorldGenLakes(Blocks.lava)).generate(this.worldObj, this.rand, k1, l1, i2);
		}
	}

	//Add Dungeons ??
	boolean doGen = TerrainGen.populate(par1IChunkProvider, worldObj, rand, par2, par3, flag, DUNGEON);
	for (k1 = 0; doGen && k1 < 8; ++k1) {
		l1 = k + this.rand.nextInt(16) + 8;
		i2 = this.rand.nextInt(256);
		int j2 = l + this.rand.nextInt(16) + 8;
		(new WorldGenDungeons()).generate(this.worldObj, this.rand, l1, i2, j2);
	}

	//Add Animals ??
	biomegenbase.decorate(this.worldObj, this.rand, k, l);
	if (TerrainGen.populate(par1IChunkProvider, worldObj, rand, par2, par3, flag, ANIMALS)) {
		SpawnerAnimals.performWorldGenSpawning(this.worldObj, biomegenbase, k + 8, l + 8, 16, 16, this.rand);
	}
	k += 8;
	l += 8;

	//Creates snow and ice in world.
	doGen = TerrainGen.populate(par1IChunkProvider, worldObj, rand, par2, par3, flag, ICE);
	for (k1 = 0; doGen && k1 < 16; ++k1) {
		for (l1 = 0; l1 < 16; ++l1) {
			i2 = this.worldObj.getPrecipitationHeight(k + k1, l + l1);

			if (this.worldObj.isBlockFreezable(k1 + k, i2 - 1, l1 + l)) {
				this.worldObj.setBlock(k1 + k, i2 - 1, l1 + l, Blocks.ice, 0, 2);
			}

			if (this.worldObj.func_147478_e(k1 + k, i2, l1 + l, true)) {
				this.worldObj.setBlock(k1 + k, i2, l1 + l, Blocks.snow_layer, 0, 2);
			}
		}
	}
	MinecraftForge.EVENT_BUS.post(new PopulateChunkEvent.Post(par1IChunkProvider, worldObj, rand, par2, par3, flag));
	BlockFalling.fallInstantly = false;
}
 
開發者ID:jtrent238,項目名稱:PopularMMOS-EpicProportions-Mod,代碼行數:80,代碼來源:ChunkProviderEpic.java

示例8: generate

import net.minecraftforge.event.terraingen.TerrainGen; //導入方法依賴的package包/類
@SubscribeEvent
public void generate(PopulateChunkEvent.Pre event) {
    if(TerrainGen.populate(event.chunkProvider, event.world, event.rand, event.chunkX, event.chunkZ, event.hasVillageGenerated, EVENT_TYPE)) {
        generateQuarry(event.world, event.rand, event.chunkX, event.chunkZ);
    }
}
 
開發者ID:GTNewHorizons,項目名稱:NewHorizonsCoreMod,代碼行數:7,代碼來源:NH_QuarryPopulator.java

示例9: generate

import net.minecraftforge.event.terraingen.TerrainGen; //導入方法依賴的package包/類
@SubscribeEvent
public void generate(PopulateChunkEvent.Pre event) {
    if(TerrainGen.populate(event.chunkProvider, event.world, event.rand, event.chunkX, event.chunkZ, event.hasVillageGenerated, EVENT_TYPE)) {
        generateGeode(event.world, event.rand, event.chunkX, event.chunkZ);
    }
}
 
開發者ID:GTNewHorizons,項目名稱:NewHorizonsCoreMod,代碼行數:7,代碼來源:NH_GeodePopulator.java

示例10: populate

import net.minecraftforge.event.terraingen.TerrainGen; //導入方法依賴的package包/類
/**
 * Populates chunk with ores etc etc
 */
public void populate(IChunkProvider par1IChunkProvider, int par2, int par3)
{
	BlockFalling.fallInstantly = true;
	int k = par2 * 16;
	int l = par3 * 16;
	BiomeGenBase biomegenbase = this.worldObj.getBiomeGenForCoords(new BlockPos(k + 16, 0, l + 16));// warn
	this.rand.setSeed(this.worldObj.getSeed());
	long i1 = this.rand.nextLong() / 2L * 2L + 1L;
	long j1 = this.rand.nextLong() / 2L * 2L + 1L;
	this.rand.setSeed((long) par2 * i1 + (long) par3 * j1 ^ this.worldObj.getSeed());
	boolean flag = false;

	MinecraftForge.EVENT_BUS
			.post(new PopulateChunkEvent.Pre(par1IChunkProvider, worldObj, rand, par2, par3, flag));

	int k1;
	int l1;
	int i2;

	if (biomegenbase != BiomeGenBase.desert && biomegenbase != BiomeGenBase.desertHills && !flag
			&& this.rand.nextInt(4) == 0
			&& TerrainGen.populate(par1IChunkProvider, worldObj, rand, par2, par3, flag, LAKE))
	{
		k1 = k + this.rand.nextInt(16) + 8;
		l1 = this.rand.nextInt(256);
		i2 = l + this.rand.nextInt(16) + 8;
		(new WorldGenLakes(Blocks.coal_block)).generate(this.worldObj, this.rand, new BlockPos(k1, l1, i2));
	}

	if (TerrainGen.populate(par1IChunkProvider, worldObj, rand, par2, par3, flag, LAVA) && !flag
			&& this.rand.nextInt(8) == 0)
	{
		k1 = k + this.rand.nextInt(16) + 8;
		l1 = this.rand.nextInt(this.rand.nextInt(248) + 8);
		i2 = l + this.rand.nextInt(16) + 8;

		if (l1 < 63 || this.rand.nextInt(10) == 0)
		{
			(new WorldGenLakes(Blocks.coal_block)).generate(this.worldObj, this.rand, new BlockPos(k1, l1, i2));
		}
	}
	biomegenbase.decorate(this.worldObj, this.rand, new BlockPos(k, 0, l));
	SpawnerAnimals.performWorldGenSpawning(this.worldObj, biomegenbase, k + 8, l + 8, 16, 16, this.rand);
	k += 8;
	l += 8;

	MinecraftForge.EVENT_BUS
			.post(new PopulateChunkEvent.Post(par1IChunkProvider, worldObj, rand, par2, par3, flag));

	BlockFalling.fallInstantly = false;
}
 
開發者ID:sokratis12GR,項目名稱:MoreDimensions,代碼行數:55,代碼來源:CoalDimension.java

示例11: populate

import net.minecraftforge.event.terraingen.TerrainGen; //導入方法依賴的package包/類
/**
 * Populates chunk with ores etc etc
 */
public void populate(IChunkProvider p_73153_1_, int p_73153_2_, int p_73153_3_)
{
	BlockFalling.fallInstantly = true;
	int k = p_73153_2_ * 16;
	int l = p_73153_3_ * 16;
	BiomeGenBase biomegenbase = this.worldObj.getBiomeGenForCoords(k + 16, l + 16);
	this.rand.setSeed(this.worldObj.getSeed());
	long i1 = this.rand.nextLong() / 2L * 2L + 1L;
	long j1 = this.rand.nextLong() / 2L * 2L + 1L;
	this.rand.setSeed((long)p_73153_2_ * i1 + (long)p_73153_3_ * j1 ^ this.worldObj.getSeed());
	boolean flag = false;

	//TODO: add registry for planets
	boolean populationFlag = ((WorldProviderPlanet)worldObj.provider).getDimensionProperties(k, l).hasRivers();
	
	if(populationFlag )
		MinecraftForge.EVENT_BUS.post(new PopulateChunkEvent.Pre(p_73153_1_, worldObj, rand, p_73153_2_, p_73153_3_, flag));

	if (this.mapFeaturesEnabled)
	{
		//TODO: maybe features
	}


	biomegenbase.decorate(this.worldObj, this.rand, k, l);
	if (TerrainGen.populate(p_73153_1_, worldObj, rand, p_73153_2_, p_73153_3_, flag, ANIMALS))
	{
		SpawnerAnimals.performWorldGenSpawning(this.worldObj, biomegenbase, k + 8, l + 8, 16, 16, this.rand);
	}
	k += 8;
	l += 8;

	//If a planet is terraformed chenge upper blocks
	if(zmaster587.advancedRocketry.api.Configuration.allowTerraforming && worldObj.provider.getClass() == WorldProviderPlanet.class) {

		if(DimensionManager.getInstance().getDimensionProperties(worldObj.provider.dimensionId).isTerraformed()) {
			Chunk chunk = worldObj.getChunkFromChunkCoords(p_73153_2_, p_73153_3_);
			PlanetEventHandler.modifyChunk(worldObj, (WorldProviderPlanet)worldObj.provider, chunk);
		}
	}
	
	if (populationFlag)
		MinecraftForge.EVENT_BUS.post(new PopulateChunkEvent.Post(p_73153_1_, worldObj, rand, p_73153_2_, p_73153_3_, flag));

	OreGenProperties oreGenProperties = DimensionManager.getInstance().getDimensionProperties(this.worldObj.provider.dimensionId).getOreGenProperties(this.worldObj);
	
	if(oreGenProperties != null) {
		for(OreEntry entry : oreGenProperties.getOreEntries()) {
			new CustomizableOreGen(entry).generate(rand, p_73153_2_, p_73153_3_, this.worldObj, this, this.worldObj.getChunkProvider());
		}
	}
	
	BlockFalling.fallInstantly = false;
}
 
開發者ID:zmaster587,項目名稱:AdvancedRocketry,代碼行數:58,代碼來源:ChunkProviderPlanet.java

示例12: populate

import net.minecraftforge.event.terraingen.TerrainGen; //導入方法依賴的package包/類
/**
 * Populates chunk with ores etc etc
 */
public void populate(IChunkProvider par1IChunkProvider, int par2, int par3) {
	BlockFalling.fallInstantly = true;
	int k = par2 * 16;
	int l = par3 * 16;
	BiomeGenBase biomegenbase = this.worldObj.getBiomeGenForCoords(k + 16, l + 16);
	this.rand.setSeed(this.worldObj.getSeed());
	long i1 = this.rand.nextLong() / 2L * 2L + 1L;
	long j1 = this.rand.nextLong() / 2L * 2L + 1L;
	this.rand.setSeed((long) par2 * i1 + (long) par3 * j1 ^ this.worldObj.getSeed());
	boolean flag = false;

	MinecraftForge.EVENT_BUS.post(new PopulateChunkEvent.Pre(par1IChunkProvider, worldObj, rand, par2, par3, flag));

	if (this.mapFeaturesEnabled) {
		this.mineshaftGenerator.generateStructuresInChunk(this.worldObj, this.rand, par2, par3);
		flag = this.villageGenerator.generateStructuresInChunk(this.worldObj, this.rand, par2, par3);
		this.strongholdGenerator.generateStructuresInChunk(this.worldObj, this.rand, par2, par3);
		this.scatteredFeatureGenerator.generateStructuresInChunk(this.worldObj, this.rand, par2, par3);
	}

	int k1;
	int l1;
	int i2;

	if (biomegenbase != BiomeGenBase.desert && biomegenbase != BiomeGenBase.desertHills && !flag && this.rand.nextInt(4) == 0 && TerrainGen.populate(par1IChunkProvider, worldObj, rand, par2, par3, flag, LAKE)) {

		k1 = k + this.rand.nextInt(16) + 8;
		l1 = this.rand.nextInt(256);
		i2 = l + this.rand.nextInt(16) + 8;
		(new WorldGenLakesTDE(Blocks.water)).generate(this.worldObj, this.rand, k1, l1, i2);
	}
	
	if (TerrainGen.populate(par1IChunkProvider, worldObj, rand, par2, par3, flag, LAVA) && !flag && this.rand.nextInt(8) == 0) {
		k1 = k + this.rand.nextInt(16) + 8;
		l1 = this.rand.nextInt(this.rand.nextInt(248) + 8);
		i2 = l + this.rand.nextInt(16) + 8;

		if (l1 < 63 || this.rand.nextInt(10) == 0) {
			(new WorldGenLakesTDE(Blocks.lava)).generate(this.worldObj, this.rand, k1, l1, i2);
		}
	}

	boolean doGen = TerrainGen.populate(par1IChunkProvider, worldObj, rand, par2, par3, flag, DUNGEON);
	for (k1 = 0; doGen && k1 < 8; ++k1) {
		l1 = k + this.rand.nextInt(16) + 8;
		i2 = this.rand.nextInt(256);
		int j2 = l + this.rand.nextInt(16) + 8;
		(new WorldGenDungeons()).generate(this.worldObj, this.rand, l1, i2, j2);
	}

	biomegenbase.decorate(this.worldObj, this.rand, k, l);
	if (TerrainGen.populate(par1IChunkProvider, worldObj, rand, par2, par3, flag, ANIMALS)) {
		SpawnerAnimals.performWorldGenSpawning(this.worldObj, biomegenbase, k + 8, l + 8, 16, 16, this.rand);
	}
	k += 8;
	l += 8;

	doGen = TerrainGen.populate(par1IChunkProvider, worldObj, rand, par2, par3, flag, ICE);
	for (k1 = 0; doGen && k1 < 16; ++k1) {
		for (l1 = 0; l1 < 16; ++l1) {
			i2 = this.worldObj.getPrecipitationHeight(k + k1, l + l1);

			if (this.worldObj.isBlockFreezable(k1 + k, i2 - 1, l1 + l)) {
				this.worldObj.setBlock(k1 + k, i2 - 1, l1 + l, Blocks.ice, 0, 2);
			}

			if (this.worldObj.func_147478_e(k1 + k, i2, l1 + l, true)) {
				this.worldObj.setBlock(k1 + k, i2, l1 + l, Blocks.snow_layer, 0, 2);
			}
		}

	}

	MinecraftForge.EVENT_BUS.post(new PopulateChunkEvent.Post(par1IChunkProvider, worldObj, rand, par2, par3, flag));

	BlockFalling.fallInstantly = false;
}
 
開發者ID:TheDarkEra,項目名稱:TheDarkEra,代碼行數:81,代碼來源:TDEChunkProvider.java

示例13: populate

import net.minecraftforge.event.terraingen.TerrainGen; //導入方法依賴的package包/類
@Override
public void populate(IChunkProvider chunkProvider, int chunkX, int chunkZ) {
	BlockFalling.fallInstantly = true;
	int x = chunkX * 16;
	int z = chunkZ * 16;
	BiomeGenBase biome = world.getBiomeGenForCoords(x + 16, z + 16);
	random.setSeed(world.getSeed());
	long randLong1 = random.nextLong() / 2L * 2L + 1L;
	long randLong2 = random.nextLong() / 2L * 2L + 1L;
	random.setSeed((long) chunkX * randLong1 + (long) chunkZ * randLong2 ^ world.getSeed());
	boolean flag = false;
	MinecraftForge.EVENT_BUS.post(new PopulateChunkEvent.Pre(chunkProvider, world, random, chunkX, chunkZ, flag));
	if(mapFeaturesEnabled) {
		populateMapGenerators(chunkProvider, chunkX, chunkX);
	}
	int xx;
	int yy;
	int zz;
	if(biome != BiomeGenBase.desert && biome != BiomeGenBase.desertHills && !flag && random.nextInt(4) == 0 && TerrainGen.populate(chunkProvider, world, random, chunkX, chunkZ, flag, LAKE)) {
		xx = x + random.nextInt(16) + 8;
		yy = random.nextInt(256);
		zz = z + random.nextInt(16) + 8;
		(new WorldGenLakes(Blocks.water)).generate(world, random, xx, yy, zz);
	}
	if(TerrainGen.populate(chunkProvider, world, random, chunkX, chunkZ, flag, LAVA) && !flag && this.random.nextInt(8) == 0) {
		xx = x + random.nextInt(16) + 8;
		yy = random.nextInt(random.nextInt(248) + 8);
		zz = z + random.nextInt(16) + 8;
		if(yy < 63 || random.nextInt(10) == 0) {
			(new WorldGenLakes(Blocks.lava)).generate(world, random, xx, yy, zz);
		}
	}
	boolean doGen = TerrainGen.populate(chunkProvider, world, random, chunkX, chunkZ, flag, DUNGEON);
	for(xx = 0; doGen && xx < 8; ++xx) {
		yy = x + random.nextInt(16) + 8;
		zz = random.nextInt(256);
		int j2 = z + random.nextInt(16) + 8;
		(new WorldGenDungeons()).generate(world, random, yy, zz, j2);
	}

	if(biome instanceof AgeBiome) {
		AgeBiome ageBiome = (AgeBiome) biome;
		ageBiome.chunkProvider = this;
		ageBiome.decorate(world, random, x, z);
		ageBiome.chunkProvider = null;
	} else {
		biome.decorate(world, random, x, z);
	}
	SpawnerAnimals.performWorldGenSpawning(world, biome, x + 8, z + 8, 16, 16, random);
	x += 8;
	z += 8;

	doGen = TerrainGen.populate(chunkProvider, world, random, chunkX, chunkZ, flag, ICE);
	for(xx = 0; doGen && xx < 16; ++xx) {
		for(yy = 0; yy < 16; ++yy) {
			zz = world.getPrecipitationHeight(x + xx, z + yy);
			if(world.isBlockFreezable(xx + x, zz - 1, yy + z)) {
				world.setBlock(xx + x, zz - 1, yy + z, Blocks.ice, 0, 2);
			}
			if(world.func_147478_e(xx + x, zz, yy + z, true)) {
				world.setBlock(xx + x, zz, yy + z, Blocks.snow_layer, 0, 2);
			}
		}
	}
	MinecraftForge.EVENT_BUS.post(new PopulateChunkEvent.Post(chunkProvider, world, random, chunkX, chunkZ, flag));
	BlockFalling.fallInstantly = false;
}
 
開發者ID:AgeCraft,項目名稱:AgeCraft-Old,代碼行數:68,代碼來源:AgeChunkProvider.java

示例14: populate

import net.minecraftforge.event.terraingen.TerrainGen; //導入方法依賴的package包/類
/**
 * Populates chunk with ores etc etc
 */
public void populate(IChunkProvider par1IChunkProvider, int par2, int par3) {
	BlockSand.fallInstantly = true;
	int k = par2 * 16;
	int l = par3 * 16;
	BiomeGenBase biomegenbase = this.worldObj.getBiomeGenForCoords(k + 16, l + 16);
	this.rand.setSeed(this.worldObj.getSeed());
	long i1 = this.rand.nextLong() / 2L * 2L + 1L;
	long j1 = this.rand.nextLong() / 2L * 2L + 1L;
	this.rand.setSeed((long) par2 * i1 + (long) par3 * j1 ^ this.worldObj.getSeed());
	boolean flag = false;

	MinecraftForge.EVENT_BUS.post(new PopulateChunkEvent.Pre(par1IChunkProvider, worldObj, rand, par2, par3, flag));

	if (this.mapFeaturesEnabled) {
		this.mineshaftGenerator.generateStructuresInChunk(this.worldObj, this.rand, par2, par3);
		flag = this.villageGenerator.generateStructuresInChunk(this.worldObj, this.rand, par2, par3);
		this.strongholdGenerator.generateStructuresInChunk(this.worldObj, this.rand, par2, par3);
		this.scatteredFeatureGenerator.generateStructuresInChunk(this.worldObj, this.rand, par2, par3);
	}

	int k1;
	int l1;
	int i2;

	if (TerrainGen.populate(par1IChunkProvider, worldObj, rand, par2, par3, flag, LAKE) && !flag && this.rand.nextInt(4) == 0) {
		k1 = k + this.rand.nextInt(16) + 8;
		l1 = this.rand.nextInt(128);
		i2 = l + this.rand.nextInt(16) + 8;
		(new WorldGenLakes(Block.waterStill.blockID)).generate(this.worldObj, this.rand, k1, l1, i2);
	}

	if (TerrainGen.populate(par1IChunkProvider, worldObj, rand, par2, par3, flag, LAVA) && !flag && this.rand.nextInt(8) == 0) {
		k1 = k + this.rand.nextInt(16) + 8;
		l1 = this.rand.nextInt(this.rand.nextInt(120) + 8);
		i2 = l + this.rand.nextInt(16) + 8;

		if (l1 < 63 || this.rand.nextInt(10) == 0) {
			(new WorldGenLakes(Block.lavaStill.blockID)).generate(this.worldObj, this.rand, k1, l1, i2);
		}
	}

	boolean doGen = TerrainGen.populate(par1IChunkProvider, worldObj, rand, par2, par3, flag, DUNGEON);
	for (k1 = 0; doGen && k1 < 8; ++k1) {
		l1 = k + this.rand.nextInt(16) + 8;
		i2 = this.rand.nextInt(128);
		int j2 = l + this.rand.nextInt(16) + 8;

		if ((new WorldGenDungeons()).generate(this.worldObj, this.rand, l1, i2, j2)) {
			;
		}
	}

	biomegenbase.decorate(this.worldObj, this.rand, k, l);
	SpawnerAnimals.performWorldGenSpawning(this.worldObj, biomegenbase, k + 8, l + 8, 16, 16, this.rand);
	k += 8;
	l += 8;

	doGen = TerrainGen.populate(par1IChunkProvider, worldObj, rand, par2, par3, flag, ICE);
	for (k1 = 0; doGen && k1 < 16; ++k1) {
		for (l1 = 0; l1 < 16; ++l1) {
			i2 = this.worldObj.getPrecipitationHeight(k + k1, l + l1);

			if (this.worldObj.isBlockFreezable(k1 + k, i2 - 1, l1 + l)) {
				this.worldObj.setBlock(k1 + k, i2 - 1, l1 + l, Block.ice.blockID, 0, 2);
			}

			if (this.worldObj.canSnowAt(k1 + k, i2, l1 + l)) {
				this.worldObj.setBlock(k1 + k, i2, l1 + l, Block.snow.blockID, 0, 2);
			}
		}
	}

	MinecraftForge.EVENT_BUS.post(new PopulateChunkEvent.Post(par1IChunkProvider, worldObj, rand, par2, par3, flag));

	BlockSand.fallInstantly = false;
}
 
開發者ID:ChistaMisuto,項目名稱:Eldritch-Infusion,代碼行數:80,代碼來源:ChunkProviderEI.java

示例15: populate

import net.minecraftforge.event.terraingen.TerrainGen; //導入方法依賴的package包/類
/**
 * Populates chunk with ores etc etc
 */
public void populate(IChunkProvider par1IChunkProvider, int par2, int par3) {
	BlockSand.fallInstantly = true;
	int k = par2 * 16;
	int l = par3 * 16;
	BiomeGenBase biomegenbase = this.worldObj.getBiomeGenForCoords(k + 16, l + 16);
	this.rand.setSeed(this.worldObj.getSeed());
	long i1 = this.rand.nextLong() / 2L * 2L + 1L;
	long j1 = this.rand.nextLong() / 2L * 2L + 1L;
	this.rand.setSeed((long) par2 * i1 + (long) par3 * j1 ^ this.worldObj.getSeed());
	boolean flag = false;

	MinecraftForge.EVENT_BUS.post(new PopulateChunkEvent.Pre(par1IChunkProvider, worldObj, rand, par2, par3, flag));

	if (this.mapFeaturesEnabled) {
		this.mineshaftGenerator.generateStructuresInChunk(this.worldObj, this.rand, par2, par3);
		flag = this.villageGenerator.generateStructuresInChunk(this.worldObj, this.rand, par2, par3);
		this.strongholdGenerator.generateStructuresInChunk(this.worldObj, this.rand, par2, par3);
		this.scatteredFeatureGenerator.generateStructuresInChunk(this.worldObj, this.rand, par2, par3);
	}

	int k1;
	int l1;
	int i2;

	if (TerrainGen.populate(par1IChunkProvider, worldObj, rand, par2, par3, flag, LAKE) && !flag && this.rand.nextInt(4) == 0) {
		k1 = k + this.rand.nextInt(16) + 8;
		l1 = this.rand.nextInt(128);
		i2 = l + this.rand.nextInt(16) + 8;
		(new WorldGenLakes(Blocks.water)).generate(this.worldObj, this.rand, k1, l1, i2);
	}

	if (TerrainGen.populate(par1IChunkProvider, worldObj, rand, par2, par3, flag, LAVA) && !flag && this.rand.nextInt(8) == 0) {
		k1 = k + this.rand.nextInt(16) + 8;
		l1 = this.rand.nextInt(this.rand.nextInt(120) + 8);
		i2 = l + this.rand.nextInt(16) + 8;

		if (l1 < 63 || this.rand.nextInt(10) == 0) {
			(new WorldGenLakes(Blocks.lava)).generate(this.worldObj, this.rand, k1, l1, i2);
		}
	}

	boolean doGen = TerrainGen.populate(par1IChunkProvider, worldObj, rand, par2, par3, flag, DUNGEON);
	for (k1 = 0; doGen && k1 < 8; ++k1) {
		l1 = k + this.rand.nextInt(16) + 8;
		i2 = this.rand.nextInt(128);
		int j2 = l + this.rand.nextInt(16) + 8;

		if ((new WorldGenDungeons()).generate(this.worldObj, this.rand, l1, i2, j2)) {
			;
		}
	}

	biomegenbase.decorate(this.worldObj, this.rand, k, l);
	SpawnerAnimals.performWorldGenSpawning(this.worldObj, biomegenbase, k + 8, l + 8, 16, 16, this.rand);
	k += 8;
	l += 8;

	doGen = TerrainGen.populate(par1IChunkProvider, worldObj, rand, par2, par3, flag, ICE);
	for (k1 = 0; doGen && k1 < 16; ++k1) {
		for (l1 = 0; l1 < 16; ++l1) {
			i2 = this.worldObj.getPrecipitationHeight(k + k1, l + l1);

			if (this.worldObj.isBlockFreezable(k1 + k, i2 - 1, l1 + l)) {
				this.worldObj.setBlock(k1 + k, i2 - 1, l1 + l, Blocks.ice, 0, 2);
			}

			if (this.worldObj.canSnowAt(k1 + k, i2, l1 + l)) {
				this.worldObj.setBlock(k1 + k, i2, l1 + l, Blocks.snow, 0, 2);
			}
		}
	}

	MinecraftForge.EVENT_BUS.post(new PopulateChunkEvent.Post(par1IChunkProvider, worldObj, rand, par2, par3, flag));

	BlockSand.fallInstantly = false;
}
 
開發者ID:ChistaMisuto,項目名稱:Eldritch-Infusion,代碼行數:80,代碼來源:ChunkProviderEI.java


注:本文中的net.minecraftforge.event.terraingen.TerrainGen.populate方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。