Skip to content

Instantly share code, notes, and snippets.

@TheDiamondYT1
Created Jul 22, 2017
Embed
What would you like to do?
<?php
$out = trim(shell_exec("nm -DC libminecraftpe.so | grep '.*::.*'"));
$out = explode("\n", $out);
$out = array_filter($out, "trim");
foreach($out as $line) {
$line = explode(' ', $line, 2);
$class = substr($line[1], 0, strpos($line[1], "::"));
if(strpos($class, "std") === false and strpos($class, "void") === false
and strpos($class, "vtable") === false
and strpos($class, "_") === false
and strpos($class, "(") === false
and strpos($class, "int") === false
and strpos($class, "<") === false) {
$title = substr($class, 2);
}
$function = substr($line[1], strpos($line[1], "::"));
$function = substr($function, 0, strpos($function, ")"));
if(strpos($function, "_") === false and strpos($function, "<") === false
and strpos($function, "+") === false
and strpos($function, "vtable") === false
and strpos($function, "void") === false) {
$method = str_replace("::", "", "void $function);");
if(strpos($method, "get") !== false) {
$method = $method . " const;";
}
}
$localPath = getPath($title);
file_put_contents($localPath . "/$title.txt", $method . PHP_EOL, FILE_APPEND);
}
function getPath($title) {
$paths = [
"Packet" => "packet",
"Screen" => "client/screen",
"Gui" => "client/gui",
"SwitchBox" => "client/gui/elements",
"Button" => "client/gui/elements",
"Tab" => "client/gui/elemements",
"Pane" => "client/gui",
"Player" => "player",
"Block" => "block",
"Item" => "item",
"World" => "world",
"Mob" => "entity",
"Particle" => "entity/particle",
"World" => "world",
"Biome" => "world/biome",
"Sound" => "client/sound",
"Options" => "client/settings",
"Realms" => "realms",
"Commands" => "command",
"Command" => "command",
"Request" => "http",
"HTTP" => "http",
"Enchant" => "item/enchantments",
"Minecraft" => "client",
"App" => "client",
"Purchase" => "store",
"Store" => "store",
"Noise" => "world/noise",
"Pack" => "resourcepack",
"Rak" => "raknet",
// files
"ClientInstance" => "client",
"GameMode" => "gamemode",
"GameType" => "gamemode",
"ExperienceOrb" => "entity",
"EyeOfEnder" => "entity",
"FallingBlock" => "entity",
"EnderDragon" => "entity",
"EnderCrystal" => "entity",
"Color" => "util",
"ColorFormat" => "util",
"BadRenderer" => "client/renderer/entity",
"ArrowRenderer" => "client/renderer/entity",
"PathFiner" => "entity/ai",
"Tag" => "nbt"
];
foreach($paths as $check => $pathname) {
if(!is_dir(__DIR__ . "/stuff/$pathname")) mkdir(__DIR__ . "/stuff/$pathname", 0777, true);
if(strpos($title, $check) !== false) {
return __DIR__ . "/stuff/$pathname";
}
return __DIR__ . "/stuff";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment