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
Wow this topic started to years ago and u still helping people with it... Respect!!!
Hmm, It's bit strange that custom Elitra still not possible to create in MCreator without code... What do you think is the reason for this? I'm too dilettante to reason, therefore, I want to ask the opinion of an understanding person
Good tutorial but I want to tell you guys it can be done in procedure now.
You need some plugins but I dont know which one is because I added too much.You can search them out here.
https://s3.bmp.ovh/imgs/2024/06/08/22963926e8adaf83.png
Dont forget to add procedure to stop flying,you know what to do.
More intuitive image
@Ivan_TheWorst
I never tried creating plugins. Honestly, never got interested on them. My hobbie is gameDev and modding. It should be easy since all my code is public only here in MCreator website. Whoever goes for it only need to add it as a tick update for the chestplate (but it can be assigned to any armor item). But I am more of a worldgen modder, only made the elytra changes since there was nothing for it.
Might give it a shot, but not soon.
@JEDIGD
That looks a lot like how it was done for 1.16.x, but please elaborate more on the topic.
Also, please add the Minecraft version you are using and the name of the plugin so we can recreate the process and make a functional tutorial for other Minecrafters.
That is done in 2023.4 forge 1.20.1. and I found it out,it's Snails' Plugin.
@__SK__
Oh, I meant not u... Your contribution already deserves respect, I don't ask u do more
(The same can be said about the Mcreator developers)
I meant, elitra already so much feels as part of game that... As if it should be in MCreator without any plugins. Maybe exists any difficulties for devs which u understand and can explain as a guy, who write this part of code.
But now after a while, I guess they have a lot of another technical incomprehensible work besides adding functionality. Something like support of neo-forge & addons. Most likely, this is how it is.
Anyway, I don't want to be rude to anyone, if I seems so - I'm sorry, English is not my native
I was wondering if you would be able to add a simple conditional to canElytraFly? I'm trying to use a player persistent logic variable to disable elytra flight. The name of the mod is Cosmic, and the variable's name is cosmicTouchIsActive. I tried this but it didn't work:
bump ^
The possible correct implementation depends on how the variable
cosmicTouchIsActive
is stored and accessed within theCosmic
mod.In Minecraft Forge, player-specific data is often handled through capabilities or directly accessing the player's
Entity
data. AssumingCosmicModVariables.PlayerVariables()
method should provide access to these variables, and it's implemented as a static method, you'll want to make sure that you're accessing the variable correctly for the specific player (entity
). Here's how you might correctly implement this functionality:CosmicModVariables
is accessible: This class should be imported or defined in your mod so that you can access the player variables.entity
is a player: Since you're dealing with player-specific variables, you need to ensure that theentity
is actually a player. This is important because other living entities like mobs can also trigger these checks.cosmicTouchIsActive
is stored in a capability or similar structure attached to the player, you might need to castentity
toPlayer
and then access the variable.The following is a "possible" revised version of your method:
import net.minecraft.world.entity.player.Player;
@Override
public boolean canElytraFly(ItemStack stack, LivingEntity entity) {
if (entity instanceof Player) {
Player player = (Player) entity;
// Assuming CosmicModVariables.PlayerVariables() requires a player instance to access the correct variables
CosmicModVariables.PlayerVariables playerVars = CosmicModVariables.PlayerVariables(player);
return playerVars.cosmicTouchIsActive;
}
return false;
}
Just in case:
CosmicModVariables
: You need to adjust how you accessCosmicModVariables.PlayerVariables()
. This method seems like it should either be a static method that requires aPlayer
entity or a method in another class that manages player data. Adjust this according to the actual implementation in theCosmic
mod.cosmicTouchIsActive
is a capability, you'll have to fetch it from the player using the appropriate method.This example assumes that you have a method to directly retrieve player-specific variables, which might not be the case. If
CosmicModVariables
handles things differently, you might need to adapt the example to fit the actual data structure and access methods used in theCosmic
mod.Thank you so much, it didn't quite work on the first try but I'll work with it, thank you for all the time you've put into this thread
If I wanted to make the elytra trigger if i pressed jump twice with a player-specific, would I just use the same thing you gave to PhatBoi but just swap true and false around, along with changing CosmicModVariables with (MyModID)ModVariables?
Does this code work for 2024.2?