Class PickupItemComponent

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

public class PickupItemComponent extends Object implements Component<EntityStore>
A component that signifies that an item entity is being used to display the pick-up animation of an item.
  • Field Details

    • PICKUP_TRAVEL_TIME_DEFAULT

      public static final float PICKUP_TRAVEL_TIME_DEFAULT
      The default travel time, in seconds, of a pickup item entity.
      See Also:
  • Constructor Details

    • PickupItemComponent

      public PickupItemComponent()
      Default Constructor for a PickupItemComponent instance.
    • PickupItemComponent

      public PickupItemComponent(@Nonnull Ref<EntityStore> targetRef, @Nonnull org.joml.Vector3d startPosition)
      Default Constructor for a PickupItemComponent instance.
      Parameters:
      targetRef - The entity reference of the entity picking up this item.
      startPosition - The start position of the pickup item entity.
    • PickupItemComponent

      public PickupItemComponent(@Nonnull Ref<EntityStore> targetRef, @Nonnull org.joml.Vector3d startPosition, float lifeTime)
      Default Constructor for a PickupItemComponent instance.
      Parameters:
      targetRef - The entity reference of the entity picking up this item.
      startPosition - The start position of the pickup item entity.
      lifeTime - The maximum lifetime to travel to the target location.
    • PickupItemComponent

      public PickupItemComponent(@Nonnull PickupItemComponent pickupItemComponent)
      Constructor for a PickupItemComponent instance.
      Parameters:
      pickupItemComponent - The PickupItemComponent instance to clone from.
  • Method Details

    • getComponentType

      @Nonnull public static ComponentType<EntityStore, PickupItemComponent> getComponentType()
      Returns:
      the PickupItemComponent type.
    • hasFinished

      public boolean hasFinished()
      Returns:
      true if finished, false otherwise.
    • setFinished

      public void setFinished(boolean finished)
      Sets whether this pickup item entity has finished.
      Parameters:
      finished - true if finished, false otherwise.
    • decreaseLifetime

      public void decreaseLifetime(float amount)
      Called to decrease the lifetime of this pickup item entity.
      Parameters:
      amount - The amount of time to decrease the lifetime by.
    • getLifeTime

      public float getLifeTime()
      Returns:
      the lifetime, in seconds, of this pickup item entity.
    • getOriginalLifeTime

      public float getOriginalLifeTime()
      Returns:
      the original lifetime, in seconds, of this pickup item entity.
    • setInitialLifeTime

      public void setInitialLifeTime(float lifeTimeS)
      Meant to be called right after that component has been created.
      Parameters:
      lifeTimeS - The lifetime, in seconds, of this pickup item entity.
    • getStartPosition

      @Nonnull public org.joml.Vector3d getStartPosition()
      Returns:
      the start position of this pickup item entity.
    • getTargetRef

      @Nullable public Ref<EntityStore> getTargetRef()
      Returns:
      the entity reference of the entity picking up this item.
    • clone

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