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.
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:
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:
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.