程序包 org.bukkit.map

接口 MapCanvas


public interface MapCanvas
代表一个画地图的画布,每个画布都关联着一个特定的 地图渲染器并表现为地图上渲染器的一层.
  • 方法详细资料

    • getMapView

      @NotNull @NotNull MapView getMapView()
      获取画布依附的地图.

      原文:Get the map this canvas is attached to.

      返回:
      画布依附的地图控件
    • getCursors

      获取与该画布相关联的游标集合.

      原文:Get the cursor collection associated with this canvas.

      返回:
      与该画布相关联的游标集合
    • setCursors

      void setCursors(@NotNull @NotNull MapCursorCollection cursors)
      设置与该画布相关联的游标集合,自从地图游标集合(MapCursorCollection)提供后这个方法通常不需要被调用.

      原文:Set the cursor collection associated with this canvas. This does not usually need to be called since a MapCursorCollection is already provided.

      参数:
      cursors - 与画布相关联的游标集合
    • setPixelColor

      void setPixelColor(int x, int y, @Nullable @Nullable Color color)
      Draw a pixel to the canvas.

      The provided color might be converted to another color, which is in the map color range. This means, that getPixelColor(int, int) might return another color than set. If null is used as color, then the color returned by getBasePixelColor(int, int) is shown on the map.

      参数:
      x - The x coordinate, from 0 to 127.
      y - The y coordinate, from 0 to 127.
      color - The color.
    • getPixelColor

      @Nullable @Nullable Color getPixelColor(int x, int y)
      Get a pixel from the canvas. If no color is set at the given position for this canvas, then null is returned and the color returned by getBasePixelColor(int, int) is shown on the map.
      参数:
      x - The x coordinate, from 0 to 127.
      y - The y coordinate, from 0 to 127.
      返回:
      The color, or null if no color is set.
    • getBasePixelColor

      @NotNull @NotNull Color getBasePixelColor(int x, int y)
      Get a pixel from the layers below this canvas.
      参数:
      x - The x coordinate, from 0 to 127.
      y - The y coordinate, from 0 to 127.
      返回:
      The color.
    • setPixel

      void setPixel(int x, int y, byte color)
      已过时。
      魔法值, 请使用 setPixelColor(int, int, Color)
      画一个像素到画布上.

      原文:Draw a pixel to the canvas.

      参数:
      x - x坐标值,从0到127
      y - y坐标值,从0到127
      color - 颜色,参考MapPalette
    • getPixel

      @Deprecated byte getPixel(int x, int y)
      已过时。
      魔法值, 请使用 getPixelColor(int, int)
      获取画布上的一个像素.

      原文:Get a pixel from the canvas.

      参数:
      x - x坐标值,从0到127
      y - y坐标值,从0到127
      返回:
      颜色. 参阅 MapPalette.
    • getBasePixel

      @Deprecated byte getBasePixel(int x, int y)
      已过时。
      魔法值, 请使用 getBasePixelColor(int, int)
      获取画布下层的一个像素.

      原文:Get a pixel from the layers below this canvas.

      参数:
      x - x坐标值,从0到127
      y - y坐标值,从0到127
      返回:
      颜色. 参阅 MapPalette.
    • drawImage

      void drawImage(int x, int y, @NotNull @NotNull Image image)
      画一张图片到地图上,如果必要的话,图像将被裁剪.

      原文:Draw an image to the map. The image will be clipped if necessary.

      参数:
      x - 图片的x坐标
      y - 图片的y坐标
      image - 要画的图片
    • drawText

      void drawText(int x, int y, @NotNull @NotNull MapFont font, @NotNull @NotNull String text)
      使用你想要的格式渲染文字到地图上.换行符(\n)会移动到下一行并返回原来的列, 字体颜色可以使用带字符的数字来改变如"§12;",这会把字体颜色换为颜色表中 第12个颜色(参考 MapPalette).

      原文:Render text to the map using fancy formatting. Newline (\n) characters will move down one line and return to the original column, and the text color can be changed using sequences such as "§12;", replacing 12 with the palette index of the color (see MapPalette).

      参数:
      x - 开始渲染的列
      y - 开始渲染的行
      font - 使用的字体
      text - 要渲染的格式化文字