Skip to content

Instantly share code, notes, and snippets.

View dktapps's full-sized avatar

Dylan T. dktapps

View GitHub Profile
@dktapps
dktapps / README.md
Last active August 13, 2021 20:36
Minecraft PE Android crashdump decoder script

Minecraft PE crashdump decoder

Setting up environment

Install depot_tools and make sure the tools are available in your PATH variable. You might need to add them to your path manually.

Getting a crashdump file

Requirements:

  • A rooted Android device with MCPE installed.
  1. Trigger the crash you want to debug. When your game crashes, DON'T RESTART IT.

Building PocketMine-MP from source (Linux/Mac)

Pre-requisites

  • Install git
  • Download and install PHP >= 7.2.0 ZTS with the required extensions
    • PMMP-provided binaries
    • This document will not cover the process of compiling PHP with the required extensions manually, but if you do you will need to:
  • enable CLI (--enable-cli)
@dktapps
dktapps / blocks.json
Last active August 15, 2021 02:42
Minecraft: PE legacy item/block magic numbers as of 1.9.0.15. For extended blocks (IDs >= 256) `itemID = 255 - blockID`
{
"minecraft:air": 0,
"minecraft:stone": 1,
"minecraft:grass": 2,
"minecraft:dirt": 3,
"minecraft:cobblestone": 4,
"minecraft:planks": 5,
"minecraft:sapling": 6,
"minecraft:bedrock": 7,
"minecraft:flowing_water": 8,
@dktapps
dktapps / README.md
Created February 18, 2019 10:56
Simple way to make chemistry blocks work correctly on a PocketMine-MP server

Enabling chemistry blocks on a PocketMine-MP server

Chemistry blocks (the ones that are implemented, that is) are already present OOB with PocketMine-MP unconditionally. Unfortunately, they don't render correctly due to weirdness in the way Mojang handles the resources.

TL;DR

  1. Download the manifest.json file from this gist.
  2. Add it to a zip file (on Windows, right click -> Send to -> Compressed (zipped) folder)
  3. Place the zip file in PocketMine-MP's resource pack folder and enable it like a normal resource pack.
  4. Profit!
@dktapps
dktapps / pre-commit
Created April 10, 2019 13:56
pre-commit hook I use for PocketMine-MP
#!/usr/bin/bash
if git rev-parse --verify HEAD >/dev/null 2>&1
then
against=HEAD
else
# Initial commit: diff against an empty tree object
against=4b825dc642cb6eb9a060e54bf8d69288fbee4904
fi
This file has been truncated, but you can view the full file.
ListTag: value={
CompoundTag: value={
CompoundTag: name='old', value={
StringTag: name='name', value='minecraft:acacia_button'
ShortTag: name='val', value='0'
}
CompoundTag: name='new', value={
StringTag: name='name', value='minecraft:acacia_button'
CompoundTag: name='states', value={
ByteTag: name='button_pressed_bit', value='0'
@dktapps
dktapps / README.md
Last active January 14, 2021 11:32

This tool is used to generate the data found in BedrockData.

Usage

Place the script in the root of a PocketMine-MP source code repository. Make sure the composer autoloader has been appropriately generated.

php decoder.php input_file.txt

Input file

calculating required block table diff
matched 3029 states
16 old states removed:
CompoundTag: value={
CompoundTag: name='block', value={
StringTag: name='name', value='minecraft:kelp'
CompoundTag: name='states', value={
IntTag: name='age', value='12'
}
}
@dktapps
dktapps / README.md
Last active February 15, 2023 13:56
Packet handler used to generate most of BedrockData for PocketMine-MP (PM3 only)

This script operates on a packet dump between a vanilla client and server.

A dump like this can be obtained in various ways - a proxy, my frida tracer, etc. However you get it, the file provided should have one packet per line, starting with read: or write: and ending with a base64-encoded packet (including the packet ID).

A quick example grabbed from one of my old log files:

read:kAHwoMpB4PUgQQAAAD8g17NAAAAAPwAAAAAAAAAA4PUgQQABAg==
write:CQ==
write:CQIBG8KnZSVtdWx0aXBsYXllci5wbGF5ZXIubGVmdAELbWN0ZXN0RHlsYW4AAA==
<?php
$opts = getopt("", ["directed", "path:"]);
$directed = isset($opts["directed"]);
$nodes = [];
class Node{
public $name;
public function __construct(string $name){