Skip to content

CMI Hologram API changed #64

Closed
Closed

Description

@ChimpGamer

Hello, I've been trying to figure out for a while now how to migrate to the new CMI Hologram API.

This is the code I've been using before version 9.8.6.0:

        val hologram = CMIHologram(UUID.randomUUID().toString(), CMILocation(displayLocation))
        val enchanted = itemStack.enchantments.isNotEmpty()

        hologram.addLine("ICON:${itemStack.type}" + if (enchanted) "%enchanted%" else "")
        hologram.updateIntervalSec = -1.0 // Disable updating of the hologram
        hologram.showRange = 20
        hologram.update()

        locationToHologram[containerLocation] = hologram
        CMI.getInstance().hologramManager.addHologram(hologram)

        val page = hologram.getPage(1) ?: return
        val line = page.lines[0] ?: return
        line.item = CMIItemStack(itemStack)

But this unfortunately no longer works after version 9.8.6.0 and there is NO migration guide available.

I've managed to get "something" working with this code:

        val hologram = CMIHologram(UUID.randomUUID().toString(), displayLocation)
        hologram.type = CMIHologramType.ArmorStand
        hologram.isSaveToFile = false // <- deprecated

        val enchanted = itemStack.enchantments.isNotEmpty()

        val lineIcon = CMIHologramLineIcon("ICON:${itemStack.type}" + if (enchanted) "%enchanted%" else "")
        lineIcon.setIcon(itemStack)
        hologram.pages.addLine(lineIcon.iconText)
        hologram.settings.apply {
            visibilityRange = 20
            updateIntervalTicks = 0
        }
        hologram.update()

        destroyDuplicates(displayLocation)
        locationToHologram[containerLocation] = hologram
        CMI.getInstance().hologramManager.add(hologram)

But I'm unsure if this code is the proper way of using the api since isSaveToFile is deprecated.

Is anyone able to provide support with this?

Thanks in advance.

Activity

  1. Zrips commented on Sep 12, 2026

    @Zrips
    Owner

    Due to major changes in underlying processing, everything changed. While some methods from previous version remains and were labeled as deprecated, you could potentially still use those, but its recommended to shift towards newer version. Most config options were moved into dedicated classes instead of being located at main one. You can check updated Wiki page at https://www.zrips.net/cmi/hologram-api/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions