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
Copy
import crafttweaker.api.item.type.projectileweapon.CrossbowItem;

Extending ProjectileWeaponItem

Link to extending-projectileweaponitem

CrossbowItem extends ProjectileWeaponItem. That means all methods available in ProjectileWeaponItem are also available in CrossbowItem

Implemented Interfaces

Link to implemented-interfaces

CrossbowItem implements the following interfaces. That means all methods defined in these interfaces are also available in CrossbowItem

Link to containsChargedProjectile

Name: containsChargedProjectile

Checks if the given stack has any charged items of the given type

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

ZenScript
Copy
// CrossbowItem.containsChargedProjectile(crossbowStack as ItemStack, ammoItem as ItemDefinition) as boolean

CrossbowItem.containsChargedProjectile(<item:minecraft:crossbow>, <item:minecraft:arrow>);
ParameterTypeDescription
Parameter
crossbowStack
Type
ItemStack
Description
The stack to check
Parameter
ammoItem
Type
ItemDefinition
Description
The ammo to check for

Link to getChargeDuration

Name: getChargeDuration

Gets the charged duration of the given stack.

Returns: the charged duration of the given stack.
Return Type: int

ZenScript
Copy
// CrossbowItem.getChargeDuration(crossbowStack as ItemStack) as int

CrossbowItem.getChargeDuration(<item:minecraft:crossbow>);
ParameterTypeDescription
Parameter
crossbowStack
Type
ItemStack
Description
The stack to check

Name: isCharged

Checks if the stack is charged

Returns: true if charged, false otherwise.
Return Type: boolean

ZenScript
Copy
// CrossbowItem.isCharged(crossbowStack as ItemStack) as boolean

CrossbowItem.isCharged(<item:minecraft:crossbow>);
ParameterTypeDescription
Parameter
crossbowStack
Type
ItemStack
Description
the stack to check

Name: performShooting

ZenScript
Copy
CrossbowItem.performShooting(level as Level, shooter as LivingEntity, hand as InteractionHand, crossbowStack as ItemStack, velocity as float, accuracy as float)
ParameterType
Parameter
level
Type
Level
Parameter
shooter
Type
LivingEntity
Parameter
hand
Type
InteractionHand
Parameter
crossbowStack
Type
ItemStack
Parameter
velocity
Type
float
Parameter
accuracy
Type
float

Name: setCharged

Sets the charged value on the given stack.

ZenScript
Copy
// CrossbowItem.setCharged(crossbowStack as ItemStack, charged as boolean)

CrossbowItem.setCharged(<item:minecraft:crossbow>, true);
ParameterTypeDescription
Parameter
crossbowStack
Type
ItemStack
Description
the stack to set the value on
Parameter
charged
Type
boolean
Description
the charged value