Last active
February 6, 2021 04:11
-
-
Save reedacartwright/b55251ae653f29150528d352e6d09213 to your computer and use it in GitHub Desktop.
Modify Minecraft Bedrock Edition Clients and Servers to Increase Nether Build Height
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Copyright 2021 Reed A. Cartwright <[email protected]> | |
# | |
# Permission is hereby granted, free of charge, to any person obtaining a copy | |
# of this software and associated documentation files (the "Software"), to deal | |
# in the Software without restriction, including without limitation the rights | |
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
# copies of the Software, and to permit persons to whom the Software is | |
# furnished to do so, subject to the following conditions: | |
# | |
# The above copyright notice and this permission notice shall be included in all | |
# copies or substantial portions of the Software. | |
# | |
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | |
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | |
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | |
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | |
# SOFTWARE. | |
################################################################################ | |
# NOTE | |
# | |
# The Minecraft End User license Agreement specifically allows owners of the | |
# game to make modifications to the game so long as they do not distribute | |
# modified versions. If you use this script to modify your game, note that you | |
# cannot share the the modified version of the game without violating the | |
# Minecraft EULA. | |
# | |
# MINECRAFT END USER LICENSE AGREEMENT (excerpt) | |
# Source: https://account.mojang.com/documents/minecraft_eula | |
# | |
# If you've bought the Game, you may play around with it and modify it by adding | |
# modifications, tools, or plugins, which we will refer to collectively as | |
# "Mods." By "Mods," we mean something original that you or someone else created | |
# that doesn't contain a substantial part of our copyrightable code or content. | |
# When you combine your Mod with the Minecraft software, we will call that | |
# combination a "Modded Version" of the Game. We have the final say on what | |
# constitutes a Mod and what doesn't. You may not distribute any Modded Versions | |
# of our Game or software, and we’d appreciate it if you didn’t use Mods for | |
# griefing. Basically, Mods are okay to distribute; hacked versions or Modded | |
# Versions of the Game client or server software are not okay to distribute. | |
# | |
################################################################################ | |
# DEPENDENCIES | |
# | |
# This script depends on the packages `readr` and `digest`. To install them run | |
# install.packages(c('readr','digest')) | |
# | |
# QUICK USAGE | |
# | |
# source('https://git.io/JtfOu') | |
# patch_nether_height('bedrock_server.exe') | |
# | |
.PATCH_RULES <- list() # Keys are a xxhash64 | |
# `patch_nether_height` reads `file` into memory as a vector of raw bytes and | |
# if it is recognized, it will patch file to increase the build height of the | |
# nether dimension to 256. It will throw an error if the file is not recognized. | |
# NOTE: Not all versions of Minecraft Bedrock Edition are supported. To see a | |
# list of supported versions see the comments below. `patch_nether_height` will | |
# also create a backup of the original file. | |
patch_nether_height <- function(file) { | |
binraw <- readr::read_file_raw(file) | |
fp <- digest::digest(binraw, 'xxhash64') | |
# check to see if we know the program | |
stopifnot(fp %in% names(.PATCH_RULES)) | |
rules <- .PATCH_RULES[[fp]] | |
# double check binary | |
stopifnot(all(binraw[rules$pos] == rules$orig)) | |
# write new values | |
binraw[rules$pos] <- rules$patch | |
# create a backup file | |
file.copy(file, paste0(file, ".bak")) | |
# write new file | |
readr::write_file(binraw, file=file) | |
invisible(NULL) | |
} | |
# BDS Linux 1.16.100.04 | |
.PATCH_RULES[["f254894b749935bd"]] <- list( | |
pos = 0xdbff1a3 + (1:4), | |
orig = as.raw(c(0x80,0x00,0x00,0x00)), | |
patch = as.raw(c(0x00,0x01,0x00,0x00)) | |
) | |
# MCPE x86_64 (Linux) 1.16.100.04 | |
.PATCH_RULES[["553b56971d621b9e"]] <- list( | |
pos = 0x74454e7 + (1:4), | |
orig = as.raw(c(0x00,0x00,0x80,0x00)), | |
patch = as.raw(c(0x00,0x00,0x00,0x01)) | |
) | |
# BDS Win10 1.16.100.04 | |
.PATCH_RULES[["b7762e49e55b624c"]] <- list( | |
pos = 0x12100b1 + (1:4), #0x400 + 0x141210cb1 - 0x14000100 | |
orig = as.raw(c(0x00,0x00,0x80,0x00)), | |
patch = as.raw(c(0x00,0x00,0x00,0x01)) | |
) | |
# Win10 1.16.100.04 | |
.PATCH_RULES[["0830de3c1b55d016"]] <- list( | |
pos = 0x1e98b1a + (1:4), # 0x141e99716+4+0x400 - 0x140001000 | |
orig = as.raw(c(0x00,0x00,0x80,0x00)), | |
patch = as.raw(c(0x00,0x00,0x00,0x01)) | |
) | |
# MCPE x86_64 (Linux) 1.16.201.01 | |
.PATCH_RULES[["4e069bc0e4f3e169"]] <- list( | |
pos = 0x75650e7 + (1:4), | |
orig = as.raw(c(0x00,0x00,0x80,0x00)), | |
patch = as.raw(c(0x00,0x00,0x00,0x01)) | |
) | |
# BDS Linux 1.16.201.02 | |
.PATCH_RULES[["6a83e5e63a7a4fac"]] <- list( | |
pos = 0xdd55583 + (1:4), | |
orig = as.raw(c(0x80,0x00,0x00,0x00)), | |
patch = as.raw(c(0x00,0x01,0x00,0x00)) | |
) | |
# BDS Win10 1.16.201.02 | |
.PATCH_RULES[["a99b98734feadbc4"]] <- list( | |
pos = 0x13f3921 + (1:4), #0x1413f451d+4+0x400 - 0x140001000 | |
orig = as.raw(c(0x00,0x00,0x80,0x00)), | |
patch = as.raw(c(0x00,0x00,0x00,0x01)) | |
) | |
# Win10 1.16.201.02 | |
.PATCH_RULES[["41ebaf5bb5f324a6"]] <- list( | |
pos = 0x217d094 + (1:4), # 0x14217dc90+4+0x400 - 0x140001000 | |
orig = as.raw(c(0x00,0x00,0x80,0x00)), | |
patch = as.raw(c(0x00,0x00,0x00,0x01)) | |
) | |
# MPCE ARM32 1.16.201.01 | |
.PATCH_RULES[["70aaa3477400413a"]] <- list( | |
pos = 0x63a8404 + (1:4), | |
orig = as.raw(c(0x4F, 0xF4, 0x00, 0x03)), | |
patch = as.raw(c(0x4F, 0xF0, 0x80, 0x73)) | |
) | |
# MCPE ARM64 1.16.201.01 | |
.PATCH_RULES[["45bf7a4d7f2f3cb1"]] <- list( | |
pos = 0x6dd9858 + (1:4), | |
orig = as.raw(c(0x03, 0x10, 0xA0, 0x52)), | |
patch = as.raw(c(0x03, 0x20, 0xA0, 0x52)) | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment