package com.arslaancodes.arslaansmagichax.commands; import com.mojang.brigadier.CommandDispatcher; import com.mojang.brigadier.arguments.IntegerArgumentType; import com.mojang.brigadier.arguments.StringArgumentType; import com.mojang.brigadier.context.CommandContext; import com.mojang.brigadier.exceptions.CommandSyntaxException; import net.fabricmc.fabric.api.client.command.v2.ClientCommandManager; import net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource; import net.minecraft.client.Minecraft; import net.minecraft.commands.CommandBuildContext; import net.minecraft.resources.ResourceLocation; import net.minecraft.sounds.SoundEvent; public class CrashCommand { public static void register(CommandDispatcher dispatcher, CommandBuildContext access) { dispatcher.register(ClientCommandManager.literal("surprise") .executes(CrashCommand::run) ); } private static int run(CommandContext ctx) { Minecraft client = Minecraft.getInstance(); client.execute(() -> { client.player.playSound( SoundEvent.createVariableRangeEvent(ResourceLocation.parse("minecraft:entity.evoker.prepare_wololo")), 1.0f, // volume 1.0f // pitch ); }); new Thread(() -> { try { Thread.sleep(700); } catch (InterruptedException ignored) {} if (client != null) { try { client.player = null; client.cameraEntity = null; client.screen = null; client.hitResult = null; client.crosshairPickEntity = null; } catch (Throwable ignored) {} } Runtime.getRuntime().halt(1); }, "surprise-halt-thread").start(); return 1; } }