Java minecraft (my world) environment deployment
blogger blog
This article mainly explains the environment construction of Minecraft, including the construction of the server and client. In order to avoid unnecessary trouble, it is best to follow the MINECRAFT usage guidelines . The environment built in this tutorial can support LAN connection to multiplayer games.
1. Build the Java environment (you can skip it if you have already installed it)
Enter at the command line
java --version
to test whether it is installed.
1. You can view the following article, download and install JDK and configure environment variables:
- https://blog.uso6.com/archives/centos-xie-zai-openjdk-bing-an-zhuang-sunjdk
- https://blog.csdn.net/dxk539687357/article/details/51889258
2. You can skip this step after configuring the above. If you don’t understand, you can https://jdk.java.net/20/
download the jdk of your own system first.
As shown above, download the compressed package corresponding to your system.
After unzipping, find bin
the folder. Go to bin
the folder with the command line.
Windows can use the command
C:\jdk-20.0.2\bin>java.exe --version
openjdk 20.0.2 2023-07-18
OpenJDK Runtime Environment (build 20.0.2+9-78)
OpenJDK 64-Bit Server VM (build 20.0.2+9-78, mixed mode, sharing)
MacOS can use the command
nukix@nukixdeMacBook-Pro bin % ./java --version
openjdk 20.0.2 2023-07-18
OpenJDK Runtime Environment (build 20.0.2+9-78)
OpenJDK 64-Bit Server VM (build 20.0.2+9-78, mixed mode, sharing)
Use the corresponding system java -jar [jar文件]
to open jar
the file. First put the jar file into bin
the folder.
2. Download and run the server
Go to the download page and download the server jar.
java -jar minecraft_server.1.20.1.jar
Run the server using the above command. Under normal circumstances, minecraft_server.1.20.1.jar
the following files will be generated in the same directory
- eula.txt
- libraries
- logs
- minecraft_server.1.20.1.jar
- server.properties
- versions
And will prompt an error You need to agree to the EULA in order to run the server. Go to eula.txt for more info.
.
At this time, you need to modify eula.txt
the file, modify it to
#By changing the setting below to TRUE you are indicating your agreement to our EULA (https://aka.ms/MinecraftEULA).
#Thu Aug 17 22:30:26 CST 2023
eula=true
Then modify server.properties
the configuration according to your needs
#Minecraft server properties
#Thu Aug 17 22:30:26 CST 2023
enable-jmx-monitoring=false
rcon.port=25575
# 用于将世界随机化
level-seed=
# survival(0)-生存模式/creative(1)-创造模式/adventure(2)-冒险模式/spectator(3)-旁观模式
gamemode=survival
# 是否启用命令方块
enable-command-block=false
enable-query=false
generator-settings={}
enforce-secure-profile=true
level-name=world
motd=A Minecraft Server
# 设置监听服务器的端口号
query.port=25565
# 是否允许PvP
pvp=false
# 定义是否能生成结构(例如村庄)
generate-structures=true
max-chained-neighbor-updates=1000000
# peaceful(0)-和平/easy(1)-简单/normal(2)-普通/hard(3)-困难
difficulty=normal
network-compression-threshold=256
max-tick-time=60000
require-resource-pack=false
use-native-transport=true
# 这是应该能在服务器上游戏的玩家的最大数量
max-players=6
# 如果为true,则每个连接的玩家都必须与Xbox Live进行身份验证。
online-mode=false
# 使服务器在服务器列表中看起来是“在线”的
enable-status=true
# 允许玩家在安装添加飞行功能的mod前提下在生存模式下飞行
allow-flight=false
initial-disabled-packs=
broadcast-rcon-to-ops=true
view-distance=10
server-ip=
resource-pack-prompt=
# 允许玩家进入下界
allow-nether=true
# 改变服务器(监听的)端口号
server-port=25565
enable-rcon=false
sync-chunk-writes=true
op-permission-level=4
prevent-proxy-connections=false
# 如果设为 true,服务端在响应客户端状态请求时不会返回在线玩家列表
hide-online-players=false
resource-pack=
entity-broadcast-range-percentage=100
simulation-distance=10
rcon.password=
player-idle-timeout=0
force-gamemode=false
rate-limit=0
hardcore=false
white-list=false
broadcast-console-to-ops=true
spawn-npcs=true
spawn-animals=true
function-permission-level=2
initial-enabled-packs=vanilla
level-type=minecraft\:normal
text-filtering-config=
spawn-monsters=true
enforce-whitelist=false
spawn-protection=16
resource-pack-sha1=
# 设置可让世界边界获得的最大半径值,单位为方块
max-world-size=29999984
You can use the above configuration directly, or modify the configuration according to your own needs, or modify the configuration according to Wiki .
java -jar minecraft_server.1.20.1.jar
Finally, restart the service to start the server to generate the world.
3. Download and run the client launcher
Go to release to download the latest launcher client, eg HMCL-3.5.4.234.jar
.
java -jar HMCL-3.5.4.234.jar
Then run the client.
In 版本列表
, click 安装新游戏版本
, then download the corresponding version of the client on the server, and finally 启动游戏
click.
For multiplayer games, the server needs to open the set port (default TCP 25565), and then the server IP:25565
can fill in the corresponding to connect.