From 4db988dbefe819d628f5e5ea75b6514fa3af5181 Mon Sep 17 00:00:00 2001 From: rfresh2 <89827146+rfresh2@users.noreply.github.com> Date: Sun, 24 Sep 2023 15:34:59 -0700 Subject: [PATCH] fix forge mixin crash --- .../launch/mixins/MixinClientPlayerEntity.java | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/launch/java/baritone/launch/mixins/MixinClientPlayerEntity.java b/src/launch/java/baritone/launch/mixins/MixinClientPlayerEntity.java index 4674ffaa6..24e807f62 100644 --- a/src/launch/java/baritone/launch/mixins/MixinClientPlayerEntity.java +++ b/src/launch/java/baritone/launch/mixins/MixinClientPlayerEntity.java @@ -26,8 +26,6 @@ import net.minecraft.client.KeyMapping; import net.minecraft.client.player.LocalPlayer; import net.minecraft.world.entity.player.Abilities; -import net.minecraft.world.item.ElytraItem; -import net.minecraft.world.item.ItemStack; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; @@ -112,14 +110,14 @@ private void updateRidden(CallbackInfo cb) { method = "aiStep", at = @At( value = "INVOKE", - target = "net/minecraft/world/item/ElytraItem.isFlyEnabled(Lnet/minecraft/world/item/ItemStack;)Z" + target = "Lnet/minecraft/client/player/LocalPlayer;tryToStartFallFlying()Z" ) ) - private boolean isFlyEnabled(ItemStack stack) { - IBaritone baritone = BaritoneAPI.getProvider().getBaritoneForPlayer((LocalPlayer) (Object) this); + private boolean tryToStartFallFlying(final LocalPlayer instance) { + IBaritone baritone = BaritoneAPI.getProvider().getBaritoneForPlayer(instance); if (baritone != null && baritone.getPathingBehavior().isPathing()) { return false; } - return ElytraItem.isFlyEnabled(stack); + return instance.tryToStartFallFlying(); } }