Java 类net.minecraft.world.gen.IChunkGenerator 实例源码

项目:Loot-Slash-Conquer    文件:LSCWorldGenerator.java   
@Override
public void generate(Random rand, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider) 
{
    int blockX = chunkX * 16;
    int blockZ = chunkZ * 16;

    switch (world.provider.getDimension())
    {
        case -1: 
            generateNether(world, rand, blockX + 8, blockZ + 8);
            break;
        case 0: 
            generateOverworld(world, rand, blockX + 8, blockZ + 8);
            break;
        case 1: 
            generateEnd(world, rand, blockX + 8, blockZ + 8);
            break;
    }
}
项目:pnc-repressurized    文件:WorldGeneratorPneumaticCraft.java   
@Override
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider) {
    if (!(chunkGenerator instanceof ChunkGeneratorFlat)) { //don't generate on flatworlds
        switch (world.provider.getDimension()) {
            case 0:
                generateSurface(world, random, chunkX * 16, chunkZ * 16);
                break;
            case -1:
                generateNether(world, random, chunkX * 16, chunkZ * 16);
                break;
            case 1:
                generateEnd(world, random, chunkX * 16, chunkZ * 16);
                break;
            default:
                generateSurface(world, random, chunkX * 16, chunkZ * 16);
        }
    }
}
项目:harshencastle    文件:WorldGen.java   
@Override
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator,
        IChunkProvider chunkProvider) {

    int dim = world.provider.getDimension();
    if(dim == 0)
    {
        if(chunkX == 44 && chunkZ == 44)
            HarshenStructures.CASTLE.generateStucture(world, random, chunkX, chunkZ);
        runGenerator(this.soulore, world, random, chunkX, chunkZ, 10, 0.5f, 0, 20);
        flowerGenerator(HarshenBlocks.HARSHEN_SOUL_FLOWER, world, random, chunkX, chunkZ, 0.015f);
        flowerGenerator(HarshenBlocks.PLANT_OF_GLEAM, world, random, chunkX, chunkZ, 0.015f);
    }
    else if(dim == DimensionPontus.DIMENSION_ID)
    {
        runGenerator(this.itiumOre, world, random, chunkX, chunkZ, 15, 0.7f, 0, 255);
        runGenerator(this.pontusEmeraldOre, world, random, chunkX, chunkZ, 25, 0.3f, 0, 255);
    }
    runGenerator(jewelDirt, world, random, chunkX, chunkZ, 40, 100.0f, 0, 200);
    generateStructure(world, HarshenStructure.get(dim), random, chunkX, chunkZ);
}
项目:SimplyTea    文件:SimplyTea.java   
@Override
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator,
        IChunkProvider chunkProvider) {
    if (random.nextInt(20) == 0){
        int x = chunkX * 16 + 2 + random.nextInt(12);
        int z = chunkZ * 16 + 2 + random.nextInt(12);
        BlockPos p = new BlockPos(x,0,z);
        p = world.getHeight(p);
        Biome b = world.getBiome(p);
        if (BiomeDictionary.hasType(b, BiomeDictionary.Type.FOREST) || b == Biomes.FOREST || b == Biomes.FOREST_HILLS){
            if (world.getBlockState(p.down()).getBlock() instanceof BlockGrass && world.isAirBlock(p)){
                BlockTeaSapling.generateTree(world, p, Blocks.AIR.getDefaultState(), random);
            }
        }
    }
}
项目:Etheric    文件:EthericWorldGenerator.java   
@Override
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator,
        IChunkProvider chunkProvider) {

    StabilityHandler.addChunkData(world.provider.getDimension(), new ChunkPos(chunkX, chunkZ), StabilityHandler.generateChunkStability(random));

    if (world.provider.getDimensionType() == DimensionType.OVERWORLD) {

        WorldGenMinable lodestone = new WorldGenMinable(RegistryManager.lodestone_ore.getDefaultState(), Config.LODESTONE_VEIN_SIZE);
        for (int i = 0; i < Config.LODESTONE_FREQUENCY; i++) {
            int x = chunkX * 16 + random.nextInt(16);
            int y = random.nextInt(Config.LODESTONE_MAX_Y - Config.LODESTONE_MIN_Y) + Config.LODESTONE_MIN_Y;
            int z = chunkZ * 16 + random.nextInt(16);
            lodestone.generate(world, random, new BlockPos(x, y, z));
        }

        BlockPos pos = new BlockPos(chunkX * 16, 0, chunkZ * 16);

        WorldGenRift rift = new WorldGenRift();
        rift.generate(world, random, pos);

    }

}
项目:GardenStuff    文件:WorldGenCandelilla.java   
@Override
public void generate (Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider) {
    int x = chunkX * 16 + 8;
    int z = chunkZ * 16 + 8;

    Biome biome = world.getBiome(new BlockPos(x, 0, z));
    if (BiomeDictionary.hasType(biome, BiomeDictionary.Type.COLD ))
    if (BiomeDictionary.hasType(biome, BiomeDictionary.Type.COLD)
        || BiomeDictionary.hasType(biome, BiomeDictionary.Type.NETHER)
        || BiomeDictionary.hasType(biome, BiomeDictionary.Type.WET)
        || BiomeDictionary.hasType(biome, BiomeDictionary.Type.WASTELAND)
        || BiomeDictionary.hasType(biome, BiomeDictionary.Type.SNOWY))
        return;

    if (!BiomeDictionary.hasType(biome, BiomeDictionary.Type.SANDY))
        return;

    if (random.nextInt(15) > 0)
        return;

    generate(world, random, new BlockPos(x, world.getSeaLevel(), z));
}
项目:Solar    文件:AshenCubeStructure.java   
@Override
void gen(World world, int x, int z, IChunkGenerator generator, IChunkProvider provider) {
    random.setSeed(world.getSeed());
    long good = random.nextLong();
    long succ = random.nextLong();

    good *= x >> 1;
    succ *= z >> 1;
    random.setSeed(good ^ succ ^ world.getSeed());
    //Generate
    if(GEN_CONFIG.ASHEN_CUBE_STRUCTURE.rarity > 0D && GEN_CONFIG.ASHEN_CUBE_STRUCTURE.rarity / 100D > random.nextDouble()) {
        BlockPos center = new BlockPos(x, 15 + random.nextInt(25), z);
        if(!world.canSeeSky(center) || !GEN_CONFIG.ASHEN_CUBE_STRUCTURE.underground) {
            genCubes(world, center);
        }
    }
}
项目:Anima-Mundi    文件:AnimaWorldGenerator.java   
@Override
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider)
{
    switch(world.provider.getDimension())
    {
        case -1:

            break;

        case 0:
            genSurface(world, random, chunkX, chunkZ, chunkGenerator, chunkProvider);
            break;

        case 1:

            break;
    }
}
项目:Thelta    文件:WorldGenerator.java   
private void generateOverworld(Random random, int chunkX, int chunkY, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider) {
    for(WorldGeneratorOreInstance inst : WorldGenStaticVars.worldGenInstances ) {
        generateOre(
                inst.targetBlock.getDefaultState(),
                world,
                random,
                chunkX*16,
                chunkY*16,
                inst.minHeight,
                inst.maxHeight,
                random.nextInt(inst.size),
                inst.spawnAttempts
                );
    }
    //generateOre(Smeltables.blockOreCopper.getDefaultState(), world, random, chunkX * 16, chunkY * 16, 16, 64, 4 + random.nextInt(4), 100);
}
项目:ToroQuest    文件:WorldGenPlacer.java   
@Override
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider) {
    if (random.nextInt(ToroQuestConfiguration.structureSpawnChance) != 0 || world.provider.getDimension() != 0) {
        return;
    }

    int roll = random.nextInt(5);

    switch (roll) {
    case 0:
        genMonolith(world, random, chunkX, chunkZ);
        break;
    case 1:
        genBastionsLair(world, random, chunkX, chunkZ);
        break;
    case 2:
        genMageTower(world, random, chunkX, chunkZ);
        break;
    case 3:
        genThroneRoom(world, random, chunkX, chunkZ);
        break;
    case 4:
        genGraveyard(world, random, chunkX, chunkZ);
        break;
    }
}
项目:TechStack-s-HeavyMachineryMod    文件:MachineModWorldGen.java   
@Override
// public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider) {
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider) {
    switch (world.provider.getDimension()) {// was get dim id

    case 0: // Overworld
        this.runGenerator(this.gen_machineMod_CrudeOilStone, world, random, chunkX, chunkZ, 15, Reference.crudeOilStoneGenMinlevel, Reference.crudeOilStoneGenMaxlevel);

        break;
    case -1: // Nether

        break;
    case 1: // End

        break;
    }
}
项目:Cyclic    文件:WorldGenEndOre.java   
@Override
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider) {
  if (world.provider.getDimension() == Const.Dimension.end) {
    if (this.genGold != null && Configs.spawnChanceGold > 0)
      this.run(this.genGold, world, random, chunkX * Const.CHUNK_SIZE, chunkZ * Const.CHUNK_SIZE, Configs.spawnChanceGold, MIN_HEIGHT, MAX_HEIGHT);
    if (this.genRedstone != null && Configs.spawnChanceRedstone > 0)
      this.run(this.genRedstone, world, random, chunkX * Const.CHUNK_SIZE, chunkZ * Const.CHUNK_SIZE, Configs.spawnChanceRedstone, MIN_HEIGHT, MAX_HEIGHT);
    if (this.genCoal != null && Configs.spawnChanceCoal > 0)
      this.run(this.genCoal, world, random, chunkX * Const.CHUNK_SIZE, chunkZ * Const.CHUNK_SIZE, Configs.spawnChanceCoal, MIN_HEIGHT, MAX_HEIGHT);
    if (this.genEmerald != null && Configs.spawnChanceEmerald > 0)
      this.run(this.genEmerald, world, random, chunkX * Const.CHUNK_SIZE, chunkZ * Const.CHUNK_SIZE, Configs.spawnChanceEmerald, MIN_HEIGHT, MAX_HEIGHT);
    if (this.genLapis != null && Configs.spawnChanceLapis > 0)
      this.run(this.genLapis, world, random, chunkX * Const.CHUNK_SIZE, chunkZ * Const.CHUNK_SIZE, Configs.spawnChanceLapis, MIN_HEIGHT, MAX_HEIGHT);
    if (this.genDiamond != null && Configs.spawnChanceDiamond > 0)
      this.run(this.genDiamond, world, random, chunkX * Const.CHUNK_SIZE, chunkZ * Const.CHUNK_SIZE, Configs.spawnChanceDiamond, MIN_HEIGHT, MAX_HEIGHT);
    if (this.genIron != null && Configs.spawnChanceIron > 0)
      this.run(this.genIron, world, random, chunkX * Const.CHUNK_SIZE, chunkZ * Const.CHUNK_SIZE, Configs.spawnChanceIron, MIN_HEIGHT, MAX_HEIGHT);
  }
}
项目:Cyclic    文件:WorldGenNetherOre.java   
@Override
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider) {
  if (world.provider.getDimension() == Const.Dimension.nether) {
    if (this.genRedstone != null && Configs.spawnChanceRedstone > 0)
      this.run(this.genRedstone, world, random, chunkX * Const.CHUNK_SIZE, chunkZ * Const.CHUNK_SIZE, Configs.spawnChanceRedstone, MIN_HEIGHT, MAX_HEIGHT);
    if (this.genGold != null && Configs.spawnChanceGold > 0)
      this.run(this.genGold, world, random, chunkX * Const.CHUNK_SIZE, chunkZ * Const.CHUNK_SIZE, Configs.spawnChanceGold, MIN_HEIGHT, MAX_HEIGHT);
    if (this.genCoal != null && Configs.spawnChanceCoal > 0)
      this.run(this.genCoal, world, random, chunkX * Const.CHUNK_SIZE, chunkZ * Const.CHUNK_SIZE, Configs.spawnChanceCoal, MIN_HEIGHT, MAX_HEIGHT);
    if (this.genEmerald != null && Configs.spawnChanceEmerald > 0)
      this.run(this.genEmerald, world, random, chunkX * Const.CHUNK_SIZE, chunkZ * Const.CHUNK_SIZE, Configs.spawnChanceEmerald, MIN_HEIGHT, MAX_HEIGHT);
    if (this.genLapis != null && Configs.spawnChanceLapis > 0)
      this.run(this.genLapis, world, random, chunkX * Const.CHUNK_SIZE, chunkZ * Const.CHUNK_SIZE, Configs.spawnChanceLapis, MIN_HEIGHT, MAX_HEIGHT);
    if (this.genDiamond != null && Configs.spawnChanceDiamond > 0)
      this.run(this.genDiamond, world, random, chunkX * Const.CHUNK_SIZE, chunkZ * Const.CHUNK_SIZE, Configs.spawnChanceDiamond, MIN_HEIGHT, MAX_HEIGHT);
    if (this.genIron != null && Configs.spawnChanceIron > 0)
      this.run(this.genIron, world, random, chunkX * Const.CHUNK_SIZE, chunkZ * Const.CHUNK_SIZE, Configs.spawnChanceIron, MIN_HEIGHT, MAX_HEIGHT);
  }
}
项目:ClockworkPhase2    文件:WorldGeneratorOres.java   
@Override
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider)
{
    if(world.provider.isSurfaceWorld())
    {
        if(ConfigValues.SPAWN_COPPER)
            spawnOres(ModBlocks.oreCopper, world, random, chunkX, chunkZ, 16, 16, 4 + random.nextInt(5), 10, 35, 128);
        if(ConfigValues.SPAWN_ZINC)
            spawnOres(ModBlocks.oreZinc, world, random, chunkX, chunkZ, 16, 16, 4 + random.nextInt(5), 10, 20, 128);
        if(ConfigValues.SPAWN_ALUMINUM)
            spawnOres(ModBlocks.oreAluminum, world, random, chunkX, chunkZ, 16, 16, 4 + random.nextInt(5), 16, 50, 128);
        if(ConfigValues.SPAWN_MOON_FLOWER_RELIC)
            spawnOres(ModBlocks.relicMoonFlower, world, random, chunkX, chunkZ, 16, 16, 1 + random.nextInt(20), 1, 1, 20);
        if(ConfigValues.SPAWN_UNKNOWN_RELIC)
            spawnOres(ModBlocks.relicUnknown, world, random, chunkX, chunkZ, 16, 16, 1 + random.nextInt(4), 4, 1, 20);
    }
}
项目:paintedbiomes    文件:PaintedBiomesEventHandler.java   
private IChunkGenerator getNewChunkProvider(World world, String chunkProviderType, String generatorOptions)
{
    if (chunkProviderType.equals("VANILLA_DEFAULT"))
    {
        return new ChunkGeneratorOverworld(world, world.getSeed(), world.getWorldInfo().isMapFeaturesEnabled(), generatorOptions);
    }
    else if (chunkProviderType.equals("VANILLA_FLAT"))
    {
        return new ChunkGeneratorFlat(world, world.getSeed(), world.getWorldInfo().isMapFeaturesEnabled(), generatorOptions);
    }
    else if (chunkProviderType.equals("VANILLA_HELL"))
    {
        return new ChunkGeneratorHell(world, world.getWorldInfo().isMapFeaturesEnabled(), world.getSeed());
    }
    else if (chunkProviderType.equals("VANILLA_END"))
    {
        return new ChunkGeneratorEnd(world, world.getWorldInfo().isMapFeaturesEnabled(), world.getSeed(), new BlockPos(100, 50, 0));
    }

    return null;
}
项目:HCoreLib    文件:AbstractWorldgen.java   
@Override
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider) {
    switch (world.provider.getDimension()) {
        case -1 :
            generateNether(world, random, chunkX * CHUNK_SIZE, chunkZ * CHUNK_SIZE);
            break;
        case 0 :
            generateOverworld(world, random, chunkX * CHUNK_SIZE, chunkZ * CHUNK_SIZE);
            break;
        case 1 :
            generateEnd(world, random, chunkX * CHUNK_SIZE, chunkZ * CHUNK_SIZE);
            break;
        default:
            generateOverworld(world, random, chunkX * CHUNK_SIZE, chunkZ * CHUNK_SIZE);
            break;
    }
}
项目:Bewitchment    文件:WorldGenOre.java   
@Override
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider) {
    if (world.provider.getDimensionType().getId() == 0) {
        Set<BiomeDictionary.Type> set = BiomeDictionary.getTypes(world.getBiome(new BlockPos(chunkX, 0, chunkZ)));

        for (BiomeDictionary.Type type : set) {
            if (biomes.isEmpty() || biomes.contains(type)) {
                generateOre(world, random, chunkX, chunkZ);
                break;
            }
        }
    }
}
项目:Geolosys    文件:StoneGenerator.java   
@Override
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider)
{
    if(stoneSpawnList.size() > 0 && world.provider.getDimension() != -1 && world.provider.getDimension() != 1)
    {
        stoneSpawnList.get(random.nextInt(stoneSpawnList.size())).generate(world, random, (chunkX * 16), (chunkZ * 16));
    }
}
项目:Geolosys    文件:OreGenerator.java   
@Override
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider)
{
    if (oreSpawnList.size() > 0 && world.provider.getDimension() != -1 && world.provider.getDimension() != 1)
    {
        oreSpawnList.get(random.nextInt(oreSpawnList.size())).generate(world, random, (chunkX * 16), (chunkZ * 16));
    }
}
项目:Randores2    文件:RandoresWorldGenerator.java   
@Override
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider) {
    if (!world.isRemote) {
        RandoresConfig config = Randores.getConfigObj();
        RandoresModules modules = config.getModules();

        boolean flag = modules.isDimensionLess();
        boolean flag2 = modules.isYoutubeMode();
        int ores = config.getMaxOres();

        if (RandoresWorldData.hasData(world)) {
            RandoresWorldData data = RandoresWorldData.getSimply(world);
            for (OreType oreType : OreTypeRegistry.instance().values()) {
                if (flag || oreType.getIsDimension().apply(world)) {
                    List<MaterialDefinition> target = data.shuffleAndGetDimensionCache(oreType, random);
                    if (!target.isEmpty()) {
                        int count = Math.min(ores, target.size()) * (flag2 ? 2 : 1);
                        for (int i = 0; i < count; i++) {
                            MaterialDefinition element = target.get(i);
                            OreComponent component = element.getOre();
                            this.generateOre(component.getBlock().getDefaultState().withProperty(RandoresOre.HARVEST_LEVEL, component.getHarvestLevel()), element.getData(), world, random, chunkX * 16, chunkZ * 16, component.getVeinSize(), component.getMaxY(), component.getMinY(), component.getMaxOccurrences(), component.getMinOccurrences(), component.getOreType().getGenerateIn());
                        }
                    }
                }
            }
        }

        if (flag || DimensionType.OVERWORLD.getId() == world.provider.getDimension()) {
            this.generateOre(CraftingBlocks.craftiniumOre.getDefaultState(), world, random, chunkX * 16, chunkZ * 16, 6, world.getHeight(), 0, 100, 50, new Block[] {Blocks.STONE});
        }
    }
}
项目:statclock    文件:Generation.java   
@Override
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider) {
    switch (world.provider.getDimension()) {
        case -1:
            break;
        case 0:
            generateSurface(world, random, chunkX * 16, chunkZ * 16);
            break;
        case 1:
            break;
    }
}
项目:PurificatiMagicae    文件:WGLabMedium.java   
@Override
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider)
{
    if (dimList.contains(world.provider.getDimension()) == dimListMode)
    {
        if (random.nextFloat() <= chance)
        {
            int x = chunkX * 16 + 16;
            int z = chunkZ * 16 + 16;
            BlockPos pos = new BlockPos(x, world.getHeight(x, z) - 1, z);
            if (pos.getY() >= minY && pos.getY() <= maxY)
            {
                try
                {
                    NBTTagCompound tag = StructureApi.INSTANCE.getStructureNbt(Utils.gRL("lab_medium"));
                    PurMag.INSTANCE.debug("WG START [lab_medium]");
                    StructureApi.INSTANCE.spawnStructure(tag, pos, null, Rotation.values()[random.nextInt(Rotation.values().length)], (WorldServer) world, random);
                    PurMag.INSTANCE.debug("WG END AT " + pos);
                }
                catch (IOException e)
                {
                    PurMag.INSTANCE.log.error("An IOException occurred when spawning the small lab structure!", e);
                }
            }
        }
    }
}
项目:PurificatiMagicae    文件:WGCrystal.java   
@Override
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider)
{
    if(dimList.contains(world.provider.getDimension()) == dimListMode)
    {
        int x = chunkX * 16 + random.nextInt(16);
        int z = chunkZ * 16 + random.nextInt(16);
        float sif = PurMag.INSTANCE.sif_storage.get(new GlobalChunkPos(chunkX, chunkZ, world.provider.getDimension()));
        int y = predicate.getY(random, chunkX, chunkZ, world, chunkGenerator, chunkProvider, x, z, sif);
        BlockPos pos = new BlockPos(x, y, z);

        if (predicate.canGenerateHere(random, chunkX, chunkZ, world, chunkGenerator, chunkProvider, pos, sif))
        {
            int count = predicate.getCrystalCount(random, chunkX, chunkZ, world, chunkGenerator, chunkProvider, pos, sif);
            predicate.beforePlace(random, chunkX, chunkZ, world, chunkGenerator, chunkProvider, pos, sif, count);
            BlockPos.MutableBlockPos genPos = new BlockPos.MutableBlockPos(pos);
            for (int i = 0; i < count; i++)
            {
                genPos.setY(pos.getY() + i);
                world.setBlockState(genPos, BlockRegistry.crystal.getDefaultState(), 2);
                TileSingleSip tss = new TileSingleSip();
                tss.setType(sipType, false);
                world.setTileEntity(genPos, tss);
            }
            PurMag.INSTANCE.debug("Crystal " + sipType + " " + pos);
            predicate.afterPlace(random, chunkX, chunkZ, world, chunkGenerator, chunkProvider, pos, sif, count);
        }
    }
}
项目:PurificatiMagicae    文件:CrystalGenPredicates.java   
@Override
public void beforePlace(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider, BlockPos pos, float sif, int count)
{
    BlockPos.MutableBlockPos p = new BlockPos.MutableBlockPos(pos);
    for (int y1 = 0; y1 < count + 1; y1++)
    {
        p.setY(p.getY() + y1);
        world.setBlockToAir(p);
    }
}
项目:PurificatiMagicae    文件:CrystalGenPredicates.java   
@Override
public int getY(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider, int x, int z, float sif)
{
    BlockPos.MutableBlockPos mut = new BlockPos.MutableBlockPos(x, 0, z);
    for (int y = 0; y < 256; y++)
    {
        mut.setY(y);
        if (world.isAirBlock(mut))
        {
            return y;
        }
    }
    return -1;
}
项目:PurificatiMagicae    文件:WGLabSmall.java   
@Override
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider)
{
    if (dimList.contains(world.provider.getDimension()) == dimListMode)
    {
        if (random.nextFloat() <= chance)
        {
            int x = chunkX * 16 + 16;
            int z = chunkZ * 16 + 16;
            BlockPos pos = new BlockPos(x, world.getHeight(x, z) - 7, z);
            if (pos.getY() >= minY && pos.getY() <= maxY)
            {
                try
                {
                    NBTTagCompound tag = StructureApi.INSTANCE.getStructureNbt(Utils.gRL("lab_small"));
                    PurMag.INSTANCE.debug("WG START [lab_small]");
                    StructureApi.INSTANCE.spawnStructure(tag, pos, null, Rotation.values()[random.nextInt(Rotation.values().length)], (WorldServer) world, random);
                    PurMag.INSTANCE.debug("WG END AT " + pos);
                }
                catch (IOException e)
                {
                    PurMag.INSTANCE.log.error("An IOException occurred when spawning the small lab structure!", e);
                }
            }
        }
    }
}
项目:UniversalRemote    文件:WorldProviderProxyClient.java   
@Override
public IChunkGenerator createChunkGenerator() {
    if(m_realProvider != null) {
        return m_realProvider.createChunkGenerator();
    } else {
        return super.createChunkGenerator();
    }
}
项目:UniversalRemote    文件:WorldProviderProxyServer.java   
@Override
public IChunkGenerator createChunkGenerator() {
    if (m_proxyProvider != null && Util.isPrefixInCallStack(m_modPrefix)) {
        return m_proxyProvider.createChunkGenerator();
    } else if (m_realProvider != null) {
        return m_realProvider.createChunkGenerator();
    } else {
        return super.createChunkGenerator();
    }
}
项目:Solar    文件:ObeliskDecorator.java   
@Override
void gen(World world, int x, int z, IChunkGenerator generator, IChunkProvider provider) {
    random.setSeed(world.getSeed());
    long good = random.nextLong();
    long succ = random.nextLong();

    good *= x >> 3;
    succ *= z >> 3;
    random.setSeed(good * succ * world.getSeed());
    //Generate
    if(GEN_CONFIG.MONOLITH_CONFIG.OBELISK_DECORATOR.rarity > 0D
            && GEN_CONFIG.MONOLITH_CONFIG.OBELISK_DECORATOR.rarity / 100D > random.nextDouble()) {
        List<AxisAlignedBB> occupied = Lists.newArrayList();
        for(int i = 0; i < GEN_CONFIG.MONOLITH_CONFIG.OBELISK_DECORATOR.size; i++) {
            BlockPos top = world.getTopSolidOrLiquidBlock(randomVector().add(x, 0, z).toBlockPos());
            int below = random.nextInt(7);
            if(top.getY() > below) {
                top = top.add(0, -below, 0);
            }
            Template obelisk = obelisks.next().load(world);
            Rotation rotation = Rotation.values()[random.nextInt(4)];
            Vector3 vec = Vector3.create(obelisk.getSize()).rotate(rotation);
            AxisAlignedBB obeliskBB = new AxisAlignedBB(top, vec.add(top).toBlockPos()).grow(1);
            if(occupied.stream().noneMatch(bb -> bb.intersects(obeliskBB))) {
                PlacementSettings settings = new PlacementSettings();
                settings.setRotation(rotation);
                settings.setRandom(random);
                obelisk.addBlocksToWorld(world, top, settings);

                occupied.add(obeliskBB);
            }
        }
    }
}
项目:customstuff4    文件:WorldGenOre.java   
@Override
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider)
{
    if (world.provider.getDimension() != dimension)
    {
        return;
    }

    BlockPos chunkPos = new BlockPos(chunkX * 16, 0, chunkZ * 16);

    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 < count; ++j)
    {
        BlockPos blockpos = chunkPos.add(random.nextInt(16), random.nextInt(maxHeight - minHeight) + minHeight, random.nextInt(16));
        gen.generate(world, random, blockpos);
    }
}
项目:TheOink    文件:OinkWorldGenerator.java   
@Override
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider) {
    int posX = chunkX * 16;
    int posZ = chunkZ * 16;
    if(world.provider.getDimension() == 0)
        generateOverworld(world, random, posX, posZ);

}
项目:Qbar    文件:QBarOreGenerator.java   
@Override
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator,
        IChunkProvider chunkProvider)
{
    if (world.provider.getDimension() == 0)
        generateVeins(random, chunkX, chunkZ, world);
}
项目:Alchemy    文件:WorldGeneratorRedDragonNest.java   
@Override
public void generate(Random random, int x, int z, World world,
        IChunkGenerator generator, IChunkProvider provider) {
    x *= 16;
    z *= 16;
    AlchemyModLoader.logger.info(Always.getCurrentBiome(world, x, z));
    if (!start && Always.getCurrentBiome(world, x, z) == ocean && should(world, x, z, need) && random.nextInt() > 900) {

    }

}
项目:Kingdom-Keys-Re-Coded    文件:WorldGenBlox.java   
@Override
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider) {
    switch (world.provider.getDimension()) {
        case -1:
            if (MainConfig.worldgen.EnableWorldGen) generateNether(world, random, chunkX * 16, chunkZ * 16);
            break;
        case 0:
            if (MainConfig.worldgen.EnableWorldGen) generateSurface(world, random, chunkX * 16, chunkZ * 16);
            break;
        case 1:
            if (MainConfig.worldgen.EnableWorldGen) generateEnd(world, random, chunkX * 16, chunkZ * 16);
            break;
    }
}
项目:Cyclic    文件:WorldGenGoldRiver.java   
@Override
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider) {
  int spawnTries = 60;
  if (Const.Dimension.overworld == world.provider.getDimension()) {
    this.run(genGold, world, random, chunkX * Const.CHUNK_SIZE, chunkZ * Const.CHUNK_SIZE, spawnTries, 0, Const.WORLDHEIGHT - 1);
  }
}
项目:Cyclic    文件:WorldGenEmeraldHeight.java   
@Override
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider) {
  int spawnTries = 70;
  if (Const.Dimension.overworld == world.provider.getDimension()) {
    this.run(genEmerald, world, random, chunkX * Const.CHUNK_SIZE, chunkZ * Const.CHUNK_SIZE, spawnTries, 0, Const.WORLDHEIGHT - 1);
  }
}
项目:Cyclic    文件:WorldGenOreSingleton.java   
@Override
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider) {
  int spawnTries = 50;
  if (Const.Dimension.overworld == world.provider.getDimension()) {
    this.run(gen, world, random, chunkX * Const.CHUNK_SIZE, chunkZ * Const.CHUNK_SIZE, spawnTries, minHeight, Const.WORLDHEIGHT - 1);
  }
}
项目:ClockworkPhase2    文件:WorldGeneratorPOI.java   
@Override
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider)
{
    if(world.provider.getDimension() == 0)
    {
        if(ConfigValues.SPAWN_WORLD_CRATER)
        {
            if(chunkX >= 0 && chunkX < 21 && chunkZ >= 0 && chunkZ < 21)
            {
                Chunk c = world.getChunkFromChunkCoords(chunkX, chunkZ);
                SchematicChunk.ModSchematicChunk chunk = SchematicHandler.INSTANCE.loadModSchematic("Ragnarok_castle", false, chunkX, chunkZ);
                int startY = 2;
                for(int x = 0; x < 16; x++)
                {
                    for(int z = 0; z < 16; z++)
                    {
                        int y2 = 0;
                        for(int y = startY; y < startY + chunk.height; y++)
                        {
                            //c.setBlockState(x, y, z, chunk.getBlock(x, y2, z).getStateFromMeta(chunk.getMetadata(x, y2, z)));
                            ++y2;
                        }
                    }
                }
            }
        }
    }
}
项目:paintedbiomes    文件:PaintedBiomesEventHandler.java   
private void overrideChunkProvider(int dimension, World world)
{
    Configs conf = Configs.getConfig(dimension);

    if (conf.overrideChunkProvider && world instanceof WorldServer)
    {
        IChunkGenerator newChunkProvider = this.getNewChunkProvider(world, conf.chunkProviderType, conf.chunkProviderOptions);

        if (newChunkProvider == null)
        {
            PaintedBiomes.logger.warn("Invalid/unknown ChunkProvider type '{}'", conf.chunkProviderType);
            return;
        }

        PaintedBiomes.logger.info("Attempting to override the ChunkProvider (of type {}) of dimension {} with {}",
                ((ChunkProviderServer)world.getChunkProvider()).chunkGenerator.getClass().getName(),
                dimension, newChunkProvider.getClass().getName());

        try
        {
            ReflectionHelper.setPrivateValue(ChunkProviderServer.class, (ChunkProviderServer)world.getChunkProvider(),
                    newChunkProvider, "field_186029_c", "chunkGenerator");
        }
        catch (UnableToAccessFieldException e)
        {
            PaintedBiomes.logger.warn("Failed to override the ChunkProvider for dimension {} with {}",
                    dimension, newChunkProvider.getClass().getName(), e);
        }
    }
}
项目:Fake-Ores-2    文件:WorldGenAntiOreStone.java   
@Override
public void generate(Random random, int chunkX, int chunkZ, World world,
        IChunkGenerator chunkGenerator, IChunkProvider chunkProvider)
{
    switch(world.provider.getDimension())
    {
    case 0:
        this.generateSurface(world, chunkX * 16, chunkZ * 16, random);
    }
}