Skip to content

Feature: AutoElytraSwap#305

Merged
beanbag44 merged 7 commits into
1.21.11from
feature/auto-elytra-swap
Jun 24, 2026
Merged

Feature: AutoElytraSwap#305
beanbag44 merged 7 commits into
1.21.11from
feature/auto-elytra-swap

Conversation

@beanbag44

Copy link
Copy Markdown
Member

Automatically swaps the users elytra when attempting to glide. This isn't just for standard flying either, it swaps to chestplate for fake fly, and has a couple extra settings. ElytraFly Only, so it won't swap your chestplate/elytra when regularly jumping and attempting to glide, and a glide delay to only start gliding after a certain amount of time post-swapping.

@PoTheMagicDragon PoTheMagicDragon left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know enough about elytra logic to comment on that, so my comments are all naming/ code structure related


var overriddenElytraPriority: Boolean? = null

val SORTER = compareByDescending<Slot> {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Normally I'd only make constants all upper case

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think it also applies to constant-style values, as long as theyre completely immutable. In the example you sent me, it included regex too which you cant use const on either

val new = swappable.find { new ->
equipped.canInsert(new.stack) && sorter.compare(equipped, new) > 0
} ?: return@forEach
fun SafeContext.tick() {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should there be an elytra manager instead of having auto armor, auto elytra swap, & elytra fly all tangled together?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah youre right. I never meant for AutoElytraSwap to end up handling so much, it kind of just happened and i didnt really think too much about moving it out. I'll make an ElytraHandler object somewhere

@JvmStatic val elytraFlyOnly by setting("ElytraFly Only", false, "Only swaps the chest piece when the ElytraFly module is enabled and gliding")
private val glideDelay by setting("Glide Delay", 0, 0..20, 1, "The delay, in ticks, between swapping to elytra, and starting to glide", unit = " ticks")

val ELYTRA_SELECTION =

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same thing about constants and case

isItem(Items.ELYTRA)
.and { it.damage < it.maxDamage }
}
val CHESTPLATE_SELECTION =

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same thing about constants and case


const val FAKE_PLAYER_ID = -2024-4-20
object PlayerUtils {
const val FAKE_PLAYER_ID = -2024-4-20

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like having these put into a class instead of free floating in a file

@PoTheMagicDragon

Copy link
Copy Markdown
Contributor

Looks good now

@beanbag44 beanbag44 merged commit ea9c3fc into 1.21.11 Jun 24, 2026
@github-project-automation github-project-automation Bot moved this from Backlog to Done in Kanban Jun 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants