A project for deployment of minecraft game.
Project description
OrzMC
A tool for deploying minecraft client and server
Only supports Python >=2.7, <4
Requires JDK 1.8 to be configured, not higher than this version, becuase forge cannot run on higher jdk versions such as 1.12!
If you not a CLI enthusiast, you can download HMCL
Client Launcher: https://hmcl.huangyuhui.net or https://github.com/huanghongxun/HMCL/releases, which is beautiful、flexable and powerful. But this tools also can be used deploy server on your Cloud Host which run Unix-like OS.
Supported Minecraft Client Version
-
supports versions of client
>= 1.13
-
you should make sure the version of the minecraft server that you will connect to is the same as that of the client.
-
This Program has been uploaded into PyPI
Supported Operating System
- mainly for MacOS and Linux required
JRE >= 1.8
andGit
installed.
Usage
Installation
$ pip install orzmc
execute orzmc -h
in shell to check the help info about this python CLI
tool
What You Can Do
- Run Minecraft Client Downloaded From Mojang Office API
- Deploy Minecraft Server on your own Clound Manchine
- Backup world for your minecraft server
- ForceUpgrade your world from old version to newer
Run Client
run the pure client normally with latest version and default username
$ pip install orzmc
$ orzmc
if you know the client version and your username
$ pip install orzmc
$ orzmc -v 1.14.2 -u player_name
you can also run the forge client
$ pip install orzmc
$ orzmc -t forge
Deploy Server
use default setting to deploy the pure server
default set jvm initial memory alloc 512M
, and max memory alloc 2G
$ pip install orzmc
$ orzmc -s
you can specify the initial memory and max memory alloced for the jvm with options -s
and -x
to run the minecraft server
$ pip install orzmc
$ orzmc -s -m 512M -x 2G -v 1.14.2
you can also deploy the spigot/forge minecraft server with option -t
Spigot Server
you should installed jre
and git
tools before you run commands below.
$ pip install orzmc
$ orzmc -s -t spigot -m 512M -x 1G -v 1.14.2
Forge Server
$ pip install orzmc
$ orzmc -s -t forge -m 512M -x 1G -v 1.14.2
由于Forge包是用JDK 8编译的,所以建安装的JDK环境为JDK8系统,不要太高,目前不兼容,会出现无法部署Forge服务器的情况。
The game resources are saved under user's home directory, and named .minecraft
This is not a game for one player, so you should invit someone you like to make you guys own beautiful world!!!
TODO List
- fire an weixin public account and group for uses get newest information and communicate with each other
- implement RCON Protocol for remote control Minecraft Server
- refine the project script for readable
- automation the process of installing JDK/JRE Runtime
- add some unit test case to guarantee quality
- use BMCLAPI to boost client download speed
- refactor project for extension
- publish wechat Emoticon
Done List
- add Paper Server deploy option
- add Spigot Server deploy option
- add a homepage for this project
- support forge client and server on MacOS, Yep!!!🤪
- backup your world map files
- use Optfine to lauch client
Reference
- Paper
- SpigotMC
- Bukkit
- Sponge
- Minecraft Forge
- Optifine
- CurseForge(最新版的相关资源下载的最好的地方)
- Minecraft 中文资源站(老旧版的资源下载站,不需要翻墙)
- Minecraft 中文百科
- Minecraft 官方Wiki
- Minecraft 微软官方
- Minecraft 网易官方
- Query协议
- RCON协议
- Server List Ping协议
- Minecraft官方Bug报告和查询
- Minecraft通过皮肤生成墙纸网站
Tips
- 制作资源包,压缩是要在assets同级目录选择所有文件,而不是在父目录下压缩, 先进入
assets
目录下面, 再执行指令zip -r resourcepack.zip ./*
生成压缩文件, 可以导出作为资源包使用. 查看资源包的SHA-1
值使用:echo -e "SHA-1: " "$(shasum -b resourcepack.zip | cut -d ' ' -f 1)"
- 使用query协议查询服务器状态需要用到UDP协议,所以在云服务器上部署需要允许这个协议访问对应的端口
关于Mac上玩时,无线网络总是断开重连的总题解决方案
这个可能是因为网络问题, minecraft的bug列表中可以搜索到这个问题: MC-98598,提供了解决方案: JVM启动参数中指定使用IPv4
: -Djava.net.preferIPv4Stack=true
测试你的服务器可以支持几个玩家同时在线
安装服务器网速测试工具speedtest-cli
, 并测速:
$ pip install speedtest-cli
$ speedtest-cli
将得到的上下行网速填入下面网址对应页面的区域时, 并将服务器的内存大小也填入, 开始计算即可
Spigot服务器支持将低版本游戏的地图更新到新版本
只需要在启动命令中添加 --forceUpgrade
选项,启动一次服务器地图更新后,启动服务器就不需要添加这个选项了。
Spigot的地图文件有三个目录:
world
对应纯净服的主世界地图目录:world
world_nether
对应纯净服的下界地图:world/DIM-1
world_the_end
对应纯净服的末路之地地图:world/DIM1
从纯净服迁移到Spigot服时,将对应文件夹复制到对应目录下,重启服务即可完成地图迁移。
为服务器添加自定义图标
在服务端jar
文件同一级目录下面, 放置命名为server-icon.png
尺寸为64x64
的png
图片,然后重新启动服务端。之后再用客户端连接时, 就会把自定义的64x64
的图片展示在服务端列表里.
添加自定义音乐播放
mp3转ogg指令: ffmpeg -i origin.mp3 -map 0:a:0 output.ogg
资源包目录定义:
├── assets
│ └── minecraft
│ ├── sounds
│ │ └── music
│ │ └── joker
│ │ └── joker.ogg
│ ├── sounds.json
│ └── textures
│ └── entity
│ ├── alex.png
│ └── steve.png
├── pack.mcmeta
└── pack.png
只需要在minecraft
目录下创建sounds
目录,用来存放声音文件ogg
格式, 并且要确保播放的声音通道是音频通道的第一个通道. 然后创建同目录级别的sounds.json
文件, 用来定义声音文件和游戏中声音事件的对应关系.
{
"music.joker": {
"sounds": [
{
"name": "music/joker/joker",
"stream": true,
"volume": 1
}
]
}
}
如上, 定义了一个游戏声音事件music.joker
, 它使用声音文件: music/joker/joker
, 在游戏内, 可以使用指令/playsound
进行播放, 如果和命令方法配合使用, 则可以有其它的好玩的用法. ;-D
添加了Spigot服务systemd服务脚本
scripts/systemd/
└── minecraft.service
0 directories, 1 file
部署时将minecraft.service
文件放入/etc/systemd/system/
目录下面, 运行命令:
$ sudo systemctl daemon-reload // 加载服务脚本
$ sudo systemctl start minecraft // 启动服务
$ sudo systemctl stop minecraft // 停止服务
$ sudo systemctl reload minecraft // 重新加载游戏
添加了用户游戏提醒脚本,使用crontab添加定时任务
scripts/crontab/mc_cron.sh
#!/usr/bin/env bash
TITLE="jokermc"
function exec() {
/usr/bin/screen -p 0 -S $TITLE -X eval 'stuff "title @a times 10 100 10"\\015'
/usr/bin/screen -p 0 -S $TITLE -X eval 'stuff "title @a title {\\"text\\":\\"温馨提示\\",\\"color\\":\\"white\\",\\"bold\\":\\"true\\"}"\\015'
/usr/bin/screen -p 0 -S $TITLE -X eval 'stuff "title @a subtitle {\\"text\\":\\"各位冒险家们注意早点休息啦!\\",\\"color\\":\\"yellow\\",\\"bold\\":\\"true\\"}"\\015'
}
exec
使用crontab -e
添加定时执行任务,目前我设置为每天凌晨两点提醒用户游戏时间太长,注意休息
# m h dom mon dow command
0 2 * * * /home/joker/mc_cron.sh
这里的配置中有一些需要跟据自己的部署环境进行调整。各位大佬应该注意一下~~~
服务器添加插件
插件下载地址: Bukkit Plugins
离线模式登录插件
- LoginSecurity: 用来处理离线模式下的用户登录
管理员命令
使用/lac
移除密码并重新载入游戏
用户命令
使用/register <password>
注册用户密码
使用/changepass <old> <new>
变更用户密码
使用/login <password>
命令可以登录
使用/logout
可以登出
指令扩展和权限管理插件
由于目前tp指令被Essentials覆盖,无法配合命令方法使用,主要是因为tp不能识别目标选择器: @a @e @r @s @p, 如果地图没有开启命令方块,可以使用这个插件扩展命令。使用替代方案,单独扩展指令:
- GetMeHome: 设置回家指令
- ChatColor: 设置消息颜色
- ChatColor Doc
皮肤设置插件
- SkinsRestorerX Repo
- .skin皮肤文件生成器网站: 上传你所使用的皮肤文件,处理后获得SkinsRestorerX需要的.skin格式的文件,命名规则为
jokerhub_username
,然后手动放入插件的Skins
目录下面 - 皮肤管理系统: 皮肤上传服务器, 可以让玩家自己上传皮肤到服务器上面
安装SkinSystem按照脚本scripts/skin_system/ubuntu_nginx_skin_system
,先使用sudo
权限执行,安装必要的软件和配置mysql
数据库。之后,把nginx
配置文件拷到目录/etc/nginx/conf.d/
下面,并替换fastcgi_pass unix:/run/php/php7.2-fpm.sock;
中的路径为php-fpm
配置文件(/etc/php/7.2/fpm/pool.d/www.conf
)中指定listen
指定的路径。重启nginx服务,并访问8001
端口。
如果皮肤上传界面不能使用,提示504
错误,可以尝试重启php-fpm
服务解决:
sudo systemctl restart php7.2-fpm.service
游戏地图相关插件(Paper 1.14.2上暂不可用)
Web端地图插件
升级服务器版本时需要迁移的文件
.
├── eula.txt // eula协议同意文件
├── plugins // 服务器安装的插件
├── server-icon.png // 服务器自定义图标
├── server.properties // 服务器配置属性
├── world // Spigot服务器主世界地图
├── world_nether // Spigot服务器下界地图
└── world_the_end // Spigot服务器末路之地地图
Paper基于Spigot/Bukkit,兼容插件,性能更好
- 从Vanilla迁移,因为地图抽离成三个文件夹,这个抽离过程会自动进行
- 从Spigot迁移,不需要做任何操作,只需要替换jar文件即可。
- 据说能显著提升性能
个人私服
自己也在阿里云上部署了一个私人Minecraft
服务器,地址:jokerhub.cn
,使用默认端口号:25565
。
私服相关配置
- 服务器地址: jokerhub.cn
- 服务器实况: https://mcweb.jokerhub.cn
- 地图下载地址: https://mcworld.jokerhub.cn
- 皮肤上传地址:https://mcskin.jokerhub.cn
- 皮肤下载网站: https://www.minecraftskins.com
- OrzMC项目地址: https://github.com/OrzGeeker/OrzMC
- 墙纸生成: http://minecraft.novaskin.me/wallpapers/mobile
- Linux类型系统远程排查工具: ssh -NfR 8010:localhost:22 joker@jokerhub.cn
客户端开光影
Optifine的jar包路径要包含在最前面,否则会有问题,解决方案参考:https://www.bountysource.com/issues/74856476-lwjgl-crash-with-optifine
- Optifine: 客户端开光影扩展
ShaderPack
- BSL Shader: 客户端光影渲染器
- SUSE Shader
resourcepacks
- Chromahills: 客户端光影材质包
😎欢迎大家一起来玩😎
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for OrzMC-1.0.33-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1570839c1e9ce6e54996739e234d122c0b9f33f0180197bdd0758809d8cf26c0 |
|
MD5 | 37bced0174b369b38a200768efba0ce8 |
|
BLAKE2b-256 | 74be00c9757b10984316cedf5d78aa70bbaa55c8351d40b56e7f8997b72d0741 |