Paint API
About
Paint API allows you to draw things on the screen, both from server and directly from client. This can allow you to create widgets from server side or effects on screen or in world from client side.
Currently it doesn't support any input, but in future, in-game menus similar to Source engine ones will be supported.
Paintable objects are created from NBT/Json objects and all have an id. If id isn't provided, a random one will be generated. Objects x and z are absolute positions based on screen, but you can align elements in one of the corners of screen. You can bulk add multiple objects in one json object.
You can edit paintable objects with /kubejs paint
command, but the recommended way is using player methods - .paint({ object })
, .removePaint(id)
, .clearPaint()
. Paintable objects will be cleared when players leave world/server, if its persistent, then it must be re-added in player.logged_in
event every time.
Currently available objects and their properties
Root
(available for all objects)
- id
Screen Object
(available for all screen / 2D objects)
- int x
- int y
- int z
- int width
- int height
- enum align (one of '', '', '')
- enum drawType (one of '', '', '', '')