[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

Last seen on 13:47, 17. Jul 2024
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
Last seen on 00:04, 14. Jul 2024
Joined Jan 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Wow this topic started to…
Wed, 06/05/2024 - 14:32

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

Last seen on 07:45, 17. Jul 2024
Joined Sep 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Good tutorial but I want to…
Sat, 06/08/2024 - 09:08

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.

Last seen on 07:45, 17. Jul 2024
Joined Sep 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
More intuitive image
Sat, 06/08/2024 - 09:11

More intuitive image

Last seen on 13:47, 17. Jul 2024
Joined May 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
@Ivan_TheWorst I never tried…
Sun, 06/09/2024 - 05:25

@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.

Last seen on 13:47, 17. Jul 2024
Joined May 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
@JEDIGDThat looks a lot like…
Sun, 06/09/2024 - 05:33

@JEDIGD

That looks a lot like how it was done for 1.16.x, but please elaborate more on the topic.

Last seen on 13:47, 17. Jul 2024
Joined May 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Also, please add the…
Sun, 06/09/2024 - 05:36

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.

Last seen on 07:45, 17. Jul 2024
Joined Sep 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
That is done in 2023.4 forge…
Sun, 06/09/2024 - 07:04

That is done in 2023.4 forge 1.20.1. and I found it out,it's Snails' Plugin.

Last seen on 00:04, 14. Jul 2024
Joined Jan 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
@__SK__ Oh, I meant not u…
Sun, 06/09/2024 - 14:05

@__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

Last seen on 08:52, 14. Jul 2024
Joined Jul 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I was wondering if you would…
Sat, 06/22/2024 - 23:10

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:

      @Override
public boolean canElytraFly(ItemStack stack, LivingEntity entity) {
if (((CosmicModVariables.PlayerVariables())).cosmicTouchIsActive == true) {
return true;
} else {
return false;
}
}
 
Last seen on 08:52, 14. Jul 2024
Joined Jul 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
bump ^
Mon, 07/08/2024 - 00:57

bump ^

Last seen on 13:47, 17. Jul 2024
Joined May 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
The possible correct…
Mon, 07/08/2024 - 12:52

The possible correct implementation depends on how the variable cosmicTouchIsActive is stored and accessed within the Cosmic mod.

In Minecraft Forge, player-specific data is often handled through capabilities or directly accessing the player's Entity data. Assuming CosmicModVariables.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:

  1. Ensure that CosmicModVariables is accessible: This class should be imported or defined in your mod so that you can access the player variables.
  2. Check if the entity is a player: Since you're dealing with player-specific variables, you need to ensure that the entity is actually a player. This is important because other living entities like mobs can also trigger these checks.
  3. Access the player-specific variable correctly: Assuming cosmicTouchIsActive is stored in a capability or similar structure attached to the player, you might need to cast entity to Player 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:

  • Check Imports: Make sure that all the required classes are properly imported.
  • Handling CosmicModVariables: You need to adjust how you access CosmicModVariables.PlayerVariables(). This method seems like it should either be a static method that requires a Player entity or a method in another class that manages player data. Adjust this according to the actual implementation in the Cosmic mod.
  • Capability Check: If 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 the Cosmic mod.

Last seen on 08:52, 14. Jul 2024
Joined Jul 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Thank you so much, it didn't…
Tue, 07/09/2024 - 03:26

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