DecentSoftware-eu / DecentHolograms

A lightweight but powerful hologram plugin with many features and configuration options.
https://www.spigotmc.org/resources/96927/
GNU General Public License v3.0
211 stars 101 forks source link

Custom text animation skip last step in list #130

Closed Andre601 closed 1 year ago

Andre601 commented 1 year ago

Just making sure

Reproduction

  1. Install DecentHolograms
  2. Create a custom Animation (Example below)
  3. Apply custom animation to hologram
  4. See issue.

Example file:

speed: 5

pause: 0

steps:
- '&f█&7████'
- '&7█&f█&7███'
- '&7██&f█&7██'
- '&7███&f█&7█'
- '&7████&f█'
- '&7███&f█&7█'
- '&7██&f█&7██'
- '&7█&f█&7███'
- '&7█&f█&7███'

Solution

My current guess is an issue with the getCurrentStep method in combination with the usage of steps.size() - 1 in the CustomTextAnimation class.

https://github.com/DecentSoftware-eu/DecentHolograms/blob/fde9238175b9fd71e38c4fb855b9003bf5f888f3/src/main/java/eu/decentsoftware/holograms/api/animations/Animation.java#L28

https://github.com/DecentSoftware-eu/DecentHolograms/blob/fde9238175b9fd71e38c4fb855b9003bf5f888f3/src/main/java/eu/decentsoftware/holograms/api/animations/custom/CustomTextAnimation.java#L29

Perhaps the issue is related to some rounding issue?

Server Version

This server is running Paper version git-Paper-519 (MC: 1.19.4) (Implementing API version 1.19.4-R0.1-SNAPSHOT) (Git: 936205b) You are 2 version(s) behind Download the new version at: https://papermc.io/downloads/paper Previous version: git-Paper-514 (MC: 1.19.4)

Client Version

1.19.4 (Using Quilt Modloader and some optimization mods)

Plugin Version

2.8.1

Log

https://mclo.gs/ney3PLB

d0by1 commented 1 year ago

Hello, I think I found the problem. It's not actually that the last step is being skipped. In your example, pause is set to 0, which means that when the animation reaches the last step, it will wait for 0 ticks and then start the animation again. So basically, the last step is only displayed for 0 ticks. If you set the pause to 5 (same as speed), it will work as intended.

Andre601 commented 1 year ago

That's actually true now that I think about it...

Tho, I think that I'm not the only one who assumed that the speed is applied to every step and that pause would be added on top of that...