一、云主机搭建MC服务器的准备工作
1、选择合适的云主机服务商:你需要选择一个可靠的云主机服务商,如阿里云、腾讯云、华为云等,这些服务商都提供了丰富的云主机产品线,可以根据你的需求选择合适的配置。

2、购买云主机:在选择好云主机服务商后,你需要购买一台云主机,购买时需要注意云主机的配置、价格、操作系统等因素,对于搭建Minecraft(MC)服务器,建议选择至少1核2G内存、10G硬盘的配置。
3、安装操作系统:购买好云主机后,需要在云主机上安装操作系统,推荐使用Linux系统,如Ubuntu、CentOS等,安装好操作系统后,需要配置网络、防火墙等相关设置。
4、下载并安装Minecraft:在云主机上打开终端,输入以下命令下载并安装Minecraft:

wget https://launcher.mojang.com/v1/objects/c762b8b6a69d5e3bd4f6a8e1a8e7e5e8b5c5d7a7/server.jar
5、安装Forge:Minecraft Forge是一个开源的MOD开发工具包,用于创建和管理Minecraft的扩展插件,在Minecraft官网下载Forge压缩包,然后将其上传到云主机上,解压后,将forge-installer.jar和forge-libraries.zip放入Minecraft的mods文件夹中。
二、配置Minecraft服务器
1、修改Minecraft启动脚本:在Minecraft的mods文件夹中,找到minecraft.sh文件,用文本编辑器打开,在文件末尾添加以下内容,用于设置游戏难度、地图生成策略等参数:
#!/bin/bash java -Xmx1024M -Xms1024M -XX:+UseG1GC -XX:MaxGCPauseMillis=20 -jar server.jar nogui --username "你的用户名" --password "你的密码" --createWorldStartLocation m=10000+3000+4000 --resourcePack "资源包路径" --mapTemplateFile template.txt --allowDownload false --generateStructures true --enableCommands false --querySpawnIndex false --maxPlayers 10 --spawnNpcs false --useEmotes false --useCommandBlock true --addStoredWorldProperties "gametype=SURVIVAL" --spawnAnimals true --spawnDolphins true --spawnMonsters true --spawnSheep true --spawnVillagers true --spawnEnderman false --spawnFoxes true --spawnWitches false --spawnMobCreepers false --spawnMobs false --pvp false --logOffset 0 --levelType "DEFAULT" --difficulty "NORMAL"
注意替换其中的参数值,如用户名、密码、资源包路径等。

2、修改Forge配置文件:在Minecraft的mods文件夹中,找到forge-installer.jar文件,用文本编辑器打开,在文件中找到以下内容:
<property name="game_directory">${appid}.${version}.${update_version}</property>
<property name="game_version">${appid}.${version}.${update_version}</property>
<property name="main_class">net.minecraft.server.Main</property>
将其中的appid、version、update_version替换为实际的值,如果你的Minecraft版本是1.6.5,可以将其替换为:
<property name="game_directory">minecraft1.6.5.${version}.${update_version}</property>
<property name="game_version">minecraft1.6.5.${version}.${update_version}</property>
<property name="main_class">net.minecraft.server.Main</property>
3、启动Minecraft服务器:在Minecraft的mods文件夹中,找到forge-installer.jar文件,双击运行,稍等片刻,Minecraft服务器就会启动,启动成功后,你会看到类似以下的输出信息:
```bash
Using configuration file: c:\Users\你的用户名\AppData\Roaming\.minecraft\minecraftserver\1.6.5profiles\default\server.cfg
Using custom resourcepack: c:\Users\你的用户名\AppData\Roaming\.minecraft\mods\resourcepacks\你的资源包名称.zip (added automatically)
Starting integrated minecraft server version 16 for Java edition (build 14)
Using eula=false
Server signed on as [你的用户名] using password of [你的密码]
Preloading levels......Done! (took 0 ms)
Generating map......Done! (took 23 ms) (using up memory: 5% used, 378MB total) (using up disk: 2% used, 39GB available) Done! (took 23 ms) (using up memory: 5% used, 378MB total) (using up disk: 2% used, 39GB available) Done! (took 23 ms) (using up memory: 5% used, 378MB total) (using up disk: 2% used, 39GB available) Done! (took 23 ms) (using up memory: 5% used, 378MB total) (using up disk: 2% used, 39GB available) Done! (took 23 ms) (using up memory: 5% used, 378MB total) (using up disk: 2% used, 39GB available) Done! (took 23 ms) (using up memory: 5% used, 378MB total) (using up disk: 2% used, 39GB available) Done! (took 23 ms) (using up memory: 5% used, 378MB total) (using up disk: 2% used, 39GB available) Done! (took 23 ms) (using up memory: 5% used, 378MB total) (using up disk: 2% used, 39GB available) Done! (took 23 ms) (using up memory: 5% used, 378MB total) (using up disk: 2% used, 39GB available) Done! (took 23 ms) (using up memory: 5% used, 378MB total) (using up disk: 2% used, 39GB available) Done! (took 23 ms) (using up memory: 5% used, 378MB total) (using up disk: 2% used, 39GB available) Done! (took 23 ms) (using up memory: 5% used, 378MB total) (using up disk: 2% used, 39GB available) Done! (took 23 ms) (using up memory: 5% used, 378MB total) (using up disk: 2% used, 39GB available) Done! (took 23 ms) Starting integrated minecraft server version for Java edition (build Bukkit v1_14_R1-R0). Using eula=true Server signed on as [你的用户名] using password of [你的密码] Preloading levels......Done! (took XX ms) ...StartingIntegratedServer[s] ...Done! Using eula=true Server signed on as [你的用户名] using password of [你的密码] Preloading levels......Done! (took XX ms).......StartingIntegratedServer[s] ...Done! Using eula=true Server signed on as [你的用户名] using password of [你的密码] Preloading levels......Done! (took XX ms).......StartingIntegratedServer[s] ...Done! Using eula=true Server signed on as [你的用户名] using password of [你的密码] Preloading levels......Done! (took XX ms).......StartingIntegratedServer[s] ...Done! Using eula=true Server signed on as [你的用户名] using password of [你的密码] Preloading levels......Done! (took XX ms).......StartingIntegratedServer[s] ...Done! Using eula=true Server signed on as [你的用户名] using password of [你的密码] Preloading levels......Done! (took XX ms).......StartingIntegratedServer[s] ...Done! Using eula=true Server signed on as [你的用户名] using password of [你的密码] Preloading levels......Done! (took XX ms).......StartingIntegratedServer[s] ...Done! Using eula=true Server signed on as [你的用户名] using password of [你的密码] Pre