Holographic text & gradient lines · Multi-line text boards and multi-colour trail lines¶
This page has two parts: holo* for visible multi-line text boards (colour codes, {variables}, content rotation, following a player), and gradient* for drawing a trail line that fades from one end to the other (or cycles through a rainbow). Both exist on the client only: they occupy no server-side entity and write nothing to the save.
The model for holographic text is "multiple lines = one whole block": every line shares one colour, scale, background box, through-walls switch and orientation; to give one line another colour, write a § colour code in that line's text. Line numbers start at 0 and follow the order the lines were added in.
Quick start¶
const holoCreate = ll.import("HologramLib", "holoCreate");
const holoAddLine = ll.import("HologramLib", "holoAddLine");
const holoSetScale = ll.import("HologramLib", "holoSetScale");
const holoDraw = ll.import("HologramLib", "holoDraw");
const holo = holoCreate(100.5, 66, 100.5);
holoAddLine(holo, "§eWelcome to spawn"); // the § colour code only affects this line
holoAddLine(holo, "Online: {online}"); // {online} is replaced with the current online count
holoSetScale(holo, 1.5); // scale up the whole block
holoDraw(holo); // show it to every online player
The smallest useful gradient line:
const gradientCreate = ll.import("HologramLib", "gradientCreate");
const gradientDraw = ll.import("HologramLib", "gradientDraw");
const trail = gradientCreate(100, 65, 100, 130, 70, 130, 20); // built from 20 segments
gradientDraw(trail); // red → blue by default
Holographic text: creation¶
Create a holographic text at a coordinate¶
holoCreate(x, y, z)
- Parameters:
x:Float
the world coordinate X the holographic text sits aty:Float
the world coordinate Y the holographic text sits atz:Float
the world coordinate Z the holographic text sits at- Return value: the holographic-text id (incrementing from
1);<= 0means creation failed - Return type:
Integer -
Example:
Delete a holographic text and sync the client¶
holoDestroy(id)
- Parameters:
id:Integer
the holographic-text id- Return value:
truewhen the deletion succeeds;falsewheniddoes not exist - Return type:
Boolean -
Example:
Delete every current holographic text¶
holoDestroyAll()
- Return value: no return value
- Return type:
Null -
Example:
Holographic text: lines and content¶
Append a line of text at the end¶
holoAddLine(id, text)
- Parameters:
id:Integer
the holographic-text idtext:String
the text of this line; it may use§colour codes and{variables}- Return value:
truewhen the append succeeds;falsewheniddoes not exist - Return type:
Boolean -
Example:
const create = ll.import("HologramLib", "holoCreate"); const addLine = ll.import("HologramLib", "holoAddLine"); const draw = ll.import("HologramLib", "holoDraw"); const holo = create(100.5, 66, 100.5); addLine(holo, "§eFirst line"); addLine(holo, "§7Second line"); draw(holo); // adding a line while it is on screen refreshes it immediately, no need to draw again
Replace the text of one line¶
holoSetLineText(id, lineIndex, text)
- Parameters:
id:Integer
the holographic-text idlineIndex:Integer
the line number, starting at0text:String
the new text- Return value:
trueon success;falsewheniddoes not exist or the line number is out of range - Return type:
Boolean -
Example:
Give one line a pool of rotating contents¶
holoSetLinePool(id, lineIndex, content, intervalMs)
- Parameters:
id:Integer
the holographic-text idlineIndex:Integer
the line number, starting at0content:Array<String>
the array of candidate contents; passing an empty array = clear the content pool, and this line goes back to the text set byholoSetLineTextintervalMs:Integer
the rotation interval, in milliseconds. With only 1 entry in the pool, or withintervalMs <= 0, there is no rotation and entry 0 is shown permanently- Return value:
truewhen the setting succeeds;falsewheniddoes not exist or the line number is out of range - Return type:
Boolean -
Example:
Set whether one line parses variables¶
holoSetLineParseVariables(id, lineIndex, enabled)
- Parameters:
id:Integer
the holographic-text idlineIndex:Integer
the line number, starting at0enabled:Booleantrue= parse variables (the default);false= the{}on this line is shown literally, as it is written- Return value:
truewhen the setting succeeds;falsewheniddoes not exist or the line number is out of range - Return type:
Boolean -
Example:
Delete one line and move the lines after it up¶
holoRemoveLine(id, lineIndex)
- Parameters:
id:Integer
the holographic-text idlineIndex:Integer
the line number to delete, starting at0- Return value:
truewhen the deletion succeeds;falsewheniddoes not exist or the line number is out of range - Return type:
Boolean -
Example:
Clear every line and take the block off screen¶
holoClearLines(id)
- Parameters:
id:Integer
the holographic-text id- Return value:
trueon success;falsewheniddoes not exist - Return type:
Boolean -
Example:
Query the current line count¶
holoGetLineCount(id)
- Parameters:
id:Integer
the holographic-text id- Return value: the line count; returns
0wheniddoes not exist - Return type:
Integer -
Example:
Holographic text: whole-block style¶
Set the colour of the whole text block¶
holoSetColor(id, r, g, b, a)
- Parameters:
id:Integer
the holographic-text idr:Float
the red component,0.0 ~ 1.0g:Float
the green component,0.0 ~ 1.0b:Float
the blue component,0.0 ~ 1.0a:Float
the alpha component,0.0 ~ 1.0- Return value:
trueon success;falsewheniddoes not exist - Return type:
Boolean -
Example:
Set the scale of the whole text block¶
holoSetScale(id, scale)
- Parameters:
id:Integer
the holographic-text idscale:Float
the scale factor, which must be greater than 0 (1= the original size)- Return value:
trueon success; returnsfalsewheniddoes not exist orscale <= 0 - Return type:
Boolean -
Example:
Set the colour of the board behind the text¶
holoSetBackgroundColor(id, r, g, b, a)
- Parameters:
id:Integer
the holographic-text idr:Float
the red component of the board colour,0.0 ~ 1.0g:Float
the green component of the board colour,0.0 ~ 1.0b:Float
the blue component of the board colour,0.0 ~ 1.0a:Float
the alpha component of the board colour,0.0 ~ 1.0; leave it unset for the client's default colour- Return value:
trueon success;falsewheniddoes not exist - Return type:
Boolean -
Example:
Restore the board to the client's default colour¶
holoClearBackgroundColor(id)
- Parameters:
id:Integer
the holographic-text id- Return value:
trueon success;falsewheniddoes not exist - Return type:
Boolean -
Example:
Decide whether the holographic text is occluded by blocks¶
holoSetDepthTest(id, enabled)
- Parameters:
id:Integer
the holographic-text idenabled:Booleantrue= occluded by blocks / entities;false= always rendered (visible through walls), which is also the default behaviour- Return value:
trueon success;falsewheniddoes not exist - Return type:
Boolean -
Example:
Fix the whole text block to a three-axis orientation¶
holoSetRotation(id, pitch, yaw, roll)
- Parameters:
id:Integer
the holographic-text idpitch:Float
one of the rotation angles about the three axes, in degreesyaw:Float
one of the rotation angles about the three axes, in degreesroll:Float
one of the rotation angles about the three axes, in degrees- Return value:
trueon success;falsewheniddoes not exist. Once set, it no longer faces the camera - Return type:
Boolean -
Example:
Clear the rotation so the whole text block faces the camera¶
holoClearRotation(id)
- Parameters:
id:Integer
the holographic-text id- Return value:
trueon success;falsewheniddoes not exist - Return type:
Boolean -
Example:
Holographic text: position and following¶
Move the holographic text to a new coordinate¶
holoSetLocation(id, x, y, z)
- Parameters:
id:Integer
the holographic-text idx:Float
the new world coordinate Xy:Float
the new world coordinate Yz:Float
the new world coordinate Z- Return value:
trueon success;falsewheniddoes not exist - Return type:
Boolean -
Example:
Migrate the holographic text to another dimension¶
holoSetDimension(id, dimId)
- Parameters:
id:Integer
the holographic-text iddimId:Integer
the target dimension number —0Overworld,1Nether,2End- Return value:
trueon success;falsewheniddoes not exist - Return type:
Boolean -
Example:
Make a holographic text follow a player with a Y offset¶
holoSetFollowPlayer(id, playerName, offsetY)
- Parameters:
id:Integer
the holographic-text idplayerName:String
the name of the player to follow (LSE'srealName)offsetY:Float
the height offset added on top of the player's foot Y- Return value:
trueon success;falsewheniddoes not exist - Return type:
Boolean -
Example:
const setFollowPlayer = ll.import("HologramLib", "holoSetFollowPlayer"); const refresh = ll.import("HologramLib", "holoRefresh"); setFollowPlayer(holo, "Steve", 2.5); // following does not advance on its own: to keep the text above the player's head, refresh it on a timer yourself setInterval(() => refresh(holo), 100);
Stop following and stay at the current position¶
holoClearFollowPlayer(id)
- Parameters:
id:Integer
the holographic-text id- Return value:
trueon success;falsewheniddoes not exist - Return type:
Boolean -
Example:
Holographic text: display and refresh¶
Show a holographic text to every online player (any dimension)¶
holoDraw(id)
- Parameters:
id:Integer
the holographic-text id- Return value:
trueonce it has been shown;falsewheniddoes not exist (or there is no content to show) - Return type:
Boolean -
Example:
Show a holographic text to one dimension only¶
holoDrawToDimension(id, dimId)
- Parameters:
id:Integer
the holographic-text iddimId:Integer
the dimension number —0Overworld,1Nether,2End- Return value:
trueonce it has been shown;falsewheniddoes not exist (or there is no content to show) - Return type:
Boolean -
Example:
Show a holographic text to one player only¶
holoDrawToPlayer(id, playerName)
- Parameters:
id:Integer
the holographic-text idplayerName:String
the player name; nothing is displayed while the player is offline- Return value:
trueonce it has been shown;falsewheniddoes not exist, the player is offline, or there is no content to show - Return type:
Boolean -
Example:
Hide a holographic text but keep its content¶
holoRemove(id)
- Parameters:
id:Integer
the holographic-text id- Return value:
trueon success;falsewheniddoes not exist - Return type:
Boolean -
Example:
Resolve the variables and follow coordinates again in place¶
holoRefresh(id)
- Parameters:
id:Integer
the holographic-text id- Return value:
truewhen the refresh succeeds;falsewheniddoes not exist, or this holographic text has not been shown yet - Return type:
Boolean -
Example:
Gradient lines: creation¶
Create a multi-segment gradient line (red → blue by default)¶
gradientCreate(x1, y1, z1, x2, y2, z2, segments)
- Parameters:
x1:Float
the world coordinate X of the start pointy1:Float
the world coordinate Y of the start pointz1:Float
the world coordinate Z of the start pointx2:Float
the world coordinate X of the end pointy2:Float
the world coordinate Y of the end pointz2:Float
the world coordinate Z of the end pointsegments:Integer
the number of segments; more segments give a smoother transition and more line segments; below2it is treated as2, above100as100, and 10 ~ 50 is suggested- Return value: the gradient-line id (incrementing from
1);<= 0means creation failed - Return type:
Integer -
Example:
Gradient lines: colour¶
Set the start colour and the end colour¶
gradientSetGradient(id, r1, g1, b1, r2, g2, b2)
- Parameters:
id:Integer
the gradient-line idr1:Float
the red component of the start colour,0.0 ~ 1.0g1:Float
the green component of the start colour,0.0 ~ 1.0b1:Float
the blue component of the start colour,0.0 ~ 1.0r2:Float
the red component of the end colour,0.0 ~ 1.0g2:Float
the green component of the end colour,0.0 ~ 1.0b2:Float
the blue component of the end colour,0.0 ~ 1.0- Return value:
trueon success;falsewheniddoes not exist. The middle blends automatically, and the line leaves rainbow mode - Return type:
Boolean -
Example:
Make a gradient line cycle through rainbow colours¶
gradientSetRainbow(id, speed)
- Parameters:
id:Integer
the gradient-line idspeed:Float
the cycle speed; at1.0the hue advances 60 degrees per second, and the larger it is the faster it goes- Return value:
trueon success;falsewheniddoes not exist - Return type:
Boolean -
Example:
Set the whole line to a single colour¶
gradientSetColor(id, r, g, b, a)
- Parameters:
id:Integer
the gradient-line idr:Float
the red component,0.0 ~ 1.0g:Float
the green component,0.0 ~ 1.0b:Float
the blue component,0.0 ~ 1.0a:Float
the alpha component,0.0 ~ 1.0- Return value:
trueon success;falsewheniddoes not exist. This turns off both gradient and rainbow mode - Return type:
Boolean -
Example:
Change the two endpoints of a gradient line¶
gradientSetEndpoints(id, x1, y1, z1, x2, y2, z2)
- Parameters:
id:Integer
the gradient-line idx1:Float
the new world coordinate X of the start pointy1:Float
the new world coordinate Y of the start pointz1:Float
the new world coordinate Z of the start pointx2:Float
the new world coordinate X of the end pointy2:Float
the new world coordinate Y of the end pointz2:Float
the new world coordinate Z of the end point- Return value:
trueon success;falsewheniddoes not exist - Return type:
Boolean -
Example:
Gradient lines: display and destruction¶
Show a gradient line to every online player (any dimension)¶
gradientDraw(id)
- Parameters:
id:Integer
the gradient-line id- Return value:
trueonce it has been shown;falsewheniddoes not exist - Return type:
Boolean -
Example:
Show a gradient line to one dimension only¶
gradientDrawToDimension(id, dimId)
- Parameters:
id:Integer
the gradient-line iddimId:Integer
the dimension number —0Overworld,1Nether,2End- Return value:
trueonce it has been shown;falsewheniddoes not exist - Return type:
Boolean -
Example:
Hide a gradient line but keep its data¶
gradientRemove(id)
- Parameters:
id:Integer
the gradient-line id- Return value:
trueon success;falsewheniddoes not exist - Return type:
Boolean -
Example:
Delete a gradient line and all its segments¶
gradientDestroy(id)
- Parameters:
id:Integer
the gradient-line id- Return value:
truewhen the deletion succeeds;falsewheniddoes not exist - Return type:
Boolean -
Example:
Delete every current gradient line¶
gradientDestroyAll()
- Return value: no return value
- Return type:
Null -
Example:
Gradient lines: animation¶
Advance the rainbow animation time (the script calls it by tick)¶
gradientTick(deltaTime)
- Parameters:
deltaTime:Float
the time that passed in this beat, in seconds; one beat at 20 tps is0.05. Only rainbow-mode lines are advanced; ordinary gradient lines and single-colour lines are unaffected- Return value: no return value
- Return type:
Null -
Example:
Things to know¶
- Pass every parameter the signature asks for. There are no default values on the LSE side: give too few or too many and the call hands you the failure value straight away (
Booleangivesfalse,Integergives0,Stringgives an empty string), with no exception to warn you. - Per-line style does not exist: multiple lines share one colour / scale / background box / through-walls switch / orientation. To change the colour of one line, write a
§colour code in that line's text (for example"§cred §agreen"); to scale the whole block up, useholoSetScale. Since26.40.8the 8 per-line functionsholoSetLineScale,holoSetLineColor,holoSetLineGradient,holoSetLineRainbow,holoSetLineScroll,holoSetVerticalAnimation,holoSetLineSpacingandholoTickhave been removed, andll.importgetsnullfor them. - Variables:
{player},{online},{time},{tps},{dimension},{x},{y}and{z}in the text are replaced (with MeowPAPI installed, the external placeholders it provides are supported as well). When the text contains variables and the display target is not a single player, the library keeps one copy of the text per viewer: the shape count becomes the number of viewers, which suits small-audience cases such as a party-leader view or quest tracking — do not use it for high-frequency refreshes broadcast to the whole server. - Dynamic lines rotate by time: the content pool picks its entry by "current time ÷ interval" modulo, so several holographic texts using the same pool and the same interval stay in phase naturally; changing the pool's content is reflected immediately, and the refresh itself is throttled by the library to 0.5 seconds, so nothing is re-sent while the content has not changed.
- Following does not advance on its own:
holoSetFollowPlayertakes the player's coordinate once, at the moment of the call, andholoDrawandholoRefresheach take it once as well. The text does not move along as the player walks, so you have to callholoRefreshon a timer yourself (for example once every 2 ticks); after the player logs off the text stays at the last position it resolved. - Switching to a single-player target changes how variables behave: after
holoDrawToPlayeronly that one player receives the text, and the variables are resolved for that player alone. - Colour changes on a gradient line wait for the next resend:
gradientSetGradient,gradientSetColor,gradientSetRainbowandgradientTickonly update the segment colour values, and the client does not see the new colour until anothergradientDrawor the library's background resend every 15 seconds. - Frequent
gradientDrawflickers: it destroys the old segments first and then builds new ones;gradientSetEndpointsalso rebuilds the segments when the line is already on screen. - You do not have to resend when a player joins: holographic texts and gradient lines live in client memory only, and the library resends them automatically after a player joins (once 1 second and once 5 seconds after joining, then a background resend every 15 seconds).
- Calling from the main thread is recommended (inside a server tick or an event callback).
- When the library is not installed or not loaded,
ll.importreturnsnulland calling it directly throws; you can check for null first, or callll.hasExported("HologramLib", "holoDraw")first as a capability check.