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


Java BiomeTypes类代码示例

本文整理汇总了Java中org.spongepowered.api.world.biome.BiomeTypes的典型用法代码示例。如果您正苦于以下问题:Java BiomeTypes类的具体用法?Java BiomeTypes怎么用?Java BiomeTypes使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


BiomeTypes类属于org.spongepowered.api.world.biome包,在下文中一共展示了BiomeTypes类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: coverSurfaceStone

import org.spongepowered.api.world.biome.BiomeTypes; //导入依赖的package包/类
private void coverSurfaceStone() {
    for (int x = 1; x < snapshots.length - 1; x++) {
        for (int z = 1; z < snapshots[0][0].length - 1; z++) {
            int y = this.highestY(x, z, true);
            BlockSnapshot block = snapshots[x][y][z];

            if (block.getState().getType() == BlockTypes.STONE || block.getState().getType() == BlockTypes.GRAVEL
                    || block.getState().getType() == BlockTypes.FARMLAND
                    || block.getState().getType() == BlockTypes.DIRT || block.getState().getType() == BlockTypes.SANDSTONE) {
                if (this.biome == BiomeTypes.DESERT || this.biome == BiomeTypes.DESERT_HILLS || this.biome == BiomeTypes.BEACH) {
                    this.snapshots[x][y][z] = this.snapshots[x][y][z].withState(BlockTypes.SAND.getDefaultState());
                } else {
                    this.snapshots[x][y][z] = this.snapshots[x][y][z].withState(BlockTypes.GRASS.getDefaultState());
                }
            }
        }
    }
}
 
开发者ID:MinecraftPortCentral,项目名称:GriefPrevention,代码行数:19,代码来源:RestoreNatureProcessingTask.java

示例2: initBiomeCache

import org.spongepowered.api.world.biome.BiomeTypes; //导入依赖的package包/类
public static void initBiomeCache() {
    try {
        Field[] fields = BiomeTypes.class.getFields();
        biomes = new BiomeType[fields.length];
        biomeMap = new HashMap<>();
        for (int i = 0; i < fields.length; i++) {
            Field field = fields[i];
            String name = field.getName();
            biomeMap.put(name, i);
            biomes[i] = (BiomeType) field.get(null);
        }

    } catch (IllegalArgumentException | IllegalAccessException e) {
        e.printStackTrace();
    }
}
 
开发者ID:IntellectualSites,项目名称:PlotSquared,代码行数:17,代码来源:SpongeUtil.java

示例3: generateBiomes

import org.spongepowered.api.world.biome.BiomeTypes; //导入依赖的package包/类
@Override
public void generateBiomes(MutableBiomeVolume buffer)
{
    Vector3i min = buffer.getBiomeMin();
    Vector3i max = buffer.getBiomeMax();

    for (int x = min.getX(); x <= max.getX(); x++) {
        for (int y = min.getY(); y <= max.getY(); y++) {
            if (x * x + y * y < HILLS_RADIUS) {
                buffer.setBiome(x, y, 0, BiomeTypes.EXTREME_HILLS);
            } else if (x * x + y * y < FOREST_RADIUS) {
                buffer.setBiome(x, y, 0, BiomeTypes.FOREST);
            } else if (x * x + y * y < BEACH_RADIUS) {
                buffer.setBiome(x, y, 0, BiomeTypes.BEACH);
            } else {
                buffer.setBiome(x, y, 0, BiomeTypes.OCEAN);
                // TODO mushrooms islands
            }
        }
    }
}
 
开发者ID:CubeEngine,项目名称:modules-extra,代码行数:22,代码来源:DiscworldBiomeGenerator.java

示例4: reset

import org.spongepowered.api.world.biome.BiomeTypes; //导入依赖的package包/类
@Override
public Builder reset() {
    this.name = null;
    this.temperature = 0;
    this.humidity = 0;
    this.persisted = BiomeTypes.VOID;
    this.settingsBuilder = null;
    return this;
}
 
开发者ID:LanternPowered,项目名称:LanternServer,代码行数:10,代码来源:LanternVirtualBiomeTypeBuilder.java

示例5: getDefaultSettings

