本文整理汇总了Java中org.bukkit.block.BlockFace.NORTH_EAST属性的典型用法代码示例。如果您正苦于以下问题:Java BlockFace.NORTH_EAST属性的具体用法?Java BlockFace.NORTH_EAST怎么用?Java BlockFace.NORTH_EAST使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.bukkit.block.BlockFace
的用法示例。
在下文中一共展示了BlockFace.NORTH_EAST属性的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getBlockFace
static BlockFace getBlockFace(byte rotation) {
switch (rotation) {
case 0:
return BlockFace.NORTH;
case 1:
return BlockFace.NORTH_NORTH_EAST;
case 2:
return BlockFace.NORTH_EAST;
case 3:
return BlockFace.EAST_NORTH_EAST;
case 4:
return BlockFace.EAST;
case 5:
return BlockFace.EAST_SOUTH_EAST;
case 6:
return BlockFace.SOUTH_EAST;
case 7:
return BlockFace.SOUTH_SOUTH_EAST;
case 8:
return BlockFace.SOUTH;
case 9:
return BlockFace.SOUTH_SOUTH_WEST;
case 10:
return BlockFace.SOUTH_WEST;
case 11:
return BlockFace.WEST_SOUTH_WEST;
case 12:
return BlockFace.WEST;
case 13:
return BlockFace.WEST_NORTH_WEST;
case 14:
return BlockFace.NORTH_WEST;
case 15:
return BlockFace.NORTH_NORTH_WEST;
default:
throw new AssertionError(rotation);
}
}
示例2: getBlockFace
public static BlockFace getBlockFace(double yaw){
int y = (int) ((yaw+11.25)/22.5);
switch(y){
case -8:
return BlockFace.NORTH;
case -7:
return BlockFace.NORTH_NORTH_EAST;
case -6:
return BlockFace.NORTH_EAST;
case -5:
return BlockFace.EAST_NORTH_EAST;
case -4:
return BlockFace.EAST;
case -3:
return BlockFace.EAST_SOUTH_EAST;
case -2:
return BlockFace.SOUTH_EAST;
case -1:
return BlockFace.SOUTH_SOUTH_EAST;
case 0:
return BlockFace.SOUTH;
case 1:
return BlockFace.SOUTH_SOUTH_WEST;
case 2:
return BlockFace.SOUTH_WEST;
case 3:
return BlockFace.WEST_SOUTH_WEST;
case 4:
return BlockFace.WEST;
case 5:
return BlockFace.WEST_NORTH_WEST;
case 6:
return BlockFace.NORTH_WEST;
case 7:
return BlockFace.NORTH_NORTH_WEST;
default:
return BlockFace.NORTH;
}
}