Обработчики скобок

Link to обработчики-скобок

Bracket Handlers or BracketExpressionParser (BEP for short) are pieces of code that reference game objects (or create new objects) such as Items, Blocks or Resource Locations.

An example of a Bracket Handler would be the Item Bracket Handler:

ZenScript
Copy
<item:minecraft:diamond>

That references the Diamond Item in the game.

Bracket Handlers always start with their type, so an Item Bracket Handler starts with item and a Block Bracket Handler starts with block.

The general format for Bracket Handlers are:

ZenScript
Copy
<type:modid:name>

As stated above, type is what kind of Bracket Handler is being called. modid is the mod that owns the object. name is the name of the object being referenced.

Some more examples are:

ZenScript
Copy
<block:minecraft:white_wool> // References the White Wool Block.
<item:minecraft:white_wool> // References the White Wool Item.
<fluid:minecraft:water> // References the Water Fluid.
<effect:minecraft:haste> // References the Haste Potion Effect.

While the format above is used most of the time, there are some instances where there just isn't a need for the modid.

In cases where a modid isn't needed to reference an object (Such as Text Formatting, where mods can't add new objects), a different format is used.

ZenScript
Copy
<type:name>

Some examples of this are:

ZenScript
Copy
<damagesource:inFire> // Обозначает огонь как источник урона
Note: This is talking about the Vanilla Data Pack Tag

Link to note-this-is-talking-about-the-vanilla-data-pack-tag

Tags are special and need another layer of categorization, as a tag with the name minecraft:white_wool could be referring to both an ItemTag and a BlockTag.

The format used on Tags is:

ZenScript
Copy
<tag:type:modid:name>

Examples of this are:

ZenScript
Copy
<tag:items:minecraft:white_wool> // References the White Wool Item Tag.
<tag:blocks:minecraft:white_wool> // References the White Wool Block Tag.
<tag:fluids:minecraft:water> // References the Water Fluid Tag.

На данный момент обработчики скобок не имеют строго определенного формата, мод может добавить обработчик скобок, работающий совсем по-другому. Перечисленные здесь форматы используются самим CraftTweaker и обозначены, чтобы объяснить, как работают обработчики скобок в принципе.

Getting Bracket Handlers

Link to getting-bracket-handlers

Since mods can add their own Bracket Handlers, it is impossible to list them all here, there is a command in-game that will output a list of all Bracket Handlers and their values though! Просто используйте команду /ct dump_brackets и осмотрите созданную ей папку ct_dumps.