Item display · one line of item name or a 3D item placed into the world¶
itemDetail* and itemDisplay* both make the client see a single item: the server gains no entity, and nothing is written to the save.
itemDetailShowshows one line of auto-translated item name at a coordinate (for example "Diamond x64"). Behind it is a holographic text, and the id it returns can still be refined withholo*.itemDisplay*puts a 3D item / block model at a coordinate: you can swap the item, rotate it on three axes, scale it and make it follow a player; once you give it a hit volume it can be clicked too (clicks are fetched back by pollingghost*).
Both domains are "create + show" in one step, so there is no separate show call to make. Reconnecting players are re-sent automatically by the library; after a script or server restart the displays are gone and you have to create them again.
Quick start¶
const itemDetailShow = ll.import("HologramLib", "itemDetailShow");
const itemDisplayCreate = ll.import("HologramLib", "itemDisplayCreate");
// 1. One line of text: show "Diamond x64" in the Overworld at (100.5, 65, -200.5)
const tip = itemDetailShow(0, 100.5, 65, -200.5, "minecraft:diamond", 0, 64, "");
// 2. One 3D model: a diamond floating above the same coordinate
const box = itemDisplayCreate(100.5, 66, -200.5, 0, "minecraft:diamond", 0);
tip is a holographic-text id as well (pass it to the holo* family), and box is an item-display id (pass it to every itemDisplay* function below).
itemDetail* — one line of auto-translated item name¶
Show one line of auto-translated item name¶
itemDetailShow(dimId, x, y, z, itemId, aux, count, customText)
- Parameters:
dimId:Integer
the dimension to put it in —0Overworld /1Nether /2Endx:Float
world coordinate Xy:Float
world coordinate Yz:Float
world coordinate ZitemId:String
the item identifier, for exampleminecraft:diamondaux:Integer
the item aux value (data value); use0when there is nonecount:Integer
the count; only a count greater than1adds thexNsuffixcustomText:String
custom text; an empty string = use the auto-translated item name, a non-empty string replaces it completely (supports§colour codes and{variables})- Return value: the holographic-text id (keep refining it with
holo*); returns-1on failure (creation failed, or that dimension cannot be drawn) - Return type:
Integer -
Example:
Delete the line of item name¶
itemDetailHide(id)
- Parameters:
id:Integer
the id returned byitemDetailShow- Return value:
true= deleted; returnsfalsewhen the id does not exist - Return type:
Boolean -
Example:
itemDisplay creation¶
Create a floating item model¶
itemDisplayCreate(x, y, z, dim, itemId, aux)
- Parameters:
x:Float
world coordinate Xy:Float
world coordinate Yz:Float
world coordinate Zdim:Integer
the dimension id,0/1/2itemId:String
the item identifier, for exampleminecraft:diamondaux:Integer
the item aux value (data value); use0when there is none- Return value: the item-display id; returns a negative number on failure
- Return type:
Integer -
Example:
Create with translation, rotation and scale preset¶
itemDisplayCreateAdvanced(x, y, z, dim, itemId, aux, offX, offY, offZ, rotX, rotY, rotZ, scale)
- Parameters:
x:Float
world coordinate X, the same asitemDisplayCreatey:Float
world coordinate Y, the same asitemDisplayCreatez:Float
world coordinate Z, the same asitemDisplayCreatedim:Integer
the dimension id, the same asitemDisplayCreateitemId:String
the item identifier, the same asitemDisplayCreateaux:Integer
the item aux value (data value), the same asitemDisplayCreateoffX:String
translation in model units along X; write a constant number or a Molang expression stringoffY:String
translation in model units along Y; write a constant number or a Molang expression stringoffZ:String
translation in model units along Z; write a constant number or a Molang expression stringrotX:String
rotation around X (degrees); write a constant number or a Molang expression stringrotY:String
rotation around Y (degrees); write a constant number or a Molang expression stringrotZ:String
rotation around Z (degrees); write a constant number or a Molang expression stringscale:String
scaling; write a constant number or a Molang expression string- Return value: the item-display id; returns a negative number on failure
- Return type:
Integer -
Example:
const advanced = ll.import("HologramLib", "itemDisplayCreateAdvanced"); // A diamond that spins forever: rotY is driven by Molang, so the server needs no per-tick packet const spin = advanced(0.5, 66, 0.5, 0, "minecraft:diamond", 0, "0", "-4", "0", "180", "math.sin(query.life_time*90)*360", "180", "0.375");
Create with mode, view distance and visible players preset¶
itemDisplayCreateSeamless(x, y, z, dim, itemId, aux, offX, offY, offZ, rotX, rotY, rotZ, scale, mode, viewDistance, visiblePlayer)
- Parameters:
- The first 13 parameters: the same as
itemDisplayCreateAdvanced. mode:Integer-1= use the default (decided automatically),1= item flat rendering,2= block solid renderingviewDistance:Float
the visible distance (blocks);-1= use the default,0= unlimited distancevisiblePlayer:String
show it to this one player only; an empty string = visible to everyone- Return value: the item-display id; returns a negative number on failure
- Return type:
Integer -
Example:
Create with a random id¶
itemDisplayCreateRandom(x, y, z, dim, itemId, aux)
- Parameters: the same as
itemDisplayCreate. - Return value: the item-display id from the random range (starting at
0x10000000), which never collides with an incrementing id; returns a negative number on failure - Return type:
Integer -
Example:
Create under a chosen id to restore a display¶
itemDisplayCreateWithId(x, y, z, dim, itemId, aux, desiredId)
- Parameters:
- The first 6 parameters: the same as
itemDisplayCreate. desiredId:Integer
the id you want; it must be greater than0and must not be taken right now- Return value: on success it is exactly
desiredId;desiredId <= 0, or an id that is already taken, returns-2 - Return type:
Integer -
Example:
itemDisplay properties¶
Swap the item the display shows¶
itemDisplaySetItem(id, itemId, aux)
- Parameters:
id:Integer
the item-display iditemId:String
the new item identifieraux:Integer
the new item aux value (data value)- Return value:
true= changed; returnsfalsewhen the id does not exist. Swapping the item clears any extra data set earlier - Return type:
Boolean -
Example:
Swap the item together with extra data¶
itemDisplaySetItemWithNbt(id, itemId, aux, nbt)
- Parameters:
id:Integer
the item-display iditemId:String
the new item identifieraux:Integer
the new item aux value (data value)nbt:String
an SNBT string; an empty string = clear the extra data. A parse failure is treated as "no extra data" and logged- Return value:
true= changed; returnsfalsewhen the id does not exist - Return type:
Boolean -
Example:
Toggle the item's enchantment glint¶
itemDisplaySetGlint(id, on)
- Parameters:
id:Integer
the item-display idon:Booleantrue= add the glint,false= remove it; setting the same value again does not trigger a resend- Return value:
true= set; returnsfalsewhen the id does not exist - Return type:
Boolean -
Example:
Move the display to new coordinates¶
itemDisplaySetPosition(id, x, y, z, dim)
- Parameters:
id:Integer
the item-display idx:Float
the new world coordinate Xy:Float
the new world coordinate Yz:Float
the new world coordinate Zdim:Integer
the target dimension; a negative number = change the coordinates only and keep the current dimension- Return value:
true= changed; returnsfalsewhen the id does not exist. Setting the position of a display that is following a player by hand releases the follow - Return type:
Boolean -
Example:
Adjust the item's translation inside the model¶
itemDisplaySetOffset(id, ox, oy, oz)
- Parameters:
id:Integer
the item-display idox:String
a constant number or a Molang expression stringoy:String
a constant number or a Molang expression string; the default Y in item mode is"-4"oz:String
a constant number or a Molang expression string- Return value:
true= changed; returnsfalsewhen the id does not exist - Return type:
Boolean -
Example:
Adjust the render-pixel-level base offset¶
itemDisplaySetBaseOffset(id, ox, oy, oz)
- Parameters:
id:Integer
the item-display idox:String
a constant number or a Molang expression string; the default is"0"oy:String
a constant number or a Molang expression string; the default is"0"oz:String
a constant number or a Molang expression string; the default is"0"- Return value:
true= changed; returnsfalsewhen the id does not exist - Return type:
Boolean -
Example:
Set the three-axis rotation¶
itemDisplaySetRotation(id, rx, ry, rz)
- Parameters:
id:Integer
the item-display idrx:String
a constant number or a Molang expression string (degrees); the item-mode defaultrotXis"180"(in item mode the library compensates the facing itself)ry:String
a constant number or a Molang expression string (degrees); the item-mode defaultrotYis"0"rz:String
a constant number or a Molang expression string (degrees); the item-mode defaultrotZis"180"- Return value:
true= changed; returnsfalsewhen the id does not exist - Return type:
Boolean -
Example:
Add a yaw rotation delta¶
itemDisplayRotateY(id, delta)
- Parameters:
id:Integer
the item-display iddelta:Float
the angle to add (degrees); positive or negative- Return value:
true= added; returnsfalsewhen the id does not exist - Return type:
Boolean -
Example:
Set the display's scale¶
itemDisplaySetScale(id, scale)
- Parameters:
id:Integer
the item-display idscale:String
a constant number or a Molang expression string; the item-mode default is"0.375", and block mode suggests"0.5"- Return value:
true= changed; returnsfalsewhen the id does not exist - Return type:
Boolean -
Example:
Scale the display up or down by a factor¶
itemDisplayScaleBy(id, factor)
- Parameters:
id:Integer
the item-display idfactor:Float
greater than1enlarges,0 < factor < 1shrinks;<= 0is refused outright- Return value:
true= changed; returnsfalsewhenfactor <= 0, when the id does not exist, or when the multiplication leaves the result no greater than0 - Return type:
Boolean -
Example:
Jump straight to the target scale¶
itemDisplayScaleTo(id, targetScale)
- Parameters:
id:Integer
the item-display idtargetScale:Float
the target scale; below0.01(or not a finite number) it is clamped to0.01- Return value: only the block render path supports it: returns
falsewhenmodeis1(item flat), andfalsewhen the id does not exist - Return type:
Boolean -
Example:
Set the block mode's second-stage transform¶
itemDisplaySetExtend(id, scale, rx, ry)
- Parameters:
id:Integer
the item-display idscale:String
a constant number or a Molang expression string; effective in block mode only, the default is"1"rx:String
a constant number or a Molang expression string; effective in block mode only, the default is"-90"ry:String
a constant number or a Molang expression string; effective in block mode only, the default is"0"- Return value:
true= changed; returnsfalsewhen the id does not exist - Return type:
Boolean -
Example:
Switch the item's render mode¶
itemDisplaySetMode(id, mode)
- Parameters:
id:Integer
the item-display idmode:Integer0= auto (the default, decided from the item itself),1= item flat rendering,2= block solid rendering- Return value:
true= set; returnsfalsewhen the id does not exist. When the value equals the current one it returnstruestraight away without resending - Return type:
Boolean -
Example:
Turn this display on or off¶
itemDisplaySetEnabled(id, enabled)
- Parameters:
id:Integer
the item-display idenabled:Booleanfalse= players cannot see it (the id stays valid, so you can turn it back on at any time),true= show it again- Return value:
true= set; returnsfalsewhen the id does not exist - Return type:
Boolean -
Example:
Set the display's visible distance¶
itemDisplaySetViewDistance(id, dist)
- Parameters:
id:Integer
the item-display iddist:Float
the distance in blocks;<= 0= unlimited distance- Return value:
true= set; returnsfalsewhen the id does not exist. The same value as the current one is not resent - Return type:
Boolean -
Example:
itemDisplay visible-player whitelist¶
Show it only to the players on the list¶
itemDisplaySetVisiblePlayers(id, playerNames)
- Parameters:
id:Integer
the item-display idplayerNames:Array<String>
an array of player names, matched by LSE'srealName; an empty array = clear the restriction and go back to visible to everyone- Return value:
true= set; returnsfalsewhen the id does not exist. The dimension and view-distance conditions still apply on top - Return type:
Boolean -
Example:
Put a single player on the whitelist¶
itemDisplaySetVisiblePlayer(id, playerName)
- Parameters:
id:Integer
the item-display idplayerName:String
the only player who can see it (realName)- Return value:
true= set; returnsfalsewhen the id does not exist - Return type:
Boolean -
Example:
Clear the whitelist and go back to visible to everyone¶
itemDisplayClearVisiblePlayers(id)
- Parameters:
id:Integer
the item-display id- Return value:
true= cleared (it counts as success even when there was no restriction to begin with); returnsfalsewhen the id does not exist - Return type:
Boolean -
Example:
itemDisplay following & clicking¶
Make the display follow a player in real time¶
itemDisplayFollow(id, playerName, offX, offY, offZ)
- Parameters:
id:Integer
the item-display idplayerName:String
the target player name (realName)offX:Float
the offset added on top of the player's coordinate XoffY:Float
the offset added on top of the player's coordinate YoffZ:Float
the offset added on top of the player's coordinate Z- Return value:
true= following started; returnsfalsewhen the id does not exist. A player logging off releases the follow automatically (the display stays where it is), and a manualitemDisplaySetPositionreleases it too - Return type:
Boolean -
Example:
Release the follow and stay where it is¶
itemDisplayUnfollow(id)
- Parameters:
id:Integer
the item-display id- Return value: returns
trueeven when there is no follow relationship (so repeating the call is safe) - Return type:
Boolean -
Example:
Create a display with item NBT / enchant glint (1.30.0 / 26.51.4)¶
itemDisplayCreateFull(x, y, z, dim, itemId, aux, offX, offY, offZ, rotX, rotY, rotZ, scale, nbt, glint)
- Params: the first 13 match
itemDisplayCreateAdvanced; plus: nbt:String
item SNBT (custom name / enchantments), empty string = noneglint:Booleantrueadds the enchant glint- Returns: item-display id; negative on failure
- Notes: same result as
itemDisplayCreateAdvanced+itemDisplaySetItemWithNbt+itemDisplaySetGlint, but without that extra post-create respawn — which made a freshly appeared display blink. -
Example:
Render an existing entity as an FMBE model for one player (1.30.0)¶
itemDisplayEmitForEntity(playerName, uniqueId, itemId, aux, offsetY, rotX, rotY, rotZ, scale, nbt, glint)
- Params:
playerName(only this player),uniqueId(an existing entity),itemId/aux/nbt/glint(what it looks like),offsetY/rotX/rotY/rotZ/scale(FMBE appearance;rotY = "0"→ use the entity's velocity direction) - Returns: render mode actually used —
1item plane,23D block;-1on failure - Notes: sends
RemoveActor + AddActor(fox) + MobEquipment + SetActorData + animationsonce with the caller's id and keeps no state; when/who/how it rests/size are the caller's decisions. -
Example:
Give the display a hitbox¶
itemDisplaySetHitbox(id, width, height)
- Parameters:
id:Integer
the item-display idwidth:Float
the width of the hit volumeheight:Float
the height of the hit volume;0for both = back to unhittable (the default behaviour)- Return value:
true= set; returnsfalsewhen the id does not exist. The event from a hit is fetched back by pollingghost*, under the domainitemDisplay - Return type:
Boolean -
Example:
itemDisplay queries & destruction¶
Check whether the display still exists¶
itemDisplayExists(id)
- Parameters:
id:Integer
the item-display id- Return value:
true= it exists - Return type:
Boolean -
Example:
Check whether an id is already taken¶
itemDisplayIsIdUsed(id)
- Parameters:
id:Integer
the item-display id to check- Return value:
true= already taken (in which caseitemDisplayCreateWithIdreturns-2) - Return type:
Boolean -
Example:
List the ids of all displays¶
itemDisplayGetAllIds()
- Return value: every display id; an empty array when there are none
- Return type:
Array<Integer> -
Example:
Find the nearest display in a dimension¶
itemDisplayFindNearest(x, y, z, dim, maxDist)
- Parameters:
x:Float
the world coordinate X of the search centrey:Float
the world coordinate Y of the search centrez:Float
the world coordinate Z of the search centredim:Integer
the dimension to search inmaxDist:Float
the search radius (blocks);<= 0= unlimited distance- Return value: the nearest display id; returns
-1when nothing in that dimension matches - Return type:
Integer -
Example:
Get a runtime summary for troubleshooting¶
itemDisplayGetInfo(id)
- Parameters:
id:Integer
the item-display id- Return value: the summary text, containing the id, dimension, coordinates, mode, on/off state, item, view distance, visible list and the number of players that have seen it; returns
not_foundwhen the id does not exist - Return type:
String -
Example:
Delete one item display¶
itemDisplayDestroy(id)
- Parameters:
id:Integer
the item-display id- Return value:
true= deleted; returnsfalsewhen the id does not exist - Return type:
Boolean -
Example:
Delete every item display¶
itemDisplayDestroyAll()
- Return value: no return value
- Return type:
Null -
Example:
Things to know¶
- The library supplies the default pose: in item mode
offsetYis"-4",rotXandrotZare"180"andscaleis"0.375"(block mode suggests"0.5"); the default visible distance is 64 blocks. - Molang expressions: the translation / rotation / scale parameters all take an expression directly (for example
"math.sin(query.life_time*90)*360"), and the client computes the animation, so the server does not have to push a packet every tick. - Property changes merge: changing several of them in the same tick rebuilds the display only once (so it cannot flicker repeatedly). A rebuild does resend the whole display, though, so to "follow something every tick" use
itemDisplayFollowinstead of callingitemDisplaySetPositionover and over inside a tick loop. itemDisplayScaleToonly does a one-shot jump: it produces no gradual animation of its own, so step it yourself for an eased effect; it returnsfalsewhenmodeis1(item flat).- Clicking needs a hit volume: only once
itemDisplaySetHitboxhas set a non-zero width and height can the client's raycast hit it; the interaction / attack that follows is fetched back by pollingghost*(withdomain=itemDisplayin the entry). - Ids are not interchangeable: an
itemDisplay*id belongs to the item-display domain only, so do not pass it toholo*/entity*or any other domain. The other way round, the iditemDetailShowreturns is a holographic-text id. - The library writes nothing to disk: after a script or server restart the displays are gone and have to be created again; reconnecting players need no handling, because the library re-sends automatically.