Document Patches
minecraft-pi-reborn/pipeline/head This commit looks good Details

This commit is contained in:
TheBrokenRail 2021-03-04 19:27:24 -05:00
parent 97e7655b12
commit 9efaf5ec42
12 changed files with 47 additions and 25 deletions

View File

@ -34,9 +34,6 @@ export MCPI_FEATURES
export MCPI_RENDER_DISTANCE
export MCPI_USERNAME
# Allow X11 Connections From Root
xhost local:root
# Prepare Environment
export USER_HOME="${HOME}"
export USER_UID="$(id -u)"

View File

@ -1,10 +1,31 @@
# Dedicated Server
The dedicated server is a version of Minecraft: Pi Edition modified to run in a headless environment. It loads settings from a ``server.properties`` file.
To use, install the ``minecraft-pi-reborn-server`` package and run ``minecraft-pi-reborn-server``. It will generate the world and ``server.properties`` in the current directory.
This server is also compatible with MCPE Alpha v0.6.1.
## Setup
### Debian Package
To use, install the ``minecraft-pi-reborn-server`` package and run ``minecraft-pi-reborn-server`` or use. It will generate the world and ``server.properties`` in the current directory.
### Docker Compose
Make sure you have ``qemu-user-static`` installed and ``binfmt`` setup.
```yml
version: "3.7"
services:
minecraft-pi:
image: thebrokenrail/minecraft-pi-reborn:server
volumes:
- ./minecraft-pi/data:/home/.minecraft-pi
- /usr/bin/qemu-arm-static:/usr/bin/qemu-arm-static
restart: always
stdin_open: true
tty: true
ports:
- "19132:19132/udp"
```
## Server Limitations
- Player data is not saved because of limitations with MCPE LAN worlds
- An easy workaround is to place your inventory in a chest before logging off

View File

@ -124,6 +124,10 @@ static uint32_t Minecraft_gui_property_offset = 0x198; // Gui
static uint32_t CommandServer_minecraft_property_offset = 0x18; // Minecraft *
// ServerLevel
#define SERVER_LEVEL_SIZE 0xb80
// Packet
typedef void (*Packet_read_t)(unsigned char *packet, unsigned char *bit_stream);

View File

