Java 类net.minecraft.world.gen.feature.WorldGenerator 实例源码

项目:Got-Wood    文件:BlockFruitSapling.java   
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);
}
  }
项目:CustomWorldGen    文件:BiomeHills.java   
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));
}
项目:ExPetrum    文件:ExPBiomeDecorator.java   
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);
}
项目:ExPetrum    文件:ExPBiomeDecorator.java   
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);
}
项目:CrystalMod    文件:BlockNormalSapling.java   
@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);
    }
}
项目:Naschkatze    文件:WorldGenNkOre.java   
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);
    }
}
项目:TFCTech    文件:WorldGenHevea.java   
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);
        }
    }
}
项目:AntiMatterMod    文件:OreGeneratorEntry.java   
/**
 * 鉱石生成システムのエントリー<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;
        }

    }

}
项目:Cyclic    文件:WorldGenEndOre.java   
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);
    // }
  }
}
项目:Cyclic    文件:WorldGenGoldRiver.java   
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);
    }
  }
}
项目:Cyclic    文件:WorldGenEmeraldHeight.java   
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);
    }
  }
}
项目:Cyclic    文件:WorldGenNetherOre.java   
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);
    // }
  }
}
项目:BigTrees    文件:KTreeDecorate.java   
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());
}
项目:Cooking-with-TFC    文件:BlockCustomSapling.java   
@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();
        }
    }
}
项目:Cooking-with-TFC    文件:WorldGenTrees.java   
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);
}
项目:Cooking-with-TFC    文件:WorldGenTrees.java   
private void generateTrees(Random random, int chunkX, int chunkZ, World world)
{
    int xCoord = chunkX;
    int yCoord = Global.SEALEVEL + 1;
    int zCoord = chunkZ;

    WorldGenerator worldGen = new WorldGenShortTrees(false, 0);
    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.getTopSolidOrLiquidBlock(xCoord, zCoord);            
        temperature = TFC_Climate.getBioTemperatureHeight(world, xCoord, yCoord, zCoord);

        if (shouldtreeSpawn(random, 0.25f, 2, 250f, 1200f, 5, 25, 100))
            worldGen.generate(world, random, xCoord, yCoord, zCoord);
    }
}
项目:AdvancedRocketry    文件:BlockAlienSapling.java   
@Override
public void func_149878_d(World world, int x, int y, int z, Random random)
{
    if (!net.minecraftforge.event.terraingen.TerrainGen.saplingGrowTree(world, random, x, y, z)) 
        return;

    int l = world.getBlockMetadata(x, y, z) & 7;
    Object object = new WorldGenAlienTree(true);
    int i1 = 0;
    int j1 = 0;

    if (!((WorldGenerator)object).generate(world, random, x + i1, y, z + j1))
    {
        world.setBlock(x, y, z, this, l, 4);
    }
}
项目:MineFantasy    文件:BlockSaplingMF.java   
/**
 * Attempts to grow a sapling into a tree
 */
public void growTree(World world, int x, int y, int z, Random rand)
{
    if (!TerrainGen.saplingGrowTree(world, rand, x, y, z)) return;

    int l = world.getBlockMetadata(x, y, z) & 3;
    Object object = null;
    int i1 = 0;
    int j1 = 0;
    boolean flag = false;

    if (l == 1)
    {
        object = new WorldGenEbony(true);
    }
    else
    {
        object = new WorldGenIronbarkTree(true);
    }
    world.setBlock(x, y, z, 0, 0, 4);

    if (!((WorldGenerator)object).generate(world, rand, x + i1, y, z + j1))
    {
            world.setBlock(x, y, z, this.blockID, l, 4);
    }
}
项目:MiscUtils    文件:WorldGenUtils.java   
public static void RegisterWorldGenerator(WorldGenerator gen, String Name, int Chance, int MaxY,  BiomeGenBase[] Biomes, World world, Random rand, int x, int y, int z, ConfigBase config){
    if(config.IsWorldGeneratorEnabled(Name)){
        int Ch = config.GetWorldGenerationChance(Name, Chance);
        ArrayList<BiomeGenBase> list = new ArrayList<BiomeGenBase>();

        if(Biomes != null)
            for(int i = 0; i < Biomes.length; i++)
                list.add(Biomes[i]);


        if(list.contains(world.getBiomeGenForCoords(x, y)) || list.size() <= 0) {
            for (int j = 0; j < Ch; j++) {
                gen.generate(world, rand, x + rand.nextInt(16), y + rand.nextInt(MaxY), z + rand.nextInt(16));
            }
        }


    }
}
项目:Runes-And-Silver    文件:ForestTreeSeed.java   
/**
 * Attempts to grow a sapling into a tree
 */
public void growTree(World par1World, int par2, int par3, int par4, Random par5Random)
{
    if (!TerrainGen.saplingGrowTree(par1World, par5Random, par2, par3, par4)) return;

    int l = par1World.getBlockMetadata(par2, par3, par4) & 3;
    Object object = null;
    int i1 = 0;
    int j1 = 0;
   boolean flag = false;
   object = new ForestTree();

        par1World.setBlock(par2, par3, par4, 0, 0, 4);


    if (!((WorldGenerator)object).generate(par1World, par5Random, par2 + i1, par3, par4 + j1))
    {

            par1World.setBlock(par2, par3, par4, this.blockID, l, 4);
        }
    }
项目:ForestryLegacy    文件:BlockFirSapling.java   
/**
 * Handles bonemeal usage for fir saplings type.
 */
// / FIXME: This is gone.
// @Override
public boolean onUseBonemeal(World world, int bid, int i, int j, int k) {
    if (bid != ForestryBlock.firsapling.blockID)
        return false;

    int type = world.getBlockMetadata(i, j, k) & 0x03;

    WorldGenerator generator;
    if (type != 2) {
        generator = createTreeGenerator(world, type);
    } else {
        generator = new WorldGenBigMushroom();
    }

    world.setBlockAndMetadata(i, j, k, 0, 0);
    if (!generator.generate(world, world.rand, i, j, k)) {
        world.setBlockAndMetadata(i, j, k, ForestryBlock.firsapling.blockID, type);
        return false;
    }
    return true;
}
项目:GardenCollection    文件:GardenCoreIntegration.java   
@Override
public boolean applyBonemeal (World world, int x, int y, int z, BlockGarden hostBlock, int slot) {
    Block plantBlock = hostBlock.getPlantBlockFromSlot(world, x, y, z, slot);
    if (plantBlock == null)
        return false;

    Item sapling = Item.getItemFromBlock(plantBlock);
    int saplingMeta = hostBlock.getPlantMetaFromSlot(world, x, y, z, slot);

    WorldGenerator generator = (WorldGenerator) SaplingRegistry.instance().getExtendedData(sapling, saplingMeta, "sm_generator");
    if (generator == null)
        return false;

    NBTTagCompound storedTE = hostBlock.saveAndClearPlantedContents(world, x, y, z);

    if (!generator.generate(world, world.rand, x, y + 1, z))
        hostBlock.restorePlantedContents(world, x, y, z, storedTE);

    return true;
}
项目:GardenCollection    文件:ForgeEventHandler.java   
@SubscribeEvent
public void applyEnrichedSoil (EnrichedSoilEvent event) {
    if (!GardenTrees.config.compostGrowsOrnamentalTrees)
        return;

    Item sapling = Item.getItemFromBlock(event.block);
    int saplingMeta = event.world.getBlockMetadata(event.x, event.y, event.z);
    if (sapling == null)
        return;

    WorldGenerator generator = (WorldGenerator) SaplingRegistry.instance().getExtendedData(sapling, saplingMeta, "sm_generator");
    if (generator == null)
        return;

    event.world.setBlockToAir(event.x, event.y, event.z);

    if (generator.generate(event.world, event.world.rand, event.x, event.y, event.z)) {
        event.setResult(Event.Result.ALLOW);
        return;
    }

    event.world.setBlock(event.x, event.y, event.z, event.block, saplingMeta, 0);
}
项目:Extra-Food    文件:OliveTreeSapling.java   
@Override
public void generateTree(World worldIn, BlockPos pos, IBlockState state, Random rand)
{
    if (!net.minecraftforge.event.terraingen.TerrainGen.saplingGrowTree(worldIn, rand, pos)) return;
    Object object = rand.nextInt(14) == 0 ? new WorldGenBigTree(true) :  new OliveWorldGenTrees(false, 6, 3, 3, true);
    int i1 = 0;
    int j1 = 0;



    IBlockState iblockstate1 = Blocks.AIR.getDefaultState();
    worldIn.setBlockState(pos, iblockstate1, 4);


    if (!((WorldGenerator)object).generate(worldIn, rand, pos.add(i1, 0, j1)))
    {
        worldIn.setBlockState(pos, state, 4);
    }
}
项目:Extra-Food    文件:OrangeTreeSapling.java   
@Override
public void generateTree(World worldIn, BlockPos pos, IBlockState state, Random rand)
{
    if (!net.minecraftforge.event.terraingen.TerrainGen.saplingGrowTree(worldIn, rand, pos)) return;
    Object object = new OrangeTreeGenerator();
    int i1 = 0;
    int j1 = 0;



    IBlockState iblockstate1 = Blocks.AIR.getDefaultState();
    worldIn.setBlockState(pos, iblockstate1, 4);


    if (!((WorldGenerator)object).generate(worldIn, rand, pos.add(i1, 0, j1)))
    {
        worldIn.setBlockState(pos, state, 4);
    }
}
项目:Extra-Food    文件:BananaTreeSapling.java   
public void generateTree(World worldIn, BlockPos pos, IBlockState state, Random rand)
{
    if (!net.minecraftforge.event.terraingen.TerrainGen.saplingGrowTree(worldIn, rand, pos)) return;
    Object object = rand.nextInt(14) == 0 ? new WorldGenBigTree(true) :  new BananaWorldGenTrees(false, 6, 3, 3, true);
    int i1 = 0;
    int j1 = 0;



    IBlockState iblockstate1 = Blocks.AIR.getDefaultState();
    worldIn.setBlockState(pos, iblockstate1, 4);


    if (!((WorldGenerator)object).generate(worldIn, rand, pos.add(i1, 0, j1)))
    {
        worldIn.setBlockState(pos, state, 4);
    }
}
项目:CherryPig    文件:CPCherrySapling.java   
@Override
public void generateTree(World worldIn, BlockPos pos, IBlockState state, Random rand)
{
    if (!TerrainGen.saplingGrowTree(worldIn, rand, pos)) return;
    WorldGenerator worldgenerator;// = (WorldGenerator)(rand.nextInt(10) == 0 ? new WorldGenBigTree(true) : new WorldGenTrees(true));
    int i = 0;
    int j = 0;
    boolean flag = false;

    worldgenerator = new CPCherryTreeGen(4, false);

    IBlockState iblockstate2 = Blocks.AIR.getDefaultState();

    worldIn.setBlockState(pos, iblockstate2, 4);

    if (!worldgenerator.generate(worldIn, rand, pos.add(i, 0, j)))
    {
        worldIn.setBlockState(pos, state, 4);
    }
}
项目:ThermionicsWorld    文件:NeoBiome.java   
@Override
public void decorate(World worldIn, Random random, BlockPos pos) {
    for(WorldGenerator generator : generators) {
        for(int i=0; i<3; i++) {
            BlockPos relative = new BlockPos(
                    pos.getX() + random.nextInt(16) + 8,
                    random.nextInt(128) + 64,
                    pos.getZ() + random.nextInt(16) + 8
                    );
            generator.generate(worldIn, random, relative);
        }
    }
}
项目:harshencastle    文件:WorldGen.java   
private void runGenerator(WorldGenerator generator, World world, Random random, int chunkX, int chunkZ, int chancesPerChunk, float chancesToSpawn, int minHeight, int maxHeight) 
{
    int heightDiff = maxHeight - minHeight + 1;
    for (int i = 0; i < chancesPerChunk; i ++) 
        if(random.nextFloat() < chancesToSpawn)
        {
            int x = chunkX * 16 + random.nextInt(16);
            int y = minHeight + random.nextInt(heightDiff);
            int z = chunkZ * 16 + random.nextInt(16);
            generator.generate(world, random, new BlockPos(x, y, z));
        } 
}
项目:Steam-and-Steel    文件:BaseWorldGeneration.java   
private void lowOre(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 = 60;
    for (int i = 0; i < chancesToSpawn; i ++) {
    int x = chunk_X * 16 + rand.nextInt(16);
    int y = minHeight + rand.nextInt(heightDiff);
    int z = chunk_Z * 16 + rand.nextInt(16);
    generator.generate(world, rand, x, y, z);
    }
}
项目:Steam-and-Steel    文件:BaseWorldGeneration.java   
private void mediumOre(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 = 40;
    for (int i = 0; i < chancesToSpawn; i ++) {
    int x = chunk_X * 16 + rand.nextInt(16);
    int y = minHeight + rand.nextInt(heightDiff);
    int z = chunk_Z * 16 + rand.nextInt(16);
    generator.generate(world, rand, x, y, z);
    }
}
项目:Steam-and-Steel    文件:BaseWorldGeneration.java   
private void hardOre(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 = 20;
    for (int i = 0; i < chancesToSpawn; i ++) {
    int x = chunk_X * 16 + rand.nextInt(16);
    int y = minHeight + rand.nextInt(heightDiff);
    int z = chunk_Z * 16 + rand.nextInt(16);
    generator.generate(world, rand, x, y, z);
    }
}
项目:Steam-and-Steel    文件:BaseWorldGeneration.java   
private void netherOre(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 = 40;
    for (int i = 0; i < chancesToSpawn; i ++) {
    int x = chunk_X * 16 + rand.nextInt(16);
    int y = minHeight + rand.nextInt(heightDiff);
    int z = chunk_Z * 16 + rand.nextInt(16);
    generator.generate(world, rand, x, y, z);
    }
}
项目:DecompiledMinecraft    文件:BiomeDecorator.java   
/**
 * Standard ore generation helper. Generates most ores.
 */
