當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。