本文整理汇总了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);
}
示例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;
}
}
示例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;
}
}
}
示例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);
}
}
}
示例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);
}
示例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);
}
}
}
示例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);
}
}
}
示例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);
}
}
}
}
示例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))));
}
示例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))));
}
示例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) {
;
}
}
示例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;
}
示例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()));
}
示例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()));
}
示例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()));
}