Skip to content

Compat with 1.21.4#20

Merged
InLieuOfLuna merged 2 commits intoInLieuOfLuna:masterfrom
KealJones:upgrade-1.21.4
Mar 22, 2025
Merged

Compat with 1.21.4#20
InLieuOfLuna merged 2 commits intoInLieuOfLuna:masterfrom
KealJones:upgrade-1.21.4

Conversation

@KealJones
Copy link
Contributor

Get compatibility with 1.21.4. It has a new Gliding mechanic that replaces FallFlying and some other basic api changes but overall the logic is mostly the same. I left some comments in this PR for a few areas.

It seems that my changes are slightly less efficient and don't work with Meteor's ElytraFly "bounce" mode but for casual play it works perfectly well... It works better on a server than in single player because of the addition of minor lag on servers, I assume. Something about the last tick before hitting the ground id think.

I am by no means an expert in fabric modding or java so anyone that can figure it out feel free to branch off this or do your own thing. <3

public static boolean checkFallFlyingIgnoreGround(ClientPlayerEntity player) {
if (!player.isTouchingWater() && !player.hasStatusEffect(StatusEffects.LEVITATION)) {
var itemStack = player.getEquippedStack(EquipmentSlot.CHEST);
if (itemStack.isOf(Items.ELYTRA) && ElytraItem.isUsable(itemStack)) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

ElytraItem is gone I didn't try hard to find a replacement for the ElytraItem.isUsable call removing it seemed fine enough.

Copy link
Owner

Choose a reason for hiding this comment

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

I'm going to merge this, though will add LivingEntity.canGlideWith(itemStack, EquipmentSlot.CHEST) after, ensuring the elytra is usable is useful for stopping packets being sent trying to glide when elytra breaks.


@SuppressWarnings("ConstantConditions")
@Inject(method = "tickFallFlying", at = @At("TAIL"))
@Inject(method = "tickMovement", at = @At("TAIL"))
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The is a tickGliding that replaced tickFallFlying but it doesn't work at all as you never get a gliding tick that would have isGliding as false. So I opted for tickMovement which seems to work but is obviously far less efficient.

Copy link
Owner

Choose a reason for hiding this comment

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

This is fine, and was the way I was using previously

Copy link
Owner

@InLieuOfLuna InLieuOfLuna left a comment

Choose a reason for hiding this comment

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

lgtm

public static boolean checkFallFlyingIgnoreGround(ClientPlayerEntity player) {
if (!player.isTouchingWater() && !player.hasStatusEffect(StatusEffects.LEVITATION)) {
var itemStack = player.getEquippedStack(EquipmentSlot.CHEST);
if (itemStack.isOf(Items.ELYTRA) && ElytraItem.isUsable(itemStack)) {
Copy link
Owner

Choose a reason for hiding this comment

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

I'm going to merge this, though will add LivingEntity.canGlideWith(itemStack, EquipmentSlot.CHEST) after, ensuring the elytra is usable is useful for stopping packets being sent trying to glide when elytra breaks.


@SuppressWarnings("ConstantConditions")
@Inject(method = "tickFallFlying", at = @At("TAIL"))
@Inject(method = "tickMovement", at = @At("TAIL"))
Copy link
Owner

Choose a reason for hiding this comment

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

This is fine, and was the way I was using previously

@InLieuOfLuna InLieuOfLuna self-assigned this Mar 22, 2025
@InLieuOfLuna InLieuOfLuna merged commit 499b0ae into InLieuOfLuna:master Mar 22, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants