Arrow

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.entity.type.projectile.arrow.Arrow;

Extending Projectile

Arrow extends Projectile. That means all methods available in Projectile are also available in Arrow

Methods

Gets the base damage that this arrow does.

Returns: The base damage of this arrow.
Return Type: double

script.zs
// Arrow.getBaseDamage() as double
myArrow.getBaseDamage();

Gets the knockback of this arrow.

Returns: The knockback of this arrow.
Return Type: int

script.zs
// Arrow.getKnockback() as int
myArrow.getKnockback();

Gets the pierce level of this arrow.

Returns: the pierce level of this arrow.
Return Type: byte

script.zs
// Arrow.getPierceLevel() as byte
myArrow.getPierceLevel();

Checks whether this arrow is a crit arrow.

Returns: true if this is a crit arrow, false otherwise.
Return Type: boolean

script.zs
// Arrow.isCritArrow() as boolean
myArrow.isCritArrow();

Checks if this arrow has physics or not.

Returns: true if this arrow doesn’t have physics, false otherwise.
Return Type: boolean

script.zs
// Arrow.isNoPhysics() as boolean
myArrow.isNoPhysics();

Sets the base damage that this arrow does.

script.zs
// Arrow.setBaseDamage(damage as double)
myArrow.setBaseDamage(0.5);
ParameterTypeDescription
Parameter
damage
Type
double
Description
The base damage.

Sets this the crit value of this arrow.

script.zs
// Arrow.setCritArrow(crit as boolean)
myArrow.setCritArrow(true);
ParameterTypeDescription
Parameter
crit
Type
boolean
Description
The crit value to set.

Sets the values of this arrow based on the enchantments the given entity has. This handles setting the knockback if the bow has a knockback enchantment.

script.zs
// Arrow.setEnchantmentEffectsFromEntity(entity as LivingEntity, distanceFactor as float)
myArrow.setEnchantmentEffectsFromEntity(entity, 1);
ParameterTypeDescription
Parameter
entity
Type
LivingEntity
Description
The entity that fired the arrow
Parameter
distanceFactor
Type
float
Description
How charged is the bow.

Sets the knockback of this arrow.

script.zs
// Arrow.setKnockback(knockback as int)
myArrow.setKnockback(5);
ParameterTypeDescription
Parameter
knockback
Type
int
Description
The knockback value.

Sets if this arrow has physics or not.

script.zs
// Arrow.setNoPhysics(noPhysics as boolean)
myArrow.setNoPhysics(true);
ParameterTypeDescription
Parameter
noPhysics
Type
boolean
Description
If this arrow has physics or not.

Sets the pierce level of this arrow.

script.zs
Arrow.setPierceLevel(pieceLevel as byte)
ParameterTypeDescription
Parameter
pieceLevel
Type
byte
Description
The pierce level of this arrow.

Sets if this arrow was shot from a crossbow or not.

script.zs
// Arrow.setShotFromCrossbow(shotFromCrossbow as boolean)
myArrow.setShotFromCrossbow(true);
ParameterTypeDescription
Parameter
shotFromCrossbow
Type
boolean
Description
If this arrow was shot from a crossbow or not.

Sets the sound event that this arrow plays when it hits an entity or block.

script.zs
Arrow.setSoundEvent(event as SoundEvent)
ParameterTypeDescription
Parameter
event
Type
SoundEvent
Description
The sound event to play when

Checks if this arrow was shot from a crossbow.

Returns: true if it was shot from a crossbow, false otherwise.
Return Type: boolean

script.zs
// Arrow.shotFromCrossbow() as boolean
myArrow.shotFromCrossbow();

Properties

NameTypeHas GetterHas SetterDescription
Name
baseDamage
Type
Arrow
Has Getter
true
Has Setter
true
Description
Sets the base damage that this arrow does.
Name
isCritArrow
Type
Arrow
Has Getter
true
Has Setter
true
Description
Sets this the crit value of this arrow.
Name
isNoPhysics
Type
Arrow
Has Getter
true
Has Setter
true
Description
Sets if this arrow has physics or not.
Name
knockback
Type
Arrow
Has Getter
true
Has Setter
true
Description
Sets the knockback of this arrow.
Name
pierceLevel
Type
Arrow
Has Getter
true
Has Setter
true
Description
Sets the pierce level of this arrow.
Name
shotFromCrossbow
Type
Arrow
Has Getter
false
Has Setter
true
Description
Sets if this arrow was shot from a crossbow or not.
Name
soundEvent
Type
Arrow
Has Getter
false
Has Setter
true
Description
Sets the sound event that this arrow plays when it hits an entity or block.