How to add attack animations [TUTORIAL]

Started by Red Tofu on

Topic category: Help with Minecraft modding (Java Edition)

Joined Nov 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
How to add attack animations [TUTORIAL]

Hi guys. I am the creator of THE UNDEAD mod

Today, i am going to teach you how to add custom animations.

1.Model

First you need to look for your mob part default rotation.

1f = 18 degree

2.Trigger

You can use mobs trigger that returns [TRUE] or [FALSE] any trigger you wanted to use.

3.Make a Trigger

This is an example of attacking trigger.

The more ticks you add the more slower the attack.

4.adds custom codes

Do this in mob render.

This won't work if the specific parts already have thier own movements.


[This is an example of mob swinging thier rightArm]

First,You need to add varieble of default rotation of model parts.

In the picture i named my varieble to [A]

---------------------------------------------------------------------------------------------

float A=5.0f; [Default rotation]
            if(e.isSprinting()==true){   [Your Trigger is true]
                   this.rightArm.rotateAngleX = f2;   [f2 means it will loops back] [f means instantmovement and won't loop back]
                   A=3.2f; [Movement value change]
            }
            else{    [If it's not true]
                   this.rightArm.rotateAngleX = 5.0f; [Default rotation]
                   A=5.0f;   [Default rotation]
            }

--------------------------------------------------------------------------------------------

[You can remove else in make have a new perm pose]

You can also try other triggers and procedures and import it inside.

------------------------------------------------------------------------------------------------

EXTRA:Double Movement

This will work if the specific parts already have thier own movements.

When your mobs already have there own movement but it can also swing there arms.

all you need to do is add your varieble into the movement animations(I have no simple explanations).

 

My eng may bad but i want to put my effort on helping other modders ;D

 

*THANKS HAVE A GOOD DAY MODDING MCREATOR*

----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

 

Joined Apr 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Please look in to my forum…
Mon, 08/02/2021 - 20:59

Please look in to my forum(question) herehttps://mcreator.net/forum/77060/need-help-hnow-lower-animation-amplitu…

I REALLY need help. Don't have  time to wait 3 month until I get an answer.. Need it very soon!

I see you are really good with animations. I know you can help! I will be so fanciful and happy if I will get an answer :))))))

Joined Nov 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
HELLO! I manage to do this…
Sat, 12/04/2021 - 18:39

HELLO! I manage to do this but for some reason, it's swinging the other day around, Like towards behind? How can I fix this to make it swing towards front? I also just combined it with the default anim and added it to "else" and now works great. Just the swing direction is the problem.

Joined Dec 2014
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Tutorial…
Wed, 05/18/2022 - 07:53
Tutorial AttackAnimationProcedure {
    public AttackAnimation execute(Animate Entity entity) {
        if (editingEntityRenderer == AnimateEntity)
            Entity.Animation false;
        if (editing entity.java) {
            entity.animation((false));
            Mod Compiling() {
                CompilingErrors=True;

                }


Return with Error Code 2

MobRender is vauge, there are two mob renderers (renderer and renderers) and neither present any code for existing animations.

Joined Jul 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
So i am trying to make a…
Sat, 08/12/2023 - 15:38

So i am trying to make a custom skeleton, and i cant do a single bit of coding. I see what your code at the top is, but i just want the custom skeleton to do the same attack as a normal skeleton (the arms using the bow) how would i do this? some help would be GREAT

Joined Jun 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
how do i make one if my mob…
Sun, 02/18/2024 - 14:32

how do i make one if my mob uses ranged attacks?