This class contains the "simple" Bracket handlers from CraftTweaker. However, some Bracket handlers, like for recipeTypes, tags, tagManagers, won't be shown here as they use a different internal structure.

Importing the class

Link to importing-the-class

It might be required for you to import the package if you encounter any issues (like casting an Array), so better be safe than sorry and add the import at the very top of the file.

ZenScript
Copy
import crafttweaker.api.BracketHandlers;

Name: getAttribute

Return Type: Attribute

ZenScript
Copy
BracketHandlers.getAttribute(tokens as string) as Attribute
ParameterTypeDescription
Parameter
tokens
Type
string
Description
No Description Provided

Name: getBiome

Gets a Biome based on the tokens.
Throws an error if it can't get the biome

Returns: The found biome
Return Type: MCBiome

ZenScript
Copy
<biome:minecraft:plain>

// BracketHandlers.getBiome(tokens as string) as MCBiome

BracketHandlers.getBiome("minecraft:plain");
ParameterTypeDescription
Parameter
tokens
Type
string
Description
The biome's resource location

Name: getBlock

Gets the give MCBlock. Throws an Exception if not found

Returns: The found MCBlock
Return Type: MCBlock

ZenScript
Copy
<block:minecraft:dirt>

// BracketHandlers.getBlock(tokens as string) as MCBlock

BracketHandlers.getBlock("minecraft:dirt");
ParameterTypeDescription
Parameter
tokens
Type
string
Description
Lo que usted escribiría en la llamada BEP.

Link to getBlockMaterial

Name: getBlockMaterial

Gets the given MCMaterial. Throws an Exception if not found.

Returns: The found MCMaterial
Return Type: MCMaterial

ZenScript
Copy
<blockmaterial:earth>

// BracketHandlers.getBlockMaterial(tokens as string) as MCMaterial

BracketHandlers.getBlockMaterial("earth");
ParameterTypeDescription
Parameter
tokens
Type
string
Description
Lo que usted escribiría en la llamada BEP.

Name: getBlockState

Creates a Blockstate based on the given inputs.
Returns null if it cannot find the block, ignored invalid variants

Returns: The found BlockState
Return Type: MCBlockState

ZenScript
Copy
<blockstate:minecraft:acacia_planks>
<blockstate:minecraft:furnace:facing=north,lit=false>

// BracketHandlers.getBlockState(tokens as string) as MCBlockState

BracketHandlers.getBlockState("minecraft:acacia_planks");
BracketHandlers.getBlockState("minecraft:furnace:facing=north,lit=false");
ParameterTypeDescription
Parameter
tokens
Type
string
Description
The block's resource location and variants

Name: getDamageSource

Gets a damage source based on type.
If the damage source is not pre-registered, it will create a new one with the given name

Returns: The found pre-registered damage source or a new one
Return Type: DamageSource

ZenScript
Copy
<damagesource:magic>

// BracketHandlers.getDamageSource(tokens as string) as DamageSource

BracketHandlers.getDamageSource("magic");
ParameterTypeDescription
Parameter
tokens
Type
string
Description
the damage sources' type

Link to getDirectionAxis

Name: getDirectionAxis

Gets the direction Axis based on name. Throws an error if it can't find the direction Axis.

Returns: The found direction Axis
Return Type: DirectionAxis

ZenScript
Copy
<directionaxis:x>

// BracketHandlers.getDirectionAxis(tokens as string) as DirectionAxis

BracketHandlers.getDirectionAxis("x");
ParameterTypeDescription
Parameter
tokens
Type
string
Description
The direction Axis's resource location

Name: getEffect

Gets the effect based on registry name. Throws an error if it can't find the effect.

Returns: The found effect
Return Type: MCPotionEffect

ZenScript
Copy
<effect:minecraft:haste>

// BracketHandlers.getEffect(tokens as string) as MCPotionEffect

BracketHandlers.getEffect("minecraft:haste");
ParameterTypeDescription
Parameter
tokens
Type
string
Description
The effect's resource location

Name: getEnchantment

Gets the enchantment based on registry name. Throws an error if it can't find the enchantment.

Returns: The found enchantment
Return Type: MCEnchantment

ZenScript
Copy
<enchantment:minecraft:riptide>

// BracketHandlers.getEnchantment(tokens as string) as MCEnchantment

BracketHandlers.getEnchantment("minecraft:riptide");
ParameterTypeDescription
Parameter
tokens
Type
string
Description
The enchantment's registry name

Link to getEntityClassification

Name: getEntityClassification

Gets the entityClassification based on registry name. Logs an error and returns null if it can't find the entityClassification.

Returns: The found entityClassification
Return Type: MCEntityClassification

ZenScript
Copy
<entityclassification:monster>

// BracketHandlers.getEntityClassification(tokens as string) as MCEntityClassification

BracketHandlers.getEntityClassification("monster");
ParameterTypeDescription
Parameter
tokens
Type
string
Description
The entityClassification's resource location

