mirror of
https://github.com/itzg/docker-minecraft-server.git
synced 2026-07-14 20:44:54 +00:00
Add support for level type and generator settings
This commit is contained in:
@@ -2,7 +2,7 @@ FROM itzg/ubuntu-openjdk-7
|
|||||||
|
|
||||||
MAINTAINER itzg
|
MAINTAINER itzg
|
||||||
|
|
||||||
ENV APT_GET_UPDATE 2015-03-28
|
ENV APT_GET_UPDATE 2015-10-03
|
||||||
RUN apt-get update
|
RUN apt-get update
|
||||||
|
|
||||||
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y libmozjs-24-bin imagemagick && apt-get clean
|
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y libmozjs-24-bin imagemagick && apt-get clean
|
||||||
@@ -31,4 +31,5 @@ ENV MC_IMAGE=YES
|
|||||||
ENV UID=1000
|
ENV UID=1000
|
||||||
ENV MOTD A Minecraft Server Powered by Docker
|
ENV MOTD A Minecraft Server Powered by Docker
|
||||||
ENV JVM_OPTS -Xmx1024M -Xms1024M
|
ENV JVM_OPTS -Xmx1024M -Xms1024M
|
||||||
ENV TYPE=VANILLA VERSION=LATEST FORGEVERSION=RECOMMENDED LEVEL=world PVP=true DIFFICULTY=easy
|
ENV TYPE=VANILLA VERSION=LATEST FORGEVERSION=RECOMMENDED LEVEL=world PVP=true DIFFICULTY=easy \
|
||||||
|
LEVEL_TYPE=DEFAULT GENERATOR_SETTINGS=
|
||||||
|
|||||||
@@ -183,11 +183,32 @@ message of the day that contains spaces by putting quotes around the whole thing
|
|||||||
|
|
||||||
### PVP Mode
|
### PVP Mode
|
||||||
|
|
||||||
By default servers are created with player-vs-player (PVP) mode enabled. You can disable this with the `PVP`
|
By default, servers are created with player-vs-player (PVP) mode enabled. You can disable this with the `PVP`
|
||||||
environment variable set to `false`, such as
|
environment variable set to `false`, such as
|
||||||
|
|
||||||
docker run -d -e PVP=false ...
|
docker run -d -e PVP=false ...
|
||||||
|
|
||||||
|
### Level Type and Generator Settings
|
||||||
|
|
||||||
|
By default, a standard world is generated with hills, valleys, water, etc. A different level type can
|
||||||
|
be configured by setting `LEVEL_TYPE` to
|
||||||
|
|
||||||
|
* DEFAULT
|
||||||
|
* FLAT
|
||||||
|
* LARGEBIOMES
|
||||||
|
* AMPLIFIED
|
||||||
|
* CUSTOMIZED
|
||||||
|
|
||||||
|
Descriptions are available at the [gamepedia](http://minecraft.gamepedia.com/Server.properties).
|
||||||
|
|
||||||
|
When using a level type of `FLAT` and `CUSTOMIZED`, you can further configure the world generator
|
||||||
|
by passing [custom generator settings](http://minecraft.gamepedia.com/Superflat).
|
||||||
|
**Since generator settings usually have ;'s in them, surround the -e value with a single quote, like below.**
|
||||||
|
|
||||||
|
For example (just the `-e` bits):
|
||||||
|
|
||||||
|
-e LEVEL_TYPE=flat -e 'GENERATOR_SETTINGS=3;minecraft:bedrock,3*minecraft:stone,52*minecraft:sandstone;2;'
|
||||||
|
|
||||||
### World Save Name
|
### World Save Name
|
||||||
|
|
||||||
You can either switch between world saves or run multiple containers with different saves by using the `LEVEL` option,
|
You can either switch between world saves or run multiple containers with different saves by using the `LEVEL` option,
|
||||||
|
|||||||
@@ -30,4 +30,4 @@ generate-structures=true
|
|||||||
view-distance=10
|
view-distance=10
|
||||||
spawn-protection=16
|
spawn-protection=16
|
||||||
motd=A Minecraft Server powered by Docker
|
motd=A Minecraft Server powered by Docker
|
||||||
|
generator-settings=
|
||||||
|
|||||||
@@ -105,6 +105,25 @@ if [ ! -e server.properties ]; then
|
|||||||
sed -i "/pvp\s*=/ c pvp=$PVP" /data/server.properties
|
sed -i "/pvp\s*=/ c pvp=$PVP" /data/server.properties
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ -n "$LEVEL_TYPE" ]; then
|
||||||
|
# normalize to uppercase
|
||||||
|
LEVEL_TYPE=${LEVEL_TYPE^^}
|
||||||
|
# check for valid values and only then set
|
||||||
|
case $LEVEL_TYPE in
|
||||||
|
DEFAULT|FLAT|LARGEBIOMES|AMPLIFIED|CUSTOMIZED)
|
||||||
|
sed -i "/level-type\s*=/ c level-type=$LEVEL_TYPE" /data/server.properties
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "Invalid LEVEL_TYPE: $LEVEL_TYPE"
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -n "$GENERATOR_SETTINGS" ]; then
|
||||||
|
sed -i "/generator-settings\s*=/ c generator-settings=$GENERATOR_SETTINGS" /data/server.properties
|
||||||
|
fi
|
||||||
|
|
||||||
if [ -n "$DIFFICULTY" ]; then
|
if [ -n "$DIFFICULTY" ]; then
|
||||||
case $DIFFICULTY in
|
case $DIFFICULTY in
|
||||||
peaceful)
|
peaceful)
|
||||||
|
|||||||
Reference in New Issue
Block a user