Импорт класса

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
Copy
import crafttweaker.api.entity.type.projectile.arrow.Arrow;

Extending Projectile

Link to extending-projectile

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

Name: getBaseDamage

Gets the base damage that this arrow does.

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

ZenScript
Copy
// Arrow.getBaseDamage() as double

myArrow.getBaseDamage();

Name: getKnockback

Gets the knockback of this arrow.

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

ZenScript
Copy
// Arrow.getKnockback() as int

myArrow.getKnockback();

Name: getPierceLevel

Gets the pierce level of this arrow.

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

ZenScript
Copy
// Arrow.getPierceLevel() as byte

myArrow.getPierceLevel();

Name: isCritArrow

Checks whether this arrow is a crit arrow.

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

ZenScript
Copy
// Arrow.isCritArrow() as boolean

myArrow.isCritArrow();

Name: isNoPhysics

Checks if this arrow has physics or not.

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

ZenScript
Copy
// Arrow.isNoPhysics() as boolean

myArrow.isNoPhysics();

Name: setBaseDamage

Sets the base damage that this arrow does.

ZenScript
Copy
// Arrow.setBaseDamage(damage as double)

myArrow.setBaseDamage(0.5);
ПараметрТипОписание
Параметр
damage
Тип
double
Описание
The base damage.

Name: setCritArrow

Sets this the crit value of this arrow.

ZenScript
Copy
// Arrow.setCritArrow(crit as boolean)

myArrow.setCritArrow(true);
ПараметрТипОписание
Параметр
crit
Тип
boolean
Описание
The crit value to set.

Link to setEnchantmentEffectsFromEntity

Name: setEnchantmentEffectsFromEntity

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.

ZenScript
Copy
// Arrow.setEnchantmentEffectsFromEntity(entity as LivingEntity, distanceFactor as float)

myArrow.setEnchantmentEffectsFromEntity(entity, 1);
ПараметрТипОписание
Параметр
entity
Тип
LivingEntity
Описание
The entity that fired the arrow
Параметр
distanceFactor
Тип
float
Описание
How charged is the bow.

Name: setKnockback

Sets the knockback of this arrow.

ZenScript
Copy
// Arrow.setKnockback(knockback as int)

myArrow.setKnockback(5);
ПараметрТипОписание
Параметр
knockback
Тип
int
Описание
The knockback value.

Name: setNoPhysics

Sets if this arrow has physics or not.

ZenScript
Copy
// Arrow.setNoPhysics(noPhysics as boolean)

myArrow.setNoPhysics(true);
ПараметрТипОписание
Параметр
noPhysics
Тип
boolean
Описание
If this arrow has physics or not.

Name: setPierceLevel

Sets the pierce level of this arrow.

ZenScript
Copy
Arrow.setPierceLevel(pieceLevel as byte)
ПараметрТипОписание
Параметр
pieceLevel
Тип
byte
Описание
The pierce level of this arrow.

Link to setShotFromCrossbow

Name: setShotFromCrossbow

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

ZenScript
Copy
// Arrow.setShotFromCrossbow(shotFromCrossbow as boolean)

myArrow.setShotFromCrossbow(true);
ПараметрТипОписание
Параметр
shotFromCrossbow
Тип
boolean
Описание
If this arrow was shot from a crossbow or not.

Name: setSoundEvent

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

ZenScript
Copy
Arrow.setSoundEvent(event as SoundEvent)
ПараметрТипОписание
Параметр
event
Тип
SoundEvent
Описание
The sound event to play when

Link to shotFromCrossbow

Name: shotFromCrossbow

Checks if this arrow was shot from a crossbow.

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

ZenScript
Copy
// Arrow.shotFromCrossbow() as boolean

myArrow.shotFromCrossbow();

Свойства

Link to свойства

НазваниеТипИмеет GetterИмеет SetterОписание
Название
baseDamage
Тип
Arrow
Имеет Getter
true
Имеет Setter
true
Описание
Sets the base damage that this arrow does.
Название
isCritArrow
Тип
Arrow
Имеет Getter
true
Имеет Setter
true
Описание
Sets this the crit value of this arrow.
Название
isNoPhysics
Тип
Arrow
Имеет Getter
true
Имеет Setter
true
Описание
Sets if this arrow has physics or not.
Название
knockback
Тип
Arrow
Имеет Getter
true
Имеет Setter
true
Описание
Sets the knockback of this arrow.
Название
pierceLevel
Тип
Arrow
Имеет Getter
true
Имеет Setter
true
Описание
Sets the pierce level of this arrow.
Название
shotFromCrossbow
Тип
Arrow
Имеет Getter
false
Имеет Setter
true
Описание
Sets if this arrow was shot from a crossbow or not.
Название
soundEvent
Тип
Arrow
Имеет Getter
false
Имеет Setter
true
Описание
Sets the sound event that this arrow plays when it hits an entity or block.