本文整理汇总了Java中cn.nukkit.level.format.LevelProvider.getClass方法的典型用法代码示例。如果您正苦于以下问题:Java LevelProvider.getClass方法的具体用法?Java LevelProvider.getClass怎么用?Java LevelProvider.getClass使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cn.nukkit.level.format.LevelProvider
的用法示例。
在下文中一共展示了LevelProvider.getClass方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: Chunk
import cn.nukkit.level.format.LevelProvider; //导入方法依赖的package包/类
public Chunk(LevelProvider level, int chunkX, int chunkZ, byte[] terrain, List<CompoundTag> entityData, List<CompoundTag> tileData, Map<Integer, Integer> extraData) {
ByteBuffer buffer = ByteBuffer.wrap(terrain).order(ByteOrder.BIG_ENDIAN);
byte[] blocks = new byte[32768];
buffer.get(blocks);
byte[] data = new byte[16384];
buffer.get(data);
byte[] skyLight = new byte[16384];
buffer.get(skyLight);
byte[] blockLight = new byte[16384];
buffer.get(blockLight);
int[] heightMap = new int[256];
for (int i = 0; i < 256; i++) {
heightMap[i] = buffer.get() & 0xff;
}
int[] biomeColors = new int[256];
for (int i = 0; i < 256; i++) {
biomeColors[i] = buffer.getInt();
}
this.provider = level;
if (level != null) {
this.providerClass = level.getClass();
}
this.x = chunkX;
this.z = chunkZ;
this.blocks = blocks;
this.data = data;
this.skyLight = skyLight;
this.blockLight = blockLight;
if (biomeColors.length == 256) {
this.biomeColors = biomeColors;
} else {
this.biomeColors = new int[256];
}
if (heightMap.length == 256) {
this.heightMap = heightMap;
} else {
int[] ints = new int[256];
Arrays.fill(ints, 127);
this.heightMap = ints;
}
this.NBTentities = entityData == null ? new ArrayList<>() : entityData;
this.NBTtiles = tileData == null ? new ArrayList<>() : tileData;
this.extraData = extraData == null ? new HashMap<>() : extraData;
}