介绍
This data pack serves as a library for many Qrazy data packs and provides some helpful utils for data pack developers such as myself.
Enchantment-driven multi-slot items
Ever want to create a full-body armor set or a two-handed weapon in just one item? This pack makes it easy. Using enchantment tags, you can make a single item take up more than one slot with several different customizable functions.
Armor sets and two-handers are tied to enchantments, not to items. This means that an armor set or two-hander enchantment will function the same way when applied to any given item (although items do have to be equippable on the legs for armor sets to work).
Armor sets
To get started, create a new enchantment. For the armor set to function properly, you need to follow a couple guidelines:
- The enchantment must run the function
qrazy:armor_set/master/tickonce per tick. - The enchantment must only use the slot
legs. Armor sets are only designed to use the legs slot, and using any other slot may have unpredictable consequences.
Beyond that, you can customize the enchantment all you want. It can have any description, any supported items, any other effects, etc., as long as you comply with the guidelines above.
After you’ve created your enchantment, you need to decide which slots it should replace. Armor set items always go in the legs slot, and they can replace the head, chest, and/or feet slots. To make an armor set replace a slot, add it to the corresponding enchantment tag.
For the head slot: #qrazy:armor_set/replaces_slot/head (data/qrazy/tags/enchantment/armor_set/replaces_slot/head.json)
For the chest slot: #qrazy:armor_set/replaces_slot/chest (data/qrazy/tags/enchantment/armor_set/replaces_slot/chest.json)
For the feet slot: #qrazy:armor_set/replaces_slot/feet (data/qrazy/tags/enchantment/armor_set/replaces_slot/feet.json)
🚧 UNDER CONSTRUCTION 🚧
For files you can copy and paste into your own data pack and modify to your liking, download the file “qrazy_templates.zip“ included in the downloads for versions 1.1.0 and above.
Other utils
This pack also adds a few simple utils to make developers’ lives easier.
Find an entity from its UUID
Run “function qrazy:get_uuid {input: [array UUID], command: "(command to execute)"}` to find the owner of a UUID represented as an integer array, as they are often stored in NBT (such as a mob's Owner tag). The `command“ argument specifies the command to be executed by the entity found by the function.
Example
/function qrazy:get_uuid {input: [0, 1, 2, 3], command: "say hi"}
Get the name of an entity
Run “/function qrazy:get_entity_name {output_path: "(block <sourcePos>|entity <source>|storage <source>)"}“ to store the name of the command executor as a text component in the specified output path.
Example
/function qrazy:get_entity_name {output_path: "storage qrazy:foo bar.baz"}
Output in storage
qrazy:foo:{bar: {
baz: (the executor's name in text component form)
}
}
Get the type of an entity
Run “/function qrazy:get_entity_id {output_path: "(block <sourcePos>|entity <source>|storage <source>)"}“ to store the entity type of the command executor as a string in the specified output path.
Example
/execute as @n[type=pig] run function qrazy:get_entity_id {output_path: "storage qrazy:foo bar.baz"}
Output in storage
qrazy:foo:{bar: {
baz: "minecraft:pig"
}
}
Get the string UUID of an entity
Run “/function qrazy:get_string_uuid {output_path: "(block <sourcePos>|entity <source>|storage <source>)"}“ to store the hexadecimal UUID of the command executor as a string in the specified output path. (Important note: For players, this function instead returns the player’s username. There is no way around this.)
Example
/function qrazy:get_string_uuid {output_path: "storage qrazy:foo bar.baz"}
Output in storage
qrazy:foo:{bar: {
baz: (the executor's hex UUID or username)
}
}
Get the position of a command’s execution
Run “function qrazy:store_position/(nbt|scoreboard) {output_path: "(block <sourcePos>|entity <source>|storage <source>)", output_score: "(scoreboard owner) (scoreboard prefix)"}` to get the block position at which a command is being executed. The position is stored in `(output_path)_(x|y|z)` if you use the NBT function, and in `(scoreboard owner) (scoreboard prefix).(x|y|z)“ if you use the scoreboard function.
Example: NBT
/execute positioned 1.1 2.2 3.3 run function qrazy:store_position/nbt {output_path: "storage qrazy:foo bar.baz"}
Output in storage
qrazy:foo:{bar: {
baz_x: 1.1d,
baz_y: 2.2d,
baz_z: 3.3d
}
}
Example: Scoreboard
/execute positioned 1.1 2.2 3.3 run function qrazy:store_position/scoreboard {output_score: "@s qrazy.foo"}
Output scores:
qrazy.foo.x= 1
qrazy.foo.y= 2
qrazy.foo.z= 3
Convert integer color to hex code
Run “function qrazy:integer_color_to_hex {integer_color: (integer color), output_path: "(block <sourcePos>|entity <source>|storage <source>)"}` to get the hex code of an integer color. The output hex code is stored in `(output_path)_(r16|r1|g16|g1|b16|b1)“, where each value is a single-character string from 0 to F.
Example
/function qrazy:integer_color_to_hex {integer_color: 11259375, output_path: "storage qrazy:foo bar.baz"}
Output in storage
qrazy:foo:{bar: {
baz_r16: "A",
baz_r1: "B",
baz_g16: "C",
baz_g1: "D",
baz_b16: "E",
baz_b1: "F",
}
}
Apply specific numbers of durability damage to any item
Run “function qrazy:damage_item_not_normalized {item_damage: (number of durability points), slot_path: "(block <pos>|entity <targets>) <slot>"}“ to apply a specific amount of durability damage to an item. Unlike the system used in vanilla item modifiers, the durability is not normalized.
Example
/function qrazy:damage_item_not_normalized {item_damage: 5, slot_path: "entity @s weapon.mainhand"}
Decreases the durability of your mainhand item by 5, regardless of its maximum durability.
Store NBT as a text component
Run “function qrazy:nbt_to_text {source: "(block|entity|storage)", block: "(<x> <y> <z>)", entity: "(<source>)", storage: "(<storage>)", nbt: "(<sourcePath>)", output_path: "(block <sourcePos>|entity <source>|storage <source>)"}` to convert the contents of the input into text and store it in the output. (Note: The `block`, `entity`, and `storage“ arguments must all be present for the function to run, even though they are not used at the same time.)
Example
/function qrazy:nbt_to_text {source: "storage", block: "", entity: "", storage: "qrazy:foo", nbt: "map", output_path: "storage qrazy:bar map_text"}
Input from storage
qrazy:foo:{map: {
some: "data",
here: true
}
}
Output in storage
qrazy:bar:{map_text: '{"some":"data","here":1b}'
}
Copy a specific item component between slots (1.21.5+)
Run “function qrazy:copy_component {source_item_path: "(block <pos>|entity <targets>) <slot>", target_item_path: "(block <pos>|entity <targets>) <slot>", component: "(<component id>)"}` to copy the specified `component` from the `source_item_path` to the `target_item_path`. The `component` argument must also be prefixed with `minecraft:`. (Note: The given component must be specified in the source item's NBT data, so for example copying the `minecraft:attribute_modifiers“ component from an unmodified diamond sword will not work.)
Example
/function qrazy:copy_component {source_item_path: "entity @s weapon.mainhand", target_item_path: "entity @s weapon.offhand", component: "minecraft:enchantments"}
Copies all enchantments from the executor’s mainhand item to their offhand item.
常见问题
Qrazy Lib 支持哪些 Minecraft 版本?
Qrazy Lib 支持 Minecraft Java 版 1.21.4–1.21.8,共 5 个版本。下载时注意选择和你游戏版本一致的文件。
Qrazy Lib 怎么安装?
新建世界时在「数据包」里把下载的 .zip 拖进去;已有的存档,把文件放进存档目录下的 datapacks 文件夹,进游戏输入 /reload 即可生效。服务器同样放在世界目录的 datapacks 里。
KaptainQrazyKool 的其他作品
查看全部 →
Qrazy Target Dummy
Minecraft Dungeons Target Dummies in vanilla Minecraft
BioGrav
Variable gravity across biomes, configurable to your heart's content!
Headlamps
...No, not that kind of headlamp.
That One Gray Pixel
Fixes that irritating grayish-yellow pixel on weathered copper bars and chains
评论
登录后评论和评分