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


Java BlockFace.SELF属性代码示例

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


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

示例1: notchToBlockFace

/**
 * Notch uses a 0-5 to mean DOWN, UP, NORTH, SOUTH, WEST, EAST
 * in that order all over. This method is convenience to convert for us.
 *
 * @return BlockFace the BlockFace represented by this number
 */
public static BlockFace notchToBlockFace(int notch) {
    switch (notch) {
    case 0:
        return BlockFace.DOWN;
    case 1:
        return BlockFace.UP;
    case 2:
        return BlockFace.NORTH;
    case 3:
        return BlockFace.SOUTH;
    case 4:
        return BlockFace.WEST;
    case 5:
        return BlockFace.EAST;
    default:
        return BlockFace.SELF;
    }
}
 
开发者ID:UraniumMC,项目名称:Uranium,代码行数:24,代码来源:CraftBlock.java

示例2: getDirection

/**
 * Get the direction "to" is relative to "from".
 * @param from
 * @param to
 * @return direction
 */
public static BlockFace getDirection(Location from, Location to) {
    double dis = 0;
    BlockFace ret = BlockFace.SELF;
    for (BlockFace face : FACES) {
        if (face == BlockFace.SELF)
            continue;

        Location sub = to.clone().subtract(from.getX(), from.getY(), from.getZ());
        double tDis = (sub.getX() * face.getModX()) + (sub.getZ() * face.getModZ());
        if (tDis >= dis) {
            dis = tDis;
            ret = face;
        }
    }
    return ret;
}
 
开发者ID:Kneesnap,项目名称:Kineticraft,代码行数:22,代码来源:Utils.java

示例3: getBlockPower

public int getBlockPower(BlockFace face) {
    int power = 0;
    BlockRedstoneWire wire = Blocks.redstone_wire;
    net.minecraft.world.World world = chunk.getHandle().worldObj;
    if ((face == BlockFace.DOWN || face == BlockFace.SELF) && world.getIndirectPowerOutput(x, y - 1, z, 0)) power = wire.func_150178_a(world, x, y - 1, z, power);
    if ((face == BlockFace.UP || face == BlockFace.SELF) && world.getIndirectPowerOutput(x, y + 1, z, 1)) power = wire.func_150178_a(world, x, y + 1, z, power);
    if ((face == BlockFace.EAST || face == BlockFace.SELF) && world.getIndirectPowerOutput(x + 1, y, z, 2)) power = wire.func_150178_a(world, x + 1, y, z, power);
    if ((face == BlockFace.WEST || face == BlockFace.SELF) && world.getIndirectPowerOutput(x - 1, y, z, 3)) power = wire.func_150178_a(world, x - 1, y, z, power);
    if ((face == BlockFace.NORTH || face == BlockFace.SELF) && world.getIndirectPowerOutput(x, y, z - 1, 4)) power = wire.func_150178_a(world, x, y, z - 1, power);
    if ((face == BlockFace.SOUTH || face == BlockFace.SELF) && world.getIndirectPowerOutput(x, y, z + 1, 5)) power = wire.func_150178_a(world, x, y, z - 1, power);
    return power > 0 ? power : (face == BlockFace.SELF ? isBlockIndirectlyPowered() : isBlockFaceIndirectlyPowered(face)) ? 15 : 0;
}
 
开发者ID:UraniumMC,项目名称:Uranium,代码行数:12,代码来源:CraftBlock.java

示例4: getNext

/**
 * Gets the next BlockFace clock wise
 *
 * @param direction the starting direction
 * @param steps     the amount of steps to go
 * @return the direction
 */
@Nonnull
public static BlockFace getNext(@Nonnull BlockFace direction, int steps) {
    for (int i = 0; i < RADIAL.length; i++) {
        if (RADIAL[i] == direction) {
            return RADIAL[Math.floorMod(i + steps, RADIAL.length)];
        }
    }
    return BlockFace.SELF;
}
 
开发者ID:VoxelGamesLib,项目名称:VoxelGamesLibv2,代码行数:16,代码来源:DirectionUtil.java


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