Name: getEntityType

Gets the entityType based on registry name. Throws an exception if it can't find the entityType.

Returns: The found entityType
Return Type: MCEntityType

ZenScript
Copy
<entitytype:minecraft:pig>

// BracketHandlers.getEntityType(tokens as string) as MCEntityType

BracketHandlers.getEntityType("minecraft:pig");
ParameterTypeDescription
Parameter
tokens
Type
string
Description
The entityType's resource location

Link to getEquipmentSlotType

Name: getEquipmentSlotType

Gets the equipment slot type based on name. Throws an error if it can't find the equipment slot type.

Returns: The found equipment slot type
Return Type: MCEquipmentSlotType

ZenScript
Copy
<equipmentslottype:mainhand>

// BracketHandlers.getEquipmentSlotType(tokens as string) as MCEquipmentSlotType

BracketHandlers.getEquipmentSlotType("mainhand");
ParameterTypeDescription
Parameter
tokens
Type
string
Description
The equipment slot type's name

Name: getFluidStack

Gets the fluid Stack based on registry name. Throws an error if it can't find the fluid.

Returns: A stack of the liquid with amount == 1mb
Return Type: IFluidStack

ZenScript
Copy
<fluid:minecraft:water>

// BracketHandlers.getFluidStack(tokens as string) as IFluidStack

BracketHandlers.getFluidStack("minecraft:water");
ParameterTypeDescription
Parameter
tokens
Type
string
Description
The Fluid's resource location

Name: getItem

Gets the item based on registry name. Throws an error if it can't find the item.

Returns: The found item
Return Type: IItemStack

ZenScript
Copy
<item:minecraft:dirt>

// BracketHandlers.getItem(tokens as string) as IItemStack

BracketHandlers.getItem("minecraft:dirt");
ParameterTypeDescription
Parameter
tokens
Type
string
Description
The item's resource location

Name: getItemGroup

Gets an ItemGroup by name.
Will throw an error if the group could not be found!

Returns: The found ItemGroup
Return Type: ItemGroup

ZenScript
Copy
<itemgroup:misc>

// BracketHandlers.getItemGroup(tokens as string) as ItemGroup

BracketHandlers.getItemGroup(misc);
ParameterTypeDescription
Parameter
tokens
Type
string
Description
The ItemGroup's name.

Name: getPotion

Return Type: MCPotion

ZenScript
Copy
BracketHandlers.getPotion(tokens as string) as MCPotion
ParameterTypeDescription
Parameter
tokens
Type
string
Description
No Description Provided

Name: getProfession

Gets the villager profession based on registry name. Throws an exception if it can't find the profession.

Returns: The found profession
Return Type: MCVillagerProfession

ZenScript
Copy
<profession:minecraft:armorer>

// BracketHandlers.getProfession(tokens as string) as MCVillagerProfession

BracketHandlers.getProfession("minecraft:armorer");
ParameterTypeDescription
Parameter
tokens
Type
string
Description
The profession's resource location

Link to getRecipeManager

Name: getRecipeManager

Gets the recipeManager based on registry name. Throws an error if it can't find the recipeManager.
Throws an exception if the given recipeType is not found.

This will always return IRecipeManager.

There is also a BEP for that but that works differently so it can't be automatically added to the docs here.
But the BEP looks the same as the other ones: <recipetype:minecraft:crafting>

Returns: The found recipeManager
Return Type: IRecipeManager

ZenScript
Copy
// BracketHandlers.getRecipeManager(tokens as string) as IRecipeManager

BracketHandlers.getRecipeManager("minecraft:crafting");
ParameterTypeDescription
Parameter
tokens
Type
string
Description
The recipeManager's resource location

Link to getResourceLocation

Name: getResourceLocation

Creates a Resource location based on the tokens.
Throws an error if the tokens are not a valid location.

Returns: The location
Return Type: MCResourceLocation

ZenScript
Copy
<resource:minecraft:dirt>

// BracketHandlers.getResourceLocation(tokens as string) as MCResourceLocation

BracketHandlers.getResourceLocation("minecraft:dirt");
ParameterTypeDescription
Parameter
tokens
Type
string
Description
The resource location

Link to getTextFormatting

Name: getTextFormatting

Return Type: TextFormatting

ZenScript
Copy
BracketHandlers.getTextFormatting(tokens as string) as TextFormatting
ParameterTypeDescription
Parameter
tokens
Type
string
Description
No Description Provided

Name: getToolType

Gets a tool type by name.
If the tool type doesn't exist yet, this will create a new one with the given name

Returns: The found tool type or a new one
Return Type: ToolType

ZenScript
Copy
<tooltype:shovel>

// BracketHandlers.getToolType(tokens as string) as ToolType

BracketHandlers.getToolType("shovel");
ParameterTypeDescription
Parameter
tokens
Type
string
Description
the tool type's name