KyoriPowered / adventure

A user-interface library, formerly known as text, for Minecraft: Java Edition
https://docs.advntr.dev/
MIT License
678 stars 103 forks source link

Phase issues with <gradient> and more than 2 colors #1052

Open Diego6k9 opened 3 months ago

Diego6k9 commented 3 months ago

Not possible to animate a seamless gradient animation when using more than 2 colors, gets out of phase after a bit, tried for several hours now. Works perfectly fine when using only 2 colors, but anything more and there seem to be some phase issues when going from -1 to 1 and from 1 to -1.

View post on imgur.com
``` public void start() { StringBuilder sb = new StringBuilder("").append(getPlainDisplayName()); BukkitTask task = Bukkit.getScheduler().runTaskTimer(getPlugin(), () -> { ItemMeta meta = getItemStack().getItemMeta(); meta.displayName(getMiniMessageBuilder().deserialize(sb.toString().replaceAll(PHASE_PLACEHOLDER, String.valueOf(phase)))); getPlayer().sendMessage("§a" + phase); getItemStack().setItemMeta(meta); getInventory().setItem(getSlot(), getItemStack()); if (animationDirection == AnimationDirection.LEFT_TO_RIGHT) { phase = (phase - getAnimationSpeed() < -1) ? 1 : phase - getAnimationSpeed(); } else { phase = (phase + getAnimationSpeed() > 1) ? -1 : phase + getAnimationSpeed(); } }, 1L, 2L); getRunningAnimations().put(getPlayer().getUniqueId(), task); }
zml2008 commented 3 months ago

Which version of adventure?

Diego6k9 commented 3 months ago

Which version of adventure?

Using the one included in the latest paper 1.20.4 version

zml2008 commented 3 months ago

That's not a version number

Diego6k9 commented 3 months ago

That's not a version number

image