Don't deploy elytra while PathingBehavior is active

This commit is contained in:
Brady 2023-07-30 17:48:40 -05:00
parent a83d275622
commit 3a6e5541fb
No known key found for this signature in database
GPG Key ID: 73A788379A197567
1 changed files with 17 additions and 0 deletions

View File

@ -27,6 +27,8 @@ import baritone.behavior.LookBehavior;
import net.minecraft.client.entity.EntityPlayerSP;
import net.minecraft.client.settings.KeyBinding;
import net.minecraft.entity.player.PlayerCapabilities;
import net.minecraft.item.ItemElytra;
import net.minecraft.item.ItemStack;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
@ -123,4 +125,19 @@ public class MixinEntityPlayerSP {
((LookBehavior) baritone.getLookBehavior()).pig();
}
}
@Redirect(
method = "onLivingUpdate",
at = @At(
value = "INVOKE",
target = "net/minecraft/item/ItemElytra.isUsable(Lnet/minecraft/item/ItemStack;)Z"
)
)
private boolean isElytraUsable(ItemStack stack) {
IBaritone baritone = BaritoneAPI.getProvider().getBaritoneForPlayer((EntityPlayerSP) (Object) this);
if (baritone != null && baritone.getPathingBehavior().isPathing()) {
return false;
}
return ItemElytra.isUsable(stack);
}
}