java类net.minecraft.world.gen.IChunkGenerator的实例源码

LSCWorldGenerator.java 文件源码 项目:Loot-Slash-Conquer 阅读 20 收藏 0 点赞 0 评论 0
@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;
    }
}
WorldGeneratorPneumaticCraft.java 文件源码 项目:pnc-repressurized 阅读 30 收藏 0 点赞 0 评论 0
@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);
        }
    }
}
WorldGen.java 文件源码 项目:harshencastle 阅读 27 收藏 0 点赞 0 评论 0
@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.java 文件源码 项目:SimplyTea 阅读 25 收藏 0 点赞 0 评论 0
@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);
            }
        }
    }
}
EthericWorldGenerator.java 文件源码 项目:Etheric 阅读 25 收藏 0 点赞 0 评论 0
@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);

    }

}
WorldGenCandelilla.java 文件源码 项目:GardenStuff 阅读 24 收藏 0 点赞 0 评论 0
@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));
}
AshenCubeStructure.java 文件源码 项目:Solar 阅读 23 收藏 0 点赞 0 评论 0
@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);
        }
    }
}
AnimaWorldGenerator.java 文件源码 项目:Anima-Mundi 阅读 23 收藏 0 点赞 0 评论 0
@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;
    }
}
WorldGenerator.java 文件源码 项目:Thelta 阅读 28 收藏 0 点赞 0 评论 0
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);
}
WorldGenPlacer.java 文件源码 项目:ToroQuest 阅读 20 收藏 0 点赞 0 评论 0
@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;
    }
}
MachineModWorldGen.java 文件源码 项目:TechStack-s-HeavyMachineryMod 阅读 17 收藏 0 点赞 0 评论 0
@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;
    }
}
WorldGenEndOre.java 文件源码 项目:Cyclic 阅读 24 收藏 0 点赞 0 评论 0
@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);
  }
}
WorldGenNetherOre.java 文件源码 项目:Cyclic 阅读 24 收藏 0 点赞 0 评论 0
@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);
  }
}
WorldGeneratorOres.java 文件源码 项目:ClockworkPhase2 阅读 16 收藏 0 点赞 0 评论 0
@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);
    }
}
PaintedBiomesEventHandler.java 文件源码 项目:paintedbiomes 阅读 19 收藏 0 点赞 0 评论 0
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;
}
AbstractWorldgen.java 文件源码 项目:HCoreLib 阅读 20 收藏 0 点赞 0 评论 0
@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;
    }
}
WorldGenOre.java 文件源码 项目:Bewitchment 阅读 21 收藏 0 点赞 0 评论 0
@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;
            }
        }
    }
}
StoneGenerator.java 文件源码 项目:Geolosys 阅读 20 收藏 0 点赞 0 评论 0
@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));
    }
}
OreGenerator.java 文件源码 项目:Geolosys 阅读 27 收藏 0 点赞 0 评论 0
@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));
    }
}
RandoresWorldGenerator.java 文件源码 项目:Randores2 阅读 21 收藏 0 点赞 0 评论 0
@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});
        }
    }
}
Generation.java 文件源码 项目:statclock 阅读 21 收藏 0 点赞 0 评论 0
@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;
    }
}
WGLabMedium.java 文件源码 项目:PurificatiMagicae 阅读 29 收藏 0 点赞 0 评论 0
@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);
                }
            }
        }
    }
}
WGCrystal.java 文件源码 项目:PurificatiMagicae 阅读 19 收藏 0 点赞 0 评论 0
@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);
        }
    }
}
CrystalGenPredicates.java 文件源码 项目:PurificatiMagicae 阅读 24 收藏 0 点赞 0 评论 0
@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);
    }
}
CrystalGenPredicates.java 文件源码 项目:PurificatiMagicae 阅读 23 收藏 0 点赞 0 评论 0
@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;
}
WGLabSmall.java 文件源码 项目:PurificatiMagicae 阅读 17 收藏 0 点赞 0 评论 0
@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);
                }
            }
        }
    }
}
WorldProviderProxyClient.java 文件源码 项目:UniversalRemote 阅读 21 收藏 0 点赞 0 评论 0
@Override
public IChunkGenerator createChunkGenerator() {
    if(m_realProvider != null) {
        return m_realProvider.createChunkGenerator();
    } else {
        return super.createChunkGenerator();
    }
}
WorldProviderProxyServer.java 文件源码 项目:UniversalRemote 阅读 26 收藏 0 点赞 0 评论 0
@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();
    }
}
ObeliskDecorator.java 文件源码 项目:Solar 阅读 18 收藏 0 点赞 0 评论 0
@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);
            }
        }
    }
}
WorldGenOre.java 文件源码 项目:customstuff4 阅读 25 收藏 0 点赞 0 评论 0
@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);
    }
}


问题


面经


文章

微信
公众号

扫码关注公众号