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.
导入类
Link to 导入类
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
参数 | 类型 |
---|---|
参数 tokens | 类型 string |
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");
参数 | 类型 | 描述 |
---|---|---|
参数 tokens | 类型 string | 描述 The block's resource location and variants |
Name: getCreativeModeTab
Gets an CreativeModeTab by name.
Will throw an error if the tab could not be found!
Returns: The found ItemGroup
Return Type: CreativeModeTab
ZenScript Copy<creativemodetab:misc>
// BracketHandlers.getCreativeModeTab(tokens as string) as CreativeModeTab
BracketHandlers.getCreativeModeTab(misc);
参数 | 类型 | 描述 |
---|---|---|
参数 tokens | 类型 string | 描述 The CreativeModeTab's name. |
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");
参数 | 类型 | 描述 |
---|---|---|
参数 tokens | 类型 string | 描述 the damage sources' type |
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");
参数 | 类型 | 描述 |
---|---|---|
参数 tokens | 类型 string | 描述 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
ZenScript Copy<entitytype:minecraft:pig>
// BracketHandlers.getEntityType(tokens as string) as EntityType
BracketHandlers.getEntityType("minecraft:pig");
参数 | 类型 | 描述 |
---|---|---|
参数 tokens | 类型 string | 描述 The entityType'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");
参数 | 类型 | 描述 |
---|---|---|
参数 tokens | 类型 string | 描述 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");
参数 | 类型 | 描述 |
---|---|---|
参数 tokens | 类型 string | 描述 The mobeffect's resource location |
Name: getPotion
Return Type: Potion
ZenScript CopyBracketHandlers.getPotion(tokens as string) as Potion
参数 | 类型 |
---|---|
参数 tokens | 类型 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");
参数 | 类型 | 描述 |
---|---|---|
参数 tokens | 类型 string | 描述 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");
参数 | 类型 | 描述 |
---|---|---|
参数 tokens | 类型 string | 描述 The recipeManager's resource location |
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: ResourceLocation
ZenScript Copy// BracketHandlers.getResourceLocation(tokens as string) as ResourceLocation
BracketHandlers.getResourceLocation("minecraft:dirt");
参数 | 类型 | 描述 |
---|---|---|
参数 tokens | 类型 string | 描述 The 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");
参数 | 类型 | 描述 |
---|---|---|
参数 tokens | 类型 string | 描述 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");
参数 | 类型 | 描述 |
---|---|---|
参数 tokens | 类型 string | 描述 The strategy'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");
参数 | 类型 | 描述 |
---|---|---|
参数 tokens | 类型 string | 描述 The profession's resource location |