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


Java World.getBlockType方法代码示例

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


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

示例1: actPrimary

import com.sk89q.worldedit.world.World; //导入方法依赖的package包/类
@Override
public boolean actPrimary(Platform server, LocalConfiguration config, Player player, LocalSession session, com.sk89q.worldedit.util.Location clicked) {
    World world = (World) clicked.getExtent();
    final int blockType = world.getBlockType(clicked.toVector());
    if (blockType == BlockID.BEDROCK
            && !player.canDestroyBedrock()) {
        return true;
    }

    EditSession editSession = session.createEditSession(player);
    editSession.getSurvivalExtent().setToolUse(config.superPickaxeDrop);

    try {
        if (editSession.setBlock(clicked.getBlockX(), clicked.getBlockY(), clicked.getBlockZ(), EditSession.nullBlock)) {
            world.playEffect(clicked.toVector(), 2001, blockType);
        }
    } finally {
        editSession.flushQueue();
        session.remember(editSession);
    }

    return true;
}
 
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:24,代码来源:SinglePickaxe.java

示例2: actPrimary

import com.sk89q.worldedit.world.World; //导入方法依赖的package包/类
@Override
public boolean actPrimary(Platform server, LocalConfiguration config, Player player, LocalSession session, Location clicked) {
    World world = (World) clicked.getExtent();

    int initialType = world.getBlockType(clicked.toVector());

    if (initialType == BlockID.AIR) {
        return true;
    }

    if (initialType == BlockID.BEDROCK && !player.canDestroyBedrock()) {
        return true;
    }

    EditSession editSession = session.createEditSession(player);

    try {
        recurse(server, editSession, world, clicked.toVector().toBlockVector(),
                clicked.toVector(), range, initialType, new HashSet<BlockVector>());
    } catch (WorldEditException e) {
        throw new RuntimeException(e);
    }
    editSession.flushQueue();
    session.remember(editSession);
    return true;
}
 
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:27,代码来源:FloodFillTool.java

示例3: ascendToCeiling

import com.sk89q.worldedit.world.World; //导入方法依赖的package包/类
@Override
public boolean ascendToCeiling(int clearance, boolean alwaysGlass) {
    Vector pos = getBlockIn();
    int x = pos.getBlockX();
    int initialY = Math.max(0, pos.getBlockY());
    int y = Math.max(0, pos.getBlockY() + 2);
    int z = pos.getBlockZ();
    World world = getPosition().getWorld();

    // No free space above
    if (world.getBlockType(new Vector(x, y, z)) != 0) {
        return false;
    }

    while (y <= world.getMaxY()) {
        // Found a ceiling!
        if (!BlockType.canPassThrough(world.getBlock(new Vector(x, y, z)))) {
            int platformY = Math.max(initialY, y - 3 - clearance);
            floatAt(x, platformY + 1, z, alwaysGlass);
            return true;
        }

        ++y;
    }

    return false;
}
 
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:28,代码来源:PlayerWrapper.java


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