Home Commands Examples Getting Started With Scripts Global Keywords
BracketDumpers BracketHandlers BracketValidators ResourceLocationBracketHandler

CrossbowItem

Importing the class

If you need to reference this type directly, like when casting an Array, or as a parameter, you will need to import it. Simply add the import at the top of the file.

script.zs
import crafttweaker.api.item.type.projectileweapon.CrossbowItem;

Extends

CrossbowItem extends ProjectileWeaponItem.

Implements

CrossbowItem implements the following interfaces:

Vanishable,ItemLike

Undocumented Interfaces

FeatureElement,IItemExtension

Members

Getter
Gets a predicate for the supported projectiles for this item.
script.zs
// CrossbowItem.allSupportedProjectiles as function(t as ItemStack) as bool
myCrossbowItem.allSupportedProjectiles

Return Type: function(t as ItemStack) as bool

static ARROW_ONLY() as function(t as ItemStack) as bool
A predicate which only accepts arrow items
script.zs
// CrossbowItem.ARROW_ONLY() as function(t as ItemStack) as bool;
CrossbowItem.ARROW_ONLY();

Return Type: function(t as ItemStack) as bool

static ARROW_OR_FIREWORK() as function(t as ItemStack) as bool
A predicate which supports arrow items and fireworks
script.zs
// CrossbowItem.ARROW_OR_FIREWORK() as function(t as ItemStack) as bool;
CrossbowItem.ARROW_OR_FIREWORK();

Return Type: function(t as ItemStack) as bool

asItem() as Item
script.zs
// CrossbowItem.asItem() as Item;
myCrossbowItem.asItem();

Return Type: ItemDefinition

as Item
script.zs
// CrossbowItem as Item
myCrossbowItem as Item

Return Type: ItemDefinition

Getter
script.zs
// CrossbowItem.commandString as string
myCrossbowItem.commandString

Return Type: string

commandString() as string
script.zs
// CrossbowItem.commandString() as string;
myCrossbowItem.commandString();

Return Type: string

static containsChargedProjectile(crossbowStack as ItemStack, ammoItem as Item) as bool
Checks if the given stack has any charged items of the given type

Returns: true if it contains the charged item, false otherwise.

script.zs
// CrossbowItem.containsChargedProjectile(crossbowStack as ItemStack, ammoItem as Item) as bool;
CrossbowItem.containsChargedProjectile(<item:minecraft:crossbow>, <item:minecraft:arrow>);

Parameters:

crossbowStack Type: ItemStack - The stack to check
ammoItem Type: ItemDefinition - The ammo to check for

Return Type: bool

Getter
script.zs
// CrossbowItem.defaultInstance as IItemStack
myCrossbowItem.defaultInstance

Return Type: IItemStack

defaultInstance() as IItemStack
script.zs
// CrossbowItem.defaultInstance() as IItemStack;
myCrossbowItem.defaultInstance();

Return Type: IItemStack

implicit as IItemStack
script.zs
// CrossbowItem as IItemStack
myCrossbowItem as IItemStack

Return Type: IItemStack

Getter
Gets the default projectile range for this item.
script.zs
// CrossbowItem.defaultProjectileRange as int
myCrossbowItem.defaultProjectileRange

Return Type: int

static getChargeDuration(crossbowStack as ItemStack) as int
Gets the charged duration of the given stack.

Returns: the charged duration of the given stack.

script.zs
// CrossbowItem.getChargeDuration(crossbowStack as ItemStack) as int;
CrossbowItem.getChargeDuration(<item:minecraft:crossbow>);

Parameters:

crossbowStack Type: ItemStack - The stack to check

Return Type: int

static isCharged(crossbowStack as ItemStack) as bool
Checks if the stack is charged

Returns: true if charged, false otherwise.

script.zs
// CrossbowItem.isCharged(crossbowStack as ItemStack) as bool;
CrossbowItem.isCharged(<item:minecraft:crossbow>);

Parameters:

crossbowStack Type: ItemStack - the stack to check

Return Type: bool

static performShooting(level as Level, shooter as LivingEntity, hand as InteractionHand, crossbowStack as ItemStack, velocity as float, accuracy as float)
script.zs
// CrossbowItem.performShooting(level as Level, shooter as LivingEntity, hand as InteractionHand, crossbowStack as ItemStack, velocity as float, accuracy as float);
CrossbowItem.performShooting(myLevel, myLivingEntity, myInteractionHand, myItemStack, myFloat, myFloat);

Parameters:

level Type: Level
shooter Type: LivingEntity
crossbowStack Type: ItemStack
velocity Type: float
accuracy Type: float
Getter
script.zs
// CrossbowItem.registryName as ResourceLocation
myCrossbowItem.registryName

Return Type: ResourceLocation

registryName() as ResourceLocation
script.zs
// CrossbowItem.registryName() as ResourceLocation;
myCrossbowItem.registryName();

Return Type: ResourceLocation

static setCharged(crossbowStack as ItemStack, charged as bool)
Sets the charged value on the given stack.
script.zs
// CrossbowItem.setCharged(crossbowStack as ItemStack, charged as bool);
CrossbowItem.setCharged(<item:minecraft:crossbow>, true);

Parameters:

crossbowStack Type: ItemStack - the stack to set the value on
charged Type: bool - the charged value
Getter
Gets a predicate for the supported held projectiles for this item.


held projectiles are projectiles that can only be used when held in the off-hand while shooting / charging

script.zs
// CrossbowItem.supportedHeldProjectiles as function(t as ItemStack) as bool
myCrossbowItem.supportedHeldProjectiles

Return Type: function(t as ItemStack) as bool