protected void genStandardOre1(int blockCount, WorldGenerator generator, int minHeight, int maxHeight)
{
    if (maxHeight < minHeight)
    {
        int i = minHeight;
        minHeight = maxHeight;
        maxHeight = i;
    }
    else if (maxHeight == minHeight)
    {
        if (minHeight < 255)
        {
            ++maxHeight;
        }
        else
        {
            --minHeight;
        }
    }

    for (int j = 0; j < blockCount; ++j)
    {
        BlockPos blockpos = this.field_180294_c.add(this.randomGenerator.nextInt(16), this.randomGenerator.nextInt(maxHeight - minHeight) + minHeight, this.randomGenerator.nextInt(16));
        generator.generate(this.currentWorld, this.randomGenerator, blockpos);
    }
}
项目:DecompiledMinecraft    文件:BiomeDecorator.java   
/**
 * Standard ore generation helper. Generates Lapis Lazuli.
 */
protected void genStandardOre2(int blockCount, WorldGenerator generator, int centerHeight, int spread)
{
    for (int i = 0; i < blockCount; ++i)
    {
        BlockPos blockpos = this.field_180294_c.add(this.randomGenerator.nextInt(16), this.randomGenerator.nextInt(spread) + this.randomGenerator.nextInt(spread) + centerHeight - spread, this.randomGenerator.nextInt(16));
        generator.generate(this.currentWorld, this.randomGenerator, blockpos);
    }
}
项目:DecompiledMinecraft    文件:BiomeDecorator.java   
/**
 * Standard ore generation helper. Generates most ores.
 */
