BufferProvider

Group
player
Methods
4
Fields
None

Getting one

client:getBufferProvider()

Methods

MethodReturnsDescription
getPixels(){number}The buffer itself: pixels[i] reads pixel i - 1 (row by row, getWidth() pixels a row) as a signed 32-bit int, pixels[i] = argb store…
getWidth()numberThe buffer's width: the canvas width in pixels, one row of getPixels().
getHeight()numberThe buffer's height: the canvas height in pixels.
equals(any)booleanWhether other equals this BufferProvider, as == answers it (false for a value of another class).

Returned by

MethodReturnsDescription
Client.getBufferProviderBufferProvider?The client's frame buffer: the canvas-sized ARGB image the client draws its whole interface into (the 3D scene is drawn on the GPU and comp…

Method details

getPixels

getPixels: (BufferProvider) -> {number}

The buffer itself: pixels[i] reads pixel i - 1 (row by row, getWidth() pixels a row) as a signed 32-bit int, pixels[i] = argb stores it in the frame now (an int, or its unsigned 32-bit form as bit32 gives it), and #pixels is getWidth() * getHeight(). Past the end a read is nil and a write raises. Every access is the client's buffer as it is now. Inside an overlay's render, a layer's Graphics2D draws reach the buffer after every overlay of that layer has rendered, so a pixel written there lands under them and a read does not see them yet. Outside the frame's draw (an event, a client tick) the buffer is the other of the client's two frame buffers: it holds the frame before the last one shown, and the next frame clears it before drawing, so a write there is never shown. Game thread only.

getWidth

getWidth: (BufferProvider) -> number

The buffer's width: the canvas width in pixels, one row of getPixels().

equals

equals: (BufferProvider, any) -> boolean

Whether other equals this BufferProvider, as == answers it (false for a value of another class).