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.
Импорт класса
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.
import crafttweaker.api.BracketHandlers;
Methods
Gets a Biome based on the tokens. Throws an error if it can't get the biome
Returns: The found biome Return Type: MCBiome
<biome:minecraft:plain>
BracketHandlers.getBiome(tokens as string) as MCBiome
BracketHandlers.getBiome("minecraft:plain");
Параметр | Тип | Description |
---|
tokens | string | The biome's resource location |
Gets the give MCBlock. Throws an Exception if not found
Returns: The found MCBlock Return Type: MCBlock
<block:minecraft:dirt>
BracketHandlers.getBlock(tokens as string) as MCBlock
BracketHandlers.getBlock("minecraft:dirt");
Параметр | Тип | Description |
---|
tokens | string | То, что вы можете написать в BEP вызове. |
Gets the given MCMaterial. Throws an Exception if not found.
Returns: The found MCMaterial Return Type: MCMaterial
<blockmaterial:earth>
BracketHandlers.getBlockMaterial(tokens as string) as MCMaterial
BracketHandlers.getBlockMaterial("earth");
Параметр | Тип | Description |
---|
tokens | string | То, что вы можете написать в BEP вызове. |
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
<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");
Параметр | Тип | Description |
---|
tokens | string | The block's resource location and variants |
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
<damagesource:magic>
BracketHandlers.getDamageSource(tokens as string) as DamageSource
BracketHandlers.getDamageSource("magic");
Параметр | Тип | Description |
---|
tokens | string | the damage sources' type |
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
<directionaxis:x>
BracketHandlers.getDirectionAxis(tokens as string) as DirectionAxis
BracketHandlers.getDirectionAxis("x");
Параметр | Тип | Description |
---|
tokens | string | The direction Axis's resource location |
Gets the effect based on registry name. Throws an error if it can't find the effect.
Returns: The found effect Return Type: MCPotionEffect
<effect:minecraft:haste>
BracketHandlers.getEffect(tokens as string) as MCPotionEffect
BracketHandlers.getEffect("minecraft:haste");
Параметр | Тип | Description |
---|
tokens | string | The effect's resource location |
Gets the enchantment based on registry name. Throws an error if it can't find the enchantment.
Returns: The found enchantment Return Type: MCEnchantment
<enchantment:minecraft:riptide>
BracketHandlers.getEnchantment(tokens as string) as MCEnchantment
BracketHandlers.getEnchantment("minecraft:riptide");
Параметр | Тип | Description |
---|
tokens | string | The enchantment's registry name |
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
<entityclassification:monster>
BracketHandlers.getEntityClassification(tokens as string) as MCEntityClassification
BracketHandlers.getEntityClassification("monster");
Параметр | Тип | Description |
---|
tokens | string | The entityClassification's resource location |
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: MCEntityType
<entitytype:minecraft:pig>
BracketHandlers.getEntityType(tokens as string) as MCEntityType
BracketHandlers.getEntityType("minecraft:pig");
Параметр | Тип | Description |
---|
tokens | string | The entityType's resource location |
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
<equipmentslottype:mainhand>
BracketHandlers.getEquipmentSlotType(tokens as string) as MCEquipmentSlotType
BracketHandlers.getEquipmentSlotType("mainhand");
Параметр | Тип | Description |
---|
tokens | string | The equipment slot type's name |
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
<fluid:minecraft:water>
BracketHandlers.getFluidStack(tokens as string) as IFluidStack
BracketHandlers.getFluidStack("minecraft:water");
Параметр | Тип | Description |
---|
tokens | string | The Fluid's resource location |
Gets the item based on registry name. Throws an error if it can't find the item.
Returns: The found item Return Type: IItemStack
<item:minecraft:dirt>
BracketHandlers.getItem(tokens as string) as IItemStack
BracketHandlers.getItem("minecraft:dirt");
Параметр | Тип | Description |
---|
tokens | string | The item's resource location |
Return Type: MCPotion
BracketHandlers.getPotion(tokens as string) as MCPotion
Параметр | Тип | Description |
---|
tokens | string | No Description Provided |
Gets the villager profession based on registry name. Logs an error and return null
if it can't find the profession.
Returns: The found profession Return Type: MCVillagerProfession
<profession:minecraft:armorer>
BracketHandlers.getProfession(tokens as string) as MCVillagerProfession
BracketHandlers.getProfession("minecraft:armorer");
Параметр | Тип | Description |
---|
tokens | string | The profession's resource location |
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
BracketHandlers.getRecipeManager(tokens as string) as IRecipeManager
BracketHandlers.getRecipeManager("minecraft:crafting");
Параметр | Тип | Description |
---|
tokens | string | The recipeManager's resource location |
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
<resource:minecraft:dirt>
BracketHandlers.getResourceLocation(tokens as string) as MCResourceLocation
BracketHandlers.getResourceLocation("minecraft:dirt");
Параметр | Тип | Description |
---|
tokens | string | The resource location |
Return Type: TextFormatting
BracketHandlers.getTextFormatting(tokens as string) as TextFormatting
Параметр | Тип | Description |
---|
tokens | string | No Description Provided |