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


Java WorldGenerator类代码示例

本文整理汇总了Java中net.minecraft.world.gen.feature.WorldGenerator的典型用法代码示例。如果您正苦于以下问题:Java WorldGenerator类的具体用法?Java WorldGenerator怎么用?Java WorldGenerator使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


WorldGenerator类属于net.minecraft.world.gen.feature包,在下文中一共展示了WorldGenerator类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: generateTree

import net.minecraft.world.gen.feature.WorldGenerator; //导入依赖的package包/类
public void generateTree(World worldIn, BlockPos pos, IBlockState state, Random rand)
  {
      if (!net.minecraftforge.event.terraingen.TerrainGen.saplingGrowTree(worldIn, rand, pos)) return;
      
      
      WorldGenerator worldgenerator;

switch (wood.getName()) {
	case "banana":
	default:
		worldgenerator = new WorldGenApple(true);
}

worldIn.setBlockToAir(pos);
worldIn.setBlockToAir(pos.up());
	
if (!worldgenerator.generate(worldIn, rand, pos)) {
	worldIn.setBlockState(pos, state, 4);
}
  }
 
开发者ID:MinecraftModDevelopmentMods,项目名称:Got-Wood,代码行数:21,代码来源:BlockFruitSapling.java

示例2: decorate

import net.minecraft.world.gen.feature.WorldGenerator; //导入依赖的package包/类
public void decorate(World worldIn, Random rand, BlockPos pos)
{
    super.decorate(worldIn, rand, pos);
    net.minecraftforge.common.MinecraftForge.ORE_GEN_BUS.post(new net.minecraftforge.event.terraingen.OreGenEvent.Pre(worldIn, rand, pos));
    WorldGenerator emeralds = new EmeraldGenerator();
    if (net.minecraftforge.event.terraingen.TerrainGen.generateOre(worldIn, rand, emeralds, pos, net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.EMERALD))
        emeralds.generate(worldIn, rand, pos);

    for (int i = 0; i < 7; ++i)
    {
        int j1 = rand.nextInt(16);
        int k1 = rand.nextInt(64);
        int l1 = rand.nextInt(16);
        if (net.minecraftforge.event.terraingen.TerrainGen.generateOre(worldIn, rand, theWorldGenerator, pos.add(j1, k1, l1), net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.SILVERFISH))
        this.theWorldGenerator.generate(worldIn, rand, pos.add(j1, k1, l1));
    }
    net.minecraftforge.common.MinecraftForge.ORE_GEN_BUS.post(new net.minecraftforge.event.terraingen.OreGenEvent.Post(worldIn, rand, pos));
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:19,代码来源:BiomeHills.java

示例3: cropsPassGenerate

import net.minecraft.world.gen.feature.WorldGenerator; //导入依赖的package包/类
public void cropsPassGenerate(World worldIn, Random rand, Biome biome, BlockPos pos)
{
	if (!(biome instanceof ExPBiome))
	{
		return;
	}
	
	int x = rand.nextInt(16) + 8;
	int z = rand.nextInt(16) + 8;
	BlockPos at = worldIn.getHeight(pos.add(x, 0, z));
	
	WorldGenerator cropsGen = new CropGenerator((ExPBiome) biome);
	EventGenVegetation event = new EventGenVegetation(worldIn, at, rand, cropsGen, Type.WILD_CROP);
	if (MinecraftForge.TERRAIN_GEN_BUS.post(event))
	{
		return;
	}
	
	event.generator.generate(worldIn, rand, at);
}
 
开发者ID:V0idWa1k3r,项目名称:ExPetrum,代码行数:21,代码来源:ExPBiomeDecorator.java

示例4: beyyBushesPassGenerate

import net.minecraft.world.gen.feature.WorldGenerator; //导入依赖的package包/类
public void beyyBushesPassGenerate(World worldIn, Random rand, Biome biome, BlockPos pos)
{
    if (!(biome instanceof ExPBiome))
    {
        return;
    }

    int x = rand.nextInt(16) + 8;
    int z = rand.nextInt(16) + 8;
    BlockPos at = worldIn.getHeight(pos.add(x, 0, z));
    EnumSeason currentSeason = IExPWorld.of(worldIn).getCurrentSeason();
    EnumShrubState stateToGenerate = currentSeason == EnumSeason.WINTER ? EnumShrubState.DEAD : currentSeason == EnumSeason.AUTUMN ? EnumShrubState.AUTUMN : rand.nextFloat() < 0.3 ? EnumShrubState.BLOOMING : EnumShrubState.NORMAL;
    WorldGenerator gen = new BerryBushGenerator(stateToGenerate);
    EventGenVegetation event = new EventGenVegetation(worldIn, at, rand, gen, Type.BERRY_BUSH);
    if (MinecraftForge.TERRAIN_GEN_BUS.post(event))
    {
        return;
    }

    event.generator.generate(worldIn, rand, at);
}
 
开发者ID:V0idWa1k3r,项目名称:ExPetrum,代码行数:22,代码来源:ExPBiomeDecorator.java

示例5: generateTree

import net.minecraft.world.gen.feature.WorldGenerator; //导入依赖的package包/类
@Override
public void generateTree(@Nonnull World worldIn, @Nonnull BlockPos pos, @Nonnull IBlockState state, @Nonnull Random rand) {
	if(!net.minecraftforge.event.terraingen.TerrainGen.saplingGrowTree(worldIn, rand, pos)) {
		return;
	}
	SaplingType type = state.getValue(VARIANT);
	WorldGenerator gen = null;
	if(type == SaplingType.BAMBOO){
		gen = new WorldGenBambooTree(false);
	}		
	if(gen == null)return;
	// replace sapling with air
	worldIn.setBlockToAir(pos);
	if (!gen.generate(worldIn, rand, pos))
	{
		worldIn.setBlockState(pos, state, 4);
	}
}
 
开发者ID:Alec-WAM,项目名称:CrystalMod,代码行数:19,代码来源:BlockNormalSapling.java

示例6: runGenerator

import net.minecraft.world.gen.feature.WorldGenerator; //导入依赖的package包/类
private void runGenerator(WorldGenerator generator, World world, Random rand,
                          int chunk_x, int chunk_z, int veinsPerChunk, int minHeight, int maxHeight) {


    if(minHeight<0||maxHeight>256||minHeight>maxHeight) {

        throw new IllegalArgumentException("Illegal Height Arguments");
    }

    int heightDiff = (maxHeight - minHeight + 1);

    for (int i=0; i<veinsPerChunk; i++) {

        int x = chunk_x * 16 + rand.nextInt(16);
        int y = minHeight + rand.nextInt(heightDiff);
        int z = chunk_z * 16 + rand.nextInt(16);
        BlockPos tempPos = new BlockPos(x, y, z);
        generator.generate(world, rand, tempPos);
    }
}
 
开发者ID:secknv,项目名称:Naschkatze,代码行数:21,代码来源:WorldGenNkOre.java

示例7: generateTree

import net.minecraft.world.gen.feature.WorldGenerator; //导入依赖的package包/类
private void generateTree(Random random, int chunkX, int chunkZ, World world) {
	WorldGenerator gen = new WorldGenHeveaTree();
	int xCoord = chunkX;
	int yCoord = Global.SEALEVEL + 1;
	int zCoord = chunkZ;

	int numTrees = 1;
	if (random.nextInt(20) == 0)
		numTrees += random.nextInt(3);

	for (int var2 = 0; var2 < numTrees; ++var2) {
		xCoord = chunkX + random.nextInt(16);
		zCoord = chunkZ + random.nextInt(16);
		yCoord = world.getHeightValue(xCoord, zCoord);

		temperature = TFC_Climate.getBioTemperatureHeight(world, xCoord, world.getHeightValue(xCoord, zCoord), zCoord);

		int spawnChance = this.treeSpawnChance();
		if (random.nextInt(100) < spawnChance) {
			gen.generate(world, random, xCoord, yCoord, zCoord);
		}
	}
}
 
开发者ID:Shurgent,项目名称:TFCTech,代码行数:24,代码来源:WorldGenHevea.java

示例8: OreGeneratorEntry

import net.minecraft.world.gen.feature.WorldGenerator; //导入依赖的package包/类
/**
 * 鉱石生成システムのエントリー<br>
 * 生成高度配列の指定方法は
 * PROPERTY_OVERWORLD,10,25 -- 通常ワールドに10~25の間に生成
 * PROPERTY_HELL,150,200    -- ネザーに150~200の間に生成
 * これを1列にしたもの
 *
 * @param genMinable         ジェネレーターアルゴリズムクラス
 * @param loop               1チャンク内にジェネレートを実行する回数
 * @param isGeneratOverworld 通常世界に生成するか
 * @param isGeneratHell      ネザーに生成するか
 * @param isGeneratEnd       エンドに生成するか
 * @param limiter            生成高度配列
 */
private OreGeneratorEntry(WorldGenerator genMinable, int loop, boolean isGeneratOverworld, boolean isGeneratHell, boolean isGeneratEnd, int... limiter) {
	this.loop = loop;
	this.isGeneratOverworld = isGeneratOverworld;
	this.isGeneratHell = isGeneratHell;
	this.isGeneratEnd = isGeneratEnd;
	this.genMinable = genMinable;
	for (int i = 0; i < limiter.length; ) {
		switch (limiter[i++]) {
			case 0:
				this.minYOverworld = limiter[i++];
				this.maxYOverworld = limiter[i++];
				break;
			case 1:
				this.minYHell = limiter[i++];
				this.maxYHell = limiter[i++];
				break;
			case 2:
				this.minYEnd = limiter[i++];
				this.maxYEnd = limiter[i++];
				break;
		}
		
	}
	
}
 
开发者ID:Team-Antimatter-Mod,项目名称:AntiMatterMod,代码行数:40,代码来源:OreGeneratorEntry.java

示例9: run

import net.minecraft.world.gen.feature.WorldGenerator; //导入依赖的package包/类
private void run(WorldGenerator generator, World world, Random rand, int chunk_X, int chunk_Z, int chancesToSpawn, int minHeight, int maxHeight) {
  if (minHeight < 0 || maxHeight > 256 || minHeight > maxHeight)
    throw new IllegalArgumentException("Illegal Height Arguments for WorldGenerator");
  int heightDiff = maxHeight - minHeight;
  BlockPos pos;
  // BiomeGenBase biome;
  for (int i = 0; i < chancesToSpawn; i++) {
    int x = chunk_X + rand.nextInt(Const.CHUNK_SIZE);
    int y = minHeight + rand.nextInt(heightDiff);
    int z = chunk_Z + rand.nextInt(Const.CHUNK_SIZE);
    pos = new BlockPos(x, y, z);
    // biome = world.getBiomeGenForCoords(pos);
    // if(biome == Biomes.sky){
    generator.generate(world, rand, pos);
    // }
  }
}
 
开发者ID:PrinceOfAmber,项目名称:Cyclic,代码行数:18,代码来源:WorldGenEndOre.java

示例10: run

import net.minecraft.world.gen.feature.WorldGenerator; //导入依赖的package包/类
private void run(WorldGenerator generator, World world, Random rand, int chunk_X, int chunk_Z, int chancesToSpawn, int minHeight, int maxHeight) {
  if (minHeight < 0 || maxHeight > Const.WORLDHEIGHT || minHeight > maxHeight)
    throw new IllegalArgumentException("Illegal Height Arguments for WorldGenerator");
  int heightDiff = maxHeight - minHeight;
  BlockPos pos;
  Biome biome;
  for (int i = 0; i < chancesToSpawn; i++) {
    int x = chunk_X + rand.nextInt(Const.CHUNK_SIZE);
    int y = minHeight + rand.nextInt(heightDiff);
    int z = chunk_Z + rand.nextInt(Const.CHUNK_SIZE);
    pos = new BlockPos(x, y, z);
    biome = world.getBiome(pos);
    if (biome == Biomes.RIVER || biome == Biomes.FROZEN_RIVER) {
      generator.generate(world, rand, pos);
    }
  }
}
 
开发者ID:PrinceOfAmber,项目名称:Cyclic,代码行数:18,代码来源:WorldGenGoldRiver.java

示例11: run

import net.minecraft.world.gen.feature.WorldGenerator; //导入依赖的package包/类
private void run(WorldGenerator generator, World world, Random rand, int chunk_X, int chunk_Z, int chancesToSpawn, int minHeight, int maxHeight) {
  if (minHeight < 0 || maxHeight > Const.WORLDHEIGHT || minHeight > maxHeight)
    throw new IllegalArgumentException("Illegal Height Arguments for WorldGenerator");
  int heightDiff = maxHeight - minHeight;
  BlockPos pos;
  Biome biome;
  for (int i = 0; i < chancesToSpawn; i++) {
    int x = chunk_X + rand.nextInt(Const.CHUNK_SIZE);
    int y = minHeight + rand.nextInt(heightDiff);
    int z = chunk_Z + rand.nextInt(Const.CHUNK_SIZE);
    pos = new BlockPos(x, y, z);
    biome = world.getBiome(pos);
    if (biome == Biomes.EXTREME_HILLS || biome == Biomes.EXTREME_HILLS_EDGE || biome == Biomes.EXTREME_HILLS_WITH_TREES) {
      generator.generate(world, rand, pos);
    }
  }
}
 
开发者ID:PrinceOfAmber,项目名称:Cyclic,代码行数:18,代码来源:WorldGenEmeraldHeight.java

示例12: run

import net.minecraft.world.gen.feature.WorldGenerator; //导入依赖的package包/类
private void run(WorldGenerator generator, World world, Random rand, int chunk_X, int chunk_Z, int chancesToSpawn, int minHeight, int maxHeight) {
  if (minHeight < 0 || maxHeight > 256 || minHeight > maxHeight)
    throw new IllegalArgumentException("Illegal Height Arguments for WorldGenerator");
  int heightDiff = maxHeight - minHeight;
  BlockPos pos;
  // BiomeGenBase biome;
  for (int i = 0; i < chancesToSpawn; i++) {
    int x = chunk_X + rand.nextInt(Const.CHUNK_SIZE);
    int y = minHeight + rand.nextInt(heightDiff);
    int z = chunk_Z + rand.nextInt(Const.CHUNK_SIZE);
    pos = new BlockPos(x, y, z);
    // biome = world.getBiomeGenForCoords(pos);
    // if(biome == Biomes.hell){// no longer do this, in case some mod adds biomes to nether
    generator.generate(world, rand, pos);
    // }
  }
}
 
开发者ID:PrinceOfAmber,项目名称:Cyclic,代码行数:18,代码来源:WorldGenNetherOre.java

示例13: getGenerator

import net.minecraft.world.gen.feature.WorldGenerator; //导入依赖的package包/类
private static WorldGenerator getGenerator(Algorithm algorithm) {
	switch (algorithm) {
	case TallOak:
		return new KWorldGenTallTree(false);
	case BlockOak:
		return new WorldGenBlockOak(false);
	case GreatOak:
		return new WorldGenGreatOak(false); 
	case SwampOak:
		return new WorldGenSwampOak(false);
	case BigPine:
		return new WorldGenBigPine(false);
	case BigBirch:
		return new WorldGenBigBirch(false);
	case Dead:
		return new WorldGenDesertTree(false);
	case Cyprus:
		return new KWorldGenCyprusTree(false);
	case Hat:
		return new KWorldGenHatTree(false);
	}
	
	throw new IllegalArgumentException("Unknown algorithm: " + algorithm.toString());
}
 
开发者ID:vidaj,项目名称:BigTrees,代码行数:25,代码来源:KTreeDecorate.java

示例14: growTree

import net.minecraft.world.gen.feature.WorldGenerator; //导入依赖的package包/类
@Override
public void growTree(World world, int i, int j, int k, Random rand, long timestamp)
{
	int meta = world.getBlockMetadata(i, j, k);
	world.setBlockToAir(i, j, k);
	WorldGenerator worldGen = new WorldGenShortTrees(false, meta);
	
	if (worldGen != null && !worldGen.generate(world, rand, i, j, k))
	{
		world.setBlock(i, j, k, this, meta, 3);
		if (world.getTileEntity(i, j, k) instanceof TESapling)
		{
			TESapling te = (TESapling) world.getTileEntity(i, j, k);
			te.growTime = timestamp;
			te.enoughSpace = false;
			te.markDirty();
		}
	}
}
 
开发者ID:StrayWolfe,项目名称:Cooking-with-TFC,代码行数:20,代码来源:BlockCustomSapling.java

示例15: generateFruitTrees

import net.minecraft.world.gen.feature.WorldGenerator; //导入依赖的package包/类
private void generateFruitTrees(Random random, int chunkX, int chunkZ, World world)
{
	int xCoord = chunkX + random.nextInt(16);
	int zCoord = chunkZ + random.nextInt(16);
	int yCoord = world.getTopSolidOrLiquidBlock(xCoord, zCoord);
	int meta = random.nextInt(Constants.NUTTREETYPES.length);
	temperature = TFC_Climate.getBioTemperatureHeight(world, xCoord, yCoord, zCoord);
	
	WorldGenerator worldGen = new WorldGenFruitTrees(false, meta);

	if(meta == 1 || meta == 2)
	{
		if(shouldtreeSpawn(random, 0.25f, 2, 500f, 1200f, 25, 45, 175))
			worldGen.generate(world, random, xCoord, yCoord, zCoord);
	}
	else if(shouldtreeSpawn(random, 0.25f, 2, 500f, 1200f, 5, 25, 175))
		worldGen.generate(world, random, xCoord, yCoord, zCoord);
}
 
开发者ID:StrayWolfe,项目名称:Cooking-with-TFC,代码行数:19,代码来源:WorldGenTrees.java


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