protected void genStandardOre1(int blockCount, WorldGenerator generator, int minHeight, int maxHeight)
{
    if (maxHeight < minHeight)
    {
        int i = minHeight;
        minHeight = maxHeight;
        maxHeight = i;
    }
    else if (maxHeight == minHeight)
    {
        if (minHeight < 255)
        {
            ++maxHeight;
        }
        else
        {
            --minHeight;
        }
    }

    for (int j = 0; j < blockCount; ++j)
    {
        BlockPos blockpos = this.field_180294_c.add(this.randomGenerator.nextInt(16), this.randomGenerator.nextInt(maxHeight - minHeight) + minHeight, this.randomGenerator.nextInt(16));
        generator.generate(this.currentWorld, this.randomGenerator, blockpos);
    }
}
项目:DecompiledMinecraft    文件:BiomeDecorator.java   
/**
 * Standard ore generation helper. Generates Lapis Lazuli.
 */
protected void genStandardOre2(int blockCount, WorldGenerator generator, int centerHeight, int spread)
{
    for (int i = 0; i < blockCount; ++i)
    {
        BlockPos blockpos = this.field_180294_c.add(this.randomGenerator.nextInt(16), this.randomGenerator.nextInt(spread) + this.randomGenerator.nextInt(spread) + centerHeight - spread, this.randomGenerator.nextInt(16));
        generator.generate(this.currentWorld, this.randomGenerator, blockpos);
    }
}
项目:BaseClient    文件:BiomeDecorator.java   
/**
 * Standard ore generation helper. Generates most ores.
 */
