[TUTORIAL] How to use Nerdy's GeckoLib Plugin [2022.3] [Outdated]

Started by NerdyPuzzle on

Topic category: User side tutorials

Last seen on 18:15, 21. May 2024
Joined Jul 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
[TUTORIAL] How to use Nerdy's GeckoLib Plugin [2022.3] [Outdated]
Sun, 04/09/2023 - 13:31 (edited)

Time to learn how to use your GeckoLib models and animations! The plugin, by default, will play 8 built-in animations (which your animations will need to be named as when making them):

  • "walk" -Walking animation (loops)
  • "idle" -Idle animation (loops)
  • "death" -Death animation
  • "swim" -Swimming animation (loops)
  • "attack" -Attack animation
  • "sneak" -Will play while the entity is crouching (can be set though a procedure block, loops)
  • "sprint" -Will play while the entity is sprinting (can be set through a procedure block, loops)
  • Support for the head movement animation which will apply to the group named as "head" in blockbench. Added as an option of the model procedure in version 1.5

These animations will not require a procedure to play (except for sneak and sprint). If you do not want to make them, don't, since you can use the procedure added in version 1.9 of the plugin to play any animation you want.

Your animation file and model file will need to start with the same name. (entity.animation.json, entity.geo.json) The animations for the built-in triggers inside the animation file need one of the names above. Delete the default name you get when creating them, there's no need for the animation.entity.new nonsense I keep seeing people use in the replies. The animations you trigger through the procedure can be named anything you want.

 

EDIT: Since some of you seem to have a bit of trouble with this, here is a screenshot showing how you structure the animations properly in blockbench:

animations

Your model will need to be a GeckoLib animated model, which is available when using the GeckoLib blockbench plugin. Java models or bedrock models made without it will NOT work unless converted. The model name needs to be lowercase and not have any spaces.

 

 

Now, onto the first step, which is obviously enabling the API and regenerating the code.

 

Once the API is enabled, you will need to create two folders in your mod's assets directory, "geo" and "animations". Drop your animation file in the animations folder and your model in the geo folder. Your texture can be imported as any regular texture is imported into MCreator.

 

files

 

 

 

 

 

 

 

 

 

 

 

 

 

Now that you've imported your assets, It's time to make an entity. This is as simple as it normally would be. Create your entity, and before saving it, simply set any texture to it. The model and textures you select will not matter unless you plan on using a custom Java model, which is also supported, but will not be compatible with geckolib animations.

 

entity

 

 

Take note of what you named your entity element, this will be required later. Not the name of the entity, the name of the element.

Now, you may have noticed that this gives you an error. This is fine, as we have not registered a model to it yet.

To register a model, you need to create a new procedure, which contains the name of your entity element, followed by Model with a capital M as shown below:

 

model element

 

 

 

 

 

 

 

 

 

Once created, select the Setup model (GeckoLib) event (renamed to Setup class in version 2.2) which is provided by the plugin, and ONLY use the procedure which is provided by the plugin to set the appropriate names of your entity, model and texture.

 

procedure

 

 

 

 

 

Save the procedure. You will get an error, which is still normal as the code of the entity has not updated, and doesn't know the new procedure exists.

 

And finally, to get rid of the error and finish setting up your GeckoLib entity, simply regenerate the code, or open and save your entity again.

 

That's it! You can now follow the same steps to add as many GeckoLib entities as you want into your mod.

 

v1.6 Update - Glow layer support tutorial

Missed them? Well, glow layers are back!

Registering a glow layer is very simple. The first step is creating a new procedure, with the name of your entity followed by Layer. You should now have three elements that look similar to the ones below. The capital letters are very important.

elements

Inside the layer procedure, select the model setup event you used in your model procedure, and use the new procedure block provided by the plugin. The model will need to be the model of the entity you're registering the layer for and the texture name will obviously be the name of the glowing texture you are registering which needs to be imported as an entity texture so the procedure can locate it.

layer

Now, the final step will be to enable the glow layer by going in your entity settings and choosing any texture for the glow layer option. Which one you choose does not matter, since the model will use the texture you specified in the procedure.

textureglow

Now, to get rid of build errors, regenerate the code and you're good to go!

Here is the result of using a glow layer on the example entity shown in the plugin page:

result

 

 

v1.8 Update - Disabling death rotation

Did you make a death animation, and yet you cannot really see it due to the way the entity rotates when it's killed?

Well, here is the solution you've been looking for!

Disabling deah rotation is possibly the simplest to use feature yet. All there is to it is selecting the built-in chicken model in your entity menu:

model

Yes, that's it. The chicken model will of course not apply to your entity, since that is retrieved from your model procedure. To change how long your entity stays dead, you will need to change the length in the entity code, which is just as simple.

Just go to the bottom of the entity code and find the lines:

@Override
	protected void tickDeath() {
		++this.deathTime;
		if (this.deathTime == 20) {
			this.remove(YourEntity.RemovalReason.KILLED);
		}
	}

And change the number after this.deathTime ==. By default, it is set to 20, which is 1 second as that is what 20 ticks translate to.

 

v1.9 Update - Play animation procedure

It's finally here! You can now trigger any animation at any time using the brand new animation procedure. It really is as simple as it sounds!

new procedure

 

v2.2 Update - New and improved animation procedure

Well... my former implementation of the animation procedure was... less than ideal. In this update I decided to replace the animation procedure with a far better version.

To use this, you need to first replace the old procedure (which will be removed after a few updates), as it is only kept in the plugin so workspaces updating versions will not break.

Here is an example of the procedure being used. It is ideal to use scoreboard scores to trigger animations (if they don't work in your procedure), as there seems to still be issues which I cannot fix.

procedure

The entity name needs to be the name of the entity element, not the display name. The animation name will of course be the name you used for your animation in blockbench.

Update: It seems using immediate source entity instead of source entity will work. Use scoreboards if it doesn't.

 

v2.4 Update - Java model support & Translucent textures

You can now use Java models alongside GeckoLib models without locking the code. 

Also, GeckoLib entities now support translucent textures. Cool stuff. Not much to explain here.

 

V2.9 Update - Animated Block element

It is now possible to make animated blocks using the geckolib plugin through the use of a new element.

(As of right now, only forge 1.18.2 and 1.19.2 are supported due to the sheer amount of work it took to make this, the rest will be supported later)

 

First off, you need to make sure that java plugins are enabled, otherwise this feature will not exist.

java

Now, you will need to import the model the same way you did with your entity models, in the same directory path. The difference here is that you will need to set the model type in blockbench to block/item when making it.

model

And you will need to export your display settings too once you're done with them. This is very important.

settingexport

Now, just make the block. Settings can be whatever you like, and you write the model name on the first page where the texture is in the text field. Same way you did with the model procedure for entities, but there instead.

modelfield

Now you will need to import your display settings file. It will need to be named the registry name of your element followed by .json. You can see your element registry name by clicking this button shown below.

registryname

Your display settings file needs to go in this folder shown down here.

directoruy

Well, that's it. Obviously GeckoLib must be enabled in workspace settings for any of this to work. Your animated block should now be there. The default animation should be named "0". That is the animation that will always be playing. (UPDATED) Other animations can be triggered using the new block animation procedure. It uses numbers ranging from 1-1000 as the animation name due to limitations I faced while getting them to actually work.

 

V3.5 Update - Animated Item element

It is now possible to make animated items using the geckolib plugin through the use of a new element.

(As of right now, only forge 1.18.2 and 1.19.2 are supported, other versions will be available  later)

 

First off, you need to make sure that java plugins are enabled, otherwise this feature will not exist, just like animated blocks.

Now, you will need to import the model the same way you did with your entity models, in the same directory path. The difference here is that you will need to set the model type in blockbench to block/item when making it, just like blocks, which is shown above.

 

And you will need to export your display settings too once you're done with them. This is very important. This is what will display the actual item, otherwise you'll just be getting a black and purple box. Once again, this is just the same as animated blocks.

 

Now, just make the item. Settings can be whatever you like, and you write the model name on the first page where the texture is in the text field. Same way you did with the model procedure for entities, but there instead.

field

Now you will need to import your display settings file. It will need to be named the registry name of your element followed by .json. You can see your element registry name by clicking the button shown above in the animated block tutorial.

Your display settings file needs to go in the same folder that your animated block display settings would go. (in case you didn't know, this is shown above in the animated block tutorial!)

 

Well, that's it. Simple enough? It sure should be. The default animation that will always loop should be named "idle", and any other animations will need to be played using the item animation procedure. You can see an example below.

procedure

 

 

 

 

If you have not yet installed the plugin, you can find it here.

 

If you are updating versions and you get an error for the model or glow procedures, simply open them and the entity, save them, and finally regenerate the code. If that doesn't work for some reason, just remake the procedure. This issue can be caused due to the change in the code between versions 3.0 and 3.1 of GeckoLib.

 

If spawning your entity causes a crash, one of the below reasons is the cause:


-You used uppercase letters or spaces in the model name.
-You didn't create a GeckoLib model.
-You placed your files in the wrong location. Check that the geo and animations folders are in the assets/yourmod'sID folder.
-You didn't write the model name correctly in the procedure.
-You enabled the head animation, but there is no group in your model that is named "head"
-Your animation or model file name is incorrect. Check the valid names at the top of the tutorial.

If none of these are the issue, look through the replies to this post before asking for help. It is very likely that someone else had the same issue and the solution has been posted.

Edited by NerdyPuzzle on Sun, 04/09/2023 - 13:31
Last seen on 18:15, 21. May 2024
Joined Jul 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I do not support version…
Sun, 02/19/2023 - 16:03

I do not support version 2022.3

Last seen on 17:55, 21. Feb 2023
Joined Feb 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
how do i put it into…
Mon, 02/20/2023 - 15:40

how do i put it into minecraft? like, i did all the steps and i think it works, but it dont starts in minecraft, it says i dont have geckolib, but i installed it. which geckolib archive i need to install?

Last seen on 13:48, 13. Jan 2024
Joined Nov 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Hello, I've been working on…
Mon, 02/20/2023 - 22:41

Hello, I've been working on this project for 5 days using MCreator and the GeckoLib plugin, but I've run into some issues. Since yesterday evening, I've been trying to create an animated item, but I can't find a decent tutorial that explains it well, as the plugin wiki doesn't go into enough detail. The problem is that no matter which folder I put the files in or how I arrange the folders in the game, there will always be a black and purple block. Another issue I've encountered is that after creating a block with working animations with GeckoLib, as soon as it's placed, all the textures of the surrounding blocks disappear. I've also searched for help on this and it seems to be a recurring error. If you want, I can send you the workspace or files so you can help me.

Last seen on 17:57, 7. Apr 2023
Joined Feb 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Hi there, i'm having this…
Thu, 02/23/2023 - 21:21

Hi there, i'm having this problem, I tried to rename everything and nothing happens, also, deleting and redoing the workspace.

I need help :(


Executing Gradle task: build 
Build info: MCreator 2022.3.48217, forge-1.18.2, 64-bit, 8023 MB, Windows 10, JVM 17.0.3, JAVA_HOME: C:\Program Files\Pylo\MCreator\jdk, started on: 2023-02-23-16:18:37 
  
> Configure project : 
The code of this workspace uses official obfuscation mappings provided by Mojang. These mappings fall under their associated license you should be fully aware of. 
(c) 2020 Microsoft Corporation. These mappings are provided "as-is" and you bear the risk of using them. You may copy and use the mappings for development purposes, 
but you may not redistribute the mappings complete and unmodified. Microsoft makes no warranties, express or implied, with respect to the mappings provided here. 
Use and modification of this document or the source code (in any form) of Minecraft: Java Edition is governed by the Minecraft End User License Agreement available 
at https://account.mojang.com/documents/minecraft_eula. 
  
> Task :compileJava FAILED 
C:\Users\\MCreatorWorkspaces\cenozoicpark\src\main\java\net\mcreator\cenozoicpark\procedures\PlatybelodonModelProcedure.java:16: error: cannot find symbol 
public class PlatybelodonModelProcedure extends AnimatedGeoModel<PlatybelodonEntity> { 
                                                ^ 
  symbol: class AnimatedGeoModel 
C:\Users\\MCreatorWorkspaces\cenozoicpark\src\main\java\net\mcreator\cenozoicpark\procedures\PlatybelodonModelProcedure.java:17: error: method does not override or implement a method from a supertype 
   @Override 
   ^ 
C:\Users\\MCreatorWorkspaces\cenozoicpark\src\main\java\net\mcreator\cenozoicpark\procedures\PlatybelodonModelProcedure.java:22: error: method does not override or implement a method from a supertype 
   @Override 
   ^ 
C:\Users\\MCreatorWorkspaces\cenozoicpark\src\main\java\net\mcreator\cenozoicpark\procedures\PlatybelodonModelProcedure.java:27: error: method does not override or implement a method from a supertype 
   @Override 
   ^ 
4 errors 
FAILURE: Build failed with an exception. 
* What went wrong: 
Execution failed for task ':compileJava'. 
> Compilation failed; see the compiler error output for details. 
* Try: 
> Run with --stacktrace option to get the stack trace. 
> Run with --info or --debug option to get more log output. 
> Run with --scan to get full insights. 
* Get more help at https://help.gradle.org 
BUILD FAILED in 9s 
1 actionable task: 1 executed 
  
BUILD FAILED 
Task completed in 1 minute and 19 seconds 
 
Last seen on 04:48, 27. Feb 2023
Joined Jan 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Hi, when I tried to set up a…
Mon, 02/27/2023 - 03:20

Hi, when I tried to set up a geckolib model everything went fine until I tried to run the client and I have confirmed that this issue only occurs when I set up a custom geckolib model.

Last seen on 12:02, 20. Mar 2024
Joined Jan 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I'm trying to make an…
Mon, 02/27/2023 - 22:21

I'm trying to make an animated block. Every time I load the game, it crashes. I already have the animation made in Blockbench and I've followed all of your directions. I cannot spot any issues with what I've done though I must admit I found the animated block instructions somewhat difficult to follow. I tried moving the animation and model files into the custom folder, which allowed the game to load but crashed it when I actually placed the block. I apologize if a similar question has already been asked & solved - there are too many comments for me to read them all right now, but I read through the first 10 pages and saw nothing.

Last seen on 12:02, 20. Mar 2024
Joined Jan 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Figured it out - I think it…
Mon, 02/27/2023 - 22:35

Figured it out - I think it was some sort of bug in the system but I went into the files and fixed it manually. I thought I was misunderstanding the instructions because they seemed almost too simple, but it turns out they were just that simple! Sorry for adding to the endless flow of comments you have to grapple with. It seems exhausting to run a plugin of this magnitude. Thanks for this incredible mod

Last seen on 12:56, 8. Mar 2023
Joined Mar 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Hi, is there a way to change…
Wed, 03/01/2023 - 02:44

Hi, is there a way to change the texture of an entity or block when an event happens?

Last seen on 18:32, 5. Jun 2023
Joined Mar 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I downloaded the plugin,…
Wed, 03/01/2023 - 05:18

I downloaded the plugin, there are no animation procedures under GeckoLib.  I am using 2022.3 version 3.5, but I'm not able to play any custom animations

Last seen on 16:59, 10. Apr 2024
Joined Oct 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I made a block with…
Wed, 03/01/2023 - 20:34

I made a block with animations and created some particles, but when I import it to mcreator the particles don't appear, only the animations I made for the block.
How do I import the particles so that they appear in the animation within the game? 

*Animations made in blockbench

Last seen on 19:18, 20. May 2024
Joined Feb 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
dont know if someone can…
Wed, 03/01/2023 - 20:47

dont know if someone can help me with this, but im on mcreator 2022.2 and animations arent working, ive tried every bug fix I could find, like uncapitilzing letters and remaking the animations, but none have worked, any help would be appriciated

Last seen on 13:02, 7. Apr 2023
Joined Dec 2018
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I might have a bug or an…
Fri, 03/03/2023 - 21:47

I might have a bug or an issue with the animations. I've successfully implemented a model of a starling (bird) with three animations (walk, idle and pick) into mcreator. Everything works fine, it has a "passive flying mob" AI and uses "walk" animation when it flies. "idle" is activated when its on the ground as expected. However, quite often, mid-flight it runs the "idle" animation. Scenario; the bird is on the ground (idle animation) then flies away (moves to "walk"/fly animation) and randomly does its idle animation in the sky, floating in mid air instead of only using "walk" in air. Is this a problem someone else has solved? Is it AI related or is something wrong with the animations? 

Last seen on 01:32, 6. Jun 2023
Joined Jul 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Is this incompatible with…
Sat, 03/04/2023 - 01:37

Is this incompatible with the plugin that makes 1.16 mod-able again, or did I simply make a mistake, as when I reload the workspace I still have an error