本文整理汇总了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;
}
}
示例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;
}
示例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;
}
示例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;
}