本文整理汇总了Java中net.minecraft.world.level.biome.BiomeSource类的典型用法代码示例。如果您正苦于以下问题:Java BiomeSource类的具体用法?Java BiomeSource怎么用?Java BiomeSource使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
BiomeSource类属于net.minecraft.world.level.biome包,在下文中一共展示了BiomeSource类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: convertRegions
import net.minecraft.world.level.biome.BiomeSource; //导入依赖的package包/类
private void convertRegions(File baseFolder, ArrayList<File> regionFiles, BiomeSource biomeSource, int currentCount, int totalCount, ProgressListener progress) {
for (File regionFile : regionFiles) {
convertRegion(baseFolder, regionFile, biomeSource, currentCount, totalCount, progress);
currentCount++;
int percent = (int) Math.round(100.0d * (double) currentCount / (double) totalCount);
progress.progressStagePercentage(percent);
}
}
示例2: convertRegion
import net.minecraft.world.level.biome.BiomeSource; //导入依赖的package包/类
private void convertRegion(File baseFolder, File regionFile, BiomeSource biomeSource, int currentCount, int totalCount, ProgressListener progress) {
try {
String name = regionFile.getName();
RegionFile regionSource = new RegionFile(regionFile);
RegionFile regionDest = new RegionFile(new File(baseFolder, name.substring(0, name.length() - RegionFile.MCREGION_EXTENSION.length()) + RegionFile.ANVIL_EXTENSION));
for (int x = 0; x < 32; x++) {
for (int z = 0; z < 32; z++) {
if (regionSource.hasChunk(x, z) && !regionDest.hasChunk(x, z)) {
DataInputStream regionChunkInputStream = regionSource.getChunkDataInputStream(x, z);
if (regionChunkInputStream == null) {
System.out.println("Failed to fetch input stream");
continue;
}
CompoundTag chunkData = NbtIo.read(regionChunkInputStream);
regionChunkInputStream.close();
CompoundTag compound = chunkData.getCompound("Level");
{
OldLevelChunk oldChunk = OldChunkStorage.load(compound);
CompoundTag tag = new CompoundTag();
CompoundTag levelData = new CompoundTag();
tag.put("Level", levelData);
OldChunkStorage.convertToAnvilFormat(oldChunk, levelData, biomeSource);
DataOutputStream chunkDataOutputStream = regionDest.getChunkDataOutputStream(x, z);
NbtIo.write(tag, chunkDataOutputStream);
chunkDataOutputStream.close();
}
}
}
int basePercent = (int) Math.round(100.0d * (double) (currentCount * 1024) / (double) (totalCount * 1024));
int newPercent = (int) Math.round(100.0d * (double) ((x + 1) * 32 + currentCount * 1024) / (double) (totalCount * 1024));
if (newPercent > basePercent) {
progress.progressStagePercentage(newPercent);
}
}
regionSource.close();
regionDest.close();
} catch (IOException e) {
e.printStackTrace();
}
}