Class ProjectileComponent

java.lang.Object
com.hypixel.hytale.server.core.entity.entities.ProjectileComponent
All Implemented Interfaces:
Component<EntityStore>, Cloneable

public class ProjectileComponent extends Object implements Component<EntityStore>
A component that is attached to a projectile entity, containing the projectile attributes and configuration
  • Field Details

  • Constructor Details

    • ProjectileComponent

      public ProjectileComponent(@Nonnull String projectileAssetName)
      Default Constructor for a ProjectileComponent instance
      Parameters:
      projectileAssetName - The name of the affiliated projectile asset
    • ProjectileComponent

      public ProjectileComponent(@Nonnull ProjectileComponent other)
  • Method Details

    • getComponentType

      @Nonnull public static ComponentType<EntityStore, ProjectileComponent> getComponentType()
      Returns:
      the component type for the ProjectileComponent component
    • assembleDefaultProjectile

      @Nonnull public static Holder<EntityStore> assembleDefaultProjectile(@Nonnull TimeResource time, @Nonnull String projectileAssetName, @Nonnull org.joml.Vector3d position, @Nonnull Rotation3f rotation)
      Creates a new entity holder, using the given projectile name, position and rotation
      Parameters:
      time - The time resource of the entity store
      projectileAssetName - The name of the associated projectile asset
      position - The position of the projectile
      rotation - The rotation of the projectile
      Returns:
      the newly created entity holder for the projectile entity
    • initialize

      public boolean initialize()
      Called to initialize this projectile component for a projectile entity.
      Returns:
      true if initialization was successful, false otherwise.
    • initializePhysics

      public void initializePhysics(@Nonnull BoundingBox boundingBox)
      Called to initialize the physics of this projectile.
      Parameters:
      boundingBox - The configured bounding box of the projectile.
    • onProjectileBounce

      public void onProjectileBounce(@Nonnull org.joml.Vector3d position, @Nonnull ComponentAccessor<EntityStore> componentAccessor)
      Called when the projectile bounces.
      Parameters:
      position - The position of the projectile.
      componentAccessor - The component accessor for accessing components and resources.
    • consumeDeadTimer

      public boolean consumeDeadTimer(float dt)
      Consumes the dead timer of the projectile
      Parameters:
      dt - The delta time to consume
      Returns:
      true if the dead timer has expired, false otherwise
    • onProjectileDeath

      public void onProjectileDeath(@Nonnull Ref<EntityStore> ref, @Nonnull org.joml.Vector3d position, @Nonnull CommandBuffer<EntityStore> commandBuffer)
      Called upon the death of the given projectile.
      Parameters:
      ref - The entity reference to the affiliated projectile.
      position - The position of the projectile.
      commandBuffer - The CommandBuffer<EntityStore> for component access.
    • shoot

      public void shoot(@Nonnull Holder<EntityStore> holder, @Nonnull UUID creatorUuid, double x, double y, double z, float yaw, float pitch)
    • computeStartOffset

      public static void computeStartOffset(boolean pitchAdjust, double verticalCenterShot, double horizontalCenterShot, double depthShot, float yaw, float pitch, @Nonnull org.joml.Vector3d offset)
    • isOnGround

      public boolean isOnGround()
    • getProjectile

      @Nullable public Projectile getProjectile()
    • getAppearance

      public String getAppearance()
    • getProjectileAssetName

      public String getProjectileAssetName()
    • getSimplePhysicsProvider

      public SimplePhysicsProvider getSimplePhysicsProvider()
    • applyBrokenPenalty

      public void applyBrokenPenalty(float penalty)
    • getCreatorUuid

      public UUID getCreatorUuid()
    • clone

      @Nonnull public Component<EntityStore> clone()
      Specified by:
      clone in interface Component<EntityStore>
      Returns:
      a clone instance of the original component instance.