Class Hologram<T extends Hologram<T>>

java.lang.Object
com.maximde.hologramlib.hologram.Hologram<T>
Direct Known Subclasses:
BlockHologram, ItemHologram, TextHologram

public abstract class Hologram<T extends Hologram<T>> extends Object
  • Field Details

    • location

      protected org.bukkit.Location location
    • dead

      protected boolean dead
    • updateTaskPeriod

      protected long updateTaskPeriod
    • maxPlayerRenderDistanceSquared

      protected double maxPlayerRenderDistanceSquared
    • billboard

      protected org.bukkit.entity.Display.Billboard billboard
    • teleportDuration

      protected int teleportDuration
    • interpolationDurationTransformation

      protected int interpolationDurationTransformation
    • viewRange

      protected double viewRange
    • brightness

      protected int brightness
    • isInvisible

      protected boolean isInvisible
    • id

      protected final String id
    • entityID

      protected int entityID
    • scale

      protected org.joml.Vector3f scale
    • translation

      protected org.joml.Vector3f translation
    • rightRotation

      protected com.github.retrooper.packetevents.util.Quaternion4f rightRotation
    • leftRotation

      protected com.github.retrooper.packetevents.util.Quaternion4f leftRotation
    • renderMode

      protected final RenderMode renderMode
      The render mode determines which players can see the hologram: - NEARBY: Only players within viewing distance - ALL: All players on the server - VIEWER_LIST: Only specific players added as viewers - NONE: Hologram is not visible to any players
    • entityType

      protected final com.github.retrooper.packetevents.protocol.entity.type.EntityType entityType
    • task

      protected TaskHandle task
    • entity

      protected me.tofaa.entitylib.wrapper.WrapperEntity entity
    • attachedEntityId

      @Nullable protected Integer attachedEntityId
  • Constructor Details

    • Hologram

      protected Hologram(String id, com.github.retrooper.packetevents.protocol.entity.type.EntityType entityType)
    • Hologram

      protected Hologram(String id, RenderMode renderMode, com.github.retrooper.packetevents.protocol.entity.type.EntityType entityType)
  • Method Details

    • self

      protected T self()
    • update

      public T update()
      Updates the set properties for the entity (shows them to the players). Should be called after making any changes to the hologram object.
    • validateId

      protected void validateId(String id)
    • toVector3f

      protected com.github.retrooper.packetevents.util.Vector3f toVector3f(org.joml.Vector3f vector)
    • kill

      @Deprecated public void kill()
      Deprecated.
      THIS METHOD WILL BE MADE 'private' SOON! Use HologramManager#remove(Hologram) instead!
    • teleport

      public T teleport(org.bukkit.Location newLocation)
    • applyMeta

      protected abstract me.tofaa.entitylib.meta.EntityMeta applyMeta()
    • getTranslation

      public Vector3F getTranslation()
    • getScale

      public Vector3F getScale()
    • sendPacket

      protected void sendPacket(com.github.retrooper.packetevents.wrapper.PacketWrapper<?> packet, List<org.bukkit.entity.Player> players)
    • attachToPlayer

      public void attachToPlayer(org.bukkit.entity.Player player)
      Attaches this hologram to a player.
      Parameters:
      player - The player to attach the hologram to
    • attach

      public void attach(int entityId)
      Attaches this hologram to another entity, making it ride the target entity. Warning: Keep in mind that the hologram's location is not automatically updated when it is attached to another entity, so if the entity moves too far away from the hologram's location, the hologram may be unloaded. To work around this, you will need to teleport the hologram to the entity's location when the entity is moved far away from the hologram's original location.
      Parameters:
      entityId - The entity id to attach the hologram to
    • detach

      public void detach()
      Detaches the hologram from its attached entity, if any.
    • addElement

      public static int[] addElement(int[] array, int element)
      Adds an element to the array if it is not already present.
      Parameters:
      array - The input array to which the element may be added.
      element - The element to be added to the array.
      Returns:
      A new array containing the original elements plus the new element if it was not already included.
    • removeElement

      public static int[] removeElement(int[] array, int element)
      Removes all occurrences of the specified element from the given array.
      Parameters:
      array - The input array from which the element will be removed.
      element - The element to be removed from the array.
      Returns:
      A new array with all occurrences of the specified element removed.
    • addPassenger

      public void addPassenger(int... entityIDs)
      Attaches entities to this hologram.
      Parameters:
      entityIDs - The passengers
    • getPassengers

      public Set<Integer> getPassengers()
    • setUpdateTaskPeriod

      public T setUpdateTaskPeriod(long updateTaskPeriod)
      Period in ticks between updates of the hologram's viewer list. Lower values mean more frequent updates but higher server load. Default is 60 ticks (3 seconds).
    • setMaxPlayerRenderDistanceSquared

      public T setMaxPlayerRenderDistanceSquared(double maxPlayerRenderDistanceSquared)
    • setBillboard

      public T setBillboard(org.bukkit.entity.Display.Billboard billboard)
    • getInterpolationDurationRotation

      @Deprecated(forRemoval=true) public int getInterpolationDurationRotation()
      Deprecated, for removal: This API element is subject to removal in a future version.
    • setInterpolationDurationRotation

      @Deprecated(forRemoval=true) public T setInterpolationDurationRotation(int teleportDuration)
      Deprecated, for removal: This API element is subject to removal in a future version.
    • setTeleportDuration

      public T setTeleportDuration(int teleportDuration)
    • setInterpolationDurationTransformation

      public T setInterpolationDurationTransformation(int interpolationDurationTransformation)
    • setViewRange

      public T setViewRange(double viewRange)
    • setLeftRotation

      public T setLeftRotation(float x, float y, float z, float w)
    • setRightRotation

      public T setRightRotation(float x, float y, float z, float w)
    • setTranslation

      public T setTranslation(float x, float y, float z)
    • setTranslation

      public T setTranslation(Vector3F translation)
    • setTransformation

      public T setTransformation(org.bukkit.util.Transformation transformation)
    • setTransformationMatrix

      public T setTransformationMatrix(org.joml.Matrix4f matrix4f)
    • setBrightness

      public T setBrightness(int brightness)
    • setBrightness

      public T setBrightness(org.bukkit.entity.Display.Brightness brightness)
    • setBrightness

      public T setBrightness(int blockLight, int skyLight)
    • addViewer

      public T addViewer(org.bukkit.entity.Player player)
    • removeViewer

      public T removeViewer(org.bukkit.entity.Player player)
    • getViewerUUIDs

      public Set<UUID> getViewerUUIDs()
    • getViewers

      public List<org.bukkit.entity.Player> getViewers()
    • addAllViewers

      public T addAllViewers(List<org.bukkit.entity.Player> viewerList)
    • removeAllViewers

      public T removeAllViewers()
    • setScale

      public T setScale(float x, float y, float z)
    • setScale

      public T setScale(Vector3F scale)
    • setIsInvisible

      public T setIsInvisible(boolean isInvisible)
      Sets the visibility state of the hologram.
      Parameters:
      isInvisible - A boolean indicating whether the hologram's blue line when using F3+B is invisible (true) or visible (false).
      Returns:
      The current instance of the hologram for method chaining.
    • copy

      protected abstract T copy()
    • copy

      protected abstract T copy(String id)