ProjectileComponent

public class ProjectileComponent implements Component

Component for tracking projectile state. Attach this component to entities that need to track projectile data.

java.lang.Object > ProjectileComponent

Field Summary

projectileAssetName

private String projectileAssetName

Field projectileAssetName.

brokenDamageModifier

private float brokenDamageModifier

Field brokenDamageModifier.

deadTimer

private double deadTimer

Field deadTimer.

creatorUuid

private UUID creatorUuid

Field creatorUuid.

haveHit

private boolean haveHit

Field haveHit.

lastBouncePosition

private Vector3d lastBouncePosition

Field lastBouncePosition.

holder

final Holder holder

Field holder.

projectileComponent

final ProjectileComponent projectileComponent

Field projectileComponent.

appearance

final String appearance

Field appearance.

bounceParticles

final WorldParticle bounceParticles

Field bounceParticles.

results

final ObjectList> results

Field results.

hitParticles

final WorldParticle hitParticles

Field hitParticles.

targetEntity

final Entity targetEntity

Field targetEntity.

shooterRef

final Ref shooterRef

Field shooterRef.

missParticles

final WorldParticle missParticles

Field missParticles.

entityStore

final EntityStore entityStore

Field entityStore.

world

final World world

Field world.

explosionConfig

final ExplosionConfig explosionConfig

Field explosionConfig.

chunkStore

final Store chunkStore

Field chunkStore.

creatorRef

final Ref creatorRef

Field creatorRef.

damageSource

final Damage.ProjectileSource damageSource

Field damageSource.

deathParticles

final WorldParticle deathParticles

Field deathParticles.

direction

final Vector3d direction

Field direction.

Method Detail

getComponentType

public ProjectileComponent> getComponentType ()

Method getComponentType.

ProjectileComponent

public private ProjectileComponent ()

Method ProjectileComponent.

assembleDefaultProjectile

static Holder assembleDefaultProjectile (@Nonnull final TimeResource time, @Nonnull final String projectileAssetName, @Nonnull final Vector3d position, @Nonnull final Vector3f rotation)

Method assembleDefaultProjectile.

Parameters:
@Nonnull final TimeResource time
@Nonnull final String projectileAssetName
@Nonnull final Vector3d position
@Nonnull final Vector3f rotation

TransformComponent

public new TransformComponent (position.clone()

Method TransformComponent.

Parameters:
position.clone( position.clone(

initialize

public boolean initialize ()

Method initialize.

initializePhysics

public void initializePhysics (@Nonnull final BoundingBox boundingBox)

Method initializePhysics.

Parameters:
@Nonnull final BoundingBox boundingBox

onProjectileBounce

public void onProjectileBounce (@Nonnull final Vector3d position, @Nonnull final ComponentAccessor componentAccessor)

Method onProjectileBounce.

Parameters:
@Nonnull final Vector3d position
@Nonnull final ComponentAccessor componentAccessor

onProjectileHitEvent

private void onProjectileHitEvent (@Nonnull final Ref ref, @Nonnull final Vector3d position, @Nonnull final Ref targetRef, @Nonnull final ComponentAccessor componentAccessor)

Method onProjectileHitEvent.

Parameters:
@Nonnull final Ref ref
@Nonnull final Vector3d position
@Nonnull final Ref targetRef
@Nonnull final ComponentAccessor componentAccessor

Damage

public new Damage (new Damage.ProjectileSource((shooterRef != null)

Method Damage.

Parameters:
new Damage.ProjectileSource((shooterRef != null

consumeDeadTimer

public boolean consumeDeadTimer (final float dt)

Method consumeDeadTimer.

Parameters:
final float dt

bounceHandler

protected void bounceHandler (@Nonnull final Vector3d position, @Nonnull final ComponentAccessor componentAccessor)

Method bounceHandler.

Parameters:
@Nonnull final Vector3d position
@Nonnull final ComponentAccessor componentAccessor

impactHandler

protected void impactHandler (@Nonnull final Ref ref, @Nonnull final Vector3d position, @Nullable final Ref targetRef, @Nonnull final ComponentAccessor componentAccessor)

Method impactHandler.

Parameters:
@Nonnull final Ref ref
@Nonnull final Vector3d position
@Nullable final Ref targetRef
@Nonnull final ComponentAccessor componentAccessor

onProjectileMissEvent

private void onProjectileMissEvent (@Nonnull final Vector3d position, @Nonnull final ComponentAccessor componentAccessor)

Method onProjectileMissEvent.

Parameters:
@Nonnull final Vector3d position
@Nonnull final ComponentAccessor componentAccessor

onProjectileDeath

public void onProjectileDeath (@Nonnull final Ref ref, @Nonnull final Vector3d position, @Nonnull final CommandBuffer commandBuffer)

Method onProjectileDeath.

Parameters:
@Nonnull final Ref ref
@Nonnull final Vector3d position
@Nonnull final CommandBuffer commandBuffer

shoot

public void shoot (@Nonnull final Holder holder, @Nonnull final UUID creatorUuid, double x, double y, double z, final float yaw, final float pitch)

Method shoot.

Parameters:
@Nonnull final Holder holder
@Nonnull final UUID creatorUuid
double x
double y
double z
final float yaw
final float pitch

computeStartOffset

static void computeStartOffset (final boolean pitchAdjust, final double verticalCenterShot, final double horizontalCenterShot, final double depthShot, final float yaw, final float pitch, @Nonnull final Vector3d offset)

Method computeStartOffset.

Parameters:
final boolean pitchAdjust
final double verticalCenterShot
final double horizontalCenterShot
final double depthShot
final float yaw
final float pitch
@Nonnull final Vector3d offset

isOnGround

public boolean isOnGround ()

Method isOnGround.

getProjectile

public Projectile getProjectile ()

Method getProjectile.

getAppearance

public String getAppearance ()

Method getAppearance.

getProjectileAssetName

public String getProjectileAssetName ()

Method getProjectileAssetName.

getSimplePhysicsProvider

public SimplePhysicsProvider getSimplePhysicsProvider ()

Method getSimplePhysicsProvider.

applyBrokenPenalty

public void applyBrokenPenalty (final float penalty)

Method applyBrokenPenalty.

Parameters:
final float penalty

clone

public Component clone ()

Method clone.