当前位置: 首页>>代码示例>>Java>>正文


Java ChunkProviderFlat类代码示例

本文整理汇总了Java中net.minecraft.world.gen.ChunkProviderFlat的典型用法代码示例。如果您正苦于以下问题:Java ChunkProviderFlat类的具体用法?Java ChunkProviderFlat怎么用?Java ChunkProviderFlat使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ChunkProviderFlat类属于net.minecraft.world.gen包,在下文中一共展示了ChunkProviderFlat类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getGroundLevel

import net.minecraft.world.gen.ChunkProviderFlat; //导入依赖的package包/类
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);
}
 
开发者ID:MinimumContent,项目名称:muon,代码行数:24,代码来源:MuonUtils.java

示例2: createChunkGenerator

import net.minecraft.world.gen.ChunkProviderFlat; //导入依赖的package包/类
/**
 * @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;
    }
}
 
开发者ID:NeptunePowered,项目名称:NeptuneMod,代码行数:26,代码来源:MixinWorldProvider.java

示例3: generate

import net.minecraft.world.gen.ChunkProviderFlat; //导入依赖的package包/类
@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;
        }
    }
}
 
开发者ID:MineMaarten,项目名称:MinesweeperMod,代码行数:19,代码来源:WorldGeneratorMinesweeper.java

示例4: generate

import net.minecraft.world.gen.ChunkProviderFlat; //导入依赖的package包/类
@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);
        }
    }
}
 
开发者ID:MineMaarten,项目名称:PneumaticCraft,代码行数:19,代码来源:WorldGeneratorPneumaticCraft.java

示例5: getGenForWorld

import net.minecraft.world.gen.ChunkProviderFlat; //导入依赖的package包/类
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);
}
 
开发者ID:modmuss50,项目名称:TechnicalDimensions,代码行数:8,代码来源:CustomChunkProvider.java

示例6: generate

import net.minecraft.world.gen.ChunkProviderFlat; //导入依赖的package包/类
@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);
        }
    }
}
 
开发者ID:JayAvery,项目名称:geomastery,代码行数:15,代码来源:WorldGenerator.java

示例7: generate

import net.minecraft.world.gen.ChunkProviderFlat; //导入依赖的package包/类
@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);
        }
    }
}
 
开发者ID:MineMaarten,项目名称:MineChess,代码行数:16,代码来源:WorldGeneratorMineChess.java

示例8: generate

import net.minecraft.world.gen.ChunkProviderFlat; //导入依赖的package包/类
@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);
			}
		}
	}
}
 
开发者ID:WildBamaBoy,项目名称:spellbound,代码行数:31,代码来源:WorldGenMushrooms.java

示例9: createChunkGenerator

import net.minecraft.world.gen.ChunkProviderFlat; //导入依赖的package包/类
/**
 * 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))));
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:8,代码来源:WorldProvider.java

示例10: createChunkGenerator

import net.minecraft.world.gen.ChunkProviderFlat; //导入依赖的package包/类
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))));
}
 
开发者ID:NSExceptional,项目名称:Zombe-Modpack,代码行数:5,代码来源:WorldProvider.java

示例11: setTarget

import net.minecraft.world.gen.ChunkProviderFlat; //导入依赖的package包/类
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) {
      ;
   }

}
 
开发者ID:lerion13,项目名称:witchery,代码行数:43,代码来源:EntitySpirit.java

示例12: defaultHeights

import net.minecraft.world.gen.ChunkProviderFlat; //导入依赖的package包/类
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;
}
 
开发者ID:MinimumContent,项目名称:muon,代码行数:44,代码来源:MuonHeightMap.java

示例13: createChunkGenerator

import net.minecraft.world.gen.ChunkProviderFlat; //导入依赖的package包/类
/**
 * 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()));
}
 
开发者ID:MinecraftModdedClients,项目名称:Resilience-Client-Source,代码行数:8,代码来源:WorldProvider.java

示例14: getChunkGenerator

import net.minecraft.world.gen.ChunkProviderFlat; //导入依赖的package包/类
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()));
}
 
开发者ID:xtrafrancyz,项目名称:Cauldron,代码行数:5,代码来源:WorldType.java

示例15: func_76555_c

import net.minecraft.world.gen.ChunkProviderFlat; //导入依赖的package包/类
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()));
}
 
开发者ID:HATB0T,项目名称:RuneCraftery,代码行数:4,代码来源:WorldProvider.java


注:本文中的net.minecraft.world.gen.ChunkProviderFlat类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。