Class WeaponProjectile
java.lang.Object
me.deecaad.weaponmechanics.weapon.projectile.AProjectile
me.deecaad.weaponmechanics.weapon.projectile.weaponprojectile.WeaponProjectile
-
Constructor Summary
ConstructorsConstructorDescriptionWeaponProjectile(ProjectileSettings projectileSettings, org.bukkit.entity.LivingEntity shooter, org.bukkit.Location location, org.bukkit.util.Vector motion, org.bukkit.inventory.ItemStack weaponStack, String weaponTitle, org.bukkit.inventory.EquipmentSlot hand, Sticky sticky, Through through, Bouncy bouncy) -
Method Summary
Modifier and TypeMethodDescriptionclone(org.bukkit.Location location, org.bukkit.util.Vector motion) Clones the settings of this weapon projectile without shooting itintdoublegetDrag()doubleorg.bukkit.inventory.EquipmentSlotgetHand()Can be null through APIintdouble-1.0 means not useddouble-1.0 means not useddoubleorg.bukkit.inventory.ItemStackCan be null if for example API is used to shoot this projectile.booleanbooleanbooleanbooleanvoidonEnd()Override this method to do something on endvoidvoidSets the bouncy properties of this projectile (whether it bounces on blocks/entities).voidsetProjectileSettings(ProjectileSettings projectileSettings) voidsetRolling(boolean rolling) Setting rolling to true disables projectile gravityvoidsetStickedData(StickedData stickedData) Set new sticked data.voidvoidSets the sticky properties of this projectile (whether it sticks to blocks/entities).voidsetThrough(Through through) voidsetThrough(Through through, boolean isThroughChanged) Sets the through properties of this projectile (whether it passes through blocks/entities).booleanThis method updates the projectile's position/velocity, and handles all physics interactions during that movement.Methods inherited from class me.deecaad.weaponmechanics.weapon.projectile.AProjectile
addDistanceTravelled, addProjectileScript, getAliveTicks, getBukkitLocation, getCurrentBlock, getDisguise, getDistanceTravelled, getIntTag, getLastLocation, getLocation, getMotion, getMotionLength, getNormalizedMotion, getShooter, getTag, getWorld, getX, getY, getZ, isDead, isOwnedByCurrentRegion, onCollide, onStart, remove, scriptEvent, setIntTag, setLocation, setMotion, setRawLocation, setTag, spawnDisguise, tick, updateDisguise
-
Constructor Details
-
WeaponProjectile
public WeaponProjectile(ProjectileSettings projectileSettings, org.bukkit.entity.LivingEntity shooter, org.bukkit.Location location, org.bukkit.util.Vector motion, org.bukkit.inventory.ItemStack weaponStack, String weaponTitle, org.bukkit.inventory.EquipmentSlot hand, Sticky sticky, Through through, Bouncy bouncy)
-
-
Method Details
-
clone
Clones the settings of this weapon projectile without shooting it- Parameters:
location- the cloned projectile's new start locationmotion- the cloned projectile's new motion- Returns:
- the cloned projectile
-
getProjectileSettings
-
setProjectileSettings
-
getSticky
-
setSticky
-
setSticky
Sets the sticky properties of this projectile (whether it sticks to blocks/entities). IfisStickyChanged == true, then no copy will be made. This means that the passedstickyinstance must be mutable.- Parameters:
sticky- The nullable sticky instance.isStickyChanged- true if sticky is mutable.
-
getThrough
-
setThrough
-
setThrough
Sets the through properties of this projectile (whether it passes through blocks/entities). IfisThroughChanged == true, then no copy will be made. This means that the passedthroughinstance must be mutable.- Parameters:
through- The nullable through instance.isThroughChanged- true if through is mutable.
-
getBouncy
-
setBouncy
-
setBouncy
Sets the bouncy properties of this projectile (whether it bounces on blocks/entities). IfisBouncyChanged == true, then no copy will be made. This means that the passedthroughinstance must be mutable.- Parameters:
bouncy- The nullable bouncy instance.isBouncyChanged- true if bouncy is mutable.
-
getGravity
public double getGravity()- Overrides:
getGravityin classAProjectile- Returns:
- gravity of projectile
-
getMinimumSpeed
public double getMinimumSpeed()Description copied from class:AProjectile-1.0 means not used- Overrides:
getMinimumSpeedin classAProjectile- Returns:
- minimum speed of projectile
-
isRemoveAtMinimumSpeed
public boolean isRemoveAtMinimumSpeed()- Overrides:
isRemoveAtMinimumSpeedin classAProjectile- Returns:
- whether to remove projectile when minimum speed is reached
-
getMaximumSpeed
public double getMaximumSpeed()Description copied from class:AProjectile-1.0 means not used- Overrides:
getMaximumSpeedin classAProjectile- Returns:
- maximum speed of projectile
-
isRemoveAtMaximumSpeed
public boolean isRemoveAtMaximumSpeed()- Overrides:
isRemoveAtMaximumSpeedin classAProjectile- Returns:
- whether to remove projectile when maximum speed is reached
-
getDrag
public double getDrag()- Overrides:
getDragin classAProjectile- Returns:
- base speed decreasing
-
getMaximumAliveTicks
public int getMaximumAliveTicks()- Overrides:
getMaximumAliveTicksin classAProjectile- Returns:
- the maximum amount of ticks projectile can be alive
-
hasTravelledMaximumDistance
public boolean hasTravelledMaximumDistance() -
getWeaponStack
@Nullable public org.bukkit.inventory.ItemStack getWeaponStack()Can be null if for example API is used to shoot this projectile.- Returns:
- the item stack used to shoot this projectile
-
getWeaponTitle
- Returns:
- the weapon title used to shoot this projectile
-
getHand
public org.bukkit.inventory.EquipmentSlot getHand()Can be null through API- Returns:
- the hand used to shoot this projectile.
-
getStickedData
- Returns:
- the sticked data if this projectile is sticked to some entity or block
-
setStickedData
Set new sticked data. If new sticked data is null, sticked data is removed- Parameters:
stickedData- the new sticked data
-
getThroughAmount
public double getThroughAmount()- Returns:
- the amount of hit boxes this projectile has gone through using through feature
-
getBounces
public int getBounces()- Returns:
- the amount of hit boxes this projectile has bounced off using bouncy feature
-
setRolling
public void setRolling(boolean rolling) Setting rolling to true disables projectile gravity- Parameters:
rolling- the new rolling state
-
isRolling
public boolean isRolling()- Returns:
- whether projectile is currently rolling
-
updatePosition
public boolean updatePosition()Description copied from class:AProjectileThis method updates the projectile's position/velocity, and handles all physics interactions during that movement. This method also updatesAProjectile.distanceTravelled.- Specified by:
updatePositionin classAProjectile- Returns:
- true if projectile should be removed from projectile runnable
-
onEnd
public void onEnd()Description copied from class:AProjectileOverride this method to do something on end- Overrides:
onEndin classAProjectile
-