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


Java World.getMaxHeight方法代码示例

本文整理汇总了Java中org.bukkit.World.getMaxHeight方法的典型用法代码示例。如果您正苦于以下问题:Java World.getMaxHeight方法的具体用法?Java World.getMaxHeight怎么用?Java World.getMaxHeight使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.bukkit.World的用法示例。


在下文中一共展示了World.getMaxHeight方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getHighestLocation

import org.bukkit.World; //导入方法依赖的package包/类
public static Location getHighestLocation(final Location origin, final Location def) {
    Preconditions.checkNotNull((Object) origin, (Object) "The location cannot be null");
    final Location cloned = origin.clone();
    final World world = cloned.getWorld();
    final int x = cloned.getBlockX();
    int y = world.getMaxHeight();
    final int z = cloned.getBlockZ();
    while (y > origin.getBlockY()) {
        final Block block = world.getBlockAt(x, --y, z);
        if (!block.isEmpty()) {
            final Location next = block.getLocation();
            next.setPitch(origin.getPitch());
            next.setYaw(origin.getYaw());
            return next;
        }
    }
    return def;
}
 
开发者ID:funkemunky,项目名称:HCFCore,代码行数:19,代码来源:BukkitUtils.java

示例2: EndPortalFaction

import org.bukkit.World; //导入方法依赖的package包/类
public EndPortalFaction() {
    super("EndPortal");

    World overworld = Bukkit.getWorld("world");
    int maxHeight = overworld.getMaxHeight();
    int min = SettingsYML.END_PORTAL_CENTER - SettingsYML.END_PORTAL_RADIUS;
    int max = SettingsYML.END_PORTAL_CENTER + SettingsYML.END_PORTAL_RADIUS;

    // North East (++)
    addClaim(new Claim(this, new Location(overworld, min, 0, min), new Location(overworld, max, maxHeight, max)), null);

    // South West (--)
    addClaim(new Claim(this, new Location(overworld, -max, maxHeight, -max), new Location(overworld, -min, 0, -min)), null);

    // North West (-+)
    addClaim(new Claim(this, new Location(overworld, -max, 0, min), new Location(overworld, -min, maxHeight, max)), null);

    // South East (+-)
    addClaim(new Claim(this, new Location(overworld, min, 0, -max), new Location(overworld, max, maxHeight, -min)), null);

    this.safezone = true;
}
 
开发者ID:funkemunky,项目名称:HCFCore,代码行数:23,代码来源:EndPortalFaction.java

示例3: getTopLocation

import org.bukkit.World; //导入方法依赖的package包/类
public static Location getTopLocation(Location location) {
    World world = location.getWorld();
    int height = world.getMaxHeight();
    int x = location.getBlockX();
    int z = location.getBlockZ();
    for (int i = height; i >= 0; i--) {
        Block block = world.getBlockAt(x, i, z);
        if (block.getType().isSolid())
            return new Location(world, x, i + 1, z);
    }

    return location;
}
 
开发者ID:EntryPointKR,项目名称:MCLibrary,代码行数:14,代码来源:Locations.java

示例4: getEmptyLocation

import org.bukkit.World; //导入方法依赖的package包/类
public static Location getEmptyLocation(Location location, Predicate<Block> filter) {
    World world = location.getWorld();
    int maxHeight = world.getMaxHeight();
    int x = location.getBlockX();
    int z = location.getBlockZ();
    for (int i = location.getBlockY(); i < maxHeight; i++) {
        Block block = world.getBlockAt(x, i, z);
        if (block.getType() == Material.AIR
                && filter.test(block))
            return new Location(world, x, i, z);
    }

    return location;
}
 
开发者ID:EntryPointKR,项目名称:MCLibrary,代码行数:15,代码来源:Locations.java

示例5: areAjacentBlocksTransparent

import org.bukkit.World; //导入方法依赖的package包/类
public static boolean areAjacentBlocksTransparent(
        ChunkMapManager manager,
        World world,
        boolean checkCurrentBlock,
        int x,
        int y,
        int z,
        int countdown
) throws IOException
{
    if (y >= world.getMaxHeight() || y < 0)
        return true;

    if(checkCurrentBlock) {
        ChunkData chunkData = manager.getChunkData();
        int blockData = manager.get(x, y, z);
        int id;

        if (blockData < 0) {
            id = Orebfuscator.nms.getBlockId(world, x, y, z);

            if (id < 0) {
                id = 1;
                chunkData.useCache = false;
            }
        } else {
            id = ChunkMapManager.getBlockIdFromData(blockData);
        }

        if (OrebfuscatorConfig.isBlockTransparent(id)) {
            return true;
        }
    }

    if (countdown == 0)
        return false;

    if (areAjacentBlocksTransparent(manager, world, true, x, y + 1, z, countdown - 1))
        return true;
    if (areAjacentBlocksTransparent(manager, world, true, x, y - 1, z, countdown - 1))
        return true;
    if (areAjacentBlocksTransparent(manager, world, true, x + 1, y, z, countdown - 1))
        return true;
    if (areAjacentBlocksTransparent(manager, world, true, x - 1, y, z, countdown - 1))
        return true;
    if (areAjacentBlocksTransparent(manager, world, true, x, y, z + 1, countdown - 1))
        return true;
    if (areAjacentBlocksTransparent(manager, world, true, x, y, z - 1, countdown - 1))
        return true;

    return false;
}
 
开发者ID:SamaGames,项目名称:AntiCheat,代码行数:53,代码来源:Calculations.java

示例6: generateBlockSections

import org.bukkit.World; //导入方法依赖的package包/类
@Nonnull
@Override
public byte[][] generateBlockSections(@Nonnull World world, @Nonnull Random random, int x, int z, @Nonnull BiomeGrid biomes) {
    return new byte[world.getMaxHeight() / 16][];
}
 
开发者ID:VoxelGamesLib,项目名称:VoxelGamesLibv2,代码行数:6,代码来源:CleanRoomChunkGenerator.java

示例7: generateExtBlockSections

import org.bukkit.World; //导入方法依赖的package包/类
@Nonnull
@Override
public short[][] generateExtBlockSections(@Nonnull World world, @Nonnull Random random, int x, int z, @Nonnull BiomeGrid biomes) {
    return new short[world.getMaxHeight() / 16][];
}
 
开发者ID:VoxelGamesLib,项目名称:VoxelGamesLibv2,代码行数:6,代码来源:CleanRoomChunkGenerator.java

示例8: generateBlockSections

import org.bukkit.World; //导入方法依赖的package包/类
@Override
public byte[][] generateBlockSections(World world, Random rand, int chunkX, int chunkZ, BiomeGrid grid) {
    byte[][] chunk = new byte[world.getMaxHeight() / 16][];
    basicTerrainGenerator.generate(chunk, world, chunkX, chunkZ, grid);
    return chunk;
}
 
开发者ID:IzzelAliz,项目名称:TalentZzzz,代码行数:7,代码来源:MapGenerator.java


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