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


Java BiomeType类代码示例

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


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

示例1: copyToBiomeObjectArray

import org.spongepowered.api.world.biome.BiomeType; //导入依赖的package包/类
public static BiomeType[] copyToBiomeObjectArray(BiomeVolume area, Vector3i min, Vector3i max, Vector3i size) {
    // Check if the volume has more biomes than can be stored in an array
    final long memory = (long) size.getX() * (long) size.getY() * (long) size.getZ();
    // Leave 8 bytes for a header used in some JVMs
    if (memory > Integer.MAX_VALUE - 8) {
        throw new OutOfMemoryError("Cannot copy the biomes to an array because the size limit was reached!");
    }
    final BiomeType[] copy = new BiomeType[(int) memory];
    int i = 0;
    for (int x = min.getX(); x <= max.getX(); x++) {
        for (int z = min.getZ(); z <= max.getZ(); z++) {
            for (int y = min.getY(); y <= max.getY(); y++) {
                copy[i++] = area.getBiome(x, y, z);
            }
        }
    }
    return copy;
}
 
开发者ID:LanternPowered,项目名称:LanternServer,代码行数:19,代码来源:ExtentBufferHelper.java

示例2: fill

import org.spongepowered.api.world.biome.BiomeType; //导入依赖的package包/类
@Override
public void fill(BiomeVolumeFiller filler) {
    final int xMin = this.volume.getBiomeMin().getX();
    final int yMin = this.volume.getBiomeMin().getY();
    final int zMin = this.volume.getBiomeMin().getZ();
    final int xMax = this.volume.getBiomeMax().getX();
    final int yMax = this.volume.getBiomeMax().getY();
    final int zMax = this.volume.getBiomeMax().getZ();
    for (int z = zMin; z <= zMax; z++) {
        for (int y = yMin; y <= yMax; y++) {
            for (int x = xMin; x <= xMax; x++) {
                final BiomeType biome = filler.produce(x, y, z);
                this.volume.setBiome(x, y, z, biome);
            }
        }
    }
}
 
开发者ID:LanternPowered,项目名称:LanternServer,代码行数:18,代码来源:LanternMutableBiomeVolumeWorker.java

示例3: map

import org.spongepowered.api.world.biome.BiomeType; //导入依赖的package包/类
@Override
public void map(BiomeVolumeMapper mapper, MutableBiomeVolume destination) {
    final Vector3i offset = align(destination);
    final int xOffset = offset.getX();
    final int yOffset = offset.getY();
    final int zOffset = offset.getZ();
    final UnmodifiableBiomeVolume unmodifiableArea = this.volume.getUnmodifiableBiomeView();
    final int xMin = unmodifiableArea.getBiomeMin().getX();
    final int yMin = unmodifiableArea.getBiomeMin().getY();
    final int zMin = unmodifiableArea.getBiomeMin().getZ();
    final int xMax = unmodifiableArea.getBiomeMax().getX();
    final int yMax = unmodifiableArea.getBiomeMax().getY();
    final int zMax = unmodifiableArea.getBiomeMax().getZ();
    for (int z = zMin; z <= zMax; z++) {
        for (int y = yMin; y <= yMax; y++) {
            for (int x = xMin; x <= xMax; x++) {
                final BiomeType biome = mapper.map(unmodifiableArea, x, y, z);
                destination.setBiome(x + xOffset, y + yOffset, z + zOffset, biome);
            }
        }
    }
}
 
开发者ID:LanternPowered,项目名称:LanternServer,代码行数:23,代码来源:LanternBiomeVolumeWorker.java

示例4: getBiomeCopy

import org.spongepowered.api.world.biome.BiomeType; //导入依赖的package包/类
@Override
public MutableBiomeVolume getBiomeCopy(StorageType type) {
    switch (type) {
        case STANDARD:
            final BiomeType[] array = new BiomeType[this.biomes.length()];
            for (int i = 0; i < array.length; i++) {
                array[i] = this.biomes.get(i);
            }
            return new ObjectArrayMutableBiomeBuffer(array, this.start, this.size);
        case THREAD_SAFE:
            final AtomicReferenceArray<BiomeType> copy = new AtomicReferenceArray<>(this.biomes.length());
            for (int i = 0; i < copy.length(); i++) {
                copy.set(i, this.biomes.get(i));
            }
            return new AtomicObjectArrayMutableBiomeBuffer(copy, this.start, this.size);
        default:
            throw new UnsupportedOperationException(type.name());
    }
}
 
