Compatibility
Minecraft: Java Edition
Platforms
Tags
Creators
Details
ArLib
A utility datapack library for Minecraft 26.1+ (pack format 101).
It includes the following functionality: chat functions, player management, combat, world controls, math helpers, entity tools, inventory utilities, sound, and teleport functions.
And it also helps developers developing with logging,
All functions use macro parameters passed through arlib:input storage unless noted otherwise.
General usage pattern:
data merge storage arlib:input {param1:"value1", param2:"value2"}
function arlib:<category>/<name> with storage arlib:input
Logging Screenshot

Documentation
Docs
Debug / Dev Logging
ArLib has a built-in debug logging system. Log messages are only shown when debug mode is enabled and only to players who have the arlib.debug tag.
Setup
# Enable debug logging
scoreboard players set #debug arlib.dev 1
# Show log messages for a player
tag @s add arlib.debug
# Hide log messages for a player
tag @s remove arlib.debug
# Disable debug logging entirely
scoreboard players set #debug arlib.dev 0
The ArLib "Loaded." message also only appears when debug is on.
Log functions
All log functions take a single message parameter.
chat/info - Aqua [INFO] prefix.
data merge storage arlib:input {message:"Player entered zone."}
function arlib:chat/info with storage arlib:input
chat/success - Green [OK] prefix.
data merge storage arlib:input {message:"Arena ready."}
function arlib:chat/success with storage arlib:input
chat/warn - Yellow [WARN] prefix.
data merge storage arlib:input {message:"Low on resources."}
function arlib:chat/warn with storage arlib:input
chat/error - Dark red [ERROR] prefix.
data merge storage arlib:input {message:"Target not found."}
function arlib:chat/error with storage arlib:input
Chat
chat/send - Send a formatted chat message to a specific target.
| Param | Description |
|---|---|
| prefix | Tag shown in brackets, e.g. "INFO" |
| color | Color code for the prefix (0-f) |
| message | The message text |
| target | Player selector, e.g. "@a", "@s" |
data merge storage arlib:input {prefix:"INFO", color:"6", message:"Hello!", target:"@a"}
function arlib:chat/send with storage arlib:input
chat/broadcast - Same as chat/send but always sends to all players. No target param needed.
| Param | Description |
|---|---|
| prefix | Tag shown in brackets |
| color | Color code for the prefix (0-f) |
| message | The message text |
data merge storage arlib:input {prefix:"SERVER", color:"b", message:"Restarting soon."}
function arlib:chat/broadcast with storage arlib:input
chat/title - Show a title and subtitle on screen.
| Param | Description |
|---|---|
| target | Player selector |
| title | Main title text |
| subtitle | Subtitle text |
data merge storage arlib:input {target:"@a", title:"Welcome!", subtitle:"Enjoy your stay."}
function arlib:chat/title with storage arlib:input
chat/actionbar - Show a message on the action bar (above the hotbar).
| Param | Description |
|---|---|
| target | Player selector |
| message | The message text |
data merge storage arlib:input {target:"@s", message:"Mana: 50/100"}
function arlib:chat/actionbar with storage arlib:input
chat/clear - Clear a player's chat by flooding it with blank lines.
| Param | Description |
|---|---|
| target | Player selector |
data merge storage arlib:input {target:"@a"}
function arlib:chat/clear with storage arlib:input
Player
player/heal - Fully heals a player.
| Param | Description |
|---|---|
| target | Player selector |
data merge storage arlib:input {target:"@s"}
function arlib:player/heal with storage arlib:input
player/feed - Fully restores food and saturation.
| Param | Description |
|---|---|
| target | Player selector |
data merge storage arlib:input {target:"@s"}
function arlib:player/feed with storage arlib:input
player/clear_effects - Removes all potion effects.
| Param | Description |
|---|---|
| target | Player selector |
data merge storage arlib:input {target:"@a"}
function arlib:player/clear_effects with storage arlib:input
player/freeze - Freeze or unfreeze a player by setting movement speed and jump strength to 0.
| Param | Description |
|---|---|
| target | Player selector |
| state | "freeze" or "unfreeze" |
data merge storage arlib:input {target:"@s", state:"freeze"}
function arlib:player/freeze with storage arlib:input
data merge storage arlib:input {target:"@s", state:"unfreeze"}
function arlib:player/freeze with storage arlib:input
Combat
combat/damage - Deal a specific amount of damage to a target. 1 = half a heart.
| Param | Description |
|---|---|
| target | Player selector |
| amount | Damage amount (half hearts) |
data merge storage arlib:input {target:"@p", amount:"6"}
function arlib:combat/damage with storage arlib:input
combat/set_health - Set a player's health to an exact value. Temporarily changes max health, heals, then restores max health to 20.
| Param | Description |
|---|---|
| target | Player selector |
| health | Health value (1-20, 1 = half heart) |
data merge storage arlib:input {target:"@s", health:"6"}
function arlib:combat/set_health with storage arlib:input
World
world/time_set - Set the world time using a named preset.
| Param | Description |
|---|---|
| time | "day", "noon", "night", or "midnight" |
data merge storage arlib:input {time:"noon"}
function arlib:world/time_set with storage arlib:input
world/weather_set - Set the weather.
| Param | Description |
|---|---|
| weather | "clear", "rain", or "thunder" |
data merge storage arlib:input {weather:"thunder"}
function arlib:world/weather_set with storage arlib:input
Time
time/is_day - Sets #is_day arlib.temp to 1 if daytime (0-12999 ticks), 0 otherwise. No parameters.
function arlib:time/is_day
execute if score #is_day arlib.temp matches 1 run say It's daytime!
time/is_night - Sets #is_night arlib.temp to 1 if nighttime (13000-23999 ticks), 0 otherwise. No parameters.
function arlib:time/is_night
execute if score #is_night arlib.temp matches 1 run function my_pack:night_logic
Math
All math functions operate on scoreboard values. Requires arlib:load to have run first.
math/clamp - Clamp a scoreboard value between a min and max.
| Param | Description |
|---|---|
| target | Score holder, e.g. "@s" or "#score" |
| objective | Scoreboard objective name |
| min | Minimum value |
| max | Maximum value |
data merge storage arlib:input {target:"@s", objective:"health", min:"0", max:"20"}
function arlib:math/clamp with storage arlib:input
math/abs - Set a scoreboard value to its absolute value.
| Param | Description |
|---|---|
| target | Score holder |
| objective | Scoreboard objective name |
scoreboard players set @s velocity -42
data merge storage arlib:input {target:"@s", objective:"velocity"}
function arlib:math/abs with storage arlib:input
# @s velocity is now 42
math/random - Generate a random number and store it in a scoreboard.
| Param | Description |
|---|---|
| target | Score holder |
| objective | Scoreboard objective name |
| min | Minimum value (inclusive) |
| max | Maximum value (inclusive) |
data merge storage arlib:input {target:"@s", objective:"dice", min:"1", max:"6"}
function arlib:math/random with storage arlib:input
Entity
entity/kill_type - Kill all entities of a given type.
| Param | Description |
|---|---|
| type | Entity type, e.g. "minecraft:zombie" |
data merge storage arlib:input {type:"minecraft:creeper"}
function arlib:entity/kill_type with storage arlib:input
entity/count_type - Count all entities of a type and store the result in a scoreboard.
| Param | Description |
|---|---|
| type | Entity type |
| target | Score holder for the result |
| objective | Scoreboard objective |
data merge storage arlib:input {type:"minecraft:zombie", target:"#count", objective:"arlib.temp"}
function arlib:entity/count_type with storage arlib:input
execute if score #count arlib.temp matches 10.. run say Too many zombies!
entity/freeze_all - Set or remove NoAI on all entities of a type.
| Param | Description |
|---|---|
| type | Entity type |
| noai | "1b" to freeze, "0b" to unfreeze |
data merge storage arlib:input {type:"minecraft:creeper", noai:"1b"}
function arlib:entity/freeze_all with storage arlib:input
entity/glow - Give the glowing effect to all entities of a type.
| Param | Description |
|---|---|
| type | Entity type |
| duration | Duration in seconds, or "infinite" |
data merge storage arlib:input {type:"minecraft:zombie", duration:"10"}
function arlib:entity/glow with storage arlib:input
entity/glow_remove - Remove the glowing effect from all entities of a type.
| Param | Description |
|---|---|
| type | Entity type |
data merge storage arlib:input {type:"minecraft:creeper"}
function arlib:entity/glow_remove with storage arlib:input
Inventory
inventory/clear_slot - Clear a specific inventory slot by replacing it with air.
| Param | Description |
|---|---|
| target | Player selector |
| slot | Slot name (see below) |
Common slots: container.0 through container.8 (hotbar), container.9 through container.35 (main inventory), armor.head, armor.chest, armor.legs, armor.feet, weapon.offhand.
data merge storage arlib:input {target:"@s", slot:"container.0"}
function arlib:inventory/clear_slot with storage arlib:input
inventory/give_safe - Give an item only if the player has at least one empty inventory slot. Shows a warning if full.
| Param | Description |
|---|---|
| target | Player selector |
| item | Item ID, e.g. "minecraft:diamond" |
| count | Amount to give |
data merge storage arlib:input {target:"@s", item:"minecraft:golden_apple", count:"3"}
function arlib:inventory/give_safe with storage arlib:input
inventory/swap_offhand - Swap a player's mainhand and offhand items.
| Param | Description |
|---|---|
| target | Player selector |
data merge storage arlib:input {target:"@s"}
function arlib:inventory/swap_offhand with storage arlib:input
Sound
sound/play - Play a sound to a target. Uses master channel, volume 1, pitch 1.
| Param | Description |
|---|---|
| target | Player selector |
| sound | Sound ID, e.g. "minecraft:entity.experience_orb.pickup" |
data merge storage arlib:input {target:"@s", sound:"minecraft:block.note_block.pling"}
function arlib:sound/play with storage arlib:input
sound/alert - Play a short high-pitched pling sound to a player.
| Param | Description |
|---|---|
| target | Player selector |
data merge storage arlib:input {target:"@a"}
function arlib:sound/alert with storage arlib:input
Teleport
tp/save - Save the executing player's current position under a named slot. Must run as the player (as @s).
| Param | Description |
|---|---|
| name | Name for the waypoint |
data merge storage arlib:input {name:"home"}
execute as @s run function arlib:tp/save with storage arlib:input
tp/load - Teleport the executing player to a previously saved position. Must run as the player.
| Param | Description |
|---|---|
| name | Name of the saved waypoint |
data merge storage arlib:input {name:"home"}
execute as @s run function arlib:tp/load with storage arlib:input
tp/swap - Swap the positions of two players.
| Param | Description |
|---|---|
| player1 | First player selector |
| player2 | Second player selector |
data merge storage arlib:input {player1:"@a[tag=red]", player2:"@a[tag=blue]"}
function arlib:tp/swap with storage arlib:input


