▶️ ЗАБЕРИ СВОИ 8 ПОДАРКОВ 🎁 ПРИ СОЗДАНИИ СВОЕГО МАЙНКРАФТ СЕРВЕРА
Моды/ArLib
ArLib

ArLib

Chat & utility library for Datapacks

Оцените первым
21
0

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

!Logging Chat Example

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.

ParamDescription
prefixTag shown in brackets, e.g. "INFO"
colorColor code for the prefix (0-f)
messageThe message text
targetPlayer 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.

ParamDescription
prefixTag shown in brackets
colorColor code for the prefix (0-f)
messageThe 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.

ParamDescription
targetPlayer selector
titleMain title text
subtitleSubtitle 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).

ParamDescription
targetPlayer selector
messageThe 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.

ParamDescription
targetPlayer selector
data merge storage arlib:input {target:"@a"}
function arlib:chat/clear with storage arlib:input

Player

player/heal - Fully heals a player.

ParamDescription
targetPlayer selector
data merge storage arlib:input {target:"@s"}
function arlib:player/heal with storage arlib:input

player/feed - Fully restores food and saturation.

ParamDescription
targetPlayer selector
data merge storage arlib:input {target:"@s"}
function arlib:player/feed with storage arlib:input

player/clear_effects - Removes all potion effects.

ParamDescription
targetPlayer 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.

ParamDescription
targetPlayer 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.

ParamDescription
targetPlayer selector
amountDamage 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.

ParamDescription
targetPlayer selector
healthHealth 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.

ParamDescription
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.

ParamDescription
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.

ParamDescription
targetScore holder, e.g. "@s" or "#score"
objectiveScoreboard objective name
minMinimum value
maxMaximum 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.

ParamDescription
targetScore holder
objectiveScoreboard 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.

ParamDescription
targetScore holder
objectiveScoreboard objective name
minMinimum value (inclusive)
maxMaximum 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.

ParamDescription
typeEntity 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.

ParamDescription
typeEntity type
targetScore holder for the result
objectiveScoreboard 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.

ParamDescription
typeEntity 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.

ParamDescription
typeEntity type
durationDuration 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.

ParamDescription
typeEntity 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.

ParamDescription
targetPlayer selector
slotSlot 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.

ParamDescription
targetPlayer selector
itemItem ID, e.g. "minecraft:diamond"
countAmount 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.

ParamDescription
targetPlayer 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.

ParamDescription
targetPlayer selector
soundSound 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.

ParamDescription
targetPlayer 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).

ParamDescription
nameName 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.

ParamDescription
nameName 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.

ParamDescription
player1First player selector
player2Second player selector
data merge storage arlib:input {player1:"@a[tag=red]", player2:"@a[tag=blue]"}
function arlib:tp/swap with storage arlib:input
Партнёрский материал

Как поиграть с друзьями с модом ArLib?

Мод ArLib куда интереснее в компании: поднимите сервер Майнкрафт с уже установленным модом, позовите друзей и играйте по своим правилам. Хостинг Майнкрафт для мода ArLib будет готов за пару минут - BungeeHost сделает всё за вас.

Часто задаваемые вопросы

Совместимость

Minecraft: Java Edition

26.1.x1.21.x

Платформы

Поддерживаемые окружения

Клиент и сервер

Создатели

Детали

Лицензия:
Опубликован:3 месяца назад
Обновлён:3 месяца назад
Главная