开发者ID:LanternPowered,项目名称:LanternServer,代码行数:20,代码来源:AtomicObjectArrayMutableBiomeBuffer.java

示例5: setBiomes

import org.spongepowered.api.world.biome.BiomeType; //导入依赖的package包/类
public void setBiomes(LocalChunk<char[]> lc) {
    if (lc.biomes != null) {
        World worldObj = getSpongeWorld();
        int bx = lc.getX() << 4;
        int bz = lc.getX() << 4;
        String last = null;
        BiomeType biome = null;
        for (int x = 0; x < lc.biomes.length; x++) {
            String[] biomes2 = lc.biomes[x];
            if (biomes2 != null) {
                for (int y = 0; y < biomes2.length; y++) {
                    String biomeStr = biomes2[y];
                    if (biomeStr != null) {
                        if (last == null || !StringMan.isEqual(last, biomeStr)) {
                            biome = SpongeUtil.getBiome(biomeStr.toUpperCase());
                        }
                        worldObj.setBiome(bx, 0, bz, biome);
                    }
                }
            }
        }
    }
}
 
开发者ID:IntellectualSites,项目名称:PlotSquared,代码行数:24,代码来源:SpongeLocalQueue.java

示例6: initBiomeCache

import org.spongepowered.api.world.biome.BiomeType; //导入依赖的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

示例7: execute

import org.spongepowered.api.world.biome.BiomeType; //导入依赖的package包/类
@Override
public CommandResult execute(CommandSource src, CommandContext args) throws CommandException {
    checkIfPlayer(src);
    Player p = (Player) src;
    BiomeType type = args.<BiomeType>getOne("biome").get();

    //Find location
    Location<World> loc = BiomeFindHandler.findBiome(p, type).orElse(null);
    if (loc == null) {
        throw Messages.error(src, "teleport.command.biometeleport.fail", "%biome%", type.getName());
    }

    //Found suitable location
    Teleportation request = UltimateCore.get().getTeleportService().createTeleportation(p, Arrays.asList(p), new Transform<>(loc, p.getRotation(), p.getScale()), teleportRequest -> {
        //Complete
        Messages.send(p, "teleport.command.biometeleport.success", "%biome%", type.getName());
    }, (teleportRequest, reason) -> {
    }, true, false);
    request.start();
    return CommandResult.success();
}
 
开发者ID:Bammerbom,项目名称:UltimateCore,代码行数:22,代码来源:BiomeTeleportCommand.java

示例8: persistedType

import org.spongepowered.api.world.biome.BiomeType; //导入依赖的package包/类
@Override
public Builder persistedType(BiomeType biome) {
    checkNotNull(biome, "biome");
    checkArgument(!(biome instanceof VirtualBiomeType), "Persisted type cannot be a virtual biome.");
    this.persisted = biome;
    return this;
}
 
开发者ID:LanternPowered,项目名称:LanternServer,代码行数:8,代码来源:LanternVirtualBiomeTypeBuilder.java

示例9: merge

import org.spongepowered.api.world.biome.BiomeType; //导入依赖的package包/类
@Override
public void merge(BiomeVolume second, BiomeVolumeMerger merger, MutableBiomeVolume destination) {
    final Vector3i offsetSecond = align(second);
    final int xOffsetSecond = offsetSecond.getX();
    final int yOffsetSecond = offsetSecond.getY();
    final int zOffsetSecond = offsetSecond.getZ();
    final Vector3i offsetDestination = align(destination);
    final int xOffsetDestination = offsetDestination.getX();
    final int yOffsetDestination = offsetDestination.getY();
    final int zOffsetDestination = offsetDestination.getZ();
    final UnmodifiableBiomeVolume firstUnmodifiableArea = this.volume.getUnmodifiableBiomeView();
    final int xMin = firstUnmodifiableArea.getBiomeMin().getX();
    final int yMin = firstUnmodifiableArea.getBiomeMin().getY();
    final int zMin = firstUnmodifiableArea.getBiomeMin().getZ();
    final int xMax = firstUnmodifiableArea.getBiomeMax().getX();
    final int yMax = firstUnmodifiableArea.getBiomeMax().getY();
    final int zMax = firstUnmodifiableArea.getBiomeMax().getZ();
    final UnmodifiableBiomeVolume secondUnmodifiableArea = second.getUnmodifiableBiomeView();
    for (int z = zMin; z <= zMax; z++) {
        for (int y = yMin; y <= yMax; y++) {
            for (int x = xMin; x <= xMax; x++) {
                final BiomeType biome = merger.merge(firstUnmodifiableArea, x, y, z, secondUnmodifiableArea, x + xOffsetSecond, y + yOffsetSecond,
                        z + zOffsetSecond);
                destination.setBiome(x + xOffsetDestination, y + yOffsetDestination, z + zOffsetDestination, biome);
            }
        }
    }
}
 
