c0de paint 0.2.0Diese Seite auf Deutsch

Getting started ​

Programs that use the library include it with INCLUDE c0de_paint/cpaint. Its types and functions start with the library name, like c0de_paint/cpaint/DRAW_BOX. The name is a wink at Deluxe Paint, which everybody called DPaint.

A program draws into a canvas, a three-dimensional grid of voxels, and builds it in the world with RENDER_CANVAS. A style says how a line, a face or the inside of a shape is drawn.

First drawing ​

This program draws a hut of stone bricks of 7 by 5 by 7 voxels with a glass window on two sides and an oak door, and builds it next to the trigger block. It needs allowBlockChanges or an administrator, because it doesn't take the blocks from an inventory.

c0de
PROGRAM hut
NOOP
INCLUDE c0de/minecraft
INCLUDE c0de_paint/cpaint
NOOP
FUNCTION main
    PARAMETER at STRUCT c0de/minecraft/POSITION
BEGIN
    VARIABLE c TYPE c0de_paint/cpaint/CANVAS
    VARIABLE a STRUCT c0de_paint/cpaint/POINT
    VARIABLE b STRUCT c0de_paint/cpaint/POINT
    VARIABLE top STRUCT c0de_paint/cpaint/POINT
    VARIABLE stone STRUCT c0de_paint/cpaint/BLOCK
    VARIABLE pane STRUCT c0de_paint/cpaint/BLOCK
    VARIABLE door STRUCT c0de_paint/cpaint/BLOCK
    VARIABLE walls TYPE c0de_paint/cpaint/STYLE
    VARIABLE empty TYPE c0de_paint/cpaint/STYLE
    VARIABLE glass TYPE c0de_paint/cpaint/STYLE
    VARIABLE lower TYPE c0de_paint/cpaint/STYLE
    VARIABLE upper TYPE c0de_paint/cpaint/STYLE
    ASSIGN stone.id "stone_bricks" ;
    ASSIGN pane.id "glass" ;
    ASSIGN door.id "oak_door" ;
    ASSIGN door.properties["facing"] "north" ;
    ASSIGN door.properties["half"] "lower" ;
    CALL c0de_paint/cpaint/STYLE_SOLID
        PARAMETER block stone ;
        RESULT result walls
    CALL c0de_paint/cpaint/STYLE_EMPTY
        RESULT result empty
    CALL c0de_paint/cpaint/STYLE_SOLID
        PARAMETER block pane ;
        RESULT result glass
    CALL c0de_paint/cpaint/STYLE_SOLID
        PARAMETER block door ;
        RESULT result lower
    ASSIGN door.properties["half"] "upper" ;
    CALL c0de_paint/cpaint/STYLE_SOLID
        PARAMETER block door ;
        RESULT result upper
    NOOP
    ASSIGN b.x 6 ;
    ASSIGN b.y 4 ;
    ASSIGN b.z 6 ;
    CALL c0de_paint/cpaint/DRAW_BOX
        PARAMETER canvas c ;
        PARAMETER from a ;
        PARAMETER to b ;
        PARAMETER side_style walls ;
        PARAMETER fill_style empty ;
    NOOP
    ASSIGN a.x 0 ;
    ASSIGN a.y 2 ;
    ASSIGN a.z 2 ;
    ASSIGN b.x 0 ;
    ASSIGN b.y 2 ;
    ASSIGN b.z 4 ;
    ASSIGN top.x 0 ;
    ASSIGN top.y 3 ;
    ASSIGN top.z 2 ;
    CALL c0de_paint/cpaint/DRAW_RECTANGLE
        PARAMETER canvas c ;
        PARAMETER a a ;
        PARAMETER b b ;
        PARAMETER c top ;
        PARAMETER fill_style glass ;
    ASSIGN a.x 6 ;
    ASSIGN b.x 6 ;
    ASSIGN top.x 6 ;
    CALL c0de_paint/cpaint/DRAW_RECTANGLE
        PARAMETER canvas c ;
        PARAMETER a a ;
        PARAMETER b b ;
        PARAMETER c top ;
        PARAMETER fill_style glass ;
    NOOP
    ASSIGN a.x 3 ;
    ASSIGN a.y 1 ;
    ASSIGN a.z 0 ;
    CALL c0de_paint/cpaint/DRAW_BLOCK
        PARAMETER canvas c ;
        PARAMETER point a ;
        PARAMETER style lower ;
    ASSIGN a.y 2 ;
    CALL c0de_paint/cpaint/DRAW_BLOCK
        PARAMETER canvas c ;
        PARAMETER point a ;
        PARAMETER style upper ;
    NOOP
    CALL c0de_paint/cpaint/RENDER_CANVAS
        PARAMETER canvas c ;
        PARAMETER position at ;
END FUNCTION

The handbook ​

This handbook is a binder in the game, one of the handbooks of c0de, with a label in pink.

Recipe

c0de paint Handbook recipe

Surround an INCLUDE block with eight dyes in the colours of the rainbow: red, orange, yellow, lime, light blue, blue, purple and magenta.

Settings ​

The server has the file config/c0de_paint.properties.

  • canvasMin and canvasMax (default −128 and 255) limit the coordinates of a canvas on every axis.
  • renderBlocksPerTick (1 to 1024, default 64) is the number of blocks RENDER_CANVAS places per tick.
  • renderMiningSpeed (0 to 100, default 1) is how much faster than a player RENDER_CANVAS mines blocks with tools; 0 mines instantly.
  • canvasVoxelsPerTick (1024 to 1048576, default 65536) is the number of voxels a drawing function or a transformation processes per tick. Larger work is spread over several ticks while the process waits.
  • maxSchematicSize (1024 to 67108864, default 4194304) is the largest schematic file in bytes that c0de_paint/schematics reads and writes, and the largest canvas file of LOAD_CANVAS and SAVE_CANVAS.

Every client has the file config/c0de_paint-client.properties with allowSchematics (default true): whether the client reads the schematics and canvas files of its player for c0de_paint/schematics and LOAD_CANVAS, and allowSchematicWrites (default true): whether it writes the files of EXPORT_SCHEMATIC and SAVE_CANVAS.

allowBlockChanges, which RENDER_CANVAS without input needs, is a setting of c0de in config/c0de.properties on the server.