All Mods Resource Packs Data Packs Shaders Modpacks Plugins
Scarpet additions

Scarpet additions

by replaceitem • Downloads: 0 • Followers: 0
Description
Gallery
Changelog
Versions

scarpet-additions

Available for fabric See me on GitHub Available on Modrinth

scarpet-additions

A Carpet mod extension for some additional scarpet functions

Reqires Carpet mod

Functions

convert_color(color,model,output)

Converts a color from one model to another.

color -> List: Depending on specified model

model -> String: Input color model, can be RGB, RGBA or HSB

  • RGB: List of a red, green and blue value
  • RGBA: List of a red, green, blue and alpha value
  • HSB: List of a hue, saturation and brightnes value

output -> String: Output color model, can be RGB, RGBA, HEX or NUM

  • RGB: List of a red, green and blue value
  • RGBA: List of a red, green, blue and alpha value
  • HEX: String of hex characters (without leading '#') Can be used for format()
  • NUM: Number representing the color as 4 bytes: 0xRRGGBBAA. Can be used for 'color' parameter in draw_shape()

Examples:

convert_color([255,128,0],'rgb','hex'); -> 'FF8000'

convert_color([255,128,0],'rgb','num'); -> 0xff7f00ff

convert_color([0,255,255],'hsb','hex'); -> 'FF0000'

convert_color([120,255,255],'hsb','hex'); -> '00FF00'

Example:

__on_tick() -> (
    if((tick_time() % 2) == 0,
        headerHue = tick_time()%360;
        headerGlossIndex = (floor(tick_time()/3)%40)-10;
        header = [];
        title = 'MinecraftServer';
        for(range(length(title)),
            if(abs(_-headerGlossIndex) < 3,
                c = convert_color([headerHue,abs(_-headerGlossIndex)/3*255,255],'hsb','hex');
            ,
                if(_ < 7,
                    c = convert_color([headerHue,255,190],'hsb','hex');
                ,
                    c = convert_color([headerHue,255,255],'hsb','hex');
                );
            );
            put(header,null,str('b#%s %s',c,slice(title,_,_+1)));
        );
        header = format(header);
        footer = format('r to the server!');
        set_tab_text(header,footer);
  )
);

http_request(options)

Performs a http request specified by the given options.

This call is blocking, so you should use it in a task()!

The options parameter is a map value with the following keys:

  • uri (String): The URI to request from
  • method (String, optional): The http request method. For example GET, POST, DELETE,... Defaults to GET
  • headers (Map, optional): Each map entry is a string key pointing to a string, or list of strings
  • body (String): The body for POST or other requests

The function returns a map with the following entries:

  • status_code (number): The status code of the request
  • body (String): The body returned from the request
  • headers (Map: string -> [strings]): The received response headers
  • uri (String): The originally requested URI

Note that the response body is not parsed as json or html escaped. Use the escape_html and unescape_html functions, as well as the scarpet-builtins encode_json and decode_json.

Example usage:

// simple get request and parsing

response = http_request({
    'uri'->'https://opentdb.com/api.php?amount=1'
});

print('Response: ' + response);

if(response:'status_code' != 200,
    print('Request failed: ' + response:'status_code');
,
    body = decode_json(response:'body');
    print('\n\nBody: ' + body);

    question_data = body:'results':0;
    question = unescape_html(question_data:'question');
    answer = unescape_html(question_data:'correct_answer');

    print('\n\n\n' + question + '\n' + answer);
);

escape_html(html)

Returns the escaped html string (e.g. " -> &quot;)

unescape_html(html)

Returns the unescaped html string (e.g. &quot; -> ")

list_text(header, footer, player?)

Sets header and footer in tab menu of all players, or changes it for one player if player? is given.

set_motd(motd)

Sets the message of the day of the server.

How to Install Scarpet additions (Mod)

Scarpet additions by replaceitem is verified for Fabric across Minecraft versions 1.19, 1.19.1, 1.19.4, 1.20, 1.20.1, 1.20.2, 1.20.4, 1.20.5 (latest release: 1.1.4, file size: 241 KB). Follow the steps below to install it safely from ModCraft.tv:

  1. Click the Download button above and select your Minecraft version (1.19, 1.19.1, 1.19.4, 1.20, 1.20.1, 1.20.2, 1.20.4, 1.20.5) and platform (Fabric).
  2. Make sure you have the compatible loader or environment installed for Fabric.
  3. Move the downloaded Scarpet additions file into your Minecraft .minecraft/mods folder and launch the game.

All Versions

+ Add Version
Name Game version Platforms Published Downloads Actions
26.3 26.2 26.1.x
Fabric
7mo ago 1
1.21.x
Fabric
last yr. 1
1.21.x 1.20.x
Fabric
last yr. 1
1.20.4
Fabric
last yr. 1
1.20.x
Fabric
last yr. 1
1.19.4
Fabric
last yr. 1
1.19.1
Fabric
last yr. 1
1.19.1
Fabric
last yr. 1
1.19.1
Fabric
last yr. 1
1.19
Fabric
last yr. 1
[1.1.4] 1.1.4 by replaceitem on Apr 08, 2026
Download
  • Updated to MC 26.1
[1.1.3] 1.1.3 by replaceitem on Oct 27, 2024
Download
  • http requests failing will now throw a custom scarpet exception type http_request_error
[1.1.2] 1.1.2 by replaceitem on Apr 23, 2024
Download
  • Updated to MC 1.20.5
[1.1.1] 1.1.1 by replaceitem on Dec 12, 2023
Download
  • Updated to MC 1.20.4
[1.1.0] 1.1.0 by replaceitem on Jun 07, 2023
Download
  • Updated to Minecraft 1.20
[1.0.4] 1.0.4 by replaceitem on Mar 20, 2023
Download
  • Updated to Minecraft 1.19.4
[1.0.3] 1.0.3 by replaceitem on Nov 15, 2022
Download
  • Reworked http function to be more versatile, and renamed to http_request
  • Added escape_html and unescape_html functions, since the http function no longer parses and escapes json automatically
  • Added a discord link to the Modmenu page
[1.0.2] 1.0.2 by replaceitem on Aug 02, 2022
Download
  • http() function works now
[1.0.1] 1.0.1 by replaceitem on Aug 02, 2022
Download
  • Updated to minecraft 1.19.1
[1.0.0] 1.0.0 by replaceitem on Jun 17, 2022
Download
Initial modrinth release

Previous releases can be found [here](https://github.com/replaceitem/scarpet-additions/releases)
Scarpet additions Icon
Download Scarpet additions
Select game version
Select platform