类 BlockPos

所有已实现的接口:
Comparable<BlockPos>

public class BlockPos extends ReadWriteObject implements Comparable<BlockPos>
Represents a block position in 3D space with integer coordinates.
  • 构造器详细资料

  • 方法详细资料

    • x

      public int x()
      Get x coordinate
      返回:
      the x coordinate
    • y

      public int y()
      Get y coordinate
      返回:
      the y coordinate
    • z

      public int z()
      Get z coordinate
      返回:
      the z coordinate
    • fromLocation

      public static BlockPos fromLocation(Location location)
      Creates a BlockPos from a Bukkit Location.
      参数:
      location - the location to convert
      返回:
      a new BlockPos with the location's block coordinates
    • toLocation

      public Location toLocation(World world)
      Converts this BlockPos to a Bukkit Location in the specified world.
      参数:
      world - the world for the location
      返回:
      a new Location at this block position
    • plus

      public BlockPos plus(int x, int y, int z)
      Adds the specified offsets to this position.
      参数:
      x - the X offset
      y - the Y offset
      z - the Z offset
      返回:
      a new BlockPos with the added coordinates
    • plus

      public BlockPos plus(BlockPos pos)
      Adds another BlockPos to this position.
      参数:
      pos - the position to add
      返回:
      a new BlockPos with the added coordinates
    • minus

      public BlockPos minus(int x, int y, int z)
      Subtracts the specified offsets from this position.
      参数:
      x - the X offset
      y - the Y offset
      z - the Z offset
      返回:
      a new BlockPos with the subtracted coordinates
    • minus

      public BlockPos minus(BlockPos pos)
      Subtracts another BlockPos from this position.
      参数:
      pos - the position to subtract
      返回:
      a new BlockPos with the subtracted coordinates
    • distanceSquared

      public int distanceSquared(BlockPos other)
      Calculates the squared distance to another BlockPos.
      参数:
      other - the other position
      返回:
      the squared distance
    • distanceManhattan

      public int distanceManhattan(BlockPos other)
      Calculates the Manhattan distance (sum of absolute differences) to another BlockPos.
      参数:
      other - the other position
      返回:
      the Manhattan distance
    • min

      public BlockPos min(BlockPos other)
      Returns a BlockPos with the minimum coordinates of this and another position.
      参数:
      other - the other position
      返回:
      a new BlockPos with minimum coordinates
    • max

      public BlockPos max(BlockPos other)
      Returns a BlockPos with the maximum coordinates of this and another position.
      参数:
      other - the other position
      返回:
      a new BlockPos with maximum coordinates
    • toMap

      public @Unmodifiable Map<String,Integer> toMap()
      Converts this BlockPos to an unmodifiable map with keys "x", "y", "z".
      返回:
      a map containing the coordinates
    • getBlockKey

      public long getBlockKey()
      Converts this BlockPos to a long number which represents this BlockPos
      返回:
      a long number which represents this BlockPos
    • compareTo

      public int compareTo(BlockPos other)
      指定者:
      compareTo 在接口中 Comparable<BlockPos>
    • toString

      @NotNull public @NotNull String toString()
      覆盖:
      toString 在类中 Object
    • write

      public void write(ConfigurationSection cs)
      指定者:
      write 在类中 ReadWriteObject
    • read

      public void read(ConfigurationSection cs)
      指定者:
      read 在类中 ReadWriteObject