BracketHandlers

This class was added by a mod with mod-id crafttweaker. So you need to have this mod installed if you want to use this feature.

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.

crafttweaker.api.BracketHandlers

Methods

getBlockMaterial

Gets the given crafttweaker.api.block.material.MCMaterial. Throws an Exception if not found.

Returns: The found [crafttweaker.api.block.material.MCMaterial](/vanilla/api/block/material/MCMaterial)

Return type: crafttweaker.api.block.material.MCMaterial

<blockmaterial:earth>

crafttweaker.api.BracketHandlers.getBlockMaterial(tokens as String);
crafttweaker.api.BracketHandlers.getBlockMaterial("earth");
ParameterTypeDescription
tokensStringWhat you would write in the BEP call.

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: crafttweaker.api.block.MCBlockState

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

crafttweaker.api.BracketHandlers.getBlockState(tokens as String);
crafttweaker.api.BracketHandlers.getBlockState("minecraft:acacia_planks");
ParameterTypeDescription
tokensStringThe block's resource location and variants

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: crafttweaker.api.util.DirectionAxis

<directionaxis:x>

crafttweaker.api.BracketHandlers.getDirectionAxis(tokens as String);
crafttweaker.api.BracketHandlers.getDirectionAxis("x");
ParameterTypeDescription
tokensStringThe direction Axis's resource location

getEffect

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

Returns: The found effect

Return type: crafttweaker.api.potion.MCPotionEffect

<effect:minecraft:haste>

crafttweaker.api.BracketHandlers.getEffect(tokens as String);
crafttweaker.api.BracketHandlers.getEffect("minecraft:haste");
ParameterTypeDescription
tokensStringThe effect's resource location

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: crafttweaker.api.entity.MCEntityClassification

<entityclassification:monster>

crafttweaker.api.BracketHandlers.getEntityClassification(tokens as String);
crafttweaker.api.BracketHandlers.getEntityClassification("monster");
ParameterTypeDescription
tokensStringThe entityClassification's resource location

getEntityType

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

Returns: The found entityType

Return type: crafttweaker.api.entity.MCEntityType

<entitytype:minecraft:pig>

crafttweaker.api.BracketHandlers.getEntityType(tokens as String);
crafttweaker.api.BracketHandlers.getEntityType("minecraft:pig");
ParameterTypeDescription
tokensStringThe entityType's resource location

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: crafttweaker.api.fluid.IFluidStack

<fluid:minecraft:water>

crafttweaker.api.BracketHandlers.getFluidStack(tokens as String);
crafttweaker.api.BracketHandlers.getFluidStack("minecraft:water");
ParameterTypeDescription
tokensStringThe Fluid's resource location

getItem

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

Returns: The found item

Return type: crafttweaker.api.item.IItemStack

<item:minecraft:dirt>

crafttweaker.api.BracketHandlers.getItem(tokens as String);
crafttweaker.api.BracketHandlers.getItem("minecraft:dirt");
ParameterTypeDescription
tokensStringThe item's resource location

getPotion

Return type: crafttweaker.api.potion.MCPotion

<potion:tokens>
crafttweaker.api.BracketHandlers.getPotion(tokens as String);
ParameterTypeDescription
tokensStringNo description provided

getRecipeManager

Gets the recipeManager based on registry name. Throws an error if it can't find the recipeManager. Throws an expcetion 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: crafttweaker.api.registries.IRecipeManager

crafttweaker.api.BracketHandlers.getRecipeManager(tokens as String);
crafttweaker.api.BracketHandlers.getRecipeManager("minecraft:crafting");
ParameterTypeDescription
tokensStringThe recipeManager's resource location

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: crafttweaker.api.util.MCResourceLocation

<resource:minecraft:dirt>

crafttweaker.api.BracketHandlers.getResourceLocation(tokens as String);
crafttweaker.api.BracketHandlers.getResourceLocation("minecraft:dirt");
ParameterTypeDescription
tokensStringThe resource location

getTag

Gets the tag based on registry name. Will create an empty Tag if none is found.
However, in such a case, you need to register the tag as its appropriate type

Returns: The found tag, or a newly created one

Return type: crafttweaker.api.tag.MCTag

<tag:tag:minecraft:wool>

crafttweaker.api.BracketHandlers.getTag(tokens as String);
crafttweaker.api.BracketHandlers.getTag("tag:minecraft:wool");
ParameterTypeDescription
tokensStringThe tag's resource location

getTextFormatting

Return type: crafttweaker.api.text.TextFormatting

<formatting:tokens>
crafttweaker.api.BracketHandlers.getTextFormatting(tokens as String);
ParameterTypeDescription
tokensStringNo description provided