[TUTORIAL] Making a flying armor 2022.x - Forge 1.18.2 - Look at the comments for updates up to 2023.x 1.20.1

Started by __SK__ on

Topic category: User side tutorials

Joined May 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
[TUTORIAL] Making a flying armor 2022.x - Forge 1.18.2 - Look at the comments for updates up to 2023.x 1.20.1
Sat, 05/04/2024 - 01:18 (edited)

I tried to make it as simple as possible, it does require to lock the code.

  1. Create your default or custom 3d armor
  2. Modify the desired settings
  3. Save
  4. Now lock the code
  5. Copy the following and paste it right before the last "}" in the code

 

    

   @Override
   public boolean canElytraFly(ItemStack stack, net.minecraft.world.entity.LivingEntity entity) {
      return true;
   }

   @Override
   public boolean elytraFlightTick(ItemStack stack, net.minecraft.world.entity.LivingEntity entity, int flightTicks) {
      if (!entity.level.isClientSide) {
         int nextFlightTick = flightTicks + 1;
         if (nextFlightTick % 10 == 0) {
            if (nextFlightTick % 20 == 0) {
               stack.hurtAndBreak(1, entity, e -> e.broadcastBreakEvent(net.minecraft.world.entity.EquipmentSlot.CHEST));
            }
            entity.gameEvent(net.minecraft.world.level.gameevent.GameEvent.ELYTRA_FREE_FALL);
         }
      }
      return true;
   }

=============SPECIAL NOTE================

    If needed set stack.hurtAndBreak from 1 (default value - breakable) to 0 (unbreakable)

=============SPECIAL NOTE================

 

Congratulations, now your armor (chestplate) will act just like an elytra ... and still have armor properties.

If you still have doubts, watch the following ...

NOTE: Apologies for the image hosting issues, one of my server admins decided to rearrange the content in it causing mapping issues.

Please ... (right click and save for future reference)

Results ...

Take off

Landing

With some creativity you could add a tick to the chestplate ... adding an additional chestplate that will switch while in air for a winged model, making it cool and more enjoyable to watch.

 

I would gladly like to see screenshots of your creations.

Have fun

Edited by __SK__ on Sat, 05/04/2024 - 01:18
Joined Jul 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Is there any way to make it…
Mon, 08/05/2024 - 10:45

Is there any way to make it get powered when you press spacebar instead of using rockets or another extra item? 

Joined Sep 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
This looks super cool for…
Fri, 08/23/2024 - 02:27

This looks super cool for the mod I have in mind, but I need to ask 2 questions first:

1, does this work in the newest version of MCreator?

2, would it be possible to give this infinite boost/momentum, (like when you use a firework),?

Joined May 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
1- Will work since it is…
Fri, 08/23/2024 - 15:48

1- Will work since it is just adding a few lines of code that enables elytra flying properties to an armor.

 

2- It could be possible, if you create a momemtum effect for the player while flying. You could make it infinite, if combining the proper procedures or creating a tick for when it is elytra flying at certain height or something similar. Basically trigger a boost with spacebar (any custom key) or experiment with ticks while in air condition.

MCreator has many ways to emulate the behavior. I just enabled the elytra flying with the code provided, if you find errors on the code for updated versions just let me know.

Joined Sep 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I am in mcreator 2023.3…
Mon, 11/18/2024 - 20:25

I am in mcreator 2023.3 fabric generator, can you make one for geckolib armor in FABRIC?

Joined Jan 2025
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
This is my first time trying…
Sat, 01/11/2025 - 12:45

This is my first time trying to change code, and i'm not an english speaker, maybe i'm commiting a dumb mistake. Well, actually i'm in the version of 2023.2 - 1.19.2, and when i'm trying to run it breaks, and then in the log this appears

error: cannot find symbol if (!entity.level().isClientSide) {
^
symbol: method level()
location: variable entity of type LivingEntity
1 error
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 2s
1 actionable task: 1 executed

BUILD FAILED

Joined May 2013
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
When I did it, it didn't…
Sat, 01/11/2025 - 14:48

When I did it, it didn't work properly, so I solved it by removing the code that reduces durability during flight.
I think I need to make that part as a procedure :)

Changes made in 2024.4 version have also been reflected.

Thank you for the good tutorial.



import net.minecraft.world.item.ItemStack; //add

import net.minecraft.world.entity.player.Player; //add