@ -172,7 +172,7 @@ void _overwrite_calls(const char *file, int line, void *start, void *target) {
// Overwrite Function
void _overwrite(const char *file, int line, void *start, void *target) {
unsigned char patch_data[4] = {0x04, 0xf0, 0x1f, 0xe5};
unsigned char patch_data[4] = {0x04, 0xf0, 0x1f, 0xe5}; // "ldr pc, [pc, #-0x4]"
_patch(file, line, start, patch_data);
_patch_address(file, line, start + 4, target);

View File

@ -111,7 +111,7 @@ void chat_send_messages(unsigned char *minecraft) {
// Init
void init_chat() {
// Disable Original ChatPacket Loopback
unsigned char disable_chat_packet_loopback_patch[4] = {0x00, 0xf0, 0x20, 0xe3};
unsigned char disable_chat_packet_loopback_patch[4] = {0x00, 0xf0, 0x20, 0xe3}; // "nop"
patch((void *) 0x6b490, disable_chat_packet_loopback_patch);
// Manually Send (And Loopback) ChatPacket
overwrite_call((void *) 0x6b518, (void *) CommandServer_parse_CommandServer_dispatchPacket_injection);

View File

@ -13,11 +13,11 @@ static void set_is_survival(int new_is_survival) {
INFO("Setting Game Mode: %s", new_is_survival ? "Survival" : "Creative");
// Correct Inventpry UI
unsigned char inventory_patch[4] = {new_is_survival ? 0x00 : 0x01, 0x30, 0xa0, 0xe3};
unsigned char inventory_patch[4] = {new_is_survival ? 0x00 : 0x01, 0x30, 0xa0, 0xe3}; // "mov r3, #0x0" or "mov r3, #0x1"
patch((void *) 0x16efc, inventory_patch);
// Use Correct Size For GameMode Object
unsigned char size_patch[4] = {new_is_survival ? SURVIVAL_MODE_SIZE : CREATOR_MODE_SIZE, 0x00, 0xa0, 0xe3};
unsigned char size_patch[4] = {new_is_survival ? SURVIVAL_MODE_SIZE : CREATOR_MODE_SIZE, 0x00, 0xa0, 0xe3}; // "mov r0, #SURVIVAL_MODE_SIZE" or "mov r0, #CREATOR_MODE_SIZE"
patch((void *) 0x16ee4, size_patch);
// Replace Default CreatorMode Constructor With CreatorMode Or SurvivalMode Constructor
@ -41,15 +41,15 @@ void init_game_mode() {
overwrite_calls((void *) Minecraft_setIsCreativeMode, Minecraft_setIsCreativeMode_injection);
// Replace CreatorLevel With ServerLevel (This Fixes Beds And Mob Spawning)
unsigned char level_patch[4] = {0x68, 0x7e, 0x01, 0xeb};
unsigned char level_patch[4] = {0x68, 0x7e, 0x01, 0xeb}; // "bl 0x7692c"
patch((void *) 0x16f84, level_patch);
// Allocate Correct Size For ServerLevel
unsigned char level_size_patch[4] = {0x94, 0x0b, 0x00, 0x00};
patch((void *) 0x17004, level_size_patch);
uint32_t level_size = SERVER_LEVEL_SIZE;
patch((void *) 0x17004, (unsigned char *) &level_size);
// Allow Connecting To Survival Servers
unsigned char server_patch[4] = {0x0f, 0x00, 0x00, 0xea};
unsigned char server_patch[4] = {0x0f, 0x00, 0x00, 0xea}; // "b 0x6dcb4"
patch((void *) 0x6dc70, server_patch);
// Init C++

View File

@ -53,6 +53,6 @@ void init_game_mode_cpp() {
patch_address(SelectWorldScreen_tick_vtable_addr, (void *) SelectWorldScreen_tick_injection);
patch_address(Touch_SelectWorldScreen_tick_vtable_addr, (void *) Touch_SelectWorldScreen_tick_injection);
// Make The SimpleChooseLevelScreen Back Button Go To SelectWorldScreen Instead Of StartMenuScreen
unsigned char simple_choose_level_screen_back_button_patch[4] = {0x05, 0x10, 0xa0, 0xe3};
unsigned char simple_choose_level_screen_back_button_patch[4] = {0x05, 0x10, 0xa0, 0xe3}; // "mov r1, #0x5"
patch((void *) 0x31144, simple_choose_level_screen_back_button_patch);
}

View File

@ -71,7 +71,7 @@ void init_misc() {
if (feature_has("Remove Invalid Item Background")) {
// Remove Invalid Item Background (A Red Background That Appears For Items That Are Not Included In The gui_blocks Atlas)
unsigned char invalid_item_background_patch[4] = {0x00, 0xf0, 0x20, 0xe3};
unsigned char invalid_item_background_patch[4] = {0x00, 0xf0, 0x20, 0xe3}; // "nop"
patch((void *) 0x63c98, invalid_item_background_patch);
}

View File

@ -78,7 +78,7 @@ void init_options() {
// Main UI
overwrite((void *) Minecraft_isTouchscreen, Minecraft_isTouchscreen_injection);
// Force Correct Toolbar Size
unsigned char toolbar_patch[4] = {0x01, 0x00, 0x50, 0xe3};
unsigned char toolbar_patch[4] = {0x01, 0x00, 0x50, 0xe3}; // "cmp r0, #0x1"
patch((void *) 0x257b0, toolbar_patch);
}
@ -115,24 +115,24 @@ void init_options() {
if (feature_has("Disable Autojump By Default")) {
// Disable Autojump By Default
unsigned char autojump_patch[4] = {0x00, 0x30, 0xa0, 0xe3};
unsigned char autojump_patch[4] = {0x00, 0x30, 0xa0, 0xe3}; // "mov r3, #0x0"
patch((void *) 0x44b90, autojump_patch);
}
if (feature_has("Display Nametags By Default")) {
// Display Nametags By Default
unsigned char display_nametags_patch[4] = {0x1d, 0x60, 0xc0, 0xe5};
unsigned char display_nametags_patch[4] = {0x1d, 0x60, 0xc0, 0xe5}; // "strb r6, [r0, #0x1d]"
patch((void *) 0xa6628, display_nametags_patch);
}
// Show Block Outlines
int block_outlines = feature_has("Show Block Outlines");
unsigned char outline_patch[4] = {block_outlines ? !touch_gui : touch_gui, 0x00, 0x50, 0xe3};
unsigned char outline_patch[4] = {block_outlines ? !touch_gui : touch_gui, 0x00, 0x50, 0xe3}; // "cmp r0, #0x1" or "cmp r0, #0x0"
patch((void *) 0x4a210, outline_patch);
smooth_lighting = feature_has("Smooth Lighting");
if (smooth_lighting) {
// Enable Smooth Lighting
unsigned char smooth_lighting_patch[4] = {0x01, 0x00, 0x53, 0xe3};
unsigned char smooth_lighting_patch[4] = {0x01, 0x00, 0x53, 0xe3}; // "cmp r3, #0x1"
patch((void *) 0x59ea4, smooth_lighting_patch);
}
}

View File

@ -464,7 +464,7 @@ static void server_init() {
}
// Prevent Main Player From Loading
unsigned char player_patch[4] = {0x00, 0x20, 0xa0, 0xe3};
unsigned char player_patch[4] = {0x00, 0x20, 0xa0, 0xe3}; // "mov r2, #0x0"
patch((void *) 0x1685c, player_patch);
// Start World On Launch
overwrite_calls((void *) Minecraft_update, (void *) Minecraft_update_injection);
@ -474,14 +474,14 @@ static void server_init() {
signal(SIGINT, exit_handler);
signal(SIGTERM, exit_handler);
// Set Max Players
unsigned char max_players_patch[4] = {get_max_players(), 0x30, 0xa0, 0xe3};
unsigned char max_players_patch[4] = {get_max_players(), 0x30, 0xa0, 0xe3}; // "mov r3, #MAX_PLAYERS"
patch((void *) 0x166d0, max_players_patch);
// Custom Banned IP List
overwrite((void *) RakNet_RakPeer_IsBanned, (void *) RakNet_RakPeer_IsBanned_injection);
if (get_server_properties().get_bool("show-minecon-badge", DEFAULT_SHOW_MINECON_BADGE)) {
// Show The MineCon Icon Next To MOTD In Server List
unsigned char minecon_badge_patch[4] = {0x04, 0x1a, 0x9f, 0xe5};
unsigned char minecon_badge_patch[4] = {0x04, 0x1a, 0x9f, 0xe5}; // "ldr r1, [0x741f0]"
patch((void *) 0x737e4, minecon_badge_patch);
}

View File

@ -63,7 +63,7 @@ void init_textures() {
if (feature_has("Disable gui_blocks Atlas")) {
// Disable gui_blocks Atlas Which Contains Pre-Rendered Textures For Blocks In The Inventory
unsigned char disable_gui_blocks_atlas_patch[4] = {0x00, 0xf0, 0x20, 0xe3};
unsigned char disable_gui_blocks_atlas_patch[4] = {0x00, 0xf0, 0x20, 0xe3}; // "nop"
patch((void *) 0x63c2c, disable_gui_blocks_atlas_patch);
// Fix Grass And Leaves Inventory Rendering When The gui_blocks Atlas Is Disabled
overwrite_calls((void *) ItemRenderer_renderGuiItemCorrect, (void *) ItemRenderer_renderGuiItemCorrect_injection);

View File

@ -6,7 +6,7 @@ DEB_VERSION='1.0.0'
# Dependencies
REQUIRED_DOCKER_VERSION='19.03'
COMMON_DEPENDENCIES="docker.io (>=${REQUIRED_DOCKER_VERSION}) | docker-ce (>=${REQUIRED_DOCKER_VERSION}), libseccomp2 (>=2.4.2), docker-compose, binfmt-support"
CLIENT_DEPENDENCIES='zenity, x11-xserver-utils, login, policykit-1, passwd'
CLIENT_DEPENDENCIES='zenity, login, policykit-1, passwd'
RECOMMENDED_DEPENDENCIES='qemu-user-static'
set -e