Skip to content

3. Creating Holograms

Maxim.jsx edited this page Jul 27, 2025 · 3 revisions

This guide covers all types of holograms available in HologramLib and their customization options.

Text Holograms

Basic Creation

TextHologram textHologram = new TextHologram("unique_id")
    .setText("Hello World!")
    .setMiniMessageText("<aqua>Formatted Text!");

Full Customization

Every setter here is optional. If you are not setting a value, a default value will be used.

TextHologram textHologram = new TextHologram("unique_id")
    .setMiniMessageText("<aqua>Hello world!")
    .setSeeThroughBlocks(false)
    .setBillboard(Display.Billboard.VERTICAL)
    .setShadow(true)
    .setScale(1.5F, 1.5F, 1.5F)
    .setTextOpacity((byte) 200)
    .setBackgroundColor(Color.fromARGB(60, 255, 236, 222).asARGB())
    .setAlignment(TextDisplay.TextAlignment.CENTER)
    .setViewRange(1.0)
    .setMaxLineWidth(200);

Text Properties

  • setText(String) - Sets plain text
  • setMiniMessageText(String) - Sets MiniMessage formatted text
  • setShadow(boolean) - Toggles text shadow
  • setMaxLineWidth(int) - Sets maximum line width
  • setBackgroundColor(int) - Sets ARGB background color
  • setSeeThroughBlocks(boolean) - Controls visibility through blocks
  • setAlignment(TextDisplay.TextAlignment) - Sets text alignment
  • setTextOpacity(byte) - Sets text transparency

Item Holograms

Basic Creation

ItemHologram itemHologram = new ItemHologram("unique_id")
    .setItem(new ItemStack.Builder()
        .type(ItemTypes.DIAMOND_SWORD)
        .build());

Full Customization

ItemHologram itemHologram = new ItemHologram("unique_id")
    .setItem(new ItemStack.Builder()
        .type(ItemTypes.DIAMOND_SWORD)
        .build())
    .setGlowing(true)
    .setGlowColor(Color.CYAN)
    .setOnFire(false)
    .setDisplayType(ItemDisplayMeta.DisplayType.FIXED)
    .setBillboard(Display.Billboard.VERTICAL)
    .setScale(2.0F, 2.0F, 0.01F);

Item Properties

  • setItem(ItemStack) - Sets displayed item
  • setGlowing(boolean) - Toggles glow effect
  • setGlowColor(Color) - Sets glow color
  • setOnFire(boolean) - Toggles fire effect
  • setDisplayType(DisplayType) - Sets display mode

Block Holograms

Basic Creation

BlockHologram blockHologram = new BlockHologram("unique_id")
    .setBlock(Material.DIAMOND_BLOCK.getId());

Full Customization

BlockHologram blockHologram = new BlockHologram("unique_id")
    .setBlock(Material.DIAMOND_BLOCK.getId())
    .setOnFire(false)
    .setBillboard(Display.Billboard.VERTICAL)
    .setScale(1.0F, 1.0F, 1.0F)
    .setViewRange(1.0);

Block Properties

  • setBlock(int) - Sets displayed block
  • setOnFire(boolean) - Toggles fire effect

Common Properties

These properties are available for all hologram types:

hologram
    .setViewRange(double)                         // Viewing distance
    .setScale(float, float, float)                // Size in x, y, z
    .setBillboard(Display.Billboard)              // Rotation behavior
    .setTranslation(float, float, float)          // Position offset
    .setLeftRotation(float, float, float, float)  // Left rotation quaternion
    .setRightRotation(float, float, float, float) // Right rotation quaternion
    .setUpdateTaskPeriod(long)                    // Update interval
    .setNearbyEntityScanningDistance(double);     // Entity scan range

Spawning Holograms

After creating and configuring a hologram, spawn it using the HologramManager:

hologramManager.spawn(hologram, location);

Updating Holograms

Call update() after modifying hologram properties:

Getting an existing hologram

TextHologram textHologram ((TextHologram) hologramManager.getHologram("unique_id").get());

Removing a hologram

hologramManager.remove("unique_id");
hologram
    .setText("New Text")
    .setScale(2.0F, 2.0F, 2.0F)
    .update();

Best Practices

  1. Always use unique IDs for holograms
  2. Call update() after changing properties (if you want to apply the changes)
  3. Clean up holograms when no longer needed

For more advanced features, check out:

Clone this wiki locally