本文整理汇总了Java中cn.nukkit.nbt.tag.CompoundTag.getCompound方法的典型用法代码示例。如果您正苦于以下问题:Java CompoundTag.getCompound方法的具体用法?Java CompoundTag.getCompound怎么用?Java CompoundTag.getCompound使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cn.nukkit.nbt.tag.CompoundTag
的用法示例。
在下文中一共展示了CompoundTag.getCompound方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: BaseLevelProvider
import cn.nukkit.nbt.tag.CompoundTag; //导入方法依赖的package包/类
public BaseLevelProvider(Level level, String path) throws IOException {
this.level = level;
this.path = path;
File file_path = new File(this.path);
if (!file_path.exists()) {
file_path.mkdirs();
}
CompoundTag levelData = NBTIO.readCompressed(new FileInputStream(new File(this.getPath() + "level.dat")), ByteOrder.BIG_ENDIAN);
if (levelData.get("Data") instanceof CompoundTag) {
this.levelData = levelData.getCompound("Data");
} else {
throw new LevelException("Invalid level.dat");
}
if (!this.levelData.contains("generatorName")) {
this.levelData.putString("generatorName", Generator.getGenerator("DEFAULT").getSimpleName().toLowerCase());
}
if (!this.levelData.contains("generatorOptions")) {
this.levelData.putString("generatorOptions", "");
}
}
示例2: fromBinary
import cn.nukkit.nbt.tag.CompoundTag; //导入方法依赖的package包/类
public static Chunk fromBinary(byte[] data, LevelProvider provider) {
try {
CompoundTag chunk = NBTIO.read(new ByteArrayInputStream(Zlib.inflate(data)), ByteOrder.BIG_ENDIAN);
if (!chunk.contains("Level") || !(chunk.get("Level") instanceof CompoundTag)) {
return null;
}
return new Chunk(provider != null ? provider : McRegion.class.newInstance(), chunk.getCompound("Level"));
} catch (Exception e) {
return null;
}
}
示例3: fromBinary
import cn.nukkit.nbt.tag.CompoundTag; //导入方法依赖的package包/类
public static Chunk fromBinary(byte[] data, LevelProvider provider) {
try {
CompoundTag chunk = NBTIO.read(new ByteArrayInputStream(Zlib.inflate(data)), ByteOrder.BIG_ENDIAN);
if (!chunk.contains("Level") || !(chunk.get("Level") instanceof CompoundTag)) {
return null;
}
return new Chunk(provider, chunk.getCompound("Level"));
} catch (Exception e) {
Server.getInstance().getLogger().logException(e);
return null;
}
}
示例4: fromFastBinary
import cn.nukkit.nbt.tag.CompoundTag; //导入方法依赖的package包/类
public static Chunk fromFastBinary(byte[] data, LevelProvider provider) {
try {
CompoundTag chunk = NBTIO.read(new DataInputStream(new ByteArrayInputStream(data)), ByteOrder.BIG_ENDIAN);
if (!chunk.contains("Level") || !(chunk.get("Level") instanceof CompoundTag)) {
return null;
}
return new Chunk(provider, chunk.getCompound("Level"));
} catch (Exception e) {
return null;
}
}