Geckolib custom attack animations cause compile errors.

Started by ShiroFliro on

Topic category: Help with MCreator software

Last seen on 14:15, 15. Oct 2023
Joined Feb 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Geckolib custom attack animations cause compile errors.

The title says it all, when I ad a custom attack animation the mod doesn't compile, but when I remove the attack animation, everything goes back to normal.
MC Version: 1.20.1
MCreator Version: 2023.3

Last seen on 14:15, 15. Oct 2023
Joined Feb 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Yes, it was. For any future…
Fri, 10/13/2023 - 15:06

Yes, it was.

For any future people that might happen to get this error:

Lock the entity so you can edit the code.

find this part of the code in the (Your mob)Entity.java:

if (getAttackAnim(event.getPartialTick()) > 0f && !this.swinging) {

            this.swinging = true;

            this.lastSwing = level.getGameTime();

        }

        if (this.swinging && this.lastSwing + 7L <= level.getGameTime()) {

            this.swinging = false;

And switch BOTH level.getGameTime() to level().getGameTime()

It should look like this:

if (getAttackAnim(event.getPartialTick()) > 0f && !this.swinging) {

            this.swinging = true;

            this.lastSwing = level().getGameTime();

        }

        if (this.swinging && this.lastSwing + 7L <= level().getGameTime()) {

            this.swinging = false;