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

项目:muon    文件:MuonUtils.java   
public static int getGroundLevel(World worldin, int xpos, int zpos) {
    int chunkX = xpos >> 4;
    int chunkZ = zpos >> 4;
    IChunkProvider provider = worldin.getChunkProvider();
    ChunkPrimer primer = new ChunkPrimer();
    if (chunkX == cachedChunkX && chunkZ == cachedChunkZ && cachedChunk != null) {
        primer = cachedChunk;
    } else {
        if (provider instanceof ChunkProviderOverworld) {
            ((ChunkProviderOverworld)provider).setBlocksInChunk(chunkX, chunkZ, primer);
        } else if (provider instanceof ChunkProviderEnd) {
            ((ChunkProviderEnd) provider).setBlocksInChunk(chunkX, chunkZ, primer);
        } else if (provider instanceof ChunkProviderFlat) {
            return worldin.getSeaLevel();
        } else {
            return -1; // unhandled dimension.
        }
        cachedChunk = primer;
        cachedChunkX = chunkX;
        cachedChunkZ = chunkZ;
    }
    return primer.findGroundBlockIdx(xpos & 15, zpos & 15);
}
项目:TechnicalDimensions    文件:CustomChunkProvider.java   
public static IChunkGenerator getGenForWorld(DimData data, World worldIn, long seed, boolean mapFeaturesEnabledIn, String settings) {
    if (data.falt) {
        return new ChunkProviderFlat(worldIn, seed, mapFeaturesEnabledIn, "3;minecraft:bedrock,60*minecraft:stone,2*minecraft:dirt,minecraft:grass;3;village(size=50 distance=50),mineshaft(chance=0.5),biome_1,dungeon,decoration,lake,lava_lake");
    }
    //TODO get custom shit
    return new ChunkProviderOverworld(worldIn, seed, mapFeaturesEnabledIn, settings);
}
项目:Geographicraft    文件:ChunkGeneratorExtractor.java   
public IChunkProvider extractFrom(WorldServer world) {
    ChunkProviderServer server = accessChunkProviderServer.chunkProviderServer(world);
    IChunkProvider provider = providerFromChunkServer.get(server);
    if (!(provider instanceof ChunkProviderOverworld)){
        /*if (provider instanceof ChunkProviderWrapper) {
            provider = ((ChunkProviderWrapper)provider).wrappee();
        }*/
    }
    return provider;
}
项目:Zombe-Modpack    文件:WorldProvider.java   
public IChunkGenerator createChunkGenerator()
{
    return (IChunkGenerator)(this.terrainType == WorldType.FLAT ? new ChunkProviderFlat(this.worldObj, this.worldObj.getSeed(), this.worldObj.getWorldInfo().isMapFeaturesEnabled(), this.generatorSettings) : (this.terrainType == WorldType.DEBUG_WORLD ? new ChunkProviderDebug(this.worldObj) : (this.terrainType == WorldType.CUSTOMIZED ? new ChunkProviderOverworld(this.worldObj, this.worldObj.getSeed(), this.worldObj.getWorldInfo().isMapFeaturesEnabled(), this.generatorSettings) : new ChunkProviderOverworld(this.worldObj, this.worldObj.getSeed(), this.worldObj.getWorldInfo().isMapFeaturesEnabled(), this.generatorSettings))));
}
项目:Backmemed    文件:WorldProvider.java   
public IChunkGenerator createChunkGenerator()
{
    return (IChunkGenerator)(this.terrainType == WorldType.FLAT ? new ChunkProviderFlat(this.worldObj, this.worldObj.getSeed(), this.worldObj.getWorldInfo().isMapFeaturesEnabled(), this.generatorSettings) : (this.terrainType == WorldType.DEBUG_WORLD ? new ChunkProviderDebug(this.worldObj) : (this.terrainType == WorldType.CUSTOMIZED ? new ChunkProviderOverworld(this.worldObj, this.worldObj.getSeed(), this.worldObj.getWorldInfo().isMapFeaturesEnabled(), this.generatorSettings) : new ChunkProviderOverworld(this.worldObj, this.worldObj.getSeed(), this.worldObj.getWorldInfo().isMapFeaturesEnabled(), this.generatorSettings))));
}
项目:Backmemed    文件:WoodlandMansion.java   
public WoodlandMansion(ChunkProviderOverworld p_i47240_1_)
{
    this.field_191075_h = p_i47240_1_;
}
项目:Backmemed    文件:WoodlandMansion.java   
public Start(World p_i47235_1_, ChunkProviderOverworld p_i47235_2_, Random p_i47235_3_, int p_i47235_4_, int p_i47235_5_)
{
    super(p_i47235_4_, p_i47235_5_);
    this.func_191092_a(p_i47235_1_, p_i47235_2_, p_i47235_3_, p_i47235_4_, p_i47235_5_);
}
项目:Backmemed    文件:WoodlandMansion.java   
private void func_191092_a(World p_191092_1_, ChunkProviderOverworld p_191092_2_, Random p_191092_3_, int p_191092_4_, int p_191092_5_)
{
    Rotation rotation = Rotation.values()[p_191092_3_.nextInt(Rotation.values().length)];
    ChunkPrimer chunkprimer = new ChunkPrimer();
    p_191092_2_.setBlocksInChunk(p_191092_4_, p_191092_5_, chunkprimer);
    int i = 5;
    int j = 5;

    if (rotation == Rotation.CLOCKWISE_90)
    {
        i = -5;
    }
    else if (rotation == Rotation.CLOCKWISE_180)
    {
        i = -5;
        j = -5;
    }
    else if (rotation == Rotation.COUNTERCLOCKWISE_90)
    {
        j = -5;
    }

    int k = chunkprimer.findGroundBlockIdx(7, 7);
    int l = chunkprimer.findGroundBlockIdx(7, 7 + j);
    int i1 = chunkprimer.findGroundBlockIdx(7 + i, 7);
    int j1 = chunkprimer.findGroundBlockIdx(7 + i, 7 + j);
    int k1 = Math.min(Math.min(k, l), Math.min(i1, j1));

    if (k1 < 60)
    {
        this.field_191093_c = false;
    }
    else
    {
        BlockPos blockpos = new BlockPos(p_191092_4_ * 16 + 8, k1 + 1, p_191092_5_ * 16 + 8);
        List<WoodlandMansionPieces.MansionTemplate> list = Lists.<WoodlandMansionPieces.MansionTemplate>newLinkedList();
        WoodlandMansionPieces.func_191152_a(p_191092_1_.getSaveHandler().getStructureTemplateManager(), blockpos, rotation, list, p_191092_3_);
        this.components.addAll(list);
        this.updateBoundingBox();
        this.field_191093_c = true;
    }
}
项目:muon    文件:MuonHeightMap.java   
public static MuonHeightMap defaultHeights(World worldIn, StructureBoundingBox bb) {
    MuonHeightMap hm = new MuonHeightMap(worldIn, bb);
    // try to load default map heights from terrain generator
    IChunkProvider provider = worldIn.getChunkProvider();
    IChunkGenerator gen = null;
    try {
        gen = ((ChunkProviderServer) provider).chunkGenerator;
    } catch (Exception e) { e.printStackTrace(); }
    hm.seaLevel =  worldIn.getSeaLevel() - 1; // set sea level.
    int defaultlevel = -1;
    if (gen instanceof ChunkProviderFlat) {
        defaultlevel = worldIn.getSeaLevel() - 1;
    }
    for (int chunkX = (hm.mapbb.minX>>4); chunkX <= (hm.mapbb.maxX>>4); ++chunkX) {
        for (int chunkZ = (hm.mapbb.minZ>>4); chunkZ <= (hm.mapbb.maxZ>>4); ++chunkZ) {
            ChunkPrimer primer = new ChunkPrimer();
            if (gen instanceof ChunkProviderOverworld) {
                ((ChunkProviderOverworld) gen).setBlocksInChunk(chunkX, chunkZ, primer);
            } else if (gen instanceof ChunkProviderEnd) {
                ((ChunkProviderEnd) gen).setBlocksInChunk(chunkX, chunkZ, primer);
            } else {
                primer = null;
            }
            for (int i = 0; i < 16; ++i) {
                for (int j = 0; j < 16; ++j) {
                    int groundlevel = defaultlevel;
                    if (primer != null) {
                        //BUGGY if we do it with groundlevel = primer.findGroundBlockIdx(i, j);
                        for (int k = 255; k >= 0; --k) {
                            IBlockState state = primer.getBlockState(i,k,j);
                            if (state != Blocks.AIR.getDefaultState()) {
                                groundlevel = k;
                                break;
                            }
                        }
                    }
                    hm.setHeight((chunkX<<4)+i, (chunkZ<<4)+j, groundlevel);
                }
            }
        }
    }
    return hm;
}
项目:Geographicraft    文件:ChunkGeneratorExtractor.java   
public void impose(WorldServer world, MapGenVillage mapGen) {
    IChunkProvider provider = extractFrom(world);
    if (provider instanceof ChunkProviderOverworld) {
       villageGeneratorFromVillage.setField((ChunkProviderOverworld)provider, mapGen);
    }
}
项目:DungeonDimension    文件:MonumentChunkProvider.java   
@Override
public Chunk provideChunk(int cx, int cz) {
    ChunkProviderOverworld e;
    ChunkPrimer chunkprimer = new ChunkPrimer();
    if(cx > world_size || cx < -world_size || cz > world_size || cz < -world_size){
        return new Chunk(world, chunkprimer, cx, cz);
    }else{
        this.oceanMonumentGenerator.generate(this.world, cx, cz, chunkprimer);
        for(int x = 0; x < 16; x++){
            for(int z = 0; z < 16; z++){
                for(int y = 0; y < 63; y++){
                    if(y == 0) chunkprimer.setBlockState(x, y, z, Blocks.BEDROCK.getDefaultState());
                    else if(y < 4 && y > 0) chunkprimer.setBlockState(x, y, z, Blocks.GRAVEL.getDefaultState());
                    else chunkprimer.setBlockState(x, y, z, Blocks.WATER.getDefaultState());
                    if(cx == world_size){
                        for(int i = 0; i < 16; i++){
                            for(int wy = 1; wy < 64; wy++){
                                chunkprimer.setBlockState(15, wy, i, Blocks.BARRIER.getDefaultState());
                            }
                        }
                    }
                    if(cx == -world_size){
                        for(int i = 0; i < 16; i++){
                            for(int wy = 1; wy < 64; wy++){
                                chunkprimer.setBlockState(0, wy, i, Blocks.BARRIER.getDefaultState());
                            }
                        }
                    }
                    if(cz == world_size){
                        for(int i = 0; i < 16; i++){
                            for(int wy = 1; wy < 64; wy++){
                                chunkprimer.setBlockState(i, wy, 15, Blocks.BARRIER.getDefaultState());
                            }
                        }
                    }
                    if(cz == -world_size){
                        for(int i = 0; i < 16; i++){
                            for(int wy = 1; wy < 63; wy++){
                                chunkprimer.setBlockState(i, wy, 0, Blocks.BARRIER.getDefaultState());
                            }
                        }
                    }
                }
            }
        }
    }
    Chunk chunk = new Chunk(world, chunkprimer, cx, cz);
    byte[] biomeArr = new byte[256];
    for(int i = 0; i < 256; i++){
        biomeArr[i] = (byte) Biome.getIdForBiome(Biomes.DEEP_OCEAN);
    }
    chunk.setBiomeArray(biomeArr);
    chunk.generateSkylightMap();
    return chunk;
}
项目:FastAsyncWorldedit    文件:SpongeQueue_1_11.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;
            ChunkProviderOverworld generator = new ChunkProviderOverworld(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);
            boolean cold = base.getTemperature() <= 1;
            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;
            ChunkProviderOverworld generator = new ChunkProviderOverworld(nmsWorld, seed, false, "");
            net.minecraft.world.biome.Biome base = net.minecraft.world.biome.Biome.getBiome(biome.getId());
            fieldBiomes.set(generator, new net.minecraft.world.biome.Biome[]{base});
            boolean cold = base.getTemperature() <= 1;
            IChunkGenerator existingGenerator = nmsWorld.getChunkProvider().chunkGenerator;
            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);
}
项目:CustomOreGen    文件:WorldConfig.java   
private static void populateWorldProperties(Map<String,Object> properties, World world, WorldInfo worldInfo)
{
    properties.put("world", worldInfo == null ? "" : worldInfo.getWorldName());
    properties.put("world.seed", worldInfo == null ? 0L : worldInfo.getSeed());
    properties.put("world.version", worldInfo == null ? 0 : worldInfo.getSaveVersion());
    properties.put("world.isHardcore", worldInfo == null ? false : worldInfo.isHardcoreModeEnabled());
    properties.put("world.hasFeatures", worldInfo == null ? false : worldInfo.isMapFeaturesEnabled());
    properties.put("world.hasCheats", worldInfo == null ? false : worldInfo.areCommandsAllowed());
    properties.put("world.gameMode", worldInfo == null ? "" : worldInfo.getGameType().getName());
    properties.put("world.gameMode.id", worldInfo == null ? 0 : worldInfo.getGameType().getID());
    properties.put("world.type", worldInfo == null ? "" : worldInfo.getTerrainType().getName());
    properties.put("world.type.version", worldInfo == null ? 0 : worldInfo.getTerrainType().getGeneratorVersion());
    String genName = "RandomLevelSource";
    String genClass = "ChunkProviderOverworld";

    if (world != null)
    {
        IChunkGenerator chunkGenerator = world.provider.createChunkGenerator();
        genName = chunkGenerator.toString();
        genClass = chunkGenerator.getClass().getSimpleName();

        if (chunkGenerator instanceof ChunkProviderOverworld)
        {
            genClass = "ChunkProviderOverworld";
        }
        else if (chunkGenerator instanceof ChunkProviderFlat)
        {
            genClass = "ChunkProviderFlat";
        }
        else if (chunkGenerator instanceof ChunkProviderHell)
        {
            genClass = "ChunkProviderHell";
        }
        else if (chunkGenerator instanceof ChunkProviderEnd)
        {
            genName = "EndRandomLevelSource";
            genClass = "ChunkProviderEnd";
        }
    }

    properties.put("dimension.generator", genName);
    properties.put("dimension.generator.class", genClass);
    properties.put("dimension", world == null ? "" : world.provider.getDimensionType().getName());
    properties.put("dimension.id", world == null ? 0 : world.provider.getDimension());
    properties.put("dimension.isSurface", world == null ? false : world.provider.isSurfaceWorld());
    properties.put("dimension.hasNoSky", world == null ? false : world.provider.hasNoSky());
    properties.put("dimension.groundLevel", world == null ? 0 : world.provider.getAverageGroundLevel());
    properties.put("dimension.actualHeight", world == null ? 0 : world.getActualHeight());
    properties.put("dimension.height", world == null ? 0 : world.getHeight());
    properties.put("age", false);
}