Class BlockUtil

java.lang.Object
cn.lanink.gamecore.pathfinder.utils.BlockUtil

public class BlockUtil extends Object
Author:
iGxnon
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int[][]
    除自身外26个方向
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static boolean
    canStand(cn.nukkit.block.Block block)
     
    static boolean
    checkUpAccessed(cn.nukkit.block.Block block)
     
    static cn.nukkit.block.Block
    getNearBlock(cn.nukkit.block.Block block, cn.nukkit.math.BlockFace face)
     
    static boolean
    isPermeable(cn.nukkit.block.Block block)
     
    static double
    MHDistance(cn.nukkit.math.Vector3 start, cn.nukkit.math.Vector3 target)
    获取曼哈顿距离

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • MOTION

      public static final int[][] MOTION
      除自身外26个方向
  • Constructor Details

    • BlockUtil

      public BlockUtil()
  • Method Details

    • MHDistance

      public static double MHDistance(cn.nukkit.math.Vector3 start, cn.nukkit.math.Vector3 target)
      获取曼哈顿距离
      Parameters:
      start - 当前点
      target - 终点
      Returns:
      曼哈顿距离
    • isPermeable

      public static boolean isPermeable(cn.nukkit.block.Block block)
      Parameters:
      block - 方块
      Returns:
      是否可透过
    • canStand

      public static boolean canStand(cn.nukkit.block.Block block)
      Parameters:
      block - 检测对象
      Returns:
      是否可以立足
    • checkUpAccessed

      public static boolean checkUpAccessed(cn.nukkit.block.Block block)
      Parameters:
      block - 检测对象
      Returns:
      是否可以垂直上升一格 [爬梯子,脚手架]
    • getNearBlock

      public static cn.nukkit.block.Block getNearBlock(cn.nukkit.block.Block block, cn.nukkit.math.BlockFace face)
      Parameters:
      block - 检测对象
      face - 方块相对世界坐标的面
      Returns:
      邻居方块