c0de paint 0.2.0Diese Seite auf Deutsch

Examples ​

A tower with a pointed roof ​

A round tower of stone bricks with a cone of dark oak planks on top.

c0de
PROGRAM tower
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 base STRUCT c0de_paint/cpaint/POINT
    VARIABLE bricks STRUCT c0de_paint/cpaint/BLOCK
    VARIABLE planks STRUCT c0de_paint/cpaint/BLOCK
    VARIABLE walls TYPE c0de_paint/cpaint/STYLE
    VARIABLE roof TYPE c0de_paint/cpaint/STYLE
    VARIABLE empty TYPE c0de_paint/cpaint/STYLE
    ASSIGN bricks.id "stone_bricks" ;
    ASSIGN planks.id "dark_oak_planks" ;
    CALL c0de_paint/cpaint/STYLE_SOLID
        PARAMETER block bricks ;
        RESULT result walls
    CALL c0de_paint/cpaint/STYLE_SOLID
        PARAMETER block planks ;
        RESULT result roof
    CALL c0de_paint/cpaint/STYLE_EMPTY
        RESULT result empty
    CALL c0de_paint/cpaint/DRAW_CYLINDER
        PARAMETER canvas c ;
        PARAMETER center base ;
        PARAMETER r 4 ;
        PARAMETER h 12 ;
        PARAMETER direction "+y" ;
        PARAMETER side_style walls ;
        PARAMETER fill_style empty ;
    ASSIGN base.y 12 ;
    CALL c0de_paint/cpaint/DRAW_CONE
        PARAMETER canvas c ;
        PARAMETER center base ;
        PARAMETER r 5 ;
        PARAMETER h 6 ;
        PARAMETER direction "+y" ;
        PARAMETER fill_style roof ;
    CALL c0de_paint/cpaint/RENDER_CANVAS
        PARAMETER canvas c ;
        PARAMETER position at ;
END FUNCTION

Keeping a copy of a building ​

Copies a building into a canvas, keeps it as a canvas file and as a schematic for Litematica, and builds the copy from the file somewhere else.

c0de
PROGRAM keep_copy
NOOP
INCLUDE c0de/minecraft
INCLUDE c0de_paint/cpaint
INCLUDE c0de_paint/schematics
NOOP
FUNCTION main
    PARAMETER from STRUCT c0de/minecraft/POSITION
    PARAMETER to STRUCT c0de/minecraft/POSITION
    PARAMETER there STRUCT c0de/minecraft/POSITION
BEGIN
    VARIABLE copy TYPE c0de_paint/cpaint/CANVAS
    VARIABLE plan TYPE c0de_paint/cpaint/CANVAS
    CALL c0de_paint/cpaint/CANVAS_FROM_WORLD
        PARAMETER from from ;
        PARAMETER to to ;
        RESULT result copy
    CALL c0de_paint/cpaint/SAVE_CANVAS
        PARAMETER canvas copy ;
        PARAMETER file "building" ;
        PARAMETER overwrite TRUE ;
    CALL c0de_paint/schematics/EXPORT_SCHEMATIC
        PARAMETER canvas copy ;
        PARAMETER file "building.litematic" ;
        PARAMETER overwrite TRUE ;
    CALL c0de_paint/cpaint/LOAD_CANVAS
        PARAMETER file "building" ;
        RESULT result plan
    CALL c0de_paint/cpaint/RENDER_CANVAS
        PARAMETER canvas plan ;
        PARAMETER position there ;
END FUNCTION

A rubble path from a chest ​

A path of random blocks from a chest, built by any player: the blocks come from the chest, the tools from a second chest, and whatever is in the way goes into a third.

c0de
PROGRAM path
NOOP
INCLUDE c0de/minecraft
INCLUDE c0de_paint/cpaint
NOOP
FUNCTION main
    PARAMETER at STRUCT c0de/minecraft/POSITION
    PARAMETER supplies STRUCT c0de/minecraft/POSITION
    PARAMETER toolbox STRUCT c0de/minecraft/POSITION
    PARAMETER rubble 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 blocks ARRAY STRUCT c0de_paint/cpaint/BLOCK
    VARIABLE gravel TYPE c0de_paint/cpaint/STYLE
    ASSIGN b.x 15 ;
    ASSIGN b.z 2 ;
    CALL c0de_paint/cpaint/INVENTORY_BLOCKS
        PARAMETER position supplies ;
        RESULT result blocks
    CALL c0de_paint/cpaint/STYLE_RANDOM
        PARAMETER blocks blocks ;
        RESULT result gravel
    CALL c0de_paint/cpaint/DRAW_BOX
        PARAMETER canvas c ;
        PARAMETER from a ;
        PARAMETER to b ;
        PARAMETER fill_style gravel ;
    CALL c0de_paint/cpaint/RENDER_CANVAS
        PARAMETER canvas c ;
        PARAMETER position at ;
        PARAMETER input supplies ;
        PARAMETER tools toolbox ;
        PARAMETER output rubble ;
END FUNCTION