/*
 * Decompiled with CFR 0.152.
 * 
 * Could not load the following classes:
 *  com.mojang.brigadier.arguments.DoubleArgumentType
 *  com.mojang.brigadier.builder.LiteralArgumentBuilder
 *  net.minecraft.class_1297
 *  net.minecraft.class_2172
 *  net.minecraft.class_2596
 *  net.minecraft.class_2828$class_2829
 *  net.minecraft.class_2828$class_5911
 *  net.minecraft.class_2833
 */
package meteordevelopment.meteorclient.commands.commands;

import com.mojang.brigadier.arguments.DoubleArgumentType;
import com.mojang.brigadier.builder.LiteralArgumentBuilder;
import meteordevelopment.meteorclient.commands.Command;
import net.minecraft.class_1297;
import net.minecraft.class_2172;
import net.minecraft.class_2596;
import net.minecraft.class_2828;
import net.minecraft.class_2833;

public class VClipCommand
extends Command {
    public VClipCommand() {
        super("vclip", "Lets you clip through blocks vertically.", new String[0]);
    }

    @Override
    public void build(LiteralArgumentBuilder<class_2172> builder) {
        builder.then(VClipCommand.argument("blocks", DoubleArgumentType.doubleArg()).executes(context -> {
            double blocks = (Double)context.getArgument("blocks", Double.class);
            int packetsRequired = (int)Math.ceil(Math.abs(blocks / 10.0));
            if (packetsRequired > 20) {
                packetsRequired = 1;
            }
            if (VClipCommand.mc.field_1724.method_5765()) {
                for (int packetNumber = 0; packetNumber < packetsRequired - 1; ++packetNumber) {
                    VClipCommand.mc.field_1724.field_3944.method_52787((class_2596)class_2833.method_65307((class_1297)VClipCommand.mc.field_1724.method_5854()));
                }
                VClipCommand.mc.field_1724.method_5854().method_5814(VClipCommand.mc.field_1724.method_5854().method_23317(), VClipCommand.mc.field_1724.method_5854().method_23318() + blocks, VClipCommand.mc.field_1724.method_5854().method_23321());
                VClipCommand.mc.field_1724.field_3944.method_52787((class_2596)class_2833.method_65307((class_1297)VClipCommand.mc.field_1724.method_5854()));
            } else {
                for (int packetNumber = 0; packetNumber < packetsRequired - 1; ++packetNumber) {
                    VClipCommand.mc.field_1724.field_3944.method_52787((class_2596)new class_2828.class_5911(true, VClipCommand.mc.field_1724.field_5976));
                }
                VClipCommand.mc.field_1724.field_3944.method_52787((class_2596)new class_2828.class_2829(VClipCommand.mc.field_1724.method_23317(), VClipCommand.mc.field_1724.method_23318() + blocks, VClipCommand.mc.field_1724.method_23321(), true, VClipCommand.mc.field_1724.field_5976));
                VClipCommand.mc.field_1724.method_5814(VClipCommand.mc.field_1724.method_23317(), VClipCommand.mc.field_1724.method_23318() + blocks, VClipCommand.mc.field_1724.method_23321());
            }
            return 1;
        }));
    }
}

