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

项目: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);
}
项目:NeptuneMod    文件:MixinWorldProvider.java   
/**
 * @author jamierocks - 24th October 2016
 * @reason To use custom ChunkProviders where necessary
 */
@Overwrite
public IChunkProvider createChunkGenerator() {
    final IChunkProvider chunkProvider = 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 ChunkProviderGenerate(this.worldObj, this.worldObj.getSeed(), this.worldObj.getWorldInfo().isMapFeaturesEnabled(),
                                    this.generatorSettings) :
                            new ChunkProviderGenerate(this.worldObj, this.worldObj.getSeed(), this.worldObj.getWorldInfo().isMapFeaturesEnabled(),
                                    this.generatorSettings)));

    if (this.dimensionType.hasChunkProvider()) {
        final ChunkProviderCustom chunkProviderCustom = this.dimensionType.getChunkProvider();
        chunkProviderCustom.setWorld((net.canarymod.api.world.World) this.worldObj);
        return new NeptuneChunkProviderCustom(chunkProviderCustom, chunkProvider);
    } else {
        return chunkProvider;
    }
}
项目:MinesweeperMod    文件:WorldGeneratorMinesweeper.java   
@Override
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider){
    if(!(chunkGenerator instanceof ChunkProviderFlat)) { //don't generate on flatworlds
        switch(world.provider.dimensionId){
            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);
            default:
                generateSurface(world, random, chunkX * 16, chunkZ * 16);
                break;
        }
    }
}
项目:PneumaticCraft    文件:WorldGeneratorPneumaticCraft.java   
@Override
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider){
    if(!(chunkGenerator instanceof ChunkProviderFlat)) { //don't generate on flatworlds
        switch(world.provider.dimensionId){
            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);
        }
    }
}
项目: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);
}
项目:geomastery    文件:WorldGenerator.java   
@Override
public void generate(Random rand, int chunkScaleX, int chunkScaleZ,
        World world, IChunkGenerator chunkGenerator,
        IChunkProvider chunkProvider) {

    if (world.provider.getDimension() == 0) {

        if (!(chunkGenerator instanceof ChunkProviderFlat)) {

            generateOverworldChunk(world, rand, chunkScaleX * 16,
                chunkScaleZ * 16);
        }
    }
}
项目:MineChess    文件:WorldGeneratorMineChess.java   
@Override
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider){
    if(MineChess.DEBUG || !(chunkGenerator instanceof ChunkProviderFlat)) { //don't generate on flatworlds (unless testing)
        switch(world.provider.getDimensionId()){
            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);
        }
    }
}
项目:spellbound    文件:WorldGenMushrooms.java   
@Override
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider) 
{
    if (!(chunkGenerator instanceof ChunkProviderFlat))
    {
        for (int loop = 0; loop < 20; loop++)
        {
            final int genX = chunkX * 16 + random.nextInt(16);
            final int genY = random.nextInt(90);
            final int genZ = chunkZ * 16 + random.nextInt(16);

            int spawnId = SpellboundCore.getInstance().blockPrimaryMushroomRedOrange.blockID;

            if (random.nextBoolean())
            {
                spawnId = SpellboundCore.getInstance().blockPrimaryMushroomPinkOrange.blockID;
            }

            else if (random.nextBoolean())
            {
                spawnId = SpellboundCore.getInstance().blockPrimaryMushroomBlueGrey.blockID;
            }

            if (world.getBlockId(genX, genY, genZ) == Block.grass.blockID)
            {
                world.setBlock(genX, genY + 1, genZ, spawnId);
            }
        }
    }
}
项目:DecompiledMinecraft    文件:WorldProvider.java   
/**
 * Returns a new chunk provider which generates chunks for this world
 */
public IChunkProvider createChunkGenerator()
{
    return (IChunkProvider)(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 ChunkProviderGenerate(this.worldObj, this.worldObj.getSeed(), this.worldObj.getWorldInfo().isMapFeaturesEnabled(), this.generatorSettings) : new ChunkProviderGenerate(this.worldObj, this.worldObj.getSeed(), this.worldObj.getWorldInfo().isMapFeaturesEnabled(), this.generatorSettings))));
}
项目:DecompiledMinecraft    文件:WorldProvider.java   
/**
 * Returns a new chunk provider which generates chunks for this world
 */
public IChunkProvider createChunkGenerator()
{
    return (IChunkProvider)(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 ChunkProviderGenerate(this.worldObj, this.worldObj.getSeed(), this.worldObj.getWorldInfo().isMapFeaturesEnabled(), this.generatorSettings) : new ChunkProviderGenerate(this.worldObj, this.worldObj.getSeed(), this.worldObj.getWorldInfo().isMapFeaturesEnabled(), this.generatorSettings))));
}
项目:BaseClient    文件:WorldProvider.java   
/**
 * Returns a new chunk provider which generates chunks for this world
 */
