当前位置: 首页>>代码示例>>Java>>正文


Java WorldEntitySpawner.performWorldGenSpawning方法代码示例

本文整理汇总了Java中net.minecraft.world.WorldEntitySpawner.performWorldGenSpawning方法的典型用法代码示例。如果您正苦于以下问题:Java WorldEntitySpawner.performWorldGenSpawning方法的具体用法?Java WorldEntitySpawner.performWorldGenSpawning怎么用?Java WorldEntitySpawner.performWorldGenSpawning使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.minecraft.world.WorldEntitySpawner的用法示例。


在下文中一共展示了WorldEntitySpawner.performWorldGenSpawning方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: populate

import net.minecraft.world.WorldEntitySpawner; //导入方法依赖的package包/类
@Override
public void populate(int chunkX, int chunkZ)
{
	int x = chunkX * 16;
	int z = chunkZ * 16;

	BlockPos pos = new BlockPos(x, 0, z);

	Biome biome = this.worldObj.getBiome(pos.add(16, 0, 16));

	this.rand.setSeed(this.worldObj.getSeed());
       long l1 = (this.rand.nextLong() / 2L) * 2L + 1L;
       long l2 = (this.rand.nextLong() / 2L) * 2L + 1L;
       this.rand.setSeed((long)chunkX * l1 + (long)chunkZ * l2 ^ this.worldObj.getSeed());

	biome.decorate(this.worldObj, this.rand, pos);

   	if (gumCount < 800)
   	{
   		++gumCount;
   	}
   	else if (this.rand.nextInt(100) == 0)
   	{
   		boolean resetCounter = false;
   		
   		resetCounter = this.golden_island.generate(this.worldObj, this.rand, pos.add(this.rand.nextInt(16) + 8, this.rand.nextInt(64) + 32, this.rand.nextInt(16) + 8));

   		if (resetCounter)
   		{
   			gumCount = 0;
   		}
   	}

	if (this.rand.nextInt(3) == 0)
       {
        this.dungeon_bronze.generate(this.worldObj, this.rand, pos.add(this.rand.nextInt(16), this.rand.nextInt(64) + 32, this.rand.nextInt(16)));
       }

	if(this.rand.nextInt(500) == 0)
	{
		BlockPos newPos = pos.add(this.rand.nextInt(16), this.rand.nextInt(32) + 64, this.rand.nextInt(16));

        this.dungeon_silver.generate(this.worldObj, this.rand, newPos);
	}

	WorldEntitySpawner.performWorldGenSpawning(this.worldObj, biome, x + 8, z + 8, 16, 16, this.rand);
}
 
开发者ID:Modding-Legacy,项目名称:Aether-Legacy,代码行数:48,代码来源:ChunkProviderAether.java

示例2: populate

import net.minecraft.world.WorldEntitySpawner; //导入方法依赖的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


注:本文中的net.minecraft.world.WorldEntitySpawner.performWorldGenSpawning方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。