Home Commands Examples Getting Started With Scripts Global Keywords 1.21 Migration Guide
Equipable IItemStack ItemCooldowns ItemDefinition ItemStack UseOnContext
BracketDumpers BracketHandlers BracketValidators ResourceLocationBracketHandler

ProjectileWeaponItem

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.

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

Extending ItemDefinition

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

Static Methods

A predicate which only accepts arrow items

Return Type: Predicate<ItemStack>

script.zs
// ProjectileWeaponItem.ARROW_ONLY() as Predicate<ItemStack>
ProjectileWeaponItem.ARROW_ONLY();

A predicate which supports arrow items and fireworks

Return Type: Predicate<ItemStack>

script.zs
// ProjectileWeaponItem.ARROW_OR_FIREWORK() as Predicate<ItemStack>
ProjectileWeaponItem.ARROW_OR_FIREWORK();

Properties

NameTypeHas GetterHas SetterDescription
Name
allSupportedProjectiles
Type
Predicate<ItemStack>
Has Getter
true
Has Setter
false
Description
Gets a predicate for the supported projectiles for this item.
Name
defaultProjectileRange
Type
int
Has Getter
true
Has Setter
false
Description
Gets the default projectile range for this item.
Name
supportedHeldProjectiles
Type
Predicate<ItemStack>
Has Getter
true
Has Setter
false
Description
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