A standard library that adds variables, arithmetic, and relational operators to mcfunction
  • mcfunction 100%
Find a file
Victor Westerlund a6143ae59e feat: add directional raycast API with function callbacks on each ray tick (#16)
This PR adds a new API for creating a raycast in any direction. A callback function is dispatched with each tick.

Reviewed-on: #16
2026-11-15 13:29:48 +01:00
data feat: add directional raycast API with function callbacks on each ray tick (#16) 2026-11-15 13:29:48 +01:00
.gitignore feat: add direct math and comparison operations on integer values (#4) 2026-05-02 19:24:24 +02:00
LICENSE initial commit 2026-03-09 21:51:55 +01:00
pack.mcmeta refactor: bundle mcfstd as a datapack (#1) 2026-03-13 20:02:31 +01:00
README.md feat: add directional raycast API with function callbacks on each ray tick (#16) 2026-11-15 13:29:48 +01:00

Standard library for mcfunction

mcfstd is a library datapack for Minecraft Java Edition. It adds named integer variables, arithmetic, comparisons, callback helpers, and more on top of vanilla mcfunction commands.

The full documentation lives in the mcfstd wiki

# Set variable 'score' to 10
function var:set { k: "score", v: 10 }

# Add five
function var:math/add { k: "score", v: 5 }

# Check the result
function var:comp/eq { k: "score", v: 15 }
execute if function stdout:true run say score is 15
execute if function stdout:false run say score is not 15

Installation

Download the datapack zip from the releases page and place it directly inside your world's datapacks/ directory.

Reload the world:

reload

Enable the datapack if needed:

datapack enable "file/mcfstd-X-X-X.zip"

Replace X-X-X with the release version you installed.

Features

Feature Summary Documentation
Variables Set, unset, copy, move, increment, decrement, and test integer variables Variables
Arithmetic Add, subtract, multiply, divide, and modulo variables Arithmetic
Comparisons Compare variables against integers or other variables Comparisons
Function calls Pass variable values into Minecraft macro functions Function Calls
Raycasting Visit bounded sample points with callbacks and isolated nested casts Raycasting
Standard output Branch on the result of the previous boolean operation Standard Output
Triggers Register area enter/leave callbacks and block placement callbacks Triggers
Debugging Show scoreboards and receive trace output Debugging

For a compact list of every public function, see the Function Reference.

Public Namespaces

Namespace Purpose
var: Integer variables and operators
call: Call macro functions with variable values as arguments
raycast: Traverse sample points with caller-defined block and effect handling
trigger: Area and block callbacks
stdout: Read the boolean result of the previous comparison
debug: Debug output and scoreboard display helpers

Functions under z_std: are internal implementation details. See Internal Model for how the datapack stores variables, tracks triggers, and manages macro call storage.

More Documentation