Language

xzutils

xzutils

Modrinth

Useful and obscure. Provides enchantment reformatting for data manipulation.

13 downloads updated 3mo ago
latest v1.0.0 Modrinth
Datapack 1.21.5 – 1.21.11 LibraryUtility

XZUtils

XZUtils is a library designed to aid datapack developmnent in niche ways.

Functions

Enchantment Data Restructuring

Enchantment data is stored in items like so:
{id:level,id:level}
This is difficult to work with. This outputs a copy formatted as [{id:<name>,level:<value>},{id:<name>,level:<value>}] for easy enchantment manipulation.

ie;
{"minecraft:sharpness":5,"minecraft:looting":2}
converts to
[{"id":"minecraft:sharpness","level":5},{"id":"minecraft:looting","level":2}]

USAGE:

  1. in storage, set xzu:temp in to your enchantment map.
  2. run function xzu:enchant/build_enchantment_map/main
  3. your formatted map is located in xzu:temp out

Example:

# put enchantments from players held item in storage input
data modify storage xzu:temp in set from entity @p SelectedItem.components."minecraft:enchantments"

# convert map
function xzu:enchant/build_enchantment_map/main

# see formatted data
data get storage xzu:temp out

NOTE:
This requires 0 0 to be chunkloaded, and will set 0 0 0 to be air. XZUtils handles this automatically, but there will be an air block at 0 0 0 every time this function is used.

Versions

Beta
1.0.0
datapack · 1.21.5, 1.21.6, 1.21.7 · 3mo ago
- Initial Release
13

Comments 0

No comments yet. Be the first to share your thoughts.

Download xzutils

Files are served directly from the original source. Modgrid does not host or modify them.