There was an error while loading. Please reload this page.
You can create floating items in the same way you create text lines, by using the method Hologram.getLines().appendItem(...).
A floating melon block created above a player's head, 5 seconds later the melon block turns into a melon slice.
Location loc = player.getLocation().add(0.0, 2.0, 0.0); ItemStack itemStack = new ItemStack(Material.MELON_BLOCK); HolographicDisplaysAPI api = HolographicDisplaysAPI.get(plugin); final Hologram hologram = api.createHologram(loc); ItemHologramLine itemLine = hologram.getLines().appendItem(itemStack); Bukkit.getScheduler().runTaskLater(plugin, () -> { itemLine.setItemStack(new ItemStack(Material.MELON)); }, 5 * 20);