import org.spongepowered.api.world.biome.BiomeTypes; //导入依赖的package包/类
@Override
protected FlatGeneratorSettings getDefaultSettings() {
    final List<FlatLayer> layers = new ArrayList<>(5);
    layers.add(new FlatLayer(BlockTypes.BEDROCK, 1));
    layers.add(new FlatLayer(BlockTypes.NETHERRACK, 3));
    layers.add(new FlatLayer(BlockTypes.AIR, 120));
    layers.add(new FlatLayer(BlockTypes.NETHERRACK, 3));
    layers.add(new FlatLayer(BlockTypes.BEDROCK, 1));
    return new FlatGeneratorSettings(BiomeTypes.HELL, layers);
}
 
开发者ID:LanternPowered,项目名称:LanternServer,代码行数:11,代码来源:FlatNetherGeneratorType.java

示例6: getDefaultSettings

import org.spongepowered.api.world.biome.BiomeTypes; //导入依赖的package包/类
@Override
public FlatGeneratorSettings getDefaultSettings() {
    final List<FlatLayer> layers = new ArrayList<>(3);
    layers.add(new FlatLayer(BlockTypes.BEDROCK, 1));
    layers.add(new FlatLayer(BlockTypes.DIRT, 2));
    layers.add(new FlatLayer(BlockTypes.GRASS, 1));
    return new FlatGeneratorSettings(BiomeTypes.PLAINS, layers);
}
 
开发者ID:LanternPowered,项目名称:LanternServer,代码行数:9,代码来源:FlatOverworldGeneratorType.java

示例7: getDefaultSettings

import org.spongepowered.api.world.biome.BiomeTypes; //导入依赖的package包/类
@Override
protected FlatGeneratorSettings getDefaultSettings() {
    final List<FlatLayer> layers = new ArrayList<>(2);
    layers.add(new FlatLayer(BlockTypes.BEDROCK, 1));
    layers.add(new FlatLayer(BlockTypes.END_STONE, 3));
    return new FlatGeneratorSettings(BiomeTypes.SKY, layers);
}
 
开发者ID:LanternPowered,项目名称:LanternServer,代码行数:8,代码来源:FlatTheEndGeneratorType.java

示例8: modifyWorldGenerator

import org.spongepowered.api.world.biome.BiomeTypes; //导入依赖的package包/类
@Override
public void modifyWorldGenerator(WorldProperties world, DataContainer settings, WorldGenerator worldGenerator) {
    String worldName = world.getWorldName();
    worldGenerator.setBaseGenerationPopulator(new SpongeTerrainGen(this.plotGenerator));
    worldGenerator.setBiomeGenerator(new BiomeGenerator() {
        @Override
        public void generateBiomes(MutableBiomeVolume buffer) {
            PlotArea area = PS.get().getPlotArea(worldName, null);
            if (area != null) {
                BiomeType biome = SpongeUtil.getBiome(area.PLOT_BIOME);
                Vector3i min = buffer.getBiomeMin();
                Vector3i max = buffer.getBiomeMax();
                for (int x = min.getX(); x <= max.getX(); x++) {
                    for (int z = min.getZ(); z <= max.getZ(); z++) {
                        buffer.setBiome(x, 0, z, biome);
                }
            }
            }
    }
    });
    for (BiomeType type : ReflectionUtils.<BiomeType> getStaticFields(BiomeTypes.class)) {
        BiomeGenerationSettings biomeSettings = worldGenerator.getBiomeSettings(type);
        biomeSettings.getGenerationPopulators().clear();
        biomeSettings.getPopulators().clear();
        biomeSettings.getGroundCoverLayers().clear();
}
    worldGenerator.getGenerationPopulators().clear();
    worldGenerator.getPopulators().clear();
    PS.get().loadWorld(worldName, this);
}
 
开发者ID:IntellectualSites,项目名称:PlotSquared,代码行数:31,代码来源:SpongePlotGenerator.java

示例9: reduceLogs

