Skip to content

Commit

Permalink
fix: elytra activating in lava
Browse files Browse the repository at this point in the history
closes #11
  • Loading branch information
brooke-ec committed Feb 15, 2024
1 parent 118bbe0 commit d3476d7
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import org.spongepowered.asm.mixin.Unique;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.Redirect;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

import java.util.ArrayList;
Expand All @@ -35,6 +36,12 @@ public LocalPlayerMixin(ClientLevel clientLevel, GameProfile gameProfile) {
super(clientLevel, gameProfile);
}

// See https://github.com/NimajnebEC/auto-elytra/issues/11
@Redirect(method = "aiStep", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/player/LocalPlayer;onClimbable()Z"))
private boolean patchLavaFlight(LocalPlayer instance) {
return onClimbable() || isInLava();
}

@Inject(method = "aiStep", at = @At(value = "INVOKE", shift = At.Shift.BEFORE, target = "Lnet/minecraft/client/player/LocalPlayer;getItemBySlot(Lnet/minecraft/world/entity/EquipmentSlot;)Lnet/minecraft/world/item/ItemStack;"))
private void tryEquipElytra(CallbackInfo ci) {
if (!Configuration.AUTO_EQUIP_ENABLED.get()) return;
Expand Down

0 comments on commit d3476d7

Please sign in to comment.