Bracket Handlers

Link to bracket-handlers

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
<blockmaterial:earth> // References the Earth Block Material.
<directionaxis:x> // References the X Direction Axis.
<entityclassification:monster> // References the Monster Entity Classification.
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.

At the end of the day, Bracket Handlers don't have a fully defined format, a mod could come along and add a Bracket Handler in a completely different format than listed here, the ones listed here are just the ones used in CraftTweaker itself and to listed to try and give an understanding of how Bracket Handlers look.

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! Simply use /ct dumpBrackets and look in the newly created ct_dumps folder for them!