GeckoLib Attack animation not working

Started by Jonae on

Topic category: Help with Minecraft modding (Java Edition)

Joined Oct 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
GeckoLib Attack animation not working

Im a new modder and got good very quickly.

but when i add an attack animation (made with blockbench) with the geckolib plugin, it gives me an error.

its the correct name also.

 

how do i fix please tell me

Joined May 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
If you're using the latest…
Thu, 10/26/2023 - 17:41

If you're using the latest version of Geckolib, (the snapshot version), some of the animation functions aren't working properly and need to be manually fixed in the code. 

For the attack animations, lock the entity's code, and look for where the attack animation is reffering to '.level'. Replace this with '.level()'. This presumably changes it to the correct function call, (I just deduced this from looking at other entity code), and it appears to fix the issue. There's some similar problems with attack and walk animations, but the fixes aren't too tricky, just annoying to figure out.

Joined Oct 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
where do i find the things…
Thu, 10/26/2023 - 22:22

where do i find the things you call .level ?

 

Joined May 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
When you 'lock' a mod…
Thu, 10/26/2023 - 23:14

When you 'lock' a mod element, (using the button with the padlock on it), it allows you to edit the java code of the element. (Normally, MCreator does this for you.) Once you've locked your entity, opening it should bring up a code interface instead of the normal MCreator interface.

In that interface, you can use control-F to find each place where '.level' is written, and replace it with '.level(),' which is the correct format for the latest version.

 

These are the things you want to look for. You need to add the parentheses (), at the end of these.

Joined Oct 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I'm currently having the…
Sun, 10/29/2023 - 04:26

I'm currently having the same problem and I did what Mindthemoods said to do but every time I do it reverts back to not having parentheses.

Joined Oct 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I should also mention that…
Sun, 10/29/2023 - 15:30

I should also mention that is does work when I lock the code but not when it's unlocked. Am I supposed to keep it locked?

Joined May 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
TLDR: Yes, you need to keep…
Sun, 10/29/2023 - 15:57

TLDR: Yes, you need to keep the element locked.

Long Explanation: MCreator takes what you give it, and then uses it to generate code. When you lock an element, you're essentially telling MCreator not to mess with the code. Otherwise, it automatically rewrites code whenever a change is made. 

The problem you're having is that the latest version of Geckolib is using an outdated function, so whenever MCreator rewrites the code, it's using an outdated function that no longer works properly. By locking the code, you can make the fix yourself and stop MCreator from overwriting your changes.

This is kind of annoying, since it means you'll have to unlock the code whenever you want to change other things, and then lock the code and do the same fix before it'll compile properly. So you'll probably want to remove the animations for testing purposes, and then add the animations last so you don't have to constantly go back and forth locking and unlocking. 

Joined Oct 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
when i open the entity it…
Thu, 11/02/2023 - 00:09

when i open the entity it shows a whole menu which do i click?

 

Joined May 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
These are all the different…
Thu, 11/02/2023 - 00:24

These are all the different java and JSON files related to the mod element. The biome_modifier handles the biomes it can spawn in, the Model.java manages the actual model/shape of the entity, the spawn_egg makes a new spawn egg item to spawn the entity, and the Renderer runs the code required to visually render the entity in the world. All of the options below this are library files, (containing all the mod's entities, items, etc), that aren't as easily edited.

The one you want is the last one in the first section, [Entity Name]Entity.java, which contains the actual code for the entity's AI, triggers, and behavior. (The main file, essentially.) It's here that you can find and fix Geckolib's outdated functions.

Joined Oct 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
its still giving me an error
Thu, 11/02/2023 - 23:47

its still giving me an error

Joined May 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Are you only using the…
Tue, 11/07/2023 - 14:56

Are you only using the custom attack animation, or are there other animations you're trying to get working? Some of the other animations also need to be fixed manually in the latest snapshot.

Joined Oct 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
custom  
Thu, 11/16/2023 - 01:08

custom

 

Joined May 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
It'd help to see the…
Thu, 11/16/2023 - 15:49

It'd help to see the specific error message. That being said, there's also a new version of Geckolib out now for 2023.3, that fixes most of these issues. It might be easier to just replace your plugin and update to the latest version of MCreator.