开发者ID:LanternPowered,项目名称:LanternServer,代码行数:29,代码来源:LanternBiomeVolumeWorker.java

示例10: getImmutableBiomeCopy

import org.spongepowered.api.world.biome.BiomeType; //导入依赖的package包/类
@Override
public ImmutableBiomeVolume getImmutableBiomeCopy() {
    final BiomeType[] array = new BiomeType[this.biomes.length()];
    for (int i = 0; i < array.length; i++) {
        array[i] = this.biomes.get(i);
    }
    return new ObjectArrayImmutableBiomeBuffer(array, this.start, this.size);
}
 
开发者ID:LanternPowered,项目名称:LanternServer,代码行数:9,代码来源:AtomicObjectArrayMutableBiomeBuffer.java

示例11: modifyWorldGenerator

import org.spongepowered.api.world.biome.BiomeType; //导入依赖的package包/类
@Override
public void modifyWorldGenerator(WorldProperties world, DataContainer settings, WorldGenerator worldGenerator) {
  for (BiomeType biomeType : Sponge.getRegistry().getAllOf(BiomeType.class)) {
    worldGenerator.getBiomeSettings(biomeType).getPopulators().clear();
  }

  worldGenerator.setBaseGenerationPopulator(new SolidWorldTerrainGenerator());
}
 
开发者ID:Skelril,项目名称:Skree,代码行数:9,代码来源:SolidWorldGeneratorModifier.java

示例12: modifyWorldGenerator

import org.spongepowered.api.world.biome.BiomeType; //导入依赖的package包/类
@Override
public void modifyWorldGenerator(WorldProperties world, DataContainer settings, WorldGenerator worldGenerator) {
  for (BiomeType biomeType : Sponge.getRegistry().getAllOf(BiomeType.class)) {
    worldGenerator.getBiomeSettings(biomeType).getPopulators().clear();
  }

  worldGenerator.setBaseGenerationPopulator(new VoidTerrainGenerator());
}
 
开发者ID:Skelril,项目名称:Skree,代码行数:9,代码来源:VoidWorldGeneratorModifier.java

示例13: modifyWorldGenerator

import org.spongepowered.api.world.biome.BiomeType; //导入依赖的package包/类
@Override
public void modifyWorldGenerator(WorldProperties world, DataContainer settings, WorldGenerator worldGenerator) {
  for (BiomeType biomeType : Sponge.getRegistry().getAllOf(BiomeType.class)) {
    BiomeGenerationSettings biomeData = worldGenerator.getBiomeSettings(biomeType);
    List<Ore> populators = biomeData.getPopulators(Ore.class);
    biomeData.getPopulators().removeAll(populators);
  }
}
 
开发者ID:Skelril,项目名称:Skree,代码行数:9,代码来源:NoOreWorldGeneratorModifier.java

示例14: modifyWorldGenerator

import org.spongepowered.api.world.biome.BiomeType; //导入依赖的package包/类
@Override
public void modifyWorldGenerator(WorldProperties world, DataContainer settings, WorldGenerator worldGenerator) {
  for (BiomeType biomeType : Sponge.getRegistry().getAllOf(BiomeType.class)) {
    worldGenerator.getBiomeSettings(biomeType).getPopulators().clear();
  }

  worldGenerator.setBaseGenerationPopulator(new BarrierBlockTerrainGenerator());
}
 
开发者ID:Skelril,项目名称:Skree,代码行数:9,代码来源:BarrierWorldGeneratorModifier.java

示例15: modifyWorldGenerator

import org.spongepowered.api.world.biome.BiomeType; //导入依赖的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


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