11# Holograms
22
33Caramel holograms are lightweight wrappers around Minecraft ` TextDisplay ` entities, designed for easy multi-line floating text.
4- They use holograms
4+ They use individual displays for each line, making for better support with ViaBackwards.
55
66---
77
@@ -15,12 +15,12 @@ CaramelHologram hologram = new CaramelHologram();
1515
1616// Hologram with initial lines
1717CaramelHologram hologram = new CaramelHologram (List . of(
18- new CaramelHologramLine (CaramelUtility . colorcomp(" Hello" )),
19- new CaramelHologramLine (CaramelUtility . colorcomp(" World" ))
18+ new CaramelHologramLine (CaramelUtility . colorcomp(" <blue> Hello" )),
19+ new CaramelHologramLine (CaramelUtility . colorcomp(" <red> World" ))
2020));
2121````
2222
23- Before spawning, you ** must** set a location:
23+ Before spawning, you ** must** set a location (and update() it after) :
2424
2525```java
2626hologram. setLocation(location);
@@ -35,9 +35,9 @@ hologram.setLocation(location);
3535You can fully control the hologram’s lines after creation.
3636
3737``` java
38- hologram. addLine(new CaramelHologramLine (Component . text (" New Line" )));
39- hologram. addFront(new CaramelHologramLine (Component . text (" Top Line" )));
40- hologram. addBack(new CaramelHologramLine (Component . text (" Bottom Line" )));
38+ hologram. addLine(new CaramelHologramLine (CaramelUtility . colorcomp (" New Line" )));
39+ hologram. addFront(new CaramelHologramLine (CaramelUtility . colorcomp (" Top Line" )));
40+ hologram. addBack(new CaramelHologramLine (CaramelUtility . colorcomp (" Bottom Line" )));
4141```
4242
4343Removing lines:
@@ -52,7 +52,7 @@ Replacing all lines:
5252
5353``` java
5454hologram. setLines(List . of(
55- new CaramelHologramLine (Component . text (" Replaced" ))
55+ new CaramelHologramLine (CaramelUtility . colorcomp (" Replaced" ))
5656));
5757```
5858
@@ -62,6 +62,21 @@ Retrieving lines:
6262List<CaramelHologramLine > lines = hologram. getLines();
6363```
6464
65+ Each line also has properties that can help it:
66+ ```
67+ line.withTextOpacity(byte opacity); // out of 225, -1 for unset
68+ line.withSeeThrough(boolean seeThrough);
69+ line.withShadow(boolean shadow);
70+ line.withLineWidth(int lineWidth); // highly recomended to not change. -1 for auto.
71+ line.withText(Component text);
72+ line.withBackground(Color color); // can be null for unset
73+ line.withBillboard(Display.Billboard value);
74+ line.withAlignment(TextAlignment alignment);
75+ ```
76+
77+ And default gap lines also exist:
78+ ` CaramelHologramLine.gapLine() `
79+
6580---
6681
6782<br /><br />
@@ -75,8 +90,8 @@ hologram.setLineHeight(0.25);
7590double spacing = hologram. getLineHeight();
7691```
7792
78- Values are in ** world units ( blocks) ** , not pixels .
79- Typical values range from ` 0.22 ` to ` 0.30 ` .
93+ Values are in blocks.
94+ Typical values range from ` 0.22 ` to ` 0.30 ` , the default is ` 0.25 ` for seamless .
8095
8196---
8297
@@ -148,13 +163,11 @@ Typical usage flow:
148163CaramelHologram hologram = new CaramelHologram ();
149164hologram. setLocation(location);
150165
151- hologram. addLine(new CaramelHologramLine (Component . text (" Line 1" )));
152- hologram. addLine(new CaramelHologramLine (Component . text (" Line 2" )));
166+ hologram. addLine(new CaramelHologramLine (CaramelUtility . colorcomp (" Line 1" )));
167+ hologram. addLine(new CaramelHologramLine (CaramelUtility . colorcomp (" Line 2" )));
153168
154169hologram. setLineHeight(0.25 );
155170hologram. show();
156171```
157172
158- That’s all you need for clean, stable holograms.
159-
160- ```
173+ That’s all you need for clean, stable holograms.
0 commit comments