Class LargeDirectFramebuffer

java.lang.Object
net.minestom.server.map.framebuffers.LargeDirectFramebuffer
All Implemented Interfaces:
LargeFramebuffer

public class LargeDirectFramebuffer extends Object implements LargeFramebuffer
LargeFramebuffer with direct access to the colors array.

This implementation does not throw errors when accessing out-of-bounds coordinates through sub-views, and will instead use MapColors.NONE. This is only the case for sub-views, access through setMapColor(int, int, byte) and getMapColor(int, int) will throw an exception if out-of-bounds coordinates are inputted.

  • Constructor Details

    • LargeDirectFramebuffer

      public LargeDirectFramebuffer(int width, int height)
      Creates a new LargeDirectFramebuffer with the desired size
      Parameters:
      width - the width in pixels
      height - the height in pixels
  • Method Details

    • width

      public int width()
      Specified by:
      width in interface LargeFramebuffer
    • height

      public int height()
      Specified by:
      height in interface LargeFramebuffer
    • createSubView

      public Framebuffer createSubView(int left, int top)
      Description copied from interface: LargeFramebuffer
      Returns a new Framebuffer that represent a 128x128 sub-view of this framebuffer. Implementations are free (but not guaranteed) to throw exceptions if left & top produces out-of-bounds coordinates.
      Specified by:
      createSubView in interface LargeFramebuffer
      Parameters:
      left - the left coordinate of the sub view, in pixels
      top - the top coordinate of the sub view, in pixels
      Returns:
      the sub-view Framebuffer
    • setMapColor

      public LargeDirectFramebuffer setMapColor(int x, int y, byte color)
    • getMapColor

      public byte getMapColor(int x, int y)
      Specified by:
      getMapColor in interface LargeFramebuffer
    • getColors

      public byte[] getColors()