GitBrincie212 / Apel-Mod

Apel is a library that brings particle animations to the table with flexible behaviour and a clean developer interface. It promises also lots of predefined shapes & paths to help the developer on their particle scene
Other
2 stars 1 forks source link

SequentialAnimator doesn't populate the `delays` List #45

Closed DarthSharkie closed 2 weeks ago

DarthSharkie commented 1 month ago

When running the following, throws an IndexOutOfBoundsException accessing the delays list:

        LinearAnimator linearAnimator =
                new LinearAnimator(1, new Vector3f[]{ offset(user, 10, 0, 2), offset(user, -10, 0, 2) }, polygon, .04f);

        LinearAnimator linearAnimator2 =
                new LinearAnimator(1, new Vector3f[]{
                        offset(user, 10, 0, 2), offset(user, -10, 0, 2), offset(user, 9, 0, 2), offset(user, -9, 0, 2),
                }, polygon, new float[]{.04f, .12f, .4f});

        SequentialAnimator sequentialAnimator = new SequentialAnimator(1, linearAnimator, linearAnimator2);
        sequentialAnimator.beginAnimation(ApelServerRenderer.client(world));

The following exception is thrown:

[17:56:43] [Server thread/ERROR] (Minecraft) Failed to handle packet net.minecraft.network.packet.c2s.play.PlayerInteractItemC2SPacket@4af79581, suppressing error
 java.lang.IndexOutOfBoundsException: Index 0 out of bounds for length 0
    at java.base/java.util.Objects.checkIndex(Objects.java:385) ~[?:?]
    at java.base/java.util.ArrayList.get(ArrayList.java:427) ~[?:?]
    at net.mcbrincie.apel.lib.animators.SequentialAnimator.beginAnimation(SequentialAnimator.java:179) ~[main/:?]
    at net.mcbrincie.apel.item.DebugParticleWand1.animators(DebugParticleWand1.java:132) ~[main/:?]

I believe the SequentialAnimator needs to do something with the delay value provided or the number of animators, so the delays list is equal in size to the animators list.

DarthSharkie commented 1 month ago

Checking code, neither does ParallelAnimator -- this should be fixed in both places.

GitBrincie212 commented 1 month ago

Didn't knew this

DarthSharkie commented 3 weeks ago

This is fixed, but pending #49 before the builders version that fixes this can be PR'd.

DarthSharkie commented 2 weeks ago

Fixed in #51.