Make entity play animation while holding item (with Nerdy's GeckoLib)

Started by Ryan_Davanzo on

Topic category: Help with Minecraft modding (Java Edition)

Joined Jan 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Make entity play animation while holding item (with Nerdy's GeckoLib)

You know then you hold a bone near a wolf and he tilts his head? Same deal but with a custom GeckoLib animation.

Joined May 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Geckolib can't target…
Thu, 01/18/2024 - 22:10

Geckolib can't target players or vanilla entities. There may be another plugin that does this though. (I'm pretty sure optifine has some tools for this, might be worth looking into.) If the entity you're targeting is a geckolib custom entity, then you should be able to make animations using blockbench. (Just be sure to install the blockbench geckolib plugin.)

Joined Jan 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I have the animations. i…
Thu, 01/18/2024 - 22:41

I have the animations. i want the npc to play them when I hold an item

Joined Jan 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
like, how do I create a…
Thu, 01/18/2024 - 23:00

like, how do I create a procedure that does that?

Joined May 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
If you have Geckolib…
Sat, 01/20/2024 - 15:52

If you have Geckolib installed in your MCreator workspace, and you've enabled it in the workspace settings for your mod, you should be able to access the 'Geckolib' procedures tab. You can use the 'play animation' function to play any of the animations in that entity's geckolib animation file. In your case, you would trigger this when there is both a player within a certain range, and the nearest player within that range is holding the item in their main hand. (Using the 'does entity exist within range' and 'nearest entity in range' world functions.) 

Keep in mind that you can play an animation from the animation file even if it isn't linked to an entity's main animations, (idle, walk, etc.) As long as you have the correct name, you should be able to reference it.

Joined Jan 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Can you like...show me how…
Sat, 01/20/2024 - 16:26

Can you like...show me how to do a procedure of it? I can't find any ranged code on that. I tried right-click too but nothing happens. idk what i'm doing wrong... https://i.imgur.com/KvwbSuy.png

Joined May 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
The ranged stuff is at the…
Sun, 01/21/2024 - 15:17

The ranged stuff is at the bottom of the 'world data' tab. You're looking for 'does entity exist in radius' function and 'nearest entity in radius' function. You need to make sure you first check an entity exists in that radius, because using 'nearest entity in radius' when an entity doesn't exist in that radius can crash the game.

Try to see if you can find this- I can send pictures though if you're having trouble.

Joined Jan 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
There's no 'does entity…
Sun, 01/21/2024 - 18:00

There's no 'does entity exist in radius' and 'nearest entity in radius' functions. I searched manually and with the search bar. Is that another plugin? Also no "world data" but there's the data tap on world procedures. Or I'm dumb as a plastic chair...

Joined Jan 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
yeah i have no idea what i'm…
Sun, 01/21/2024 - 23:23

yeah i have no idea what i'm doing....

Joined Jan 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
can you...help me? i still…
Tue, 01/23/2024 - 20:31

can you...help me? i still cant get it to work.

Joined May 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Sorry! Something like this…
Wed, 01/24/2024 - 15:10

Sorry! Something like this should work. If you're using the 1.16.5 generator though, it's possible these functions aren't available.

Joined Jan 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
OMG IT WORKED! THANK YOU!now…
Thu, 01/25/2024 - 16:16

OMG IT WORKED! THANK YOU!
now to make them reset the animation when far lol
but again, thank you <3

Joined May 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
You would just need to add…
Fri, 01/26/2024 - 23:22

You would just need to add an else statement that returns it to the original animation. (Though it will probably need to finish looping through the existing one first.) Since it'll only ever be in one of the two states, you don't even need another condition.

Joined Jun 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Its still doesnt work for me…
Sat, 06/01/2024 - 12:50

Its still doesnt work for me. I copied everything