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

项目: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;
}
项目:ExPetrum    文件:ExPHandlerServer.java   
public void handleWorldSettings(World w)
{
    try
    {
        if (w.getChunkProvider() instanceof ChunkProviderServer && w.getWorldType() instanceof WorldTypeExP)
        {
            ChunkProviderServer cps = (ChunkProviderServer) w.getChunkProvider();
            if (cps.chunkGenerator instanceof ChunkGeneratorOverworld)
            {
                ChunkGeneratorOverworld cpo = (ChunkGeneratorOverworld) cps.chunkGenerator;
                for (Field f : ChunkGeneratorOverworld.class.getDeclaredFields())
                {
                    if (f.getType() == ChunkGeneratorSettings.class)
                    {
                        f.setAccessible(true);
                        ChunkGeneratorSettings.Factory factory = new ChunkGeneratorSettings.Factory();
                        factory.seaLevel = 127;
                        factory.baseSize = 17.25f;
                        f.set(cpo, factory.build());
                        break;
                    }
                }
            }
        }
    }
    catch (Exception ex)
    {
        ex.printStackTrace();
    }
}
项目:FastAsyncWorldedit    文件:SpongeQueue_1_12.java   
@Override
public boolean regenerateChunk(net.minecraft.world.World world, int x, int z, BaseBiome biome, Long seed) {
    if (biome != null) {
        try {
            if (seed == null) {
                seed = world.getSeed();
            }
            nmsWorld.getWorldInfo().getSeed();
            boolean result;
            ChunkGeneratorOverworld generator = new ChunkGeneratorOverworld(nmsWorld, seed, false, "");
            net.minecraft.world.biome.Biome base = net.minecraft.world.biome.Biome.getBiome(biome.getId());
            net.minecraft.world.biome.Biome[] existingBiomes = new net.minecraft.world.biome.Biome[256];
            Arrays.fill(existingBiomes, base);
            fieldBiomes.set(generator, existingBiomes);
            IChunkGenerator existingGenerator = (IChunkGenerator) fieldChunkGenerator.get(nmsWorld.getChunkProvider());
            long existingSeed = world.getSeed();
            {
                if (genLayer == null) genLayer = new MutableGenLayer(seed);
                genLayer.set(biome.getId());
                Object existingGenLayer1 = fieldGenLayer1.get(nmsWorld.provider.getBiomeProvider());
                Object existingGenLayer2 = fieldGenLayer2.get(nmsWorld.provider.getBiomeProvider());
                fieldGenLayer1.set(nmsWorld.provider.getBiomeProvider(), genLayer);
                fieldGenLayer2.set(nmsWorld.provider.getBiomeProvider(), genLayer);

                fieldSeed.set(nmsWorld.getWorldInfo(), seed);

                ReflectionUtils.setFailsafeFieldValue(fieldBiomeCache, this.nmsWorld.provider.getBiomeProvider(), new BiomeCache(this.nmsWorld.provider.getBiomeProvider()));

                ReflectionUtils.setFailsafeFieldValue(fieldChunkGenerator, this.nmsWorld.getChunkProvider(), generator);

                result = regenerateChunk(world, x, z);

                ReflectionUtils.setFailsafeFieldValue(fieldChunkGenerator, this.nmsWorld.getChunkProvider(), existingGenerator);

                fieldSeed.set(nmsWorld.getWorldInfo(), existingSeed);

                fieldGenLayer1.set(nmsWorld.provider.getBiomeProvider(), existingGenLayer1);
                fieldGenLayer2.set(nmsWorld.provider.getBiomeProvider(), existingGenLayer2);
            }
            return result;
        } catch (Throwable e) {
            e.printStackTrace();
        }
    }
    return regenerateChunk(world, x, z);
}
项目:FastAsyncWorldedit    文件:ForgeQueue_All.java   
@Override
public boolean regenerateChunk(net.minecraft.world.World world, int x, int z, BaseBiome biome, Long seed) {
    if (biome != null) {
        try {
            if (seed == null) {
                seed = world.getSeed();
            }
            nmsWorld.getWorldInfo().getSeed();
            boolean result;
            ChunkGeneratorOverworld generator = new ChunkGeneratorOverworld(nmsWorld, seed, false, "");
            net.minecraft.world.biome.Biome base = net.minecraft.world.biome.Biome.getBiome(biome.getId());
            net.minecraft.world.biome.Biome[] existingBiomes = new net.minecraft.world.biome.Biome[256];
            Arrays.fill(existingBiomes, base);
            fieldBiomes.set(generator, existingBiomes);
            IChunkGenerator existingGenerator = (IChunkGenerator) fieldChunkGenerator.get(nmsWorld.getChunkProvider());
            long existingSeed = world.getSeed();
            {
                if (genLayer == null) genLayer = new MutableGenLayer(seed);
                genLayer.set(biome.getId());
                Object existingGenLayer1 = fieldGenLayer1.get(nmsWorld.provider.getBiomeProvider());
                Object existingGenLayer2 = fieldGenLayer2.get(nmsWorld.provider.getBiomeProvider());
                fieldGenLayer1.set(nmsWorld.provider.getBiomeProvider(), genLayer);
                fieldGenLayer2.set(nmsWorld.provider.getBiomeProvider(), genLayer);

                fieldSeed.set(nmsWorld.getWorldInfo(), seed);

                ReflectionUtils.setFailsafeFieldValue(fieldBiomeCache, this.nmsWorld.provider.getBiomeProvider(), new BiomeCache(this.nmsWorld.provider.getBiomeProvider()));

                ReflectionUtils.setFailsafeFieldValue(fieldChunkGenerator, this.nmsWorld.getChunkProvider(), generator);

                result = regenerateChunk(world, x, z);

                ReflectionUtils.setFailsafeFieldValue(fieldChunkGenerator, this.nmsWorld.getChunkProvider(), existingGenerator);

                fieldSeed.set(nmsWorld.getWorldInfo(), existingSeed);

                fieldGenLayer1.set(nmsWorld.provider.getBiomeProvider(), existingGenLayer1);
                fieldGenLayer2.set(nmsWorld.provider.getBiomeProvider(), existingGenLayer2);
            }
            return result;
        } catch (Throwable e) {
            e.printStackTrace();
        }
    }
    return regenerateChunk(world, x, z);
}