
Tiny DataLib
This project is a library with useful utilities such as a database system and more.
Список изменений
Tiny DataLib v0.0.2 ALPHA
"The Database Expansion"
Welcome to the second Alpha release! This update is focused entirely on the Database module—making it more flexible, more powerful, and easier to use with any data key, not just player UUIDs.
Version Highlights
- Flexible Keys: New "Custom Entry" support allows you to store data using any string or NBT as a key.
- Math on the Fly: The new
var/mathsystem lets you perform operations (+=,*=, etc.) directly on database variables. - Improved Data Control: Fine-grained control with
get/setfor specific paths vsget_full/set_fullfor entire objects. - Major Refactor: Changed terminology from "Save" to "Entry" for better technical accuracy.
Migration Guide (Breaking Changes)
If you are upgrading from v0.0.1, you must update your function calls.
- Old:
tiny_datalib:database/save/... - New:
tiny_datalib:database/entry/...
Database Documentation
1. Entry Management
Use these functions to initialize or delete a slot in the database.
| Function | Method | Description |
|---|---|---|
entry/add | Entity UUID | Creates a new entry using the executor's UUID. |
entry/add/macro | {ENTRY: <key>} | Creates a new entry using a custom key (String/NBT). |
entry/remove | Entity UUID | Deletes the entry associated with the executor. |
entry/remove/macro | {ENTRY: <key>} | Deletes the entry associated with the custom key. |
Return Codes:
1: Success.-1: Entry already exists (for add) or doesn't exist (for remove).
2. Data Manipulation (NBT Objects)
These functions handle raw NBT data. Useful for saving inventories, complex state machines, or nested objects.
Partial Data (Get/Set)
Used for specific paths within an entry.
# Example: Set a specific path
function tiny_datalib:database/data/set {with:"entity @s", data:"Inventory"}
# Example: Get a specific path from a custom entry
function tiny_datalib:database/data/get/macro {ENTRY:"GlobalConfig", data:"Settings.Difficulty"}
Full Data (Get Full/Set Full)
Used to overwrite or retrieve the entire entry object.
# Example: Backup an entire player entry to storage
function tiny_datalib:database/data/get_full with entity @s
Return Codes:
1: Success.-1: Entry/UUID not found.-2: Specific data path not found.
3. Variable Logic & Math
This is the most powerful part of v0.0.2. You can now manipulate numbers stored in the database without manually pulling them to a scoreboard first.
Variable Math
Supports all standard scoreboard operations: +=, -=, *=, /=, %=, =, <, >, ><.
# Example: Adding 10 to a player's "Mana" variable
function tiny_datalib:database/var/math {with:"entity @s", var:"Mana", math:"+=", mathvalue:10}
# Example: Multiplying a custom entry variable
function tiny_datalib:database/var/math/macro {ENTRY:"WorldData", var:"DayCount", math:"*=", mathvalue:2}
Get/Set Variables
# Example: Set a variable directly
function tiny_datalib:database/var/set {with:"entity @s", var:"Level", value:5}
# Example: Get a variable with a fallback (none) if it doesn't exist
function tiny_datalib:database/var/get {with:"entity @s", var:"Coins", none:0}
Future Plans
- Raycasting: Custom range options and improved block detection accuracy.
- Distance: Optimized calculation for high-frequency checks.
- Custom Give: Intelligent item stacking and "Full Inventory" detection.
- New Modules: Advanced Mannequin/Armor Stand animation controls.
Pro-Tip for v0.0.2
When using entry/add/macro, your ENTRY key can be a simple string like "Global_Settings". This makes it incredibly easy to store data that isn't tied to a player, like a custom shop's stock or world-wide event progress.
