Conversation
| 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)) { |
There was a problem hiding this comment.
ElytraItem is gone I didn't try hard to find a replacement for the ElytraItem.isUsable call removing it seemed fine enough.
There was a problem hiding this comment.
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")) |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
This is fine, and was the way I was using previously
| 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)) { |
There was a problem hiding this comment.
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")) |
There was a problem hiding this comment.
This is fine, and was the way I was using previously
Get compatibility with 1.21.4. It has a new
Glidingmechanic that replacesFallFlyingand 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