Package com.maximde.hologramlib.hologram
Class Hologram<T extends Hologram<T>>
java.lang.Object
com.maximde.hologramlib.hologram.Hologram<T>
- Direct Known Subclasses:
BlockHologram
,ItemHologram
,TextHologram
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Integer
protected org.bukkit.entity.Display.Billboard
protected int
protected boolean
protected me.tofaa.entitylib.wrapper.WrapperEntity
protected int
protected final com.github.retrooper.packetevents.protocol.entity.type.EntityType
protected final String
protected int
protected boolean
protected com.github.retrooper.packetevents.util.Quaternion4f
protected org.bukkit.Location
protected double
protected final 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 playersprotected com.github.retrooper.packetevents.util.Quaternion4f
protected org.joml.Vector3f
protected TaskHandle
protected int
protected org.joml.Vector3f
protected long
protected double
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
protected
Hologram
(String id, RenderMode renderMode, com.github.retrooper.packetevents.protocol.entity.type.EntityType entityType) -
Method Summary
Modifier and TypeMethodDescriptionaddAllViewers
(List<org.bukkit.entity.Player> viewerList) static int[]
addElement
(int[] array, int element) Adds an element to the array if it is not already present.void
addPassenger
(int... entityIDs) Attaches entities to this hologram.addViewer
(org.bukkit.entity.Player player) protected abstract me.tofaa.entitylib.meta.EntityMeta
void
attach
(int entityId) Attaches this hologram to another entity, making it ride the target entity.void
attachToPlayer
(org.bukkit.entity.Player player) Attaches this hologram to a player.protected abstract T
copy()
protected abstract T
void
detach()
Detaches the hologram from its attached entity, if any.int
Deprecated, for removal: This API element is subject to removal in a future version.getScale()
List<org.bukkit.entity.Player>
void
kill()
Deprecated.static int[]
removeElement
(int[] array, int element) Removes all occurrences of the specified element from the given array.removeViewer
(org.bukkit.entity.Player player) protected T
self()
protected void
sendPacket
(com.github.retrooper.packetevents.wrapper.PacketWrapper<?> packet, List<org.bukkit.entity.Player> players) setBillboard
(org.bukkit.entity.Display.Billboard billboard) setBrightness
(int brightness) setBrightness
(int blockLight, int skyLight) setBrightness
(org.bukkit.entity.Display.Brightness brightness) setInterpolationDurationRotation
(int teleportDuration) Deprecated, for removal: This API element is subject to removal in a future version.setInterpolationDurationTransformation
(int interpolationDurationTransformation) setIsInvisible
(boolean isInvisible) Sets the visibility state of the hologram.setLeftRotation
(float x, float y, float z, float w) setMaxPlayerRenderDistanceSquared
(double maxPlayerRenderDistanceSquared) setRightRotation
(float x, float y, float z, float w) setScale
(float x, float y, float z) setTeleportDuration
(int teleportDuration) setTransformation
(org.bukkit.util.Transformation transformation) setTransformationMatrix
(org.joml.Matrix4f matrix4f) setTranslation
(float x, float y, float z) setTranslation
(Vector3F translation) setUpdateTaskPeriod
(long updateTaskPeriod) Period in ticks between updates of the hologram's viewer list.setViewRange
(double viewRange) teleport
(org.bukkit.Location newLocation) protected com.github.retrooper.packetevents.util.Vector3f
toVector3f
(org.joml.Vector3f vector) update()
Updates the set properties for the entity (shows them to the players).protected void
validateId
(String id)
-
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
-
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
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
-
entity
protected me.tofaa.entitylib.wrapper.WrapperEntity entity -
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
-
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
-
toVector3f
protected com.github.retrooper.packetevents.util.Vector3f toVector3f(org.joml.Vector3f vector) -
kill
Deprecated.THIS METHOD WILL BE MADE 'private' SOON! Use HologramManager#remove(Hologram) instead! -
teleport
-
applyMeta
protected abstract me.tofaa.entitylib.meta.EntityMeta applyMeta() -
getTranslation
-
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
-
setUpdateTaskPeriod
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
-
setBillboard
-
getInterpolationDurationRotation
Deprecated, for removal: This API element is subject to removal in a future version. -
setInterpolationDurationRotation
Deprecated, for removal: This API element is subject to removal in a future version. -
setTeleportDuration
-
setInterpolationDurationTransformation
-
setViewRange
-
setLeftRotation
-
setRightRotation
-
setTranslation
-
setTranslation
-
setTransformation
-
setTransformationMatrix
-
setBrightness
-
setBrightness
-
setBrightness
-
addViewer
-
removeViewer
-
getViewerUUIDs
-
getViewers
-
addAllViewers
-
removeAllViewers
-
setScale
-
setScale
-
setIsInvisible
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
-
copy
-