import org.spongepowered.api.world.biome.BiomeTypes; //导入依赖的package包/类
private void reduceLogs() {
    if (this.seaLevel < 1) {
        return;
    }

    boolean jungleBiome = this.biome == BiomeTypes.JUNGLE || this.biome == BiomeTypes.JUNGLE_HILLS;

    // scan all blocks above sea level
    for (int x = 1; x < snapshots.length - 1; x++) {
        for (int z = 1; z < snapshots[0][0].length - 1; z++) {
            for (int y = this.seaLevel - 1; y < snapshots[0].length; y++) {
                BlockSnapshot block = snapshots[x][y][z];

                // skip non-logs
                if (block.getState().getType() != BlockTypes.LOG) {
                    continue;
                }
                if (block.getState().getType() != BlockTypes.LOG2) {
                    continue;
                }

                // if in jungle biome, skip jungle logs
                Optional<? extends Enum<?>> enumProperty = block.getState().getTraitValue(EnumTraits.LOG_VARIANT);
                if (jungleBiome && enumProperty.isPresent() && enumProperty.get().name().equalsIgnoreCase("jungle")) {
                    continue;
                }

                // examine adjacent blocks for logs
                BlockSnapshot leftBlock = this.snapshots[x + 1][y][z];
                BlockSnapshot rightBlock = this.snapshots[x - 1][y][z];
                BlockSnapshot upBlock = this.snapshots[x][y][z + 1];
                BlockSnapshot downBlock = this.snapshots[x][y][z - 1];

                // if any, remove the log
                if (leftBlock.getState().getType() == BlockTypes.LOG || rightBlock.getState().getType() == BlockTypes.LOG
                        || upBlock.getState().getType() == BlockTypes.LOG || downBlock.getState().getType() == BlockTypes.LOG) {
                    this.snapshots[x][y][z] = this.snapshots[x][y][z].withState(BlockTypes.AIR.getDefaultState());
                }
            }
        }
    }
}
 
开发者ID:MinecraftPortCentral,项目名称:GriefPrevention,代码行数:43,代码来源:RestoreNatureProcessingTask.java

示例10: BiomeRegistryModule

import org.spongepowered.api.world.biome.BiomeTypes; //导入依赖的package包/类
private BiomeRegistryModule() {
    super(BiomeTypes.class);
}
 
开发者ID:LanternPowered,项目名称:LanternServer,代码行数:4,代码来源:BiomeRegistryModule.java

示例11: createBiomeBuffer

import org.spongepowered.api.world.biome.BiomeTypes; //导入依赖的package包/类
@Override
public MutableBiomeVolume createBiomeBuffer(Vector3i min, Vector3i size) {
    final BiomeType[] array = new BiomeType[size.getX() * size.getY() * size.getZ()];
    Arrays.fill(array, BiomeTypes.OCEAN);
    return new ObjectArrayMutableBiomeBuffer(array, min, size);
}
 
开发者ID:LanternPowered,项目名称:LanternServer,代码行数:7,代码来源:LanternExtentBufferFactory.java

示例12: createThreadSafeBiomeBuffer

import org.spongepowered.api.world.biome.BiomeTypes; //导入依赖的package包/类
@Override
public MutableBiomeVolume createThreadSafeBiomeBuffer(Vector3i min, Vector3i size) {
    final BiomeType[] array = new BiomeType[size.getX() * size.getY() * size.getZ()];
    Arrays.fill(array, BiomeTypes.OCEAN);
    return new AtomicObjectArrayMutableBiomeBuffer(array, min, size);
}
 
开发者ID:LanternPowered,项目名称:LanternServer,代码行数:7,代码来源:LanternExtentBufferFactory.java

示例13: ChunkBiomeBuffer

import org.spongepowered.api.world.biome.BiomeTypes; //导入依赖的package包/类
ChunkBiomeBuffer() {
    super(Vector3i.ZERO, CHUNK_BIOME_VOLUME);
    this.biomeTypes = new BiomeType[CHUNK_AREA];
    Arrays.fill(this.biomeTypes, BiomeTypes.OCEAN);
    detach();
}
 
开发者ID:LanternPowered,项目名称:LanternServer,代码行数:7,代码来源:LanternChunkManager.java

示例14: reuse

import org.spongepowered.api.world.biome.BiomeTypes; //导入依赖的package包/类
@Override
public void reuse(Vector3i start) {
    super.reuse(start);
    Arrays.fill(this.biomeTypes, BiomeTypes.OCEAN);
}
 
开发者ID:LanternPowered,项目名称:LanternServer,代码行数:6,代码来源:LanternChunkManager.java

示例15: getBiome

import org.spongepowered.api.world.biome.BiomeTypes; //导入依赖的package包/类
@Override
public BiomeType getBiome(int x, int y, int z) {
    return BiomeRegistryModule.get().getByInternalId(getBiomeId(x, y, z)).orElse(BiomeTypes.OCEAN);
}
 
开发者ID:LanternPowered,项目名称:LanternServer,代码行数:5,代码来源:LanternChunk.java


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