Topic category: User side tutorials
I tried to make it as simple as possible, it does require to lock the code.
- Create your default or custom 3d armor
- Modify the desired settings
- Save
- Now lock the code
- 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
Is there any way to make it get powered when you press spacebar instead of using rockets or another extra item?
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),?
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.
I am in mcreator 2023.3 fabric generator, can you make one for geckolib armor in FABRIC?
Not that good with fabric, try this ...
https://www.curseforge.com/minecraft/mc-mods/elytra-utilities-fabric
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
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;
}
}
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?
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 ;)
@__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));
I am using newest MCreator neoforge 1.21.1
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.
Thanks
@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
@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.