Back to 9Minecraft
Wiki 9Minecraft Wiki 9Minecraft
Gstools Wiki › Guides › Use GSTools Math Functions in Custom Command Scripts

Use GSTools Math Functions in Custom Command Scripts

Accessing Math Operations

GSTools includes trigonometry and advanced math tools designed for use in custom command setups and data packs. These functions help you calculate angles, distances, and rotations without manual computation.

How to Apply Math Tools

1. Identify your calculation need — Determine whether you need trigonometric functions (sine, cosine, tangent) or general math operations (absolute value, rounding, min/max).

2. Reference GSTools math library — In your command scripts or function files, call the appropriate math utility provided by GSTools.

3. Input your values — Pass coordinates, angles, or numbers as parameters to the function.

4. Capture the result — Store the output in a scoreboard objective or NBT tag for use in subsequent commands.

These tools are especially useful when building custom maps or scripted events where precise geometric calculations would otherwise require complex workarounds. They streamline rotation-based mechanics and distance-based triggers.