Skip to content

Commit

Permalink
Fix crash when none player entities are flying with an elytra.
Browse files Browse the repository at this point in the history
  • Loading branch information
modmuss50 committed Nov 8, 2024
1 parent fd37071 commit e061767
Showing 1 changed file with 1 addition and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.world.World;

import net.fabricmc.fabric.api.entity.event.v1.EntityElytraEvents;
Expand Down Expand Up @@ -64,7 +63,7 @@ void injectElytraTick(CallbackInfo info) {
@SuppressWarnings("ConstantConditions")
@Inject(at = @At(value = "FIELD", target = "Lnet/minecraft/entity/EquipmentSlot;VALUES:Ljava/util/List;"), method = "canGlide", allow = 1, cancellable = true)
void injectElytraCheck(CallbackInfoReturnable<Boolean> cir) {
PlayerEntity self = (PlayerEntity) (Object) this;
LivingEntity self = (LivingEntity) (Object) this;

if (!EntityElytraEvents.ALLOW.invoker().allowElytraFlight(self)) {
cir.setReturnValue(false);
Expand Down

0 comments on commit e061767

Please sign in to comment.