/*
 * Decompiled with CFR 0.152.
 * 
 * Could not load the following classes:
 *  com.google.common.collect.Streams
 *  meteordevelopment.orbit.EventHandler
 *  net.minecraft.class_1297
 *  net.minecraft.class_238
 */
package meteordevelopment.meteorclient.systems.modules.movement;

import com.google.common.collect.Streams;
import java.util.stream.Stream;
import meteordevelopment.meteorclient.events.world.TickEvent;
import meteordevelopment.meteorclient.settings.DoubleSetting;
import meteordevelopment.meteorclient.settings.Setting;
import meteordevelopment.meteorclient.settings.SettingGroup;
import meteordevelopment.meteorclient.systems.modules.Categories;
import meteordevelopment.meteorclient.systems.modules.Module;
import meteordevelopment.orbit.EventHandler;
import net.minecraft.class_1297;
import net.minecraft.class_238;

public class Parkour
extends Module {
    private final SettingGroup sgGeneral;
    private final Setting<Double> edgeDistance;

    public Parkour() {
        super(Categories.Movement, "parkour", "Automatically jumps at the edges of blocks.");
        this.sgGeneral = this.settings.getDefaultGroup();
        this.edgeDistance = this.sgGeneral.add(((DoubleSetting.Builder)((DoubleSetting.Builder)new DoubleSetting.Builder().name("edge-distance")).description("How far from the edge should you jump.")).range(0.001, 0.1).defaultValue(0.001).build());
    }

    @EventHandler
    private void onTick(TickEvent.Post event) {
        if (!this.mc.field_1724.method_24828() || this.mc.field_1690.field_1903.method_1434()) {
            return;
        }
        if (this.mc.field_1724.method_5715() || this.mc.field_1690.field_1832.method_1434()) {
            return;
        }
        class_238 box = this.mc.field_1724.method_5829();
        class_238 adjustedBox = box.method_989(0.0, -0.5, 0.0).method_1009(-this.edgeDistance.get().doubleValue(), 0.0, -this.edgeDistance.get().doubleValue());
        Stream blockCollisions = Streams.stream((Iterable)this.mc.field_1687.method_20812((class_1297)this.mc.field_1724, adjustedBox));
        if (blockCollisions.findAny().isPresent()) {
            return;
        }
        this.mc.field_1724.method_6043();
    }
}

