Minecraft

This chapter is about Minecraft setup in Docker server.

Minecraft Prep and Install

Client Setup (Java + Online)

  1. Download Java
  2. Download OptiFine the latest version.
  3. On the official Minecraft client, go add a new installation and match the version with OptiFine.
  4. Download and try the official version, then install OptiFine with Java.
  5. Under Settings -> Keep the Launcher open while games are running

Client Setup (Java + Offline)

  1. Use the client PolyMC to enable offline play.
  2. Go to the right corner, manage accounts and create an offline account.
  3. Click on add an instance and follow the guide.
  4. To install OptiFine, need the official launcher first, then download OptiFine
  5. Extract OptiFine, the extracted file should be ending in _MOD.jar
  6. Open the jar file in WinRAR, then move the files from notch folder into the base folder. Save the jar archive.image.png
  7. Go to PolyMC, right click on the instance, click Edit -> Versions -> Add to minecraft.jar and select the modified OptiFine.

Docker Server Setup

Docker-compose for minecraft server

version: "3.9"
services:
  minecraft:
    image: marctv/minecraft-papermc-server:latest
    restart: unless-stopped
    container_name: mcserver
    environment:
      - MEMORYSIZE=4G
      - PAPERMC_FLAGS=""
      - PUID=1000
      - PGID=1000
    volumes:
      - ~/docker/minecraft:/data:rw
    ports:
      - 25565:25565
      - 19132:19132
    stdin_open: true
    tty: true

This downloads the latest version of Minecraft, to use another PaperMC version, need to build the image from scratch.

Warning: PaperMC cannot be downgraded, only newerversion of PaperMC can be installed after first run.

git clone https://github.com/mtoensing/Docker-Minecraft-PaperMC-Server
# go edit the "ARG version=1.xx.x" to the correct version
docker build -t marctv/mcserver:1.xx.x

Folders and Plugins

Plugins are located in folder ./plugins some plugins have .yml files. To update or download plugins, use scp, wget on the server or VSCode.

The world folder consists of the save data. It is separated into world, nether, the_end.

Before starting the server, the eula.txt must have eula=true.

bukkit and spigot.yml in the root folder are configuration files for PaperMC.

Rcon Commands

To access the rcon-cli, use docker attach mcserver, to exit, use Ctrl-P and Q, if using VSCode may need to edit keyboard shortcut.

Editing VSCode Shortcut

Press Ctrl-Shift-P and search for keyboard shortcut json. 

[
    {
        "key": "ctrl+p",
        "command": "ctrl+p",
        "when": "terminalFocus"
    },

    {
        "key": "ctrl+q",
        "command": "ctrl+q",
        "when": "terminalFocus"
    },

    {
        "key": "ctrl+e",
        "command": "ctrl+e",
        "when": "terminalFocus"
    }

]


Useful Plugins

WorldEdit 

EssentialX

CoreProtect

ViaVersionsallow other similar version to join the server without conflict

Offline Mode/Mobile Bedrock

To allow offline play for PC version. Change server.properties and edit these lines

enforce-whitelist=false
online-mode=false

Refer to Minecraft Prep and Install to install offline client.

For bedrock compatibility, need the geyser plugin.

Geyser

To allows offline play for bedrock mobile version. Go to ./plugins/Geyser-Spigot/config.yml and change these lines. Do not install the plugin floodgate, if it's installed, removed the plugin. ViaVersions is also needed for mobile play.

auth-type: offline
enable-proxy-connections: true

Now client can play without login to Xbox or Java.

WorldGuard