/*
 * Decompiled with CFR 0.152.
 * 
 * Could not load the following classes:
 *  com.llamalad7.mixinextras.injector.wrapoperation.Operation
 *  com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation
 *  net.minecraft.class_1297
 *  net.minecraft.class_1536
 *  org.spongepowered.asm.mixin.Mixin
 *  org.spongepowered.asm.mixin.injection.At
 */
package meteordevelopment.meteorclient.mixin;

import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
import meteordevelopment.meteorclient.MeteorClient;
import meteordevelopment.meteorclient.systems.modules.Modules;
import meteordevelopment.meteorclient.systems.modules.movement.Velocity;
import net.minecraft.class_1297;
import net.minecraft.class_1536;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;

@Mixin(value={class_1536.class})
public abstract class FishingBobberEntityMixin {
    @WrapOperation(method={"method_5711"}, at={@At(value="INVOKE", target="Lnet/minecraft/class_1536;method_6954(Lnet/minecraft/class_1297;)V")})
    private void preventFishingRodPull(class_1536 instance, class_1297 entity, Operation<Void> original) {
        Velocity velocity;
        if (!instance.method_73183().method_8608() || entity != MeteorClient.mc.field_1724) {
            original.call(new Object[]{instance, entity});
        }
        if (!(velocity = Modules.get().get(Velocity.class)).isActive() || !velocity.fishing.get().booleanValue()) {
            original.call(new Object[]{instance, entity});
        }
    }
}