public IChunkProvider createChunkGenerator()
{
    return (IChunkProvider)(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 ChunkProviderGenerate(this.worldObj, this.worldObj.getSeed(), this.worldObj.getWorldInfo().isMapFeaturesEnabled(), this.generatorSettings) : new ChunkProviderGenerate(this.worldObj, this.worldObj.getSeed(), this.worldObj.getWorldInfo().isMapFeaturesEnabled(), this.generatorSettings))));
}
项目:BaseClient    文件:WorldProvider.java   
/**
 * Returns a new chunk provider which generates chunks for this world
 */
public IChunkProvider createChunkGenerator()
{
    return (IChunkProvider)(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 ChunkProviderGenerate(this.worldObj, this.worldObj.getSeed(), this.worldObj.getWorldInfo().isMapFeaturesEnabled(), this.generatorSettings) : new ChunkProviderGenerate(this.worldObj, this.worldObj.getSeed(), this.worldObj.getWorldInfo().isMapFeaturesEnabled(), this.generatorSettings))));
}
项目: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))));
}
项目:witchery    文件:EntitySpirit.java   
public void setTarget(String target, int type) {
   this.timeToLive = TimeUtil.secsToTicks(10);
   this.spiritType = type;

   try {
      if(target.equals("Village")) {
         IChunkProvider ex;
         for(ex = super.worldObj.getChunkProvider(); ex != null && ex instanceof ChunkProviderServer; ex = ((ChunkProviderServer)ex).currentChunkProvider) {
            ;
         }

         if(ex != null) {
            if(ex instanceof ChunkProviderFlat) {
               if(fieldStructureGenerators == null) {
                  fieldStructureGenerators = ReflectionHelper.findField(ChunkProviderFlat.class, new String[]{"structureGenerators", "field_82696_f", "f"});
               }

               Iterator iterator = ((List)fieldStructureGenerators.get((ChunkProviderFlat)ex)).iterator();

               while(iterator.hasNext()) {
                  if(this.setWaypointTo(iterator.next(), MapGenVillage.class)) {
                     return;
                  }
               }
            } else if(ex instanceof ChunkProviderGenerate) {
               if(fieldVillageGenerator == null) {
                  fieldVillageGenerator = ReflectionHelper.findField(ChunkProviderGenerate.class, new String[]{"villageGenerator", "field_73224_v", "v"});
               }

               if(fieldVillageGenerator != null) {
                  this.setWaypointTo(fieldVillageGenerator.get((ChunkProviderGenerate)ex), MapGenVillage.class);
               }
            } else if(ex instanceof ChunkProviderHell) {
               this.setWaypointTo(((ChunkProviderHell)ex).genNetherBridge);
            }
         }
      }
   } catch (IllegalAccessException var5) {
      ;
   }

}
项目: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;
}
项目:Resilience-Client-Source    文件:WorldProvider.java   
/**
 * Returns a new chunk provider which generates chunks for this world
 */
public IChunkProvider createChunkGenerator()
{
    return (IChunkProvider)(this.terrainType == WorldType.FLAT ? new ChunkProviderFlat(this.worldObj, this.worldObj.getSeed(), this.worldObj.getWorldInfo().isMapFeaturesEnabled(), this.field_82913_c) : new ChunkProviderGenerate(this.worldObj, this.worldObj.getSeed(), this.worldObj.getWorldInfo().isMapFeaturesEnabled()));
}
项目:Cauldron    文件:WorldType.java   
public IChunkProvider getChunkGenerator(World world, String generatorOptions)
{
    return (this == FLAT ? new ChunkProviderFlat(world, world.getSeed(), world.getWorldInfo().isMapFeaturesEnabled(), generatorOptions) : new ChunkProviderGenerate(world, world.getSeed(), world.getWorldInfo().isMapFeaturesEnabled()));
}
项目:Cauldron    文件:WorldType.java   
public IChunkProvider getChunkGenerator(World world, String generatorOptions)
{
    return (this == FLAT ? new ChunkProviderFlat(world, world.getSeed(), world.getWorldInfo().isMapFeaturesEnabled(), generatorOptions) : new ChunkProviderGenerate(world, world.getSeed(), world.getWorldInfo().isMapFeaturesEnabled()));
}
项目:RuneCraftery    文件:WorldProvider.java   
public IChunkProvider func_76555_c() {
   return (IChunkProvider)(this.field_76577_b == WorldType.field_77138_c?new ChunkProviderFlat(this.field_76579_a, this.field_76579_a.func_72905_C(), this.field_76579_a.func_72912_H().func_76089_r(), this.field_82913_c):new ChunkProviderGenerate(this.field_76579_a, this.field_76579_a.func_72905_C(), this.field_76579_a.func_72912_H().func_76089_r()));
}
项目: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);
}