BracketHandlers
Link to brackethandlers
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 Copyimport crafttweaker.api.bracket.BracketHandlers;
Static Methods
Link to static-methods
Name: getAttribute
Return Type: Attribute
ZenScript CopyBracketHandlers.getAttribute(tokens as string) as Attribute
Parameter | Type |
---|---|
Parameter tokens | Type string |
Name: getBannerPattern
Gets a banner pattern based on registry name. Throws an exception if it can't find the banner pattern.
Returns: The found banner pattern
Return Type: BannerPattern
ZenScript Copy<bannerpattern:minecraft:square_bottom_left>
// BracketHandlers.getBannerPattern(tokens as string) as BannerPattern
BracketHandlers.getBannerPattern("minecraft:square_bottom_left");
Parameter | Type | Description |
---|---|---|
Parameter tokens | Type string | Description The banner pattern's resource location |
Name: getBlock
Gets the give Block. Throws an Exception if not found
Returns: The found Block
Return Type: Block
ZenScript Copy<block:minecraft:dirt>
// BracketHandlers.getBlock(tokens as string) as Block
BracketHandlers.getBlock("minecraft:dirt");
Parameter | Type | Description |
---|---|---|
Parameter tokens | Type string | Description What you would write in the BEP call. |
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: BlockState
ZenScript Copy<blockstate:minecraft:acacia_planks>
<blockstate:minecraft:furnace:facing=north,lit=false>
// BracketHandlers.getBlockState(tokens as string) as BlockState
BracketHandlers.getBlockState("minecraft:acacia_planks");
BracketHandlers.getBlockState("minecraft:furnace:facing=north,lit=false");
Parameter | Type | Description |
---|---|---|
Parameter tokens | Type string | Description The block's resource location and variants |
Name: getComponentType
Gets a data component type based on registry name. Throws an exception if it can't find the data component type.
Returns: The found data component type
Return Type: DataComponentType
ZenScript Copy<componenttype:minecraft:max_stack_size>
// BracketHandlers.getComponentType(tokens as string) as DataComponentType
BracketHandlers.getComponentType("minecraft:max_stack_size");
Parameter | Type | Description |
---|---|---|
Parameter tokens | Type string | Description The data component type'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: Enchantment
ZenScript Copy<enchantment:minecraft:riptide>
// BracketHandlers.getEnchantment(tokens as string) as Enchantment
BracketHandlers.getEnchantment("minecraft:riptide");
Parameter | Type | Description |
---|---|---|
Parameter tokens | Type string | Description The enchantment's registry name |
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: EntityType<Entity>
ZenScript Copy<entitytype:minecraft:pig>
// BracketHandlers.getEntityType(tokens as string) as EntityType<Entity>
BracketHandlers.getEntityType("minecraft:pig");
Parameter | Type | Description |
---|---|---|
Parameter tokens | Type string | Description The entityType's resource location |
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");
Parameter | Type | Description |
---|---|---|
Parameter tokens | Type string | Description The Fluid's resource location |
Name: getInstrument
Gets an instrument based on registry name. Throws an exception if it can't find the instrument.
Returns: The found instrument
Return Type: Instrument
ZenScript Copy<instrument:minecraft:ponder_goat_horn>
// BracketHandlers.getInstrument(tokens as string) as Instrument
BracketHandlers.getInstrument("minecraft:ponder_goat_horn");
Parameter | Type | Description |
---|---|---|
Parameter tokens | Type string | Description The instrument'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");
Parameter | Type | Description |
---|---|---|
Parameter tokens | Type string | Description The item's resource location |
Name: getMobEffect
Gets the mobeffect based on registry name. Throws an error if it can't find the mobeffect.
Returns: The found mobeffect
Return Type: MobEffect
ZenScript Copy<mobeffect:minecraft:haste>
// BracketHandlers.getMobEffect(tokens as string) as MobEffect
BracketHandlers.getMobEffect("minecraft:haste");
Parameter | Type | Description |
---|---|---|
Parameter tokens | Type string | Description The mobeffect's resource location |
Name: getPotion
Return Type: Potion
ZenScript CopyBracketHandlers.getPotion(tokens as string) as Potion
Parameter | Type |
---|---|
Parameter tokens | Type string |
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: VillagerProfession
ZenScript Copy<profession:minecraft:armorer>
// BracketHandlers.getProfession(tokens as string) as VillagerProfession
BracketHandlers.getProfession("minecraft:armorer");
Parameter | Type | Description |
---|---|---|
Parameter tokens | Type string | Description The profession's resource location |
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");
Parameter | Type | Description |
---|---|---|
Parameter tokens | Type string | Description The recipeManager's resource location |
Name: getSoundEvent
Gets a sound event based on registry name. Throws an exception if it can't find the sound event.
Returns: The found sound event
Return Type: SoundEvent
ZenScript Copy<soundevent:minecraft:ambient.cave>
// BracketHandlers.getSoundEvent(tokens as string) as SoundEvent
BracketHandlers.getSoundEvent("minecraft:ambient.cave");
Parameter | Type | Description |
---|---|---|
Parameter tokens | Type string | Description The sound event's resource location |
Name: getTargetingStrategy
Gets an ITargetingStrategy based on its name.
Throws an exception if the strategy doesn't exist.
Returns: The found targeting strategy
Return Type: ITargetingStrategy
ZenScript Copy<targetingstrategy:crafttweaker:default>
// BracketHandlers.getTargetingStrategy(tokens as string) as ITargetingStrategy
BracketHandlers.getTargetingStrategy("crafttweaker:default");
Parameter | Type | Description |
---|---|---|
Parameter tokens | Type string | Description The strategy's resource location |
Name: getTrimMaterial
Gets a trim material based on registry name. Throws an exception if it can't find the trim material.
Returns: The found trim material
Return Type: TrimMaterial
ZenScript Copy<trimmaterial:minecraft:quartz>
// BracketHandlers.getTrimMaterial(tokens as string) as TrimMaterial
BracketHandlers.getTrimMaterial("minecraft:quartz");
Parameter | Type | Description |
---|---|---|
Parameter tokens | Type string | Description The trim material's resource location |
Name: getTrimPattern
Gets a trim pattern based on registry name. Throws an exception if it can't find the trim pattern.
Returns: The found trim pattern
Return Type: TrimPattern
ZenScript Copy<trimpattern:minecraft:sentry>
// BracketHandlers.getTrimPattern(tokens as string) as TrimPattern
BracketHandlers.getTrimPattern("minecraft:sentry");
Parameter | Type | Description |
---|---|---|
Parameter tokens | Type string | Description The trim pattern's resource location |
Name: getVillagerType
Gets the villager profession based on registry name. Throws an exception if it can't find the profession.
Returns: The found profession
Return Type: VillagerType
ZenScript Copy<villagertype:minecraft:armorer>
// BracketHandlers.getVillagerType(tokens as string) as VillagerType
BracketHandlers.getVillagerType("minecraft:armorer");
Parameter | Type | Description |
---|---|---|
Parameter tokens | Type string | Description The profession's resource location |