protected void genStandardOre1(int blockCount, WorldGenerator generator, int minHeight, int maxHeight)
{
    if (maxHeight < minHeight)
    {
        int i = minHeight;
        minHeight = maxHeight;
        maxHeight = i;
    }
    else if (maxHeight == minHeight)
    {
        if (minHeight < 255)
        {
            ++maxHeight;
        }
        else
        {
            --minHeight;
        }
    }

    for (int j = 0; j < blockCount; ++j)
    {
        BlockPos blockpos = this.field_180294_c.add(this.randomGenerator.nextInt(16), this.randomGenerator.nextInt(maxHeight - minHeight) + minHeight, this.randomGenerator.nextInt(16));
        generator.generate(this.currentWorld, this.randomGenerator, blockpos);
    }
}
项目:BaseClient    文件:BiomeDecorator.java   
/**
 * Standard ore generation helper. Generates Lapis Lazuli.
 */
protected void genStandardOre2(int blockCount, WorldGenerator generator, int centerHeight, int spread)
{
    for (int i = 0; i < blockCount; ++i)
    {
        BlockPos blockpos = this.field_180294_c.add(this.randomGenerator.nextInt(16), this.randomGenerator.nextInt(spread) + this.randomGenerator.nextInt(spread) + centerHeight - spread, this.randomGenerator.nextInt(16));
        generator.generate(this.currentWorld, this.randomGenerator, blockpos);
    }
}
项目:BaseClient    文件:BiomeDecorator.java   
/**
 * Standard ore generation helper. Generates most ores.
 */
protected void genStandardOre1(int blockCount, WorldGenerator generator, int minHeight, int maxHeight)
{
    if (maxHeight < minHeight)
    {
        int i = minHeight;
        minHeight = maxHeight;
        maxHeight = i;
    }
    else if (maxHeight == minHeight)
    {
        if (minHeight < 255)
        {
            ++maxHeight;
        }
        else
        {
            --minHeight;
        }
    }

    for (int j = 0; j < blockCount; ++j)
    {
        BlockPos blockpos = this.field_180294_c.add(this.randomGenerator.nextInt(16), this.randomGenerator.nextInt(maxHeight - minHeight) + minHeight, this.randomGenerator.nextInt(16));
        generator.generate(this.currentWorld, this.randomGenerator, blockpos);
    }
}