[TUTORIAL] How to use Nerdy's GeckoLib Plugin 4.0+ [2022.4+]

Started by NerdyPuzzle on Sat, 12/24/2022 - 23:04

Topic category: User side tutorials

Last seen on 00:09, 27. Jan 2023
Joined Jul 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
[TUTORIAL] How to use Nerdy's GeckoLib Plugin 4.0+ [2022.4+]
Fri, 01/13/2023 - 00:39 (edited)

How to use Nerdy's GeckoLib Plugin 4.0+ for MCreator 2022.4+


Loading the plugin

 

This plugin is a Java Plugin, which means It requires the Java Plugins feature to be enabled. This is due to the new Mod Elements that it introduces.

 

java plugin

 

Once enabled, load the plugin. You will then need to restart MCreator so the changes can be properly applied. Note that if you already have an older version of the plugin loaded, you will first need to open the plugins folder and delete it.


Enabling the API

 

In order to use any of the features provided by the plugin, you will first need to enable the GeckoLib API, as it is what provides all of the code required to use animated models. This also means that your mod will require the GeckoLib mod to launch after exported.

To enable the API, you will need to head over to workspace settings.

workspace settings

And if you have installed the plugin correctly, GeckoLib will be an option you can enable in External APIs.

apis


Using GeckoLib in Blockbench

 

If you already know what you're doing, this step can be skipped.

 

To use animated models with the plugin, they will need to be made using the GeckoLib format in Blockbench.

In order to use this format, you will need to install the GeckoLib Animation Utils plugin.

plugin


And if you do not have the plugin installed, you will find it in the available section.

available

If you do already have the plugin and it is older than what is shown above, remove it and reinstall the current version.

You can now create a GeckoLib model.

model

If you already have a model in a different format and want to animate it using GeckoLib, you can convert it to the GeckoLib format by opening the project and clicking convert under the file options.

convert

After doing so, you can animate the model.

A key thing to note is that blocks/items, entities and armors all use different types of GeckoLib models. The type of the model can be changed by clicking on GeckoLib model settings and changing the Object type.

model type

Once finished with your model, you will need to export it using the option export GeckoLib Model.

export

If your model is of the type block/item, you will also have the option to export the display settings. This should also be done if that is the case as those will be required.

Your animations will all need to be under the same category in order to be included in a single file, and can be exported by looking under the Animation tab.

anims

Take note of the exact name you used when creating each animation, as that full name will need to be used for your entity.

name

After exporting both files, make sure both start with the same name. For example here, the name "name" is used.

names

This is it. Display settings files will be explained in the block/item tutorial below.


Importing GeckoLib models in MCreator.


To import GeckoLib models and animations, you will need to drag the left part of the screen to the side in order to access your mod's files.

sidebar

This will be the result.

result

Now, you will need to go under your resources directory, and find the folder with the name of your Mod's ID.

In this case, the Mod ID is "testinganim"
 

animss

You will need to right-click the folder, and select the option "Show in explorer" to open it.

explorer

Once there, you will need to create 2 folders named "geo" and "animations"

folders

You then place the animation file in the "animations" folder, and the geo (model) file, in the "geo" folder.


Animated Entities

 

To create an animated entity and use the animations and models, you will need to use the Animated Entity element to create it.

entity

Once in the menu, you will need to write your model's name in the text field which is part of the first page.

named

In this case, I use "name", as that is what I named my model.

named2

Now, you will head over to the "Animations" page of the element.

animsss

Your entity will require an idle animation. This animation can of course have empty keyframes, but it will be required nonetheless.

idle

Once that is done, you can enable/disable other Built-In animation triggers that are included with the entity's code. These animations will play automatically without any need for procedures/conditions. More information on them can be found by clicking the "?" icon next to their names.

builtin

There are some other options that can be modified on the right panel, but those will not be explained here other than the conditions, as enough explanation is provided by clicking their "?" icon.

right

In order to use more than just the built-in animations, you will either need to use animation procedures, or the conditions provided by the entity element.

conditionsprocedure

To use the animation procedure, you will need to specify the entity element that the animation will play for.

procedure2

That's it.

The condition is a bit more tricky, but it can be more reliable.

You will need to return the name of the animation in a condition. The condition's animations will always take priority over animation procedures, and will override any currently playing animations that were triggered through them.

Here is an example of an animation condition below.

cond

The No animation procedure block will always need to be returned at the end, otherwise the last returned animation will always be playing.

The loop external animations condition will determine whether or not animations triggered through procedures or the condition will keep playing as a loop. This can be used in a similar fashion to the animation condition, but with true/false returns instead.

loops

False will always need to be returned at the end, otherwise animations will always loop.

This is about everything you need to know about animated entities.


Animated Blocks/Items

 

To get started, you will need to make sure you have also exported the display settings file that was mentioned in the blockbench tutorial, as blocks and items require it. Here is an example of what one of those files can look like after exported. Your geo/animation files will also need to be imported in the same place as entities. Scroll up to that part of the tutorial if you do not know where that is already.

displays

You will now need to create either an Animated Block or Animated Item using their respective elements.

elems

You will find a text field similar to entities in the first page of the element, in which you use the name of the model you exported.

blockitem

After that is done, your blocks/items will require their display settings file to be imported.

Before importing, you will need to make certain that the file's name matches the registry name of the element. This can be seen by clicking the button shown below.

regsnamssss

Your display settings file will now need that name.

displayname

Once that is done, you will need to find the folder named "Custom" in your workspace. This can be found in the path below.

custom

If it does not exist, you will need to create it. If you do not know how to do that, scroll up to the entity tutorial where that is explained.

You will need to right-click that folder and select the option Open in explorer. Then, put the display settings file in there.

pathtt

 

Animated block/item animations

Blocks and items both have a different animation system. Blocks use numbers, while items use regular names.

Your animated block will require an animation to be named "0" in blockbench, as that is the idle animation that will always loop.

0

Your animated item will require an idle animation, which can be set in the first page of the animated item element.

itemidle

In a similar fashion, all your block animations will need to be numbers. These can range from 1-1000. Animations outside that range will not play.

blockproc

For animated items, your animation procedure will work the same way as entity animation procedures.

testtt


First person arm rendering for Animated Items

The animated item element also has a unique feature which allows you to include player arms in the model which are only visible in first person when held.

In order to use this feature, you will need to include 2 new groups in your model, which will represent the player arms.

arms

You need to be certain that the scale of these cubes matches the scale of the player model's arms.

scale

The texture you use for them does not matter, as these arms will automatically adapt to the player's skin.

You will need to position these arms to face up, and center the pivot to the center of the very bottom of the cube.
This is required as the arms are not part of the actual model. The rotations will all need to be handled in animations.

pivot

Note that you will need to only select the group, and not the cube, otherwise the pivots will not be correct.

You can now animate the cubes in animations.

animate

Once you are done animating the arms, you can enable first person arm rendering in the element and use the name of the groups you created for the arms.

enablearms


Animated Armors

In blockbench, you will need to set your geckolib model type to armor.

ad

Once that is done, a template of an armor model structure will generate. You can either use this template, or you can convert your own armor set.
If you do decide to use the template, you need to check that the pivots of the model part groups are correctly positioned. Sometimes, there are some slight mistakes.

The model parts of the armor are split into 8 groups

  • Head

  • Body

  • Right Arm

  • Left Arm

  • Right Leg

  • Left Leg

  • Right Boot

  • Left Boot

geg

These groups can be named whatever you like as you can specify their names in the armor element, but there is no need to rename the template's groups.

These are the parts that will need to have their pivots positioned relative to the player model. Inside, you can make the armor's model.

g

The exported model and animation file should be placed in the same directory as entities. If you do not know where that is, scroll up and find the part of the tutorial that explains it.

Now, make the armor using the animated armor element.

gw

In the GeckoLib properties page, you can set the group names of the model parts

w


This is it!

Plugin Link


Common crash causes

-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 element.
-You enabled the head animation, but there is no group in your model that matches group name you provided
-Your animation file name does not match your model name, or your model name does not match your animation name.
-You put a model (geo) file in the animations folder, or an animations file in the geo folder.
-Your animations or geo folder are named incorrectly.
-Your animations file has incorrect formatting.

Edited by NerdyPuzzle on Fri, 01/13/2023 - 00:39
Last seen on 00:09, 27. Jan 2023
Joined Jul 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
You asked for it, I deliver…
Sat, 12/24/2022 - 23:36

You asked for it, I deliver. This cannot get any simpler!

Last seen on 02:40, 22. Jan 2023
Joined Feb 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
Wow! This is way better…
Sat, 12/24/2022 - 23:57

Wow! This is way better. Nice job

Last seen on 00:09, 27. Jan 2023
Joined Jul 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
Thanks! The old entities…
Sun, 12/25/2022 - 00:09

Thanks! The old entities system was very messy as I didn't know how to make proper mod elements back then, but with a new entity element, I have far more control over what I can introduce and how simple I can make it!

Last seen on 00:09, 27. Jan 2023
Joined Jul 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
Opps! I kind of um... forgot…
Sun, 12/25/2022 - 00:21

Opps! I kind of um... forgot to update animated blocks. If you JUST installed the new version, reinstall it as I've replaced it with the fixed one. Oopsie!

Last seen on 20:49, 26. Jan 2023
Joined Aug 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
Thank you so much, I've been…
Sun, 12/25/2022 - 03:08

Thank you so much, I've been waiting so long for the update!

Last seen on 14:50, 26. Jan 2023
Joined Nov 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
Thank you for your precious…
Mon, 12/26/2022 - 00:48

Thank you for your precious work!

 

Last seen on 23:13, 26. Jan 2023
Joined Mar 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
Can you make player…
Mon, 12/26/2022 - 01:43

Can you make player animations with it; I want to make a custom player fighting animation for my sword mod. 

Last seen on 00:09, 27. Jan 2023
Joined Jul 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
You can use my player…
Mon, 12/26/2022 - 02:33

You can use my player animator plugin for that.

Last seen on 01:32, 26. Jan 2023
Joined Oct 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
is there any type of limit…
Mon, 12/26/2022 - 06:45

is there any type of limit for the size of the model or texture? because my game is crashing every time I spawn my mob in and i don't see anything listed in the common crashes that could be causing it

Last seen on 00:33, 16. Jan 2023
Joined Oct 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
Amazing!
Mon, 12/26/2022 - 07:10

Amazing!

Last seen on 11:12, 13. Jan 2023
Joined Dec 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
Can you give an instance…
Tue, 12/27/2022 - 00:31

Can you give an instance workspace?Thanks a lot

Last seen on 11:12, 13. Jan 2023
Joined Dec 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
Well,maybe I make some…
Tue, 12/27/2022 - 01:11

Well,maybe I make some mistakes

My animated item didn't work

Can you give an instance workspace?Thanks a lot

Last seen on 00:09, 27. Jan 2023
Joined Jul 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
I will not. It is very…
Tue, 12/27/2022 - 01:19

I will not. It is very clearly explained here. Scroll up again and read the tutorial carefully, you more than likely left the .item in the display settings file, which is very clearly not part of the instructions as you will see.

Last seen on 01:32, 26. Jan 2023
Joined Oct 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
nevermind its something else
Tue, 12/27/2022 - 02:27

nevermind its something else