import net.minecraft.world.entity.LivingEntity; //add

import net.minecraft.world.entity.EquipmentSlot; //add

import net.minecraft.world.level.gameevent.GameEvent; //add

 

 

 

    @Override
   public boolean canElytraFly(ItemStack stack, LivingEntity entity) {
       return true;
   }

    @Override
   public boolean elytraFlightTick(ItemStack stack, LivingEntity entity, int flightTicks) {
       if (!entity.level().isClientSide) {
           int nextFlightTick = flightTicks + 1;
           if (nextFlightTick % 10 == 0) {
               if (nextFlightTick % 20 == 0) {
               }
               entity.gameEvent(GameEvent.ELYTRA_GLIDE);
           }
       }
       return true;
   }
}

 

Joined Feb 2025
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Hello, I know the topic is…
Sun, 02/09/2025 - 19:37

Hello, I know the topic is old but I want to ask anyway to see if someone can help me.

I'm trying to get this to work on the most recent (at this time) version of MCreator, 2025.1 EAP 05718 for Minecraft NeoForge 1.21.4.

I have armor, just the breastplate, and I want to fly with this code. Copying the code (latest version from answers) gives me this error:

error: The method does not override or implement a method of a supertype.

I googled it and the error comes from using @Override, when I remove the two lines where it says @Override, the mod compiles without errors but it doesn't work in the game, the armor doesn't fly.

So, I have to remove @Override (because the ArmorItem superclass doesn't contain the method I'm trying to call) but if I do, the code doesn't work.

What do I have to do then?

Joined May 2013
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
https://imgur.com/JGoJjs1  …
Mon, 02/10/2025 - 03:15

https://imgur.com/JGoJjs1

 

As it became 1.21.4 version, the function seems to have moved to another place.

In version 1.21.1, you could have enabled that feature
I don't see it in version 1.21.4...

I need to check the API for version 1.21.4 of neforge
The problem is, I don't know how to check ;)

Joined Apr 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
@__SK__   I tried using your…
Tue, 02/11/2025 - 14:39

@__SK__

 

I tried using your code but I get error:

error: incompatible types: EquipmentSlot is not a functional interface 

stack.hurtAndBreak(0, entity, e -> e.broadcastBreakEvent(EquipmentSlot.CHEST));

 

@Override
public boolean canElytraFly(ItemStack stack, LivingEntity entity) {
return true;
}

@Override
public boolean elytraFlightTick(ItemStack stack, LivingEntity entity, int flightTicks)
{
if (!entity.level().isClientSide && (flightTicks + 1) % 20 == 0) { //HERE IS THE .level THAT CHANGED TO .level()
//set stack.hurtAndBreak from 1 (default value - breakable) to 0 (unbreakable)
stack.hurtAndBreak(0, entity, e -> e.broadcastBreakEvent(EquipmentSlot.CHEST));

}
return true;
}

protected boolean onGround;
public void setOnGround(boolean p_20181_) {
this.onGround = p_20181_;
}

public boolean isOnGround() {
return this.onGround;
}


I am using newest MCreator neoforge 1.21.1

Joined May 2013
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
The line will cause a build…
Wed, 02/12/2025 - 13:15

The line will cause a build error in 2024.4 version.
It's a part that subtracts the durability, and this part can be implemented sufficiently as a trigger, so I recommend removing it.

Joined Feb 2025
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
@dkrdjdi So i asked on the…
Thu, 02/20/2025 - 20:02

@dkrdjdi

So i asked on the discord server of neoforge about that, they told that there's data component for adding elytra behaviour to an item.
The data component it's called glider.
I only could find this about adding data components to items, but I really don't understand how I have to do it and how I would have to modify the code that we have to make it work :1

Joined May 2013
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
@Lethire https://imgur.com…
Fri, 02/21/2025 - 02:08

@Lethire

https://imgur.com/l8Ghyzf

Set up the procedure.

If you put the code in the code snippet, it works the same as Elitra.
However, I think we need to take care of the conditions.

 

[FallFlying Start]

if (entity instanceof Player _player) { _player.startFallFlying(); }

 

[FallFlying Stop]

if (entity instanceof Player _player) { _player.stopFallFlying(); }

 

 

Even if you don't change Elitra to 'true', the ability to accelerate with firecrackers is automatically activated, and the landing works the same as Elitra.