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


Java BiomeSource类代码示例

本文整理汇总了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);
        }

    }
 
开发者ID:CoreNetwork,项目名称:CoreNetwork-Tools,代码行数:12,代码来源:AnvilLevelStorageSource.java

示例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();
        }
    }
 
开发者ID:CoreNetwork,项目名称:CoreNetwork-Tools,代码行数:48,代码来源:AnvilLevelStorageSource.java


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