Started by
Jonae
on
Topic category: Help with Minecraft modding (Java Edition)
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
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.
where do i find the things you call .level ?
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.
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.
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?
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.
when i open the entity it shows a whole menu which do i click?
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.
its still giving me an error
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.
custom
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.