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


Java Chunk.setTerrainPopulated方法代码示例

本文整理汇总了Java中net.minecraft.world.chunk.Chunk.setTerrainPopulated方法的典型用法代码示例。如果您正苦于以下问题:Java Chunk.setTerrainPopulated方法的具体用法?Java Chunk.setTerrainPopulated怎么用?Java Chunk.setTerrainPopulated使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.minecraft.world.chunk.Chunk的用法示例。


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

示例1: readChunkFromNBT

import net.minecraft.world.chunk.Chunk; //导入方法依赖的package包/类
/**
 * Reads the data stored in the passed NBTTagCompound and creates a Chunk with that data in the passed World.
 * Returns the created Chunk.
 */
private Chunk readChunkFromNBT(World worldIn, NBTTagCompound compound)
{
    int i = compound.getInteger("xPos");
    int j = compound.getInteger("zPos");
    Chunk chunk = new Chunk(worldIn, i, j);
    chunk.setHeightMap(compound.getIntArray("HeightMap"));
    chunk.setTerrainPopulated(compound.getBoolean("TerrainPopulated"));
    chunk.setLightPopulated(compound.getBoolean("LightPopulated"));
    chunk.setInhabitedTime(compound.getLong("InhabitedTime"));
    NBTTagList nbttaglist = compound.getTagList("Sections", 10);
    int k = 16;
    ExtendedBlockStorage[] aextendedblockstorage = new ExtendedBlockStorage[16];
    boolean flag = !worldIn.provider.getHasNoSky();

    for (int l = 0; l < nbttaglist.tagCount(); ++l)
    {
        NBTTagCompound nbttagcompound = nbttaglist.getCompoundTagAt(l);
        int i1 = nbttagcompound.getByte("Y");
        ExtendedBlockStorage extendedblockstorage = new ExtendedBlockStorage(i1 << 4, flag);
        byte[] abyte = nbttagcompound.getByteArray("Blocks");
        NibbleArray nibblearray = new NibbleArray(nbttagcompound.getByteArray("Data"));
        NibbleArray nibblearray1 = nbttagcompound.hasKey("Add", 7) ? new NibbleArray(nbttagcompound.getByteArray("Add")) : null;
        extendedblockstorage.getData().setDataFromNBT(abyte, nibblearray, nibblearray1);
        extendedblockstorage.setBlocklightArray(new NibbleArray(nbttagcompound.getByteArray("BlockLight")));

        if (flag)
        {
            extendedblockstorage.setSkylightArray(new NibbleArray(nbttagcompound.getByteArray("SkyLight")));
        }

        extendedblockstorage.removeInvalidBlocks();
        aextendedblockstorage[i1] = extendedblockstorage;
    }

    chunk.setStorageArrays(aextendedblockstorage);

    if (compound.hasKey("Biomes", 7))
    {
        chunk.setBiomeArray(compound.getByteArray("Biomes"));
    }

    // End this method here and split off entity loading to another method
    return chunk;
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:49,代码来源:AnvilChunkLoader.java


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