小游戏hh

mc

poki

bilibili

sandspiel

mc

#include<bits/stdc++.h>
#include<windows.h> 
#include<io.h>
#include <conio.h>
#include <iostream>
#include <sys/stat.h>
#include <windows.h>
#include <tlhelp32.h>
#include <tchar.h>
#include <stdio.h>
#include <io.h>
#define KEY_DOWN(VK_NONAME) ((GetAsyncKeyState(VK_NONAME) & 0x8000) ? 1:0)  //用来检测按键的点击事件
using namespace std;

void cp(const char* s, int front_color, int back_color) {
	HANDLE handle = GetStdHandle(STD_OUTPUT_HANDLE);
	SetConsoleTextAttribute(handle, BACKGROUND_INTENSITY | back_color*16 | FOREGROUND_INTENSITY | front_color);
	printf(s);
	SetConsoleTextAttribute(handle, FOREGROUND_INTENSITY | 7);
}
BOOL CALLBACK EnumWindowsProc(HWND hwnd, LPARAM lParam) {
	std::vector<char>* window_names = reinterpret_cast<std::vector<char>*>(lParam);
	char buffer[MAX_PATH];
	GetWindowText(hwnd, buffer, MAX_PATH);
	window_names->insert(window_names->end(), buffer, buffer + strlen(buffer));
	window_names->push_back('\n');
	return TRUE;
}
POINT p;
HANDLE hOutput = GetStdHandle(STD_OUTPUT_HANDLE);
HWND h = GetForegroundWindow();
CONSOLE_FONT_INFO consoleCurrentFont;

void cls(int x=0,int y=0) {
	COORD CScreen = {x,y};
	SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), CScreen);
}
void HideCursor() {
	CONSOLE_CURSOR_INFO cursor_info = {1, 0};
	SetConsoleCursorInfo(GetStdHandle(STD_OUTPUT_HANDLE), &cursor_info); 
}
 

