本文整理汇总了Java中net.minecraft.world.chunk.Chunk.setHeightMap方法的典型用法代码示例。如果您正苦于以下问题:Java Chunk.setHeightMap方法的具体用法?Java Chunk.setHeightMap怎么用?Java Chunk.setHeightMap使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.world.chunk.Chunk
的用法示例。
在下文中一共展示了Chunk.setHeightMap方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: generateHeightMap
import net.minecraft.world.chunk.Chunk; //导入方法依赖的package包/类
/**
* Recalculate height map and precipitations map for chunk
* @param chunk Chunk to process
*/
public void generateHeightMap(Chunk chunk) {
int i = chunk.getTopFilledSegment();
int heightMapMinimum = Integer.MAX_VALUE;
int[] heightMap = new int[256];
for (int j = 0; j < 16; ++j) {
for (int k = 0; k < 16; ++k) {
for (int l = i + 16; l > 0; --l) {
UBlockState state = new UBlockState(chunk.getBlockState(j, l - 1, k));
if (state.getOpacity() != 0) {
heightMap[k << 4 | j] = l;
if (l < heightMapMinimum) {
heightMapMinimum = l;
}
break;
}
}
}
}
chunk.setHeightMap(heightMap);
}
示例2: 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;
}