Minecraft

Minecraft-related functionality.

App

The main delivery method for scarpet programs into the game is in the form of apps in *.sc files located in the world scripts folder, flat. In singleplayer, you can also save apps in .minecraft/config/carpet/scripts for them to be available in any world, and here you can actually organize them in folders. When loaded (via /script load command, etc.), the game will run the content of the app once, regardless of its scope (more about the app scopes below), without executing of any functions, unless called directly, and with the exception of the __config() function, if present, which will be executed once.

Blocks and World

Entity

Inventory

Most functions in this category require inventory as the first argument. Inventory could be specified by an entity, or a block, or position (three coordinates) of a potential block with inventory, or can be preceded with inventory type. Inventory type can be null (default), 'enderchest' denoting player enderchest storage, or 'equipment' applying to entities hand and armour pieces. Then the type can be followed by entity, block or position coordinates. For instance, player enderchest inventory requires two arguments, keyword 'enderchest', followed by the player entity argument, (or a single argument as a string of a form: 'enderchest_steve' for legacy support).

Global Events

Global events will be handled once per app that is with 'global' scope. With player scoped apps, each player instance will be triggered once for each player, so a global event may be executed multiple times for such apps.

Player Events

These are triggered with a player context. For apps with a 'player' scope, they trigger once for the appropriate player. In apps with global scope they trigger once as well as a global event.

Auxillary