bool e (const std::string& name) {
	struct stat buffer;   
	return (stat (name.c_str(), &buffer) == 0); 
}
int main() {
	
	HWND hwnd = GetForegroundWindow();
	HideCursor();
	system("mode 85,22"); 
	cls();
	int sfd;
	sfd=dup(STDOUT_FILENO);  //保存屏幕输出的文件描述符,用于恢复
	
	Sleep(100);
	cls();
	system("cls");
	cls();
	
	system("color F3");
	cout<<"\n\n\n\n\n\n\n\n\n";
	
	system("color F3");
	cp("                           ",15,15);cp("|WARING                |",4,1);cout<<endl;
	cp("                           ",15,15);cp("|  请输入你的名字      |",7,1);cout<<endl;
	cp("                           ",15,15);cp("|                      |",7,1);cls(31,11);
	
	if(!e("D:\\cmcl.json")){
		string a;
		cin>>a;
		freopen("D:\\cmcl.json","w",stdout);
		cout<<"{"<<endl;
		cout<<"  \"exitWithMinecraft\": false,"<<endl;
		cout<<"  \"javaPath\": \"C:\\\\Program Files\\\\Microsoft\\\\jdk-21.0.1.12-hotspot\\\\bin\\\\java.exe\","<<endl;
		cout<<"  \"windowSizeWidth\": 854,"<<endl;
		cout<<"  \"windowSizeHeight\": 480,"<<endl;
		cout<<"  \"language\": \"zh\","<<endl;
		cout<<"  \"downloadSource\": 0,"<<endl;
		cout<<"  \"checkAccountBeforeStart\": false,"<<endl;
		cout<<"  \"accounts\": [{"<<endl;
		cout<<"    \"playerName\": \""<<a<<"\","<<endl;
		cout<<"    \"loginMethod\": 0,"<<endl;
		cout<<"    \"selected\": true"<<endl;
		cout<<"  }],"<<endl;
		cout<<"  \"printStartupInfo\": false,"<<endl;
		cout<<"  \"maxMemory\": 4096"<<endl;
		cout<<"}";
		
		freopen("CON","w",stdout);
		dup2(sfd,STDOUT_FILENO);  // 还原屏幕输出默认文件描述符指向
	}
	system("cls");
	cout<<"\n\n\n\n\n\n\n\n\n";
	system("cls");
	system("color F3");
	cout<<"NBS 调试日志...\n";
	if(!e("C:\\Program Files\\Microsoft\\jdk-21.0.1.12-hotspot\\bin\\java.exe")){
		system("curl -O \"https://download.visualstudio.microsoft.com/download/pr/47a973b7-eea0-4315-812d-c7508194af37/873834ce90b234a42cd27284c552ab35/microsoft-jdk-21.0.1-windows-x64.msi\"");
		system("microsoft-jdk-21.0.1-windows-x64.msi /passive");
		system("del microsoft-jdk-21.0.1-windows-x64.msi");
	}
	system("cls");
	system("color F3");
	cout<<"Java检测完毕\n";
	if(!e("D:\\.minecraft\\versions\\1.20.1")){
		system("powershell Start-BitsTransfer -Source \\\"https://gitee.com/MrShiehX/console-minecraft-launcher/releases/download/2.2.1/cmcl.exe\\\" -Destination \\\"D:\\\\cmcl.exe\\\"");
		system("powershell Start-BitsTransfer -Source \\\"https://gitee.com/lyf202201/image/raw/main/a.zip\\\" -Destination \\\"D:\\\\fk.zip\\\"");
		cout<<endl;
		system("powershell Expand-Archive -Path D:\\\\fk.zip -DestinationPath D:\\");
		system("cd /d D:\\ && cmcl install 1.20.1 --forge=47.2.20 --optifine=HD_U_I6 -t=2048");	
		system("cd /d D:\\ && cmcl mod --url=https://cdn.modrinth.com/data/ordsPcFz/versions/9j6YaPp2/kotlinforforge-4.10.0-all.jar");
		system("cd /d D:\\ && cmcl mod --url=https://cdn.modrinth.com/data/qANg5Jrr/versions/bFG2YxbQ/e4mc-4.0.1%2B1.19.4-forge.jar");
		system("cd /d D:\\ && cmcl mod --url=https://cdn.modrinth.com/data/RTWpcTBp/versions/70dnR0Rh/mcwifipnp-1.6.9-1.20.1-forge.jar");
		
	}
	if(!e("D:\\UI.exe")){
		system("powershell Start-BitsTransfer -Source \\\"https://gitee.com/lyf202201/image/releases/download/L/New%20App%201_Win64.exe\\\" -Destination \\\"D:\\\\UI.exe\\\"");
	}
	cout<<"Minecraft 检测完毕\n";
	system("cls");
//	freopen("d:\\a.cmd","w",stdout);
	system("powershell \\\"cd /d d:\\\\ && cmcl account --skin=steve && d:\\\\cmcl 1.20.1 && exit\\\" >> d:\\a.cmd");
//	fclose(stdout);
	system("start /min D:\\a.cmd");
	system("start D:\\UI.exe");
	Sleep(500);
	if (hwnd) {
		ShowWindow(hwnd, SW_HIDE);
	}
	dup2(sfd,STDOUT_FILENO);  // 还原屏幕输出默认文件描述符指向
	
	while(1){
		std::vector<char> window_names;
		EnumWindows(EnumWindowsProc, reinterpret_cast<LPARAM>(&window_names));
		std::string all_window_names(window_names.data());
		std::string substr = "Minecraft";
//		system("cls");
		if (all_window_names.find(substr) != std::string::npos) {
			std::cout << "Minecraft 运行中 "  << std::endl;
			system("taskkill /im ui.exe");
			return 0;
		} else {
//			std::cout << "不在运行 " << substr << std::endl;
		}
		Sleep(1000);
	}
	return 0; 
